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 183100 Details for
Bug 13672
[painting] Horizontal line between methods/members when editing class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch
13672 (text/plain), 39.58 KB, created by
Rajesh
on 2010-11-14 23:59:03 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rajesh
Created:
2010-11-14 23:59:03 EST
Size:
39.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.doc.user >Index: contexts_JDT.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.user/contexts_JDT.xml,v >retrieving revision 1.152 >diff -u -r1.152 contexts_JDT.xml >--- contexts_JDT.xml 27 Oct 2010 15:36:10 -0000 1.152 >+++ contexts_JDT.xml 15 Nov 2010 04:55:13 -0000 >@@ -88,6 +88,11 @@ > <context id="toggle_mark_occurrences_action_context"> > <description>Allows you to switch mark occurrences on and off.</description> > </context> >+ >+ <context id="toggle_method_boundary_lines_action_context"> >+ <description>Allows you to toggle method boundary lines on and off.</description> >+ <topic label="Java editor reference" href="reference/views/ref-java-editor.htm"/> >+ </context> > > <context id="display_action_context"> > <description>This command evaluates the selected expression and shows the result in the Display view.</description> >Index: reference/preferences/java/ref-preferences-editor.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.user/reference/preferences/java/ref-preferences-editor.htm,v >retrieving revision 1.5 >diff -u -r1.5 ref-preferences-editor.htm >--- reference/preferences/java/ref-preferences-editor.htm 6 Apr 2009 14:09:25 -0000 1.5 >+++ reference/preferences/java/ref-preferences-editor.htm 15 Nov 2010 04:55:13 -0000 >@@ -127,6 +127,21 @@ > </tr> > <tr> > <td valign="top"> >+ Method boundary Lines >+ </td> >+ <td valign="top"> >+ <p> >+ If enabled, the Java editor will show the Method boundary lines to indicate the beginning and end of a method. >+ </p> >+ </td> >+ <td valign="top"> >+ <p> >+ Off >+ </p> >+ </td> >+ </tr> >+ <tr> >+ <td valign="top"> > Appearance color options > </td> > <td valign="top"> >@@ -151,6 +166,9 @@ > > <dt>Source hover background</dt> > <dd>The background color for the source hover. The source hover shows the source code of the element under the mouse pointer.</dd> >+ >+ <dt>Method Boundary Lines</dt> >+ <dd>The color of the method boundary lines</dd> > </dl> > </td> > <td valign="top"> >Index: reference/views/ref-java-editor.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.user/reference/views/ref-java-editor.htm,v >retrieving revision 1.7 >diff -u -r1.7 ref-java-editor.htm >--- reference/views/ref-java-editor.htm 3 Jun 2010 07:18:34 -0000 1.7 >+++ reference/views/ref-java-editor.htm 15 Nov 2010 04:55:13 -0000 >@@ -38,6 +38,22 @@ > <tbody> > <tr> > <td align="center" valign="top"> >+ <p><img src="../../images/org.eclipse.jdt.ui/etool16/toggle_method_boundary.gif" alt="Toggle Method Boundary Lines"></p> >+ </td> >+ <td valign="top"> >+ <p> >+ Toggle Method Boundary Lines >+ </p> >+ </td> >+ <td valign="top"> >+ <p> >+ This button shows the Method boundary lines in the Java Editor. >+ </p> >+ </td> >+ </tr> >+ >+ <tr> >+ <td align="center" valign="top"> > <p><img src="../../images/org.eclipse.jdt.ui/etool16/toggle_breadcrumb.gif" alt="Toggle Java Editor Breadcrumb"></p> > </td> > <td valign="top"> >#P org.eclipse.jdt.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/plugin.properties,v >retrieving revision 1.540 >diff -u -r1.540 plugin.properties >--- plugin.properties 25 Oct 2010 14:46:12 -0000 1.540 >+++ plugin.properties 15 Nov 2010 04:55:22 -0000 >@@ -240,6 +240,10 @@ > toggleMarkOccurrences.tooltip= Toggle Mark Occurrences > toggleMarkOccurrences.description= Toggles mark occurrences in Java editors > >+toggleMethodBoundaryLines.label= Toggle Method Boundary Lines >+toggleMethodBoundaryLines.tooltip= Toggle Method Boundary Lines >+toggleMethodBoundaryLines.description= Toggles method boundary lines in Java editors >+ > toggleBreadcrumb.label= Toggle Java Editor Breadcrumb > toggleBreadcrumb.tooltip= Toggle Java Editor Breadcrumb > toggleBreadcrumb.description= Toggle the Java editor breadcrumb >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/plugin.xml,v >retrieving revision 1.845 >diff -u -r1.845 plugin.xml >--- plugin.xml 8 Nov 2010 11:43:21 -0000 1.845 >+++ plugin.xml 15 Nov 2010 04:55:28 -0000 >@@ -1333,6 +1333,19 @@ > retarget="true" > tooltip="%toggleBreadcrumb.tooltip"> > </action> >+ <action >+ allowLabelUpdate="true" >+ style="toggle" >+ toolbarPath="org.eclipse.ui.edit.text.actionSet.presentation/Presentation" >+ id="org.eclipse.jdt.ui.edit.text.java.toggleMethodBoundaryLines" >+ definitionId="org.eclipse.jdt.ui.edit.text.java.toggleMethodBoundaryLines" >+ disabledIcon="$nl$/icons/full/dtool16/toggle_method_boundary.gif" >+ icon="$nl$/icons/full/etool16/toggle_method_boundary.gif" >+ helpContextId="org.eclipse.jdt.ui.toggle_mark_occurrences_action_context" >+ label="%toggleMethodBoundaryLines.label" >+ retarget="true" >+ tooltip="%toggleMethodBoundaryLines.tooltip"> >+ </action> > </actionSet> > </extension> > >@@ -3557,6 +3570,12 @@ > id="org.eclipse.jdt.ui.edit.text.java.toggleMarkOccurrences"> > </command> > <command >+ name="%toggleMethodBoundaryLines.label" >+ description="%toggleMethodBoundaryLines.description" >+ categoryId="org.eclipse.jdt.ui.category.source" >+ id="org.eclipse.jdt.ui.edit.text.java.toggleMethodBoundaryLines"> >+ </command> >+ <command > name="%toggleBreadcrumb.label" > description="%toggleBreadcrumb.description" > categoryId="org.eclipse.jdt.ui.category.source" >Index: ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java,v >retrieving revision 1.152 >diff -u -r1.152 IJavaHelpContextIds.java >--- ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java 27 Oct 2010 15:36:09 -0000 1.152 >+++ ui/org/eclipse/jdt/internal/ui/IJavaHelpContextIds.java 15 Nov 2010 04:55:29 -0000 >@@ -61,6 +61,7 @@ > > public static final String TOGGLE_PRESENTATION_ACTION= PREFIX + "toggle_presentation_action_context"; //$NON-NLS-1$ > public static final String TOGGLE_MARK_OCCURRENCES_ACTION= PREFIX + "toggle_mark_occurrences_action_context"; //$NON-NLS-1$ >+ public static final String TOGGLE_METHOD_BOUNDARY_LINES_ACTION= PREFIX + "toggle_method_boundary_lines_action_context"; //$NON-NLS-1$ > public static final String TOGGLE_BREADCRUMB_ACTION= PREFIX + "toggle_breadcrumb_action_context"; //$NON-NLS-1$ > public static final String TOGGLE_TEXTHOVER_ACTION= PREFIX + "toggle_texthover_action_context"; //$NON-NLS-1$ > >Index: ui/org/eclipse/jdt/internal/ui/IJavaThemeConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/IJavaThemeConstants.java,v >retrieving revision 1.6 >diff -u -r1.6 IJavaThemeConstants.java >--- ui/org/eclipse/jdt/internal/ui/IJavaThemeConstants.java 11 Sep 2008 11:59:33 -0000 1.6 >+++ ui/org/eclipse/jdt/internal/ui/IJavaThemeConstants.java 15 Nov 2010 04:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2008 IBM Corporation and others. >+ * Copyright (c) 2007, 2010 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 >@@ -29,6 +29,11 @@ > public final String EDITOR_MATCHING_BRACKETS_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; > > /** >+ * Theme constant for the color used to render method boundary lines. >+ */ >+ public final String METHOD_BOUNDARY_LINES_COLOR= ID_PREFIX + PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR; >+ >+ /** > * Theme constant for the color used to render multi-line comments. > */ > public final String EDITOR_MULTI_LINE_COMMENT_COLOR= ID_PREFIX + PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR; >Index: ui/org/eclipse/jdt/internal/ui/JavaUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaUIPreferenceInitializer.java,v >retrieving revision 1.5 >diff -u -r1.5 JavaUIPreferenceInitializer.java >--- ui/org/eclipse/jdt/internal/ui/JavaUIPreferenceInitializer.java 11 Sep 2008 11:59:34 -0000 1.5 >+++ ui/org/eclipse/jdt/internal/ui/JavaUIPreferenceInitializer.java 15 Nov 2010 04:55:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -125,6 +125,10 @@ > findRGB(registry, IJavaThemeConstants.CODEASSIST_REPLACEMENT_BACKGROUND, new RGB(255, 255, 0)), fireEvent); > setDefault( > store, >+ PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR, >+ findRGB(registry, IJavaThemeConstants.METHOD_BOUNDARY_LINES_COLOR, new RGB(192, 192, 192)), fireEvent); >+ setDefault( >+ store, > PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, > findRGB(registry, IJavaThemeConstants.CODEASSIST_REPLACEMENT_FOREGROUND, new RGB(255, 0, 0)), fireEvent); > >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/BasicJavaEditorActionContributor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/BasicJavaEditorActionContributor.java,v >retrieving revision 1.49 >diff -u -r1.49 BasicJavaEditorActionContributor.java >--- ui/org/eclipse/jdt/internal/ui/javaeditor/BasicJavaEditorActionContributor.java 29 Jul 2010 09:15:47 -0000 1.49 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/BasicJavaEditorActionContributor.java 15 Nov 2010 04:55:30 -0000 >@@ -51,6 +51,8 @@ > private ToggleMarkOccurrencesAction fToggleMarkOccurrencesAction; > private ToggleBreadcrumbAction fToggleBreadcrumbAction; > >+ private ToggleMethodBoundaryLinesAction fToggleMethodBoundaryLinesAction; >+ > private RetargetTextEditorAction fGotoMatchingBracket; > private RetargetTextEditorAction fShowOutline; > private RetargetTextEditorAction fOpenStructure; >@@ -80,6 +82,7 @@ > fTogglePresentation= new TogglePresentationAction(); > > fToggleMarkOccurrencesAction= new ToggleMarkOccurrencesAction(); >+ fToggleMethodBoundaryLinesAction= new ToggleMethodBoundaryLinesAction(); > > fGotoMatchingBracket= new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$ > fGotoMatchingBracket.setActionDefinitionId(IJavaEditorActionDefinitionIds.GOTO_MATCHING_BRACKET); >@@ -129,6 +132,7 @@ > bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.TOGGLE_SHOW_SELECTED_ELEMENT_ONLY, fTogglePresentation); > bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_MARK_OCCURRENCES, fToggleMarkOccurrencesAction); > bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_BREADCRUMB, fToggleBreadcrumbAction); >+ bars.setGlobalActionHandler(IJavaEditorActionDefinitionIds.TOGGLE_METHOD_BOUNDARY_LINES, fToggleMethodBoundaryLinesAction); > } > > /* >@@ -179,6 +183,7 @@ > > fTogglePresentation.setEditor(textEditor); > fToggleMarkOccurrencesAction.setEditor(textEditor); >+ fToggleMethodBoundaryLinesAction.setEditor(textEditor); > > fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET)); > fShowOutline.setAction(getAction(textEditor, IJavaEditorActionDefinitionIds.SHOW_OUTLINE)); >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/ConstructedJavaEditorMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ConstructedJavaEditorMessages.properties,v >retrieving revision 1.19 >diff -u -r1.19 ConstructedJavaEditorMessages.properties >--- ui/org/eclipse/jdt/internal/ui/javaeditor/ConstructedJavaEditorMessages.properties 24 Jun 2010 16:18:32 -0000 1.19 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/ConstructedJavaEditorMessages.properties 15 Nov 2010 04:55:30 -0000 >@@ -46,6 +46,9 @@ > TogglePresentation.label=Show Source of Selected Element Only > TogglePresentation.tooltip=Show Source of Selected Element Only > >+ToggleMethodBoundaryLinesAction.label=Toggle Method Boundary Lines >+ToggleMethodBoundaryLinesAction.tooltip=Toggle Method Boundary Lines >+ > ToggleMarkOccurrencesAction.label= Toggle Mark Occurrences > ToggleMarkOccurrencesAction.tooltip= Toggle Mark Occurrences > >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java,v >retrieving revision 1.485 >diff -u -r1.485 JavaEditor.java >--- ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 5 Nov 2010 11:12:57 -0000 1.485 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java 15 Nov 2010 04:55:33 -0000 >@@ -30,6 +30,9 @@ > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.ST; > import org.eclipse.swt.custom.StyledText; >+import org.eclipse.swt.events.PaintEvent; >+import org.eclipse.swt.events.PaintListener; >+import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.layout.FillLayout; >@@ -63,6 +66,7 @@ > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.preference.PreferenceConverter; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.DoubleClickEvent; >@@ -82,6 +86,8 @@ > import org.eclipse.jface.text.IDocumentListener; > import org.eclipse.jface.text.IInformationControl; > import org.eclipse.jface.text.IInformationControlCreator; >+import org.eclipse.jface.text.IPaintPositionManager; >+import org.eclipse.jface.text.IPainter; > import org.eclipse.jface.text.IRegion; > import org.eclipse.jface.text.ISelectionValidator; > import org.eclipse.jface.text.ISynchronizable; >@@ -114,6 +120,7 @@ > import org.eclipse.jface.text.source.IVerticalRulerColumn; > import org.eclipse.jface.text.source.LineChangeHover; > import org.eclipse.jface.text.source.SourceViewerConfiguration; >+import org.eclipse.jface.text.source.projection.ProjectionAnnotation; > import org.eclipse.jface.text.source.projection.ProjectionSupport; > import org.eclipse.jface.text.source.projection.ProjectionViewer; > >@@ -1507,6 +1514,206 @@ > } > > >+ /** >+ * Draws lines that demarcate the boundary of a method in the editor. >+ * >+ * @since 3.7 >+ */ >+ private class MethodBoundaryLinesProvider { >+ >+ /** >+ * Paints the method boundary lines. >+ */ >+ private class MethodBoundaryLinesPainter implements IPainter, PaintListener { >+ >+ /** >+ * Tracks if the painter has been deactivated or not. >+ */ >+ private boolean fIsActive= false; >+ >+ /** >+ * The text widget associated with the source viewer. >+ */ >+ private StyledText fTextWidget; >+ >+ /** >+ * Constructs a new <code>MethodSeparatorPainter</code>. >+ */ >+ public MethodBoundaryLinesPainter() { >+ fTextWidget= fViewer.getTextWidget(); >+ } >+ >+ /* >+ * @see org.eclipse.swt.events.PaintListener#paintControl(org.eclipse.swt.events.PaintEvent) >+ * Paints the method boundary lines by locating the method elements in the damaged area. >+ */ >+ public void paintControl(PaintEvent event) { >+ if (fTextWidget != null) { >+ boolean drawBoundaryForCollapsedMethods= true; >+ event.gc.setForeground(fMethodBoundaryLinesColor); >+ int eventRegionTopLine= fTextWidget.getLineIndex(event.y); >+ //Accounting for partial line at the top >+ if (eventRegionTopLine > 0) >+ eventRegionTopLine--; >+ int eventRegionLastLine= fTextWidget.getLineIndex(event.y + event.height); >+ //Accounting for partial line at the bottom >+ if (eventRegionLastLine < fTextWidget.getLineCount() - 1) >+ eventRegionLastLine++; >+ >+ int currentLine= eventRegionTopLine; >+ while (currentLine <= eventRegionLastLine) { >+ int currentLineLength= fTextWidget.getLine(currentLine).length(); >+ if (currentLineLength > 0) >+ currentLineLength--; >+ int currentLineOffset= fTextWidget.getOffsetAtLine(currentLine) + currentLineLength; >+ IJavaElement element= getElementAt(fViewer.widgetOffset2ModelOffset(currentLineOffset), true); >+ try { >+ if (element != null && element.getElementType() == IJavaElement.METHOD) { >+ ISourceRange elementModelRegion= ((ISourceReference)element).getSourceRange(); >+ IRegion elementWidgetRegion= fViewer.modelRange2WidgetRange(new Region(elementModelRegion.getOffset(), elementModelRegion.getLength())); >+ int elementWidgetRegionOffset= elementWidgetRegion.getOffset(); >+ int elementWidgetRegionLength= elementWidgetRegion.getLength(); >+ >+ if (drawBoundaryForCollapsedMethods || !isElementCollapsed(elementModelRegion)) { >+ int boundaryLineWidth= fTextWidget.getClientArea().width; >+ int elementTopLine= fTextWidget.getLineAtOffset(elementWidgetRegionOffset); >+ int visibleRegionTopLine= fTextWidget.getLineIndex(0); >+ if (elementTopLine >= visibleRegionTopLine) { >+ int eventRegionOffset= fTextWidget.getOffsetAtLine(eventRegionTopLine); >+ if (elementWidgetRegionOffset >= eventRegionOffset) { >+ int elementTopY= fTextWidget.getLocationAtOffset(elementWidgetRegionOffset).y; >+ event.gc.drawLine(2, elementTopY, boundaryLineWidth, elementTopY); >+ } >+ } >+ int visibleRegionLastLine= fTextWidget.getLineIndex((fTextWidget.getClientArea().height - 1)); >+ int elementBottomOffset= elementWidgetRegionOffset + elementWidgetRegionLength - 1; >+ int elementLastLine= fTextWidget.getLineAtOffset(elementBottomOffset); >+ if (elementLastLine <= visibleRegionLastLine) { >+ if (elementLastLine <= eventRegionLastLine) { >+ int elementBottomY= fTextWidget.getLocationAtOffset(elementBottomOffset).y + fTextWidget.getLineHeight(elementBottomOffset); >+ event.gc.drawLine(2, elementBottomY, boundaryLineWidth, elementBottomY); >+ } >+ } >+ } >+ currentLine= fTextWidget.getLineAtOffset(elementWidgetRegionOffset + elementWidgetRegionLength) + 1; >+ } else { >+ currentLine++; >+ } >+ } catch (JavaModelException exception) { >+ JavaPlugin.log(exception); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Checks with the projection annotation model if a element is collapsed. >+ * >+ * @param elementModelRange the source range for the element >+ * @return <code>true</code> if the element is in collapsed state >+ */ >+ private boolean isElementCollapsed(ISourceRange elementModelRange) { >+ Iterator annotationIterator= (fViewer.getProjectionAnnotationModel().getAnnotationIterator(elementModelRange.getOffset(), elementModelRange.getLength(), true, true)); >+ while (annotationIterator.hasNext()) { >+ ProjectionAnnotation annotation= (ProjectionAnnotation)(annotationIterator.next()); >+ if (annotation != null && !annotation.isCollapsed()) >+ return false; >+ } >+ return true; >+ } >+ >+ /* >+ * @see IPainter#dispose() >+ */ >+ public void dispose() { >+ fTextWidget= null; >+ } >+ >+ /* >+ * @see IPainter#paint(int) >+ */ >+ public void paint(int reason) { >+ if (!fIsActive) { >+ fIsActive= true; >+ fTextWidget.addPaintListener(this); >+ fTextWidget.redraw(); >+ } else if (CONFIGURATION == reason || INTERNAL == reason) >+ fTextWidget.redraw(); >+ } >+ >+ /* >+ * @see IPainter#deactivate(boolean) >+ */ >+ public void deactivate(boolean redraw) { >+ if (fIsActive) { >+ fIsActive= false; >+ fTextWidget.removePaintListener(this); >+ if (redraw) >+ fTextWidget.redraw(); >+ } >+ } >+ >+ /* >+ * @see IPainter#setPositionManager(IPaintPositionManager) >+ */ >+ public void setPositionManager(IPaintPositionManager manager) { >+ } >+ } >+ >+ /** >+ * The source viewer associated with the editor. >+ */ >+ private JavaSourceViewer fViewer; >+ >+ /** >+ * The the method boundary lines color. >+ */ >+ private Color fMethodBoundaryLinesColor; >+ >+ /** >+ * The method boundary painter that paints the boundary lines. >+ */ >+ private MethodBoundaryLinesPainter fPainter; >+ >+ /** >+ * Constructs the <code>MethodBoundaryLinesProvider</code>. >+ * >+ * @param viewer the source viewer associated with the editor. >+ * @param methodBoundaryColor the color to be used for drawing the method boundary lines. >+ */ >+ public MethodBoundaryLinesProvider(JavaSourceViewer viewer, Color methodBoundaryColor) { >+ fViewer= viewer; >+ fMethodBoundaryLinesColor= methodBoundaryColor; >+ if (fPainter == null) { >+ fPainter= new MethodBoundaryLinesPainter(); >+ fViewer.addPainter(fPainter); >+ } >+ } >+ >+ /** >+ * Disposes the method boundary lines provider and associated painter. >+ */ >+ public void dispose() { >+ if (fPainter != null) { >+ fViewer.removePainter(fPainter); >+ fPainter.deactivate(false); >+ fPainter.dispose(); >+ fPainter= null; >+ } >+ fMethodBoundaryLinesColor= null; >+ } >+ >+ /** >+ * Sets the color for the method boundary lines. >+ * >+ * @param methodBoundaryColor the color to be used for drawing the method boundary lines. >+ */ >+ public void setColor(Color methodBoundaryColor) { >+ fMethodBoundaryLinesColor= methodBoundaryColor; >+ fPainter.paint(IPainter.CONFIGURATION); >+ } >+ } >+ > > /** Preference key for matching brackets */ > protected final static String MATCHING_BRACKETS= PreferenceConstants.EDITOR_MATCHING_BRACKETS; >@@ -1743,6 +1950,13 @@ > private long fErrorMessageTime; > > /** >+ * The method boundary lines capability provider. >+ * >+ * @since 3.7 >+ */ >+ private MethodBoundaryLinesProvider fMethodBoundaryLinesProvider; >+ >+ /** > * Timeout for the error message. > * > * @since 3.5 >@@ -1885,6 +2099,11 @@ > fProjectionModelUpdater.install(this, (ProjectionViewer)sourceViewer); > } > >+ if (JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES)) { >+ Color methodBoundaryColor= getSharedColors().getColor(PreferenceConverter.getColor(getPreferenceStore(), PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR)); >+ fMethodBoundaryLinesProvider= new MethodBoundaryLinesProvider((JavaSourceViewer)sourceViewer, methodBoundaryColor); >+ } >+ > // ensure source viewer decoration support has been created and configured > getSourceViewerDecorationSupport(sourceViewer); > >@@ -2586,6 +2805,11 @@ > fProjectionSupport= null; > } > >+ if (fMethodBoundaryLinesProvider != null) { >+ fMethodBoundaryLinesProvider.dispose(); >+ fMethodBoundaryLinesProvider= null; >+ } >+ > // cancel possible running computation > fMarkOccurrenceAnnotations= false; > uninstallOccurrencesFinder(); >@@ -2944,6 +3168,27 @@ > return; > } > >+ if (PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR.equals(property)) { >+ if (fMethodBoundaryLinesProvider != null) { >+ Color methodBoundaryColor= getSharedColors().getColor(PreferenceConverter.getColor(getPreferenceStore(), PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR)); >+ fMethodBoundaryLinesProvider.setColor(methodBoundaryColor); >+ } >+ } >+ >+ if (PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES.equals(property)) { >+ if (!JavaPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES)) { >+ if (fMethodBoundaryLinesProvider != null) { >+ fMethodBoundaryLinesProvider.dispose(); >+ fMethodBoundaryLinesProvider= null; >+ } >+ } else { >+ if (fMethodBoundaryLinesProvider == null) { >+ Color methodBoundaryColor= getSharedColors().getColor(PreferenceConverter.getColor(getPreferenceStore(), PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR)); >+ fMethodBoundaryLinesProvider= new MethodBoundaryLinesProvider((JavaSourceViewer)sourceViewer, methodBoundaryColor); >+ } >+ } >+ } >+ > } finally { > super.handlePreferenceStoreChanged(event); > } >@@ -3352,6 +3597,17 @@ > } > > /** >+ * Checks if the method boundary lines is enabled. >+ * >+ * @return <code>true</code> if the method boundary lines preference is checked >+ * @since 3.7 >+ */ >+ protected boolean isShowingMethodBoundaryLines() { >+ IPreferenceStore store= getPreferenceStore(); >+ return store != null && store.getBoolean(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES); >+ } >+ >+ /** > * @return true if editor breadcrumbs are enabled > * @since 3.4 > */ >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/ToggleMethodBoundaryLinesAction.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/ui/javaeditor/ToggleMethodBoundaryLinesAction.java >diff -N ui/org/eclipse/jdt/internal/ui/javaeditor/ToggleMethodBoundaryLinesAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/ToggleMethodBoundaryLinesAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,101 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2010 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.jdt.internal.ui.javaeditor; >+ >+ >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.jface.util.PropertyChangeEvent; >+ >+import org.eclipse.ui.PlatformUI; >+ >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.ui.texteditor.TextEditorAction; >+ >+import org.eclipse.jdt.ui.PreferenceConstants; >+ >+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; >+import org.eclipse.jdt.internal.ui.JavaPlugin; >+import org.eclipse.jdt.internal.ui.JavaPluginImages; >+ >+ >+/** >+ * A toolbar action which toggles the >+ * {@linkplain org.eclipse.jdt.ui.PreferenceConstants#SHOW_METHOD_BOUNDARY_LINES preference}. >+ * >+ * @since 3.7 >+ */ >+public class ToggleMethodBoundaryLinesAction extends TextEditorAction implements IPropertyChangeListener { >+ >+ private IPreferenceStore fStore; >+ >+ /** >+ * Constructs and updates the action. >+ */ >+ public ToggleMethodBoundaryLinesAction() { >+ super(JavaEditorMessages.getBundleForConstructedKeys(), "ToggleMethodBoundaryLinesAction.", null, IAction.AS_CHECK_BOX); //$NON-NLS-1$ >+ JavaPluginImages.setToolImageDescriptors(this, "toggle_method_boundary.gif"); //$NON-NLS-1$ >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.TOGGLE_METHOD_BOUNDARY_LINES_ACTION); >+ update(); >+ } >+ >+ /* >+ * @see IAction#actionPerformed >+ */ >+ public void run() { >+ fStore.setValue(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES, isChecked()); >+ } >+ >+ /* >+ * @see TextEditorAction#update >+ */ >+ public void update() { >+ ITextEditor editor= getTextEditor(); >+ >+ boolean checked= false; >+ if (editor instanceof JavaEditor) >+ checked= ((JavaEditor)editor).isShowingMethodBoundaryLines(); >+ >+ setChecked(checked); >+ setEnabled(editor != null); >+ } >+ >+ /* >+ * @see TextEditorAction#setEditor(ITextEditor) >+ */ >+ public void setEditor(ITextEditor editor) { >+ >+ super.setEditor(editor); >+ >+ if (editor != null) { >+ >+ if (fStore == null) { >+ fStore= JavaPlugin.getDefault().getPreferenceStore(); >+ fStore.addPropertyChangeListener(this); >+ } >+ >+ } else if (fStore != null) { >+ fStore.removePropertyChangeListener(this); >+ fStore= null; >+ } >+ >+ update(); >+ } >+ >+ /* >+ * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ if (event.getProperty().equals(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES)) >+ setChecked(Boolean.valueOf(event.getNewValue().toString()).booleanValue()); >+ } >+} >Index: ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorAppearanceConfigurationBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorAppearanceConfigurationBlock.java,v >retrieving revision 1.29 >diff -u -r1.29 JavaEditorAppearanceConfigurationBlock.java >--- ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorAppearanceConfigurationBlock.java 7 Oct 2010 09:57:54 -0000 1.29 >+++ ui/org/eclipse/jdt/internal/ui/preferences/JavaEditorAppearanceConfigurationBlock.java 15 Nov 2010 04:55:40 -0000 >@@ -59,6 +59,7 @@ > {PreferencesMessages.JavaEditorPreferencePage_backgroundForCompletionReplacement, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND, null }, > {PreferencesMessages.JavaEditorPreferencePage_foregroundForCompletionReplacement, PreferenceConstants.CODEASSIST_REPLACEMENT_FOREGROUND, null }, > {PreferencesMessages.JavaEditorPreferencePage_sourceHoverBackgroundColor, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT}, >+ { PreferencesMessages.JavaEditorPreferencePage_methodBoundaryLinesColor, PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR, null }, > > }; > >@@ -84,6 +85,8 @@ > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)); > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_EVALUTE_TEMPORARY_PROBLEMS)); > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_SHOW_SEGMENTS)); >+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES)); >+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.METHOD_BOUNDARY_LINES_COLOR)); > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND)); > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND)); > overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.CODEASSIST_REPLACEMENT_BACKGROUND)); >@@ -234,6 +237,9 @@ > label= PreferencesMessages.JavaEditorPreferencePage_showJavaElementOnly; > addCheckBox(appearanceComposite, label, PreferenceConstants.EDITOR_SHOW_SEGMENTS, 0); > >+ label= PreferencesMessages.JavaEditorPreferencePage_ShowMethodBoundaryLines; >+ addCheckBox(appearanceComposite, label, PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES, 0); >+ > Label l= new Label(appearanceComposite, SWT.LEFT ); > gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); > gd.horizontalSpan= 2; >Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java,v >retrieving revision 1.137 >diff -u -r1.137 PreferencesMessages.java >--- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java 5 Nov 2010 05:49:58 -0000 1.137 >+++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java 15 Nov 2010 04:55:41 -0000 >@@ -151,6 +151,8 @@ > public static String JavaEditorPreferencePage_enable; > public static String JavaEditorPreferencePage_preview; > public static String JavaEditorPreferencePage_highlightMatchingBrackets; >+ >+ public static String JavaEditorPreferencePage_ShowMethodBoundaryLines; > public static String JavaEditorPreferencePage_insertSingleProposalsAutomatically; > public static String JavaEditorPreferencePage_showOnlyProposalsVisibleInTheInvocationContext; > public static String JavaEditorPreferencePage_presentProposalsInAlphabeticalOrder; >@@ -178,6 +180,8 @@ > public static String JavaEditorPreferencePage_empty_input; > public static String JavaEditorPreferencePage_invalid_input; > public static String JavaEditorPreferencePage_matchingBracketsHighlightColor2; >+ >+ public static String JavaEditorPreferencePage_methodBoundaryLinesColor; > public static String JavaEditorPreferencePage_appearanceOptions; > public static String JavaEditorPreferencePage_typing_tabTitle; > public static String JavaEditorPreferencePage_closeStrings; >Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties,v >retrieving revision 1.521 >diff -u -r1.521 PreferencesMessages.properties >--- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 5 Nov 2010 05:49:58 -0000 1.521 >+++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 15 Nov 2010 04:55:42 -0000 >@@ -131,6 +131,7 @@ > JavaEditorPreferencePage_enable=Enab&le > JavaEditorPreferencePage_preview=Previe&w: > JavaEditorPreferencePage_highlightMatchingBrackets=Highlight &matching brackets >+JavaEditorPreferencePage_ShowMethodBoundaryLines=Method &boundary lines > JavaEditorPreferencePage_insertSingleProposalsAutomatically=Insert single &proposals automatically > JavaEditorPreferencePage_showOnlyProposalsVisibleInTheInvocationContext=Hide proposals not visible in the in&vocation context > JavaEditorPreferencePage_presentProposalsInAlphabeticalOrder=&Sort proposals >@@ -160,6 +161,7 @@ > JavaEditorPreferencePage_empty_input=Empty input > JavaEditorPreferencePage_invalid_input=''{0}'' is not a valid input. > JavaEditorPreferencePage_matchingBracketsHighlightColor2=Matching brackets highlight >+JavaEditorPreferencePage_methodBoundaryLinesColor= Method boundary lines > JavaEditorPreferencePage_appearanceOptions=Appearance co&lor options: > > JavaEditorPreferencePage_typing_tabTitle=T&yping >Index: ui/org/eclipse/jdt/ui/PreferenceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/PreferenceConstants.java,v >retrieving revision 1.257 >diff -u -r1.257 PreferenceConstants.java >--- ui/org/eclipse/jdt/ui/PreferenceConstants.java 5 Nov 2010 05:49:58 -0000 1.257 >+++ ui/org/eclipse/jdt/ui/PreferenceConstants.java 15 Nov 2010 04:55:45 -0000 >@@ -2275,11 +2275,32 @@ > public static final String EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK= "browserLikeLinksKeyModifierMask"; //$NON-NLS-1$ > > /** >+ * A named preference that controls whether method boundary lines are shown in the editor. >+ * <p> >+ * Value is of type <code>Boolean</code>. >+ * </p> >+ * >+ * @since 3.7 >+ */ >+ public static final String SHOW_METHOD_BOUNDARY_LINES= "showMethodBoundaryLines"; //$NON-NLS-1$ >+ >+ /** >+ * A named preference that holds the color used for method boundary lines. >+ * <p> >+ * Value is of type <code>String</code>. A RGB color value encoded as a string using class >+ * <code>PreferenceConverter</code> >+ * </p> >+ * >+ * @since 3.7 >+ */ >+ public static final String METHOD_BOUNDARY_LINES_COLOR= "methodBoundaryLinesColor"; //$NON-NLS-1$ >+ >+ /** > * A named preference that controls whether occurrences are marked in the editor. > * <p> > * Value is of type <code>Boolean</code>. > * </p> >- * >+ * > * @since 3.0 > */ > public static final String EDITOR_MARK_OCCURRENCES= "markOccurrences"; //$NON-NLS-1$ >@@ -3707,6 +3728,7 @@ > > // JavaEditorPreferencePage > store.setDefault(PreferenceConstants.EDITOR_MATCHING_BRACKETS, true); >+ store.setDefault(PreferenceConstants.SHOW_METHOD_BOUNDARY_LINES, false); > > store.setDefault(PreferenceConstants.EDITOR_CORRECTION_INDICATION, true); > store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true); >Index: ui/org/eclipse/jdt/ui/actions/IJavaEditorActionDefinitionIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/IJavaEditorActionDefinitionIds.java,v >retrieving revision 1.76 >diff -u -r1.76 IJavaEditorActionDefinitionIds.java >--- ui/org/eclipse/jdt/ui/actions/IJavaEditorActionDefinitionIds.java 25 Oct 2010 08:42:46 -0000 1.76 >+++ ui/org/eclipse/jdt/ui/actions/IJavaEditorActionDefinitionIds.java 15 Nov 2010 04:55:46 -0000 >@@ -718,8 +718,17 @@ > public static final String TOGGLE_MARK_OCCURRENCES= "org.eclipse.jdt.ui.edit.text.java.toggleMarkOccurrences"; //$NON-NLS-1$ > > /** >- * Action definition id of toggle breadcrumb action >- * (value: <code>"org.eclipse.jdt.ui.edit.text.java.toggleBreadcrumb"</code>). >+ * Action definition id of toggle method boundary lines action (value: >+ * <code>"org.eclipse.jdt.ui.edit.text.java.toggleMethodBoundaryLines"</code>). >+ * >+ * @since 3.7 >+ */ >+ public static final String TOGGLE_METHOD_BOUNDARY_LINES= "org.eclipse.jdt.ui.edit.text.java.toggleMethodBoundaryLines"; //$NON-NLS-1$ >+ >+ /** >+ * Action definition id of toggle breadcrumb action (value: >+ * <code>"org.eclipse.jdt.ui.edit.text.java.toggleBreadcrumb"</code>). >+ * > * @since 3.4 > */ > public static final String TOGGLE_BREADCRUMB= "org.eclipse.jdt.ui.edit.text.java.toggleBreadcrumb"; //$NON-NLS-1$ >#P org.eclipse.platform.doc.user >Index: reference/ref-68.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.platform.doc.user/reference/ref-68.htm,v >retrieving revision 1.31 >diff -u -r1.31 ref-68.htm >--- reference/ref-68.htm 29 May 2009 10:25:13 -0000 1.31 >+++ reference/ref-68.htm 15 Nov 2010 04:55:51 -0000 >@@ -175,8 +175,8 @@ > <tr> > <td align="center" valign="middle"><img src="../images/segment_edit.png" alt="Show source of selected element only image"></td> > <td>Show source of selected element only</td> >-<td> </td> >-<td> </td> >+<td align="center" valign="middle"><img src="../images/toggle_method_boundary.gif" alt="Toggle Method Boundary Lines"></td> >+<td>Toggle Method Boundary Lines</td> > </tr> > </tbody> > </table>
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
Flags:
daniel_megert
:
review-
Actions:
View
|
Diff
Attachments on
bug 13672
:
182840
|
183100
|
183101
|
183542
|
183719
|
183730
|
183737
|
268731