diff --git a/plugins/groovy/resources/standardDsls/extensions.gdsl b/plugins/groovy/resources/standardDsls/extensions.gdsl
index 17a71ec16568..534814cd2e97 100644
--- a/plugins/groovy/resources/standardDsls/extensions.gdsl
+++ b/plugins/groovy/resources/standardDsls/extensions.gdsl
@@ -17,6 +17,9 @@
package standardDsls
+import com.intellij.psi.search.GlobalSearchScope
+import org.jetbrains.plugins.groovy.dgm.GroovyExtensionProvider
+
/**
* @author Maxim.Medvedev
*/
@@ -35,4 +38,12 @@ contributor([:]) {
category "org.codehaus.groovy.runtime.SwingGroovyMethods"
category "org.codehaus.groovy.runtime.XmlGroovyMethods"
+ def pair = GroovyExtensionProvider.getInstance(project).collectExtensions(GlobalSearchScope.allScope(project))
+ for (def inst : pair.first) {
+ category inst, false
+ }
+
+ for (def stat : pair.second) {
+ category stat, true
+ }
}
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index 13f1dd3e41b5..1d302ffb98a1 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -139,6 +139,10 @@
+
+
+
+
@@ -163,6 +167,7 @@
+
@@ -290,6 +295,8 @@
+
+
+
+
+
+
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMClassReference.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMClassReference.java
new file mode 100644
index 000000000000..12d81532794a
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMClassReference.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.*;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMClassReference implements PsiReference {
+ private final PsiElement myElement;
+ private TextRange myRange;
+
+ public DGMClassReference(PsiElement element, int start, int end) {
+
+ myElement = element;
+ myRange = new TextRange(start, end);
+ }
+
+
+ @Override
+ public PsiElement getElement() {
+ return myElement;
+ }
+
+ @Override
+ public TextRange getRangeInElement() {
+ return myRange;
+ }
+
+ @Override
+ public PsiElement resolve() {
+ Project project = myElement.getProject();
+ return JavaPsiFacade.getInstance(project).findClass(myRange.substring(myElement.getText()), myElement.getResolveScope());
+ }
+
+ @NotNull
+ @Override
+ public String getCanonicalText() {
+ return myRange.substring(myElement.getText());
+ }
+
+ @Override
+ public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
+ if (element instanceof PsiClass) {
+ String qname = ((PsiClass)element).getQualifiedName();
+ if (qname == null) return myElement;
+ PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myElement.getProject());
+ Document document = documentManager.getDocument(myElement.getContainingFile());
+ TextRange range = myRange.shiftRight(myElement.getTextRange().getStartOffset());
+ document.replaceString(range.getStartOffset(), range.getEndOffset(), qname);
+ documentManager.commitDocument(document);
+ }
+ return myElement;
+ }
+
+ @Override
+ public boolean isReferenceTo(PsiElement element) {
+ return myElement.getManager().areElementsEquivalent(element, resolve());
+ }
+
+ @NotNull
+ @Override
+ public Object[] getVariants() {
+ return EMPTY_ARRAY;
+ }
+
+ @Override
+ public boolean isSoft() {
+ return true;
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMCompletionContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMCompletionContributor.java
new file mode 100644
index 000000000000..16f71c77b922
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMCompletionContributor.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.codeInsight.completion.*;
+import com.intellij.codeInsight.lookup.LookupElementBuilder;
+import com.intellij.lang.properties.parsing.PropertiesTokenTypes;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.patterns.PlatformPatterns;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.util.Consumer;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionUtil;
+
+import java.util.Map;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMCompletionContributor extends CompletionContributor {
+ public DGMCompletionContributor() {
+ extend(CompletionType.BASIC, PlatformPatterns.psiElement(PropertiesTokenTypes.KEY_CHARACTERS),
+ new CompletionProvider() {
+ @Override
+ protected void addCompletions(@NotNull CompletionParameters parameters,
+ ProcessingContext context,
+ @NotNull CompletionResultSet result) {
+ PsiElement position = parameters.getPosition();
+ if (!DGMUtil.isInDGMFile(position)) return;
+
+ Map map = ((PropertiesFile)position.getContainingFile()).getNamesMap();
+ for (String key : DGMUtil.KEYS) {
+ if (!map.containsKey(key)) {
+ result.addElement(LookupElementBuilder.create(key));
+ }
+ }
+ }
+ });
+
+ extend(CompletionType.BASIC, PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHARACTERS),
+ new CompletionProvider() {
+ @Override
+ protected void addCompletions(@NotNull CompletionParameters parameters,
+ ProcessingContext context,
+ @NotNull final CompletionResultSet result) {
+ PsiElement position = parameters.getPosition();
+ if (!DGMUtil.isInDGMFile(position)) return;
+
+ AllClassesGetter.processJavaClasses(parameters, result.getPrefixMatcher(), true, new Consumer() {
+ @Override
+ public void consume(PsiClass aClass) {
+ result.addElement(GroovyCompletionUtil.createClassLookupItem(aClass));
+ }
+ });
+ }
+ });
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileTypeFactory.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileTypeFactory.java
new file mode 100644
index 000000000000..e82c560e4571
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMFileTypeFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.lang.properties.PropertiesFileType;
+import com.intellij.openapi.fileTypes.ExactFileNameMatcher;
+import com.intellij.openapi.fileTypes.FileTypeConsumer;
+import com.intellij.openapi.fileTypes.FileTypeFactory;
+import com.intellij.openapi.util.SystemInfo;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMFileTypeFactory extends FileTypeFactory {
+
+ @Override
+ public void createFileTypes(@NotNull FileTypeConsumer consumer) {
+ ExactFileNameMatcher matcher = new ExactFileNameMatcher(GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
+ !SystemInfo.isFileSystemCaseSensitive);
+ consumer.consume(PropertiesFileType.INSTANCE, matcher);
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
new file mode 100644
index 000000000000..9fc2820b840a
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMImplicitPropertyUsageProvider.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.codeInspection.unused.ImplicitPropertyUsageProvider;
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.util.ArrayUtil;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMImplicitPropertyUsageProvider extends ImplicitPropertyUsageProvider {
+ @Override
+ protected boolean isUsed(Property property) {
+ if (DGMUtil.isInDGMFile(property)) {
+ String name = property.getName();
+ return ArrayUtil.find(DGMUtil.KEYS, name) >= 0;
+ }
+ return false;
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMReferenceContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMReferenceContributor.java
new file mode 100644
index 000000000000..442f3e4caed7
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMReferenceContributor.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.parsing.PropertiesTokenTypes;
+import com.intellij.patterns.PlatformPatterns;
+import com.intellij.psi.*;
+import com.intellij.util.ProcessingContext;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMReferenceContributor extends PsiReferenceContributor {
+
+ @Override
+ public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
+ registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHARACTERS), new PsiReferenceProvider() {
+ @NotNull
+ @Override
+ public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
+ if (!DGMUtil.isInDGMFile(element)) return PsiReference.EMPTY_ARRAY;
+
+ IProperty parent = (IProperty)element.getParent();
+ if (!"extensionClasses".equals(parent.getName())) {
+ return PsiReference.EMPTY_ARRAY;
+ }
+
+ ArrayList result = new ArrayList();
+
+ String text = element.getText();
+
+ int i = 0;
+ while ((i = skipWhiteSpace(i, text)) < text.length()) {
+ int end = findWhiteSpaceOrComma(i, text);
+ if (end <= text.length()) {
+ result.add(new DGMClassReference(element, i, end));
+ }
+ i = end;
+ i = skipWhiteSpace(i, text);
+ if (i == text.length()) break;
+ if (text.charAt(i) == ',') i++;
+ i = skipWhiteSpace(i, text);
+ }
+
+ return result.toArray(new PsiReference[result.size()]);
+ }
+ });
+ }
+
+ private static int skipWhiteSpace(int i, String text) {
+ while (i < text.length() && Character.isWhitespace(text.charAt(i))) {
+ i++;
+ }
+ return i;
+ }
+
+ private static int findWhiteSpaceOrComma(int i, String text) {
+ while (i < text.length() && !Character.isWhitespace(text.charAt(i)) && text.charAt(i) != ',') {
+ i++;
+ }
+ return i;
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java
new file mode 100644
index 000000000000..af695a38be7c
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/DGMUtil.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+
+/**
+ * @author Max Medvedev
+ */
+public class DGMUtil {
+ public static final String[] KEYS = new String[]{"moduleName", "moduleVersion", "extensionClasses", "staticExtensionClasses",};
+
+ public static boolean isInDGMFile(PsiElement e) {
+ PsiFile file = e.getContainingFile();
+ return file instanceof PropertiesFile &&
+ Comparing.equal(file.getName(), GroovyExtensionProvider.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE,
+ SystemInfo.isFileSystemCaseSensitive);
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
new file mode 100644
index 000000000000..c4ae7fe067af
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dgm/GroovyExtensionProvider.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2000-2012 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.dgm;
+
+import com.intellij.lang.properties.IProperty;
+import com.intellij.lang.properties.psi.PropertiesFile;
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.psi.JavaPsiFacade;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiPackage;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NonNls;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Max Medvedev
+ */
+public class GroovyExtensionProvider {
+ @NonNls public static final String ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE = "org.codehaus.groovy.runtime.ExtensionModule";
+ private final Project myProject;
+
+ public GroovyExtensionProvider(Project project) {
+ myProject = project;
+ }
+
+ public static GroovyExtensionProvider getInstance(Project project) {
+ return ServiceManager.getService(project, GroovyExtensionProvider.class);
+ }
+
+ public Pair, List> collectExtensions(GlobalSearchScope resolveScope) {
+ PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage("META-INF.services");
+ if (aPackage == null) {
+ return new Pair, List>(Collections.emptyList(), Collections.emptyList());
+ }
+
+
+ List instanceClasses = new ArrayList();
+ List staticClasses = new ArrayList();
+ for (PsiDirectory directory : aPackage.getDirectories(resolveScope)) {
+ PsiFile file = directory.findFile("org.codehaus.groovy.runtime.ExtensionModule");
+ if (file instanceof PropertiesFile) {
+ IProperty inst = ((PropertiesFile)file).findPropertyByKey("extensionClasses");
+ IProperty stat = ((PropertiesFile)file).findPropertyByKey("staticExtensionClasses");
+
+ if (inst != null) collectClasses(inst, instanceClasses);
+ if (stat != null) collectClasses(stat, staticClasses);
+ }
+ }
+
+ return new Pair, List>(instanceClasses, staticClasses);
+ }
+
+ private static void collectClasses(IProperty pr, List classes) {
+ String value = pr.getValue();
+ if (value == null) return;
+ value = value.trim();
+ String[] qnames = value.split("\\s*,\\s*");
+ ContainerUtil.addAll(classes, qnames);
+ }
+}
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy
index a576a32b8805..cc9229809b73 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.groovy
@@ -1053,4 +1053,21 @@ class Category2 {
assertNotNull(ref.resolve())
}
+
+ void testGroovyExtensions() {
+ def ref = configureByText('pack._a.groovy', '''\
+package pack
+
+class StringExt {
+ static sub(String s) {}
+}
+
+"".sub()''')
+
+ myFixture.addFileToProject("META-INF/services/org.codehaus.groovy.runtime.ExtensionModule", """\
+extensionClasses=pack.StringExt
+""")
+
+ assertNotNull(ref.resolve())
+ }
}
diff --git a/plugins/properties/src/META-INF/plugin.xml b/plugins/properties/src/META-INF/plugin.xml
index b5053ce9440b..8e152052a51b 100644
--- a/plugins/properties/src/META-INF/plugin.xml
+++ b/plugins/properties/src/META-INF/plugin.xml
@@ -6,6 +6,11 @@
This plugin enables smart editing of properties files.
JetBrains
+
+
+
+
+
+ implementationClass="com.intellij.codeInspection.unused.UnusedPropertyInspection"/>
diff --git a/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java b/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
new file mode 100644
index 000000000000..ee0b9f593638
--- /dev/null
+++ b/plugins/properties/src/com/intellij/codeInspection/unused/ImplicitPropertyUsageProvider.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2012 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 com.intellij.codeInspection.unused;
+
+import com.intellij.lang.properties.psi.Property;
+import com.intellij.openapi.extensions.ExtensionPointName;
+
+/**
+ * @author Max Medvedev
+ */
+public abstract class ImplicitPropertyUsageProvider {
+ private static final ExtensionPointName EP_NAME =
+ ExtensionPointName.create("com.intellij.properties.implicitPropertyUsageProvider");
+
+ public static boolean isImplicitlyUsed(Property property) {
+ for (ImplicitPropertyUsageProvider provider : EP_NAME.getExtensions()) {
+ if (provider.isUsed(property)) return true;
+ }
+ return false;
+ }
+
+ protected abstract boolean isUsed(Property property);
+}
diff --git a/plugins/properties/src/com/intellij/lang/properties/UnusedPropertyInspection.java b/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
similarity index 92%
rename from plugins/properties/src/com/intellij/lang/properties/UnusedPropertyInspection.java
rename to plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
index 0166a7c989f0..86d58988e5fe 100644
--- a/plugins/properties/src/com/intellij/lang/properties/UnusedPropertyInspection.java
+++ b/plugins/properties/src/com/intellij/codeInspection/unused/UnusedPropertyInspection.java
@@ -13,12 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.intellij.lang.properties;
+package com.intellij.codeInspection.unused;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.lang.ASTNode;
+import com.intellij.lang.properties.PropertiesBundle;
+import com.intellij.lang.properties.PropertySuppressableInspectionBase;
+import com.intellij.lang.properties.RemovePropertyLocalFix;
import com.intellij.lang.properties.findUsages.PropertySearcher;
import com.intellij.lang.properties.psi.Property;
import com.intellij.openapi.extensions.Extensions;
@@ -75,6 +78,8 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
original.setText(PropertiesBundle.message("searching.for.property.key.progress.text", property.getUnescapedKey()));
}
+ if (ImplicitPropertyUsageProvider.isImplicitlyUsed(property)) return;
+
String name = property.getName();
if (name == null) return;
if (searcher != null) {
@@ -97,7 +102,7 @@ public class UnusedPropertyInspection extends PropertySuppressableInspectionBase
PsiElement key = nodes.length == 0 ? property : nodes[0].getPsi();
String description = PropertiesBundle.message("unused.property.problem.descriptor.name");
- holder.registerProblem(key, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL,RemovePropertyLocalFix.INSTANCE);
+ holder.registerProblem(key, description, ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemovePropertyLocalFix.INSTANCE);
}
};
}