Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 149357 Details for
Bug 275890
Share code of "Show Change Ruler Tooltip" and "Show Tooltip Description"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix 2
275890_patch2.txt (text/plain), 32.70 KB, created by
Markus Keller
on 2009-10-12 08:16:00 EDT
(
hide
)
Description:
Fix 2
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2009-10-12 08:16:00 EDT
Size:
32.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.editors >Index: src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java,v >retrieving revision 1.132 >diff -u -r1.132 AbstractDecoratedTextEditor.java >--- src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java 6 Jul 2009 13:58:16 -0000 1.132 >+++ src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java 12 Oct 2009 12:15:58 -0000 >@@ -126,6 +126,7 @@ > import org.eclipse.ui.internal.editors.text.RefreshEditorAction; > import org.eclipse.ui.internal.texteditor.AnnotationColumn; > import org.eclipse.ui.internal.texteditor.BooleanPreferenceToggleAction; >+import org.eclipse.ui.internal.texteditor.FocusedInformationPresenter; > import org.eclipse.ui.internal.texteditor.LineNumberColumn; > import org.eclipse.ui.internal.texteditor.TextChangeHover; > import org.eclipse.ui.keys.IBindingService; >@@ -157,24 +158,6 @@ > public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { > > /** >- * Command ID of the command to display a sticky ruler hover for the current caret location. >- * Value <code>"org.eclipse.ui.edit.text.showChangeRulerInformation"</code>). >- * >- * @since 3.5 >- */ >- //TODO: move to ITextEditorActionDefinitionIds and make API >- private static final String SHOW_CHANGE_RULER_INFORMATION_ID= "org.eclipse.ui.edit.text.showChangeRulerInformation"; //$NON-NLS-1$ >- >- /** >- * Name of the action displaying a sticky ruler hover for the current caret location. >- * >- * Value: <code>"ShowChangeRulerInformation"</code> >- * @since 3.5 >- */ >- //TODO: move to ITextEditorActionConstants and make API >- private static final String SHOW_CHANGE_RULER_INFORMATION= "ShowChangeRulerInformation"; //$NON-NLS-1$ >- >- /** > * Preference key for showing the line number ruler. > */ > private final static String LINE_NUMBER_RULER= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER; >@@ -1252,8 +1235,8 @@ > showChangeRulerInformation(); > } > }; >- action.setActionDefinitionId(SHOW_CHANGE_RULER_INFORMATION_ID); >- setAction(SHOW_CHANGE_RULER_INFORMATION, action); >+ action.setActionDefinitionId(ITextEditorActionDefinitionIds.SHOW_CHANGE_RULER_INFORMATION_ID); >+ setAction(ITextEditorActionConstants.SHOW_CHANGE_RULER_INFORMATION, action); > } > > /** >Index: src/org/eclipse/ui/texteditor/FocusedInformationPresenter.java >=================================================================== >RCS file: src/org/eclipse/ui/texteditor/FocusedInformationPresenter.java >diff -N src/org/eclipse/ui/texteditor/FocusedInformationPresenter.java >--- src/org/eclipse/ui/texteditor/FocusedInformationPresenter.java 13 May 2009 15:57:09 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,170 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.ui.texteditor; >- >-import org.eclipse.swt.widgets.Shell; >- >-import org.eclipse.jface.text.AbstractInformationControlManager; >-import org.eclipse.jface.text.BadLocationException; >-import org.eclipse.jface.text.DefaultInformationControl; >-import org.eclipse.jface.text.IDocument; >-import org.eclipse.jface.text.IInformationControl; >-import org.eclipse.jface.text.IInformationControlCreator; >-import org.eclipse.jface.text.IRegion; >-import org.eclipse.jface.text.ITextViewer; >-import org.eclipse.jface.text.Region; >-import org.eclipse.jface.text.TextUtilities; >-import org.eclipse.jface.text.information.IInformationProvider; >-import org.eclipse.jface.text.information.IInformationProviderExtension; >-import org.eclipse.jface.text.information.IInformationProviderExtension2; >-import org.eclipse.jface.text.information.InformationPresenter; >-import org.eclipse.jface.text.source.IAnnotationHover; >-import org.eclipse.jface.text.source.IAnnotationHoverExtension; >-import org.eclipse.jface.text.source.ILineRange; >-import org.eclipse.jface.text.source.ISourceViewer; >-import org.eclipse.jface.text.source.SourceViewerConfiguration; >- >-/** >- * Information presenter used to present focused ("sticky") information shells. >- * >- * @since 3.5 >- */ >-class FocusedInformationPresenter extends InformationPresenter { >- >- /** >- * Information provider used to present focused information shells. >- */ >- public final static class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 { >- >- private IRegion fHoverRegion; >- private Object fHoverInfo; >- private IInformationControlCreator fControlCreator; >- >- public InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) { >- fHoverRegion= hoverRegion; >- fHoverInfo= hoverInfo; >- fControlCreator= controlCreator; >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int) >- */ >- public IRegion getSubject(ITextViewer textViewer, int invocationOffset) { >- return fHoverRegion; >- } >- /** >- * {@inheritDoc} >- * >- * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)} >- */ >- public String getInformation(ITextViewer textViewer, IRegion subject) { >- return fHoverInfo == null ? null : fHoverInfo.toString(); >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) >- * @since 3.2 >- */ >- public Object getInformation2(ITextViewer textViewer, IRegion subject) { >- return fHoverInfo; >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator() >- */ >- public IInformationControlCreator getInformationPresenterControlCreator() { >- return fControlCreator; >- } >- } >- >- /** >- * The default information control creator. >- */ >- private static class DefaultInformationControlCreator implements IInformationControlCreator { >- public IInformationControl createInformationControl(Shell shell) { >- return new DefaultInformationControl(shell, true); >- } >- } >- >- /** >- * The source viewer. >- */ >- private final ISourceViewer fSourceViewer; >- /** >- * The source viewer configuration. >- */ >- private final SourceViewerConfiguration fSourceViewerConfiguration; >- >- /** >- * Creates a new focused information presenter and installs it on the given source viewer >- * >- * @param sourceViewer the source viewer >- * @param sourceViewerConfiguration the viewer configuration >- */ >- public FocusedInformationPresenter(ISourceViewer sourceViewer, SourceViewerConfiguration sourceViewerConfiguration) { >- super(new DefaultInformationControlCreator()); >- fSourceViewer= sourceViewer; >- fSourceViewerConfiguration= sourceViewerConfiguration; >- >- // sizes: see org.eclipse.jface.text.TextViewer.TEXT_HOVER_*_CHARS >- setSizeConstraints(100, 12, true, true); >- install(sourceViewer); >- setDocumentPartitioning(sourceViewerConfiguration.getConfiguredDocumentPartitioning(sourceViewer)); >- } >- >- /** >- * Tries to show a focused ("sticky") annotation hover. >- * >- * @param annotationHover the annotation hover to show >- * @param line the line for which to show the hover >- * @return <code>true</code> if successful, <code>false</code> otherwise >- */ >- public boolean openFocusedAnnotationHover(IAnnotationHover annotationHover, int line) { >- >- try { >- // compute the hover information >- Object hoverInfo; >- if (annotationHover instanceof IAnnotationHoverExtension) { >- IAnnotationHoverExtension extension= (IAnnotationHoverExtension) annotationHover; >- ILineRange hoverLineRange= extension.getHoverLineRange(fSourceViewer, line); >- if (hoverLineRange == null) >- return false; >- final int maxVisibleLines= Integer.MAX_VALUE; // allow any number of lines being displayed, as we support scrolling >- hoverInfo= extension.getHoverInfo(fSourceViewer, hoverLineRange, maxVisibleLines); >- } else { >- hoverInfo= annotationHover.getHoverInfo(fSourceViewer, line); >- } >- >- // hover region: the beginning of the concerned line to place the control right over the line >- IDocument document= fSourceViewer.getDocument(); >- int offset= document.getLineOffset(line); >- String contentType= TextUtilities.getContentType(document, fSourceViewerConfiguration.getConfiguredDocumentPartitioning(fSourceViewer), offset, true); >- >- IInformationControlCreator controlCreator= null; >- if (annotationHover instanceof IInformationProviderExtension2) // this is undocumented, but left here for backwards compatibility >- controlCreator= ((IInformationProviderExtension2) annotationHover).getInformationPresenterControlCreator(); >- else if (annotationHover instanceof IAnnotationHoverExtension) >- controlCreator= ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator(); >- >- IInformationProvider informationProvider= new InformationProvider(new Region(offset, 0), hoverInfo, controlCreator); >- >- setOffset(offset); >- setAnchor(AbstractInformationControlManager.ANCHOR_RIGHT); >- setMargins(4, 0); // AnnotationBarHoverManager sets (5,0), minus SourceViewer.GAP_SIZE_1 >- setInformationProvider(informationProvider, contentType); >- showInformation(); >- >- return true; >- >- } catch (BadLocationException e) { >- return false; >- } >- } >-} >- >- >#P org.eclipse.ui.workbench.texteditor >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF,v >retrieving revision 1.31 >diff -u -r1.31 MANIFEST.MF >--- META-INF/MANIFEST.MF 17 Jun 2009 15:06:43 -0000 1.31 >+++ META-INF/MANIFEST.MF 12 Oct 2009 12:15:59 -0000 >@@ -9,7 +9,7 @@ > Bundle-Localization: plugin > Export-Package: > org.eclipse.ui.contentassist, >- org.eclipse.ui.internal.texteditor;x-internal:=true; texteditor="split"; mandatory:="texteditor", >+ org.eclipse.ui.internal.texteditor; texteditor="split"; mandatory:="texteditor"; x-friends:="org.eclipse.ui.editors", > org.eclipse.ui.internal.texteditor.quickdiff;x-internal:=true, > org.eclipse.ui.internal.texteditor.quickdiff.compare.equivalence;x-internal:=true, > org.eclipse.ui.internal.texteditor.rulers;x-internal:=true, >Index: src/org/eclipse/ui/internal/texteditor/FocusedInformationPresenter.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/texteditor/FocusedInformationPresenter.java >diff -N src/org/eclipse/ui/internal/texteditor/FocusedInformationPresenter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/texteditor/FocusedInformationPresenter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,165 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.texteditor; >+ >+import org.eclipse.swt.widgets.Shell; >+ >+import org.eclipse.jface.text.AbstractInformationControlManager; >+import org.eclipse.jface.text.BadLocationException; >+import org.eclipse.jface.text.DefaultInformationControl; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.IInformationControl; >+import org.eclipse.jface.text.IInformationControlCreator; >+import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.text.ITextViewer; >+import org.eclipse.jface.text.Region; >+import org.eclipse.jface.text.TextUtilities; >+import org.eclipse.jface.text.information.IInformationProvider; >+import org.eclipse.jface.text.information.IInformationProviderExtension; >+import org.eclipse.jface.text.information.IInformationProviderExtension2; >+import org.eclipse.jface.text.information.InformationPresenter; >+import org.eclipse.jface.text.source.IAnnotationHover; >+import org.eclipse.jface.text.source.IAnnotationHoverExtension; >+import org.eclipse.jface.text.source.ILineRange; >+import org.eclipse.jface.text.source.ISourceViewer; >+import org.eclipse.jface.text.source.SourceViewerConfiguration; >+ >+/** >+ * Information presenter used to present focused ("sticky") information shells. >+ * >+ * @since 3.5 >+ */ >+public class FocusedInformationPresenter extends InformationPresenter { >+ >+ /** >+ * Information provider used to present focused information shells. >+ */ >+ public final static class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 { >+ >+ private IRegion fHoverRegion; >+ private Object fHoverInfo; >+ private IInformationControlCreator fControlCreator; >+ >+ public InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) { >+ fHoverRegion= hoverRegion; >+ fHoverInfo= hoverInfo; >+ fControlCreator= controlCreator; >+ } >+ /* >+ * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int) >+ */ >+ public IRegion getSubject(ITextViewer textViewer, int invocationOffset) { >+ return fHoverRegion; >+ } >+ /** >+ * {@inheritDoc} >+ * >+ * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)} >+ */ >+ public String getInformation(ITextViewer textViewer, IRegion subject) { >+ return fHoverInfo == null ? null : fHoverInfo.toString(); >+ } >+ /* >+ * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) >+ * @since 3.2 >+ */ >+ public Object getInformation2(ITextViewer textViewer, IRegion subject) { >+ return fHoverInfo; >+ } >+ /* >+ * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator() >+ */ >+ public IInformationControlCreator getInformationPresenterControlCreator() { >+ return fControlCreator; >+ } >+ } >+ >+ /** >+ * The default information control creator. >+ */ >+ private static class DefaultInformationControlCreator implements IInformationControlCreator { >+ public IInformationControl createInformationControl(Shell shell) { >+ return new DefaultInformationControl(shell, true); >+ } >+ } >+ >+ >+ private final ISourceViewer fSourceViewer; >+ private final SourceViewerConfiguration fSourceViewerConfiguration; >+ >+ /** >+ * Creates a focused information presenter and installs it on the source viewer. >+ * >+ * @param sourceViewer the source viewer >+ * @param sourceViewerConfiguration the configuration >+ */ >+ public FocusedInformationPresenter(ISourceViewer sourceViewer, SourceViewerConfiguration sourceViewerConfiguration) { >+ super(new DefaultInformationControlCreator()); >+ fSourceViewer= sourceViewer; >+ fSourceViewerConfiguration= sourceViewerConfiguration; >+ >+ // sizes: see org.eclipse.jface.text.TextViewer.TEXT_HOVER_*_CHARS >+ setSizeConstraints(100, 12, true, true); >+ install(sourceViewer); >+ setDocumentPartitioning(sourceViewerConfiguration.getConfiguredDocumentPartitioning(sourceViewer)); >+ } >+ >+ /** >+ * Tries show a focused ("sticky") annotation hover. >+ * >+ * @param annotationHover the annotation hover to show >+ * @param line the line for which to show the hover >+ * @return <code>true</code> if successful, <code>false</code> otherwise >+ */ >+ public boolean openFocusedAnnotationHover(IAnnotationHover annotationHover, int line) { >+ >+ try { >+ // compute the hover information >+ Object hoverInfo; >+ if (annotationHover instanceof IAnnotationHoverExtension) { >+ IAnnotationHoverExtension extension= (IAnnotationHoverExtension) annotationHover; >+ ILineRange hoverLineRange= extension.getHoverLineRange(fSourceViewer, line); >+ if (hoverLineRange == null) >+ return false; >+ final int maxVisibleLines= Integer.MAX_VALUE; // allow any number of lines being displayed, as we support scrolling >+ hoverInfo= extension.getHoverInfo(fSourceViewer, hoverLineRange, maxVisibleLines); >+ } else { >+ hoverInfo= annotationHover.getHoverInfo(fSourceViewer, line); >+ } >+ >+ // hover region: the beginning of the concerned line to place the control right over the line >+ IDocument document= fSourceViewer.getDocument(); >+ int offset= document.getLineOffset(line); >+ String contentType= TextUtilities.getContentType(document, fSourceViewerConfiguration.getConfiguredDocumentPartitioning(fSourceViewer), offset, true); >+ >+ IInformationControlCreator controlCreator= null; >+ if (annotationHover instanceof IInformationProviderExtension2) // this is undocumented, but left here for backwards compatibility >+ controlCreator= ((IInformationProviderExtension2) annotationHover).getInformationPresenterControlCreator(); >+ else if (annotationHover instanceof IAnnotationHoverExtension) >+ controlCreator= ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator(); >+ >+ IInformationProvider informationProvider= new InformationProvider(new Region(offset, 0), hoverInfo, controlCreator); >+ >+ setOffset(offset); >+ setAnchor(AbstractInformationControlManager.ANCHOR_RIGHT); >+ setMargins(4, 0); // AnnotationBarHoverManager sets (5,0), minus SourceViewer.GAP_SIZE_1 >+ setInformationProvider(informationProvider, contentType); >+ showInformation(); >+ >+ return true; >+ >+ } catch (BadLocationException e) { >+ return false; >+ } >+ } >+} >+ >+ >Index: src/org/eclipse/ui/texteditor/AbstractTextEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java,v >retrieving revision 1.311 >diff -u -r1.311 AbstractTextEditor.java >--- src/org/eclipse/ui/texteditor/AbstractTextEditor.java 6 Jul 2009 12:38:38 -0000 1.311 >+++ src/org/eclipse/ui/texteditor/AbstractTextEditor.java 12 Oct 2009 12:16:02 -0000 >@@ -109,14 +109,12 @@ > > import org.eclipse.jface.text.AbstractInformationControlManager; > import org.eclipse.jface.text.BadLocationException; >-import org.eclipse.jface.text.DefaultInformationControl; > import org.eclipse.jface.text.DefaultLineTracker; > import org.eclipse.jface.text.DocumentEvent; > import org.eclipse.jface.text.IDocument; > import org.eclipse.jface.text.IDocumentListener; > import org.eclipse.jface.text.IFindReplaceTarget; > import org.eclipse.jface.text.IFindReplaceTargetExtension; >-import org.eclipse.jface.text.IInformationControl; > import org.eclipse.jface.text.IInformationControlCreator; > import org.eclipse.jface.text.IMarkRegionTarget; > import org.eclipse.jface.text.IRegion; >@@ -130,7 +128,6 @@ > import org.eclipse.jface.text.ITextViewer; > import org.eclipse.jface.text.ITextViewerExtension; > import org.eclipse.jface.text.ITextViewerExtension2; >-import org.eclipse.jface.text.ITextViewerExtension4; > import org.eclipse.jface.text.ITextViewerExtension5; > import org.eclipse.jface.text.ITextViewerExtension6; > import org.eclipse.jface.text.ITextViewerExtension7; >@@ -146,9 +143,7 @@ > import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode; > import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; > import org.eclipse.jface.text.information.IInformationProvider; >-import org.eclipse.jface.text.information.IInformationProviderExtension; > import org.eclipse.jface.text.information.IInformationProviderExtension2; >-import org.eclipse.jface.text.information.InformationPresenter; > import org.eclipse.jface.text.link.LinkedModeModel; > import org.eclipse.jface.text.link.LinkedPosition; > import org.eclipse.jface.text.quickassist.IQuickAssistAssistant; >@@ -156,9 +151,7 @@ > import org.eclipse.jface.text.source.Annotation; > import org.eclipse.jface.text.source.CompositeRuler; > import org.eclipse.jface.text.source.IAnnotationHover; >-import org.eclipse.jface.text.source.IAnnotationHoverExtension; > import org.eclipse.jface.text.source.IAnnotationModel; >-import org.eclipse.jface.text.source.ILineRange; > import org.eclipse.jface.text.source.ISourceViewer; > import org.eclipse.jface.text.source.ISourceViewerExtension3; > import org.eclipse.jface.text.source.ISourceViewerExtension4; >@@ -201,6 +194,7 @@ > import org.eclipse.ui.dialogs.PropertyDialogAction; > import org.eclipse.ui.dnd.IDragAndDropService; > import org.eclipse.ui.internal.texteditor.EditPosition; >+import org.eclipse.ui.internal.texteditor.FocusedInformationPresenter; > import org.eclipse.ui.internal.texteditor.NLSUtility; > import org.eclipse.ui.internal.texteditor.TextEditorPlugin; > import org.eclipse.ui.internal.texteditor.rulers.StringSetSerializer; >@@ -1840,51 +1834,6 @@ > > > /** >- * Information provider used to present focusable information shells. >- * >- * @since 3.3 >- */ >- private static final class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 { >- >- private IRegion fHoverRegion; >- private Object fHoverInfo; >- private IInformationControlCreator fControlCreator; >- >- InformationProvider(IRegion hoverRegion, Object hoverInfo, IInformationControlCreator controlCreator) { >- fHoverRegion= hoverRegion; >- fHoverInfo= hoverInfo; >- fControlCreator= controlCreator; >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int) >- */ >- public IRegion getSubject(ITextViewer textViewer, int invocationOffset) { >- return fHoverRegion; >- } >- /** >- * {@inheritDoc} >- * >- * @deprecated As of 2.1, replaced by {@link IInformationProviderExtension#getInformation2(ITextViewer, IRegion)} >- */ >- public String getInformation(ITextViewer textViewer, IRegion subject) { >- return fHoverInfo == null ? null : fHoverInfo.toString(); >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion) >- * @since 3.2 >- */ >- public Object getInformation2(ITextViewer textViewer, IRegion subject) { >- return fHoverInfo; >- } >- /* >- * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator() >- */ >- public IInformationControlCreator getInformationPresenterControlCreator() { >- return fControlCreator; >- } >- } >- >- /** > * This action behaves in two different ways: If there is no current text > * hover, the javadoc is displayed using information presenter. If there is > * a current text hover, it is converted into a information presenter in >@@ -1923,11 +1872,11 @@ > return; > } > >- if (sourceViewer instanceof ITextViewerExtension4) { >- ITextViewerExtension4 extension4= (ITextViewerExtension4) sourceViewer; >- if (extension4.moveFocusToWidgetToken()) >- return; >- } >+// if (sourceViewer instanceof ITextViewerExtension4) { >+// ITextViewerExtension4 extension4= (ITextViewerExtension4) sourceViewer; >+// if (extension4.moveFocusToWidgetToken()) >+// return; >+// } > > if (sourceViewer instanceof ITextViewerExtension2) { > // does a text hover exist? >@@ -1939,7 +1888,7 @@ > if (sourceViewer instanceof ISourceViewerExtension3) { > // does an annotation hover exist? > IAnnotationHover annotationHover= ((ISourceViewerExtension3) sourceViewer).getCurrentAnnotationHover(); >- if (annotationHover != null && makeAnnotationHoverFocusable(sourceViewer, annotationHover)) >+ if (annotationHover != null && makeAnnotationHoverFocusable(annotationHover)) > return; > } > >@@ -1972,14 +1921,15 @@ > if (textHover instanceof IInformationProviderExtension2) // this is conceptually wrong, but left here for backwards compatibility > controlCreator= ((IInformationProviderExtension2)textHover).getInformationPresenterControlCreator(); > >- IInformationProvider informationProvider= new InformationProvider(hoverRegion, hoverInfo, controlCreator); >+ IInformationProvider informationProvider= new FocusedInformationPresenter.InformationProvider(hoverRegion, hoverInfo, controlCreator); > >- fInformationPresenter.setOffset(offset); >- fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM); >- fInformationPresenter.setMargins(6, 6); // default values from AbstractInformationControlManager >+ FocusedInformationPresenter informationPresenter= getInformationPresenter(); >+ informationPresenter.setOffset(offset); >+ informationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM); >+ informationPresenter.setMargins(6, 6); // default values from AbstractInformationControlManager > String contentType= TextUtilities.getContentType(sourceViewer.getDocument(), getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer()), offset, true); >- fInformationPresenter.setInformationProvider(informationProvider, contentType); >- fInformationPresenter.showInformation(); >+ informationPresenter.setInformationProvider(informationProvider, contentType); >+ informationPresenter.showInformation(); > > return true; > >@@ -1991,56 +1941,30 @@ > /** > * Tries to make an annotation hover focusable (or "sticky"). > * >- * @param sourceViewer the source viewer to display the hover over > * @param annotationHover the hover to make focusable > * @return <code>true</code> if successful, <code>false</code> otherwise > */ >- private boolean makeAnnotationHoverFocusable(ISourceViewer sourceViewer, IAnnotationHover annotationHover) { >+ private boolean makeAnnotationHoverFocusable(IAnnotationHover annotationHover) { > IVerticalRulerInfo info= getVerticalRuler(); > int line= info.getLineOfLastMouseButtonActivity(); > if (line == -1) > return false; > >- try { >- >- // compute the hover information >- Object hoverInfo; >- if (annotationHover instanceof IAnnotationHoverExtension) { >- IAnnotationHoverExtension extension= (IAnnotationHoverExtension) annotationHover; >- ILineRange hoverLineRange= extension.getHoverLineRange(sourceViewer, line); >- if (hoverLineRange == null) >- return false; >- final int maxVisibleLines= Integer.MAX_VALUE; // allow any number of lines being displayed, as we support scrolling >- hoverInfo= extension.getHoverInfo(sourceViewer, hoverLineRange, maxVisibleLines); >- } else { >- hoverInfo= annotationHover.getHoverInfo(sourceViewer, line); >- } >- >- // hover region: the beginning of the concerned line to place the control right over the line >- IDocument document= sourceViewer.getDocument(); >- int offset= document.getLineOffset(line); >- String contentType= TextUtilities.getContentType(document, getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer()), offset, true); >- >- IInformationControlCreator controlCreator= null; >- if (annotationHover instanceof IInformationProviderExtension2) // this is undocumented, but left here for backwards compatibility >- controlCreator= ((IInformationProviderExtension2) annotationHover).getInformationPresenterControlCreator(); >- else if (annotationHover instanceof IAnnotationHoverExtension) >- controlCreator= ((IAnnotationHoverExtension) annotationHover).getHoverControlCreator(); >- >- IInformationProvider informationProvider= new InformationProvider(new Region(offset, 0), hoverInfo, controlCreator); >- >- fInformationPresenter.setOffset(offset); >- fInformationPresenter.setAnchor(AbstractInformationControlManager.ANCHOR_RIGHT); >- fInformationPresenter.setMargins(4, 0); // AnnotationBarHoverManager sets (5,0), minus SourceViewer.GAP_SIZE_1 >- fInformationPresenter.setInformationProvider(informationProvider, contentType); >- fInformationPresenter.showInformation(); >- >- return true; >- >- } catch (BadLocationException e) { >- return false; >- } >+ return getInformationPresenter().openFocusedAnnotationHover(annotationHover, line); > } >+ >+ /** >+ * Returns the information presenter (creates it if necessary). >+ * >+ * @return the information presenter >+ * @since 3.6 >+ */ >+ private FocusedInformationPresenter getInformationPresenter() { >+ if (fInformationPresenter == null) { >+ fInformationPresenter= new FocusedInformationPresenter(getSourceViewer(), getSourceViewerConfiguration()); >+ } >+ return fInformationPresenter; >+ } > > // modified version from TextViewer > private int computeOffsetAtLocation(ITextViewer textViewer, int x, int y) { >@@ -2066,7 +1990,6 @@ > } catch (IllegalArgumentException e) { > return -1; > } >- > } > } > >@@ -2583,10 +2506,10 @@ > */ > private Object fTextDragAndDropToken; > /** >- * The information presenter. >+ * The information presenter, may be <code>null</code>. > * @since 3.3 > */ >- private InformationPresenter fInformationPresenter; >+ private FocusedInformationPresenter fInformationPresenter; > > /** > * Tells whether this editor has been activated at least once. >@@ -3472,19 +3395,6 @@ > IVerticalRuler ruler= getVerticalRuler(); > if (ruler instanceof CompositeRuler) > updateContributedRulerColumns((CompositeRuler) ruler); >- >- IInformationControlCreator informationControlCreator= new IInformationControlCreator() { >- public IInformationControl createInformationControl(Shell shell) { >- return new DefaultInformationControl(shell, true); >- } >- }; >- >- fInformationPresenter= new InformationPresenter(informationControlCreator); >- // sizes: see org.eclipse.jface.text.TextViewer.TEXT_HOVER_*_CHARS >- fInformationPresenter.setSizeConstraints(100, 12, true, true); >- fInformationPresenter.install(getSourceViewer()); >- fInformationPresenter.setDocumentPartitioning(getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer())); >- > } > > /** >@@ -4406,6 +4316,11 @@ > fKeyBindingSupportForQuickAssistant.dispose(); > fKeyBindingSupportForQuickAssistant= null; > } >+ >+ if (fInformationPresenter != null) { >+ fInformationPresenter.uninstall(); >+ fInformationPresenter= null; >+ } > > super.dispose(); > } >Index: src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java,v >retrieving revision 1.46 >diff -u -r1.46 ITextEditorActionConstants.java >--- src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java 14 Jan 2009 10:46:47 -0000 1.46 >+++ src/org/eclipse/ui/texteditor/ITextEditorActionConstants.java 12 Oct 2009 12:16:02 -0000 >@@ -672,4 +672,12 @@ > * @since 3.5 > */ > String BLOCK_SELECTION_MODE= "BlockSelectionMode"; //$NON-NLS-1$ >+ >+ /** >+ * Name of the action displaying a sticky ruler hover for the current caret location. >+ * >+ * Value: <code>"ShowChangeRulerInformation"</code> >+ * @since 3.6 >+ */ >+ public static final String SHOW_CHANGE_RULER_INFORMATION= "ShowChangeRulerInformation"; //$NON-NLS-1$ > } >Index: src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java,v >retrieving revision 1.39 >diff -u -r1.39 ITextEditorActionDefinitionIds.java >--- src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java 14 Jan 2009 10:46:47 -0000 1.39 >+++ src/org/eclipse/ui/texteditor/ITextEditorActionDefinitionIds.java 12 Oct 2009 12:16:02 -0000 >@@ -577,4 +577,12 @@ > * @since 3.5 > */ > String BLOCK_SELECTION_MODE= "org.eclipse.ui.edit.text.toggleBlockSelectionMode"; //$NON-NLS-1$ >+ >+ /** >+ * Command ID of the command to display a sticky ruler hover for the current caret location. >+ * Value <code>"org.eclipse.ui.edit.text.showChangeRulerInformation"</code>. >+ * >+ * @since 3.6 >+ */ >+ public static final String SHOW_CHANGE_RULER_INFORMATION_ID= "org.eclipse.ui.edit.text.showChangeRulerInformation"; //$NON-NLS-1$ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 275890
:
135375
| 149357