diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index fd1c4369b052..213a58cce51f 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -39,6 +39,8 @@
+
+
@@ -61,6 +63,8 @@
+
+
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
index 2d2377a42d97..5f0c0ca5b71a 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java
@@ -46,6 +46,7 @@ import org.jetbrains.plugins.groovy.annotator.intentions.*;
import org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicMethodFix;
import org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicPropertyFix;
import org.jetbrains.plugins.groovy.config.GroovyConfigUtils;
+import org.jetbrains.plugins.groovy.extensions.GroovyUnresolvedHighlightFilter;
import org.jetbrains.plugins.groovy.findUsages.LiteralConstructorReference;
import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.lang.documentation.GroovyPresentationUtil;
@@ -238,6 +239,9 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
return;
}
}
+
+ if (!GroovyUnresolvedHighlightFilter.shouldHighlight(referenceExpression)) return;
+
registerReferenceFixes(referenceExpression, annotation);
annotation.setTextAttributes(DefaultHighlighter.UNRESOLVED_ACCESS);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFileFilter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFileFilter.java
new file mode 100644
index 000000000000..81d40b7ac09f
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFileFilter.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.extensions;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.openapi.util.Key;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public abstract class GroovyUnresolvedHighlightFileFilter {
+
+ public static final ExtensionPointName EP_NAME = ExtensionPointName.create("org.intellij.groovy.unresolvedHighlightFileFilter");
+
+ public abstract boolean isReject(@NotNull PsiFile file);
+
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFilter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFilter.java
new file mode 100644
index 000000000000..dd7eabe225a6
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedHighlightFilter.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.extensions;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public abstract class GroovyUnresolvedHighlightFilter {
+
+ public static final ExtensionPointName EP_NAME = ExtensionPointName.create("org.intellij.groovy.unresolvedHighlightFilter");
+
+ public abstract boolean isReject(@NotNull GrReferenceExpression expression);
+
+ public static boolean shouldHighlight(@NotNull GrReferenceExpression expression) {
+ for (GroovyUnresolvedHighlightFilter filter : EP_NAME.getExtensions()) {
+ if (filter.isReject(expression)) return false;
+ }
+
+ return true;
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedReferenceFilterByFile.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedReferenceFilterByFile.java
new file mode 100644
index 000000000000..992784e33626
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/extensions/GroovyUnresolvedReferenceFilterByFile.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.extensions;
+
+import com.intellij.openapi.util.Key;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
+
+/**
+ * @author Sergey Evdokimov
+ */
+public final class GroovyUnresolvedReferenceFilterByFile extends GroovyUnresolvedHighlightFilter {
+
+ private static final Key KEY = Key.create("GroovyUnresolvedHighlightFileFilter");
+
+ @Override
+ public boolean isReject(@NotNull GrReferenceExpression expression) {
+ PsiFile file = expression.getContainingFile();
+
+ Boolean cachedValue = file.getUserData(KEY);
+
+ if (cachedValue != null) return cachedValue;
+
+ boolean res = true;
+
+ for (GroovyUnresolvedHighlightFileFilter filter : GroovyUnresolvedHighlightFileFilter.EP_NAME.getExtensions()) {
+ if (filter.isReject(file)) {
+ res = false;
+ break;
+ }
+ }
+
+ file.putUserData(KEY, res);
+
+ return res;
+ }
+}