aboutsummaryrefslogtreecommitdiff
path: root/src/eclipseAgent/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-11-28 19:15:34 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-11-28 19:15:34 +0100
commita5c7d134c168f6f9e9ab6203cb54b1030057c790 (patch)
tree02ef8216f42ca2106cb6282457e131c525eac1cd /src/eclipseAgent/lombok
parentaaf3101393d4f87ea8e256ba35a5b5374e6a0161 (diff)
parent4e831b05ec08399795d27c343b6324b5b6de3443 (diff)
downloadlombok-a5c7d134c168f6f9e9ab6203cb54b1030057c790.tar.gz
lombok-a5c7d134c168f6f9e9ab6203cb54b1030057c790.tar.bz2
lombok-a5c7d134c168f6f9e9ab6203cb54b1030057c790.zip
Merge branch 'Highlighting' of https://github.com/jvanderhel/lombok into jvanderhel-Highlighting
Conflicts: src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
Diffstat (limited to 'src/eclipseAgent/lombok')
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java15
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
index 4ccc375e..25f7d7ce 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java
@@ -92,6 +92,7 @@ public class EclipsePatcher extends Agent {
patchFixSourceTypeConverter(sm);
patchDisableLombokForCodeFormatterAndCleanup(sm);
patchListRewriteHandleGeneratedMethods(sm);
+ patchSyntaxAndOccurrencesHighlighting(sm);
} else {
patchPostCompileHookEcj(sm);
}
@@ -101,6 +102,20 @@ public class EclipsePatcher extends Agent {
if (reloadExistingClasses) sm.reloadClasses(instrumentation);
}
+
+ private static void patchSyntaxAndOccurrencesHighlighting(ScriptManager sm) {
+ /*
+ * Skip generated nodes for "visual effects" (syntax highlighting && highlight occurrences)
+ */
+ sm.addScript(ScriptBuilder.exitEarly()
+ .target(new MethodTarget("org.eclipse.jdt.internal.ui.search.OccurrencesFinder", "addUsage"))
+ .target(new MethodTarget("org.eclipse.jdt.internal.ui.search.OccurrencesFinder", "addWrite"))
+ .target(new MethodTarget("org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingReconciler$PositionCollector", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName"))
+ .decisionMethod(new Hook("lombok.eclipse.agent.PatchFixes", "isGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode"))
+ .valueMethod(new Hook("lombok.eclipse.agent.PatchFixes", "returnFalse", "boolean", "java.lang.Object"))
+ .request(StackRequest.PARAM1)
+ .build());
+ }
private static void patchDisableLombokForCodeFormatterAndCleanup(ScriptManager sm) {
sm.addScript(ScriptBuilder.setSymbolDuringMethodCall()
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
index e7d6c04b..e76073bf 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchFixes.java
@@ -94,12 +94,12 @@ public class PatchFixes {
public static int fixRetrieveEllipsisStartPosition(int original, int end) {
return original == -1 ? end : original;
}
-
+
public static int fixRetrieveRightBraceOrSemiColonPosition(int original, int end) {
return original == -1 ? end : original;
}
- public static final int ALREADY_PROCESSED_FLAG = 0x800000; //Bit 24
+ public static final int ALREADY_PROCESSED_FLAG = 0x800000; //Bit 24
public static boolean checkBit24(Object node) throws Exception {
int bits = (Integer)(node.getClass().getField("bits").get(node));