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 135375 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]
Patch for org.eclipse.ui.workbench.texteditor
243304_patch_for3.6.txt (text/plain), 17.91 KB, created by
Markus Keller
on 2009-05-12 11:20:53 EDT
(
hide
)
Description:
Patch for org.eclipse.ui.workbench.texteditor
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2009-05-12 11:20:53 EDT
Size:
17.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench.texteditor >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.308 >diff -u -r1.308 AbstractTextEditor.java >--- src/org/eclipse/ui/texteditor/AbstractTextEditor.java 4 May 2009 13:43:16 -0000 1.308 >+++ src/org/eclipse/ui/texteditor/AbstractTextEditor.java 12 May 2009 14:51:25 -0000 >@@ -110,14 +110,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; >@@ -147,9 +145,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; >@@ -157,9 +153,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; >@@ -202,6 +196,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; >@@ -1844,51 +1839,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 >@@ -1943,7 +1893,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; > } > >@@ -1976,7 +1926,7 @@ > 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); >@@ -1995,55 +1945,16 @@ > /** > * 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 fInformationPresenter.openFocusedAnnotationHover(annotationHover, line); > } > > // modified version from TextViewer >@@ -2590,7 +2501,7 @@ > * The information presenter. > * @since 3.3 > */ >- private InformationPresenter fInformationPresenter; >+ private FocusedInformationPresenter fInformationPresenter; > > /** > * Tells whether this editor has been activated at least once. >@@ -3477,18 +3388,7 @@ > 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())); >- >+ fInformationPresenter= new FocusedInformationPresenter(getSourceViewer(), getSourceViewerConfiguration()); > } > > /** >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench.texteditor/META-INF/MANIFEST.MF,v >retrieving revision 1.30 >diff -u -r1.30 MANIFEST.MF >--- META-INF/MANIFEST.MF 23 Feb 2009 16:53:56 -0000 1.30 >+++ META-INF/MANIFEST.MF 12 May 2009 14:51:24 -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,159 @@ >+/******************************************************************************* >+ * 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; >+ >+ 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; >+ } >+ } >+} >+ >+
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