Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java

Issue 10703046: Issue 3753. Support for @deprecated annotation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
index 2fbeda887bf41d05337eaa6243908bd15dea475f..1f020c91349ac2c00eaed47c87737af15f7a6b35 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/SemanticHighlightings.java
@@ -26,11 +26,74 @@ import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.graphics.RGB;
/**
- * Semantic highlightings
+ * Semantic highlightings.
*/
public class SemanticHighlightings {
/**
+ * Abstract {@link SemanticHighlighting} with empty methods by default.
+ */
+ private static abstract class DefaultSemanticHighlighting extends SemanticHighlighting {
+
+ @Override
+ public RGB getDefaultDefaultTextColor() {
+ return new RGB(0, 0, 0);
+ }
+
+ @Override
+ public boolean isBoldByDefault() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnabledByDefault() {
+ return false;
+ }
+
+ @Override
+ public boolean isItalicByDefault() {
+ return false;
+ }
+
+ @Override
+ public boolean isStrikethroughByDefault() {
+ return false;
+ }
+
+ @Override
+ public boolean isUnderlineByDefault() {
+ return false;
+ }
+ }
+
+ /**
+ * Semantic highlighting deprecated elements.
+ */
+ private static final class DeprecatedElementHighlighting extends DefaultSemanticHighlighting {
+ @Override
+ public boolean consumes(SemanticToken token) {
+ DartIdentifier node = token.getNode();
+ NodeElement element = node.getElement();
+ return element != null && element.getMetadata().isDeprecated();
+ }
+
+ @Override
+ public String getDisplayName() {
+ return DartEditorMessages.SemanticHighlighting_deprecatedElement;
+ }
+
+ @Override
+ public String getPreferenceKey() {
+ return DEPRECATED_ELEMENT;
+ }
+
+ @Override
+ public boolean isStrikethroughByDefault() {
+ return true;
+ }
+ }
+
+ /**
* Semantic highlighting for variables with dynamic types.
*/
private static final class DynamicTypeHighlighting extends SemanticHighlighting {
Brian Wilkerson 2012/06/29 16:17:49 Should this subclass DefaultSemanticHighlighting?
scheglov 2012/06/29 20:11:57 Done.
@@ -172,6 +235,11 @@ public class SemanticHighlightings {
}
/**
+ * A named preference part that controls the highlighting of deprecated elements.
+ */
+ public static final String DEPRECATED_ELEMENT = "deprecated"; //$NON-NLS-1$
+
+ /**
* A named preference part that controls the highlighting of static final fields.
*/
public static final String STATIC_FINAL_FIELD = "staticFinalField"; //$NON-NLS-1$
@@ -362,7 +430,8 @@ public class SemanticHighlightings {
public static SemanticHighlighting[] getSemanticHighlightings() {
if (SEMANTIC_HIGHTLIGHTINGS == null) {
SEMANTIC_HIGHTLIGHTINGS = new SemanticHighlighting[] {
- new StaticFieldHighlighting(), new FieldHighlighting(), new DynamicTypeHighlighting()};
+ new DeprecatedElementHighlighting(), new StaticFieldHighlighting(),
+ new FieldHighlighting(), new DynamicTypeHighlighting()};
}
return SEMANTIC_HIGHTLIGHTINGS;
}

Powered by Google App Engine
This is Rietveld 408576698