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 241733 Details for
Bug 421564
[1.8][syntax highlighting] Semantic coloring for effectively final local variables (or for non-final)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
quick hack
eclipse.jdt.ui.patch (text/plain), 3.39 KB, created by
Markus Keller
on 2014-04-08 11:53:13 EDT
(
hide
)
Description:
quick hack
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2014-04-08 11:53:13 EDT
Size:
3.39 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >diff --git ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java >index 8b7ed5f..e67fc34 100644 >--- ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java >@@ -100,6 +100,11 @@ > public static final String ABSTRACT_METHOD_INVOCATION="abstractMethodInvocation"; //$NON-NLS-1$ > > /** >+ * A named preference part that controls the highlighting of effectively final local variables. >+ */ >+ public static final String LOCAL_VARIABLE_EFFECTIVELY_FINAL="localVariableEffectivelyFinal"; //$NON-NLS-1$ >+ >+ /** > * A named preference part that controls the highlighting of local variables. > */ > public static final String LOCAL_VARIABLE_DECLARATION="localVariableDeclaration"; //$NON-NLS-1$ >@@ -913,6 +918,74 @@ > public boolean consumes(SemanticToken token) { > IBinding binding= getBinding(token); > return binding != null && binding.getKind() == IBinding.METHOD; >+ } >+ } >+ >+ /** >+ * Semantic highlighting for effectively final local variables. >+ */ >+ private static final class LocalVariableEffectivelyFinalHighlighting extends SemanticHighlighting { >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#getPreferenceKey() >+ */ >+ @Override >+ public String getPreferenceKey() { >+ return LOCAL_VARIABLE_EFFECTIVELY_FINAL; >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDefaultTextColor() >+ */ >+ @Override >+ public RGB getDefaultDefaultTextColor() { >+ return new RGB(106, 62, 62); >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDefaultTextStyleBold() >+ */ >+ @Override >+ public boolean isBoldByDefault() { >+ return true; >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#isItalicByDefault() >+ */ >+ @Override >+ public boolean isItalicByDefault() { >+ return false; >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#isEnabledByDefault() >+ */ >+ @Override >+ public boolean isEnabledByDefault() { >+ return true; >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.ISemanticHighlighting#getDisplayName() >+ */ >+ @Override >+ public String getDisplayName() { >+//XXX return JavaEditorMessages.SemanticHighlighting_localVariableDeclaration; >+ return "Effectively final local variable"; >+ } >+ >+ /* >+ * @see org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlighting#consumes(org.eclipse.jdt.internal.ui.javaeditor.SemanticToken) >+ */ >+ @Override >+ public boolean consumes(SemanticToken token) { >+ IBinding binding= token.getBinding(); >+ if (binding != null && binding.getKind() == IBinding.VARIABLE && !((IVariableBinding) binding).isField()) { >+ ASTNode decl= token.getRoot().findDeclaringNode(binding); >+ return decl instanceof VariableDeclaration && ((IVariableBinding) binding).isEffectivelyFinal(); >+ } >+ return false; > } > } > >@@ -1992,6 +2065,7 @@ > new AnnotationElementReferenceHighlighting(), > new InheritedMethodInvocationHighlighting(), > new ParameterVariableHighlighting(), >+ new LocalVariableEffectivelyFinalHighlighting(), > new LocalVariableDeclarationHighlighting(), > new LocalVariableHighlighting(), > new TypeVariableHighlighting(), // before type arguments!
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 421564
: 241733