summaryrefslogtreecommitdiff
path: root/plugins/groovy/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/groovy/src')
-rw-r--r--plugins/groovy/src/META-INF/plugin.xml12
-rw-r--r--plugins/groovy/src/META-INF/structuralsearch.xml6
-rw-r--r--plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java161
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java2
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java36
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java98
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java (renamed from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java)2
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java (renamed from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java)16
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form (renamed from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form)18
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java (renamed from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java)19
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java1
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java37
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form26
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java33
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java15
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java39
-rw-r--r--plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java42
17 files changed, 278 insertions, 285 deletions
diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml
index f16d2c195482..8e3d7103e250 100644
--- a/plugins/groovy/src/META-INF/plugin.xml
+++ b/plugins/groovy/src/META-INF/plugin.xml
@@ -25,7 +25,6 @@
<depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
<depends optional="true">AntSupport</depends>
<depends optional="true" config-file="groovy-byte-code-viewer.xml">ByteCodeViewer</depends>
- <depends optional="true" config-file="structuralsearch.xml">Structural Search</depends>
<extensionPoints>
<extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
@@ -42,7 +41,6 @@
<extensionPoint name="positionManagerDelegate"
interface="org.jetbrains.plugins.groovy.extensions.debugger.ScriptPositionManagerHelper"/>
- <extensionPoint name="compilerExtension" interface="org.jetbrains.plugins.groovy.compiler.GroovyCompilerExtension"/>
<extensionPoint name="scriptTypeDetector" interface="org.jetbrains.plugins.groovy.extensions.GroovyScriptTypeDetector"/>
<extensionPoint name="namedArgumentProvider" interface="org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider"/>
@@ -275,7 +273,7 @@
<fileTypeFactory implementation="org.jetbrains.plugins.groovy.GroovyFileTypeLoader"/>
<fileTypeFactory implementation="org.jetbrains.plugins.groovy.dgm.DGMFileTypeFactory"/>
- <projectConfigurable instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
+ <projectConfigurable groupId="build" instance="org.jetbrains.plugins.groovy.gant.GantConfigurable" id="reference.settingsdialog.project.gant"
displayName="Gant"/>
<library.presentationProvider implementation="org.jetbrains.plugins.groovy.config.GroovyLibraryPresentationProvider"/>
@@ -404,6 +402,8 @@
<refactoring.helper implementation="org.jetbrains.plugins.groovy.refactoring.GroovyImportOptimizerRefactoringHelper"/>
<codeInsight.lineMarkerProvider language="Groovy"
implementationClass="org.jetbrains.plugins.groovy.codeInsight.GroovyLineMarkerProvider"/>
+ <codeInsight.lineMarkerProvider language="Groovy"
+ implementationClass="com.intellij.codeInsight.ExternalAnnotationsLineMarkerProvider"/>
<codeInsight.gotoSuper language="Groovy"
implementationClass="org.jetbrains.plugins.groovy.codeInsight.navigation.actions.GroovyGotoSuperHandler"/>
<lookup.charFilter implementation="org.jetbrains.plugins.groovy.lang.completion.GroovyReferenceCharFilter"/>
@@ -445,13 +445,13 @@
<weigher key="proximity" implementationClass="org.jetbrains.plugins.groovy.lang.completion.weighers.GrReferenceListWeigher"
id="groovyReferenceListWeigher" order="before openedInEditor"/>
- <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerClassFilterProvider"/>
+ <debuggerClassFilterProvider implementation="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerClassFilterProvider"/>
<useScopeEnlarger implementation="org.jetbrains.plugins.groovy.lang.psi.impl.search.GrPrivateFieldScopeEnlarger"/>
<debuggerEditorTextProvider language="Groovy" implementationClass="org.jetbrains.plugins.groovy.debugger.GroovyEditorTextProvider"/>
- <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings"/>
+ <xdebugger.settings implementation="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerSettings"/>
<langCodeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyLanguageCodeStyleSettingsProvider"/>
<codeStyleSettingsProvider implementation="org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettingsProvider"/>
@@ -1515,6 +1515,8 @@
implementationClass="org.jetbrains.plugins.groovy.refactoring.memberPullUp.GrPullUpHelperFactory"/>
<classTypePointerFactory implementation="org.jetbrains.plugins.groovy.lang.psi.impl.smartPointers.GrClassReferenceTypePointerFactory"/>
<hierarchy.referenceProcessor implementation="org.jetbrains.plugins.groovy.hierarchy.call.GrCallReferenceProcessor"/>
+ <structuralsearch.profile implementation="com.intellij.structuralsearch.GroovyStructuralSearchProfile"/>
+ <equivalenceDescriptorProvider implementation="com.intellij.structuralsearch.GroovyEquivalenceDescriptorProvider"/>
</extensions>
<extensions defaultExtensionNs="com.intellij.debugger">
diff --git a/plugins/groovy/src/META-INF/structuralsearch.xml b/plugins/groovy/src/META-INF/structuralsearch.xml
deleted file mode 100644
index b3b6193771de..000000000000
--- a/plugins/groovy/src/META-INF/structuralsearch.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<idea-plugin url="http://www.jetbrains.com/idea">
- <extensions defaultExtensionNs="com.intellij">
- <structuralsearch.profile implementation="com.intellij.structuralsearch.GroovyStructuralSearchProfile"/>
- </extensions>
-</idea-plugin>
- \ No newline at end of file
diff --git a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
index e23254da8d1a..3fcf1c337b86 100644
--- a/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
+++ b/plugins/groovy/src/org/intellij/plugins/intelliLang/inject/groovy/PatternEditorContextMembersProvider.java
@@ -19,7 +19,7 @@ import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.progress.EmptyProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.patterns.compiler.PatternClassBean;
import com.intellij.patterns.compiler.PatternCompilerFactory;
import com.intellij.psi.*;
@@ -30,14 +30,13 @@ import com.intellij.psi.scope.PsiScopeProcessor;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.TextOccurenceProcessor;
import com.intellij.psi.search.UsageSearchContext;
-import com.intellij.psi.util.CachedValue;
-import com.intellij.psi.util.CachedValueProvider;
-import com.intellij.psi.util.CachedValuesManager;
-import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.*;
import com.intellij.psi.xml.XmlTag;
import com.intellij.psi.xml.XmlText;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.Processor;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.SoftFactoryMap;
import com.intellij.util.text.StringSearcher;
import org.intellij.plugins.intelliLang.inject.InjectorUtils;
import org.intellij.plugins.intelliLang.inject.config.BaseInjection;
@@ -46,86 +45,74 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersContributor;
-import java.util.Collections;
import java.util.List;
+import java.util.Set;
/**
* @author Gregory.Shrago
*/
public class PatternEditorContextMembersProvider extends NonCodeMembersContributor {
- public static final Key<CachedValue<List<PsiElement>>> INJECTION_PARSED_CONTEXT = Key.create("INJECTION_PARSED_CONTEXT");
+ private static final Key<SoftFactoryMap<Class[], PsiFile>> PATTERN_INJECTION_CONTEXT = Key.create("PATTERN_INJECTION_CONTEXT");
+ private static final Key<CachedValue<Set<String>>> PATTERN_CLASSES = Key.create("PATTERN_CLASSES");
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
- @NotNull PsiScopeProcessor processor,
- @NotNull PsiElement place,
- @NotNull ResolveState state) {
+ @NotNull final PsiScopeProcessor scopeProcessor,
+ @NotNull final PsiElement place,
+ @NotNull final ResolveState state) {
final PsiFile file = place.getContainingFile().getOriginalFile();
- CachedValue<List<PsiElement>> value = file.getUserData(INJECTION_PARSED_CONTEXT);
- if (value == null) {
- final BaseInjection injection = file.getUserData(BaseInjection.INJECTION_KEY);
- final CachedValueProvider<List<PsiElement>> provider;
- if (injection == null) {
- provider = createDevProvider(file);
- }
- else {
- provider = createPatternProvider(injection, file);
+ final BaseInjection injection = file.getUserData(BaseInjection.INJECTION_KEY);
+ Processor<PsiElement> processor = new Processor<PsiElement>() {
+ @Override
+ public boolean process(PsiElement element) {
+ return element.processDeclarations(scopeProcessor, state, null, place);
}
- if (provider == null) return;
- file.putUserData(INJECTION_PARSED_CONTEXT,
- value = CachedValuesManager.getManager(file.getProject()).createCachedValue(provider, false));
+ };
+ if (injection == null) {
+ processDevContext(file, processor);
}
- final List<PsiElement> roots = value.getValue();
- for (PsiElement root : roots) {
- if (!root.processDeclarations(processor, state, null, place)) return;
+ else {
+ processPatternContext(injection, file, processor);
}
}
- private static CachedValueProvider<List<PsiElement>> createPatternProvider(final BaseInjection injection, final PsiFile file) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- return new Result<List<PsiElement>>(Collections.<PsiElement>singletonList(
- getRootByClasses(InjectorUtils.getPatternClasses(injection.getSupportId()), file.getProject())),
- ModificationTracker.NEVER_CHANGED);
- }
- };
+ private static boolean processPatternContext(@NotNull BaseInjection injection,
+ @NotNull PsiFile file,
+ @NotNull Processor<PsiElement> processor) {
+ return processor.process(getRootByClasses(file, InjectorUtils.getPatternClasses(injection.getSupportId())));
}
- private static PsiFile getRootByClasses(Class[] classes, Project project) {
- final String text = PatternCompilerFactory.getFactory().getPatternCompiler(classes).dumpContextDeclarations();
- return PsiFileFactory.getInstance(project).createFileFromText("context.groovy", GroovyFileType.GROOVY_FILE_TYPE, text);
+ @NotNull
+ private static PsiFile getRootByClasses(@NotNull PsiFile file, @NotNull Class[] classes) {
+ final Project project = file.getProject();
+ SoftFactoryMap<Class[], PsiFile> map = project.getUserData(PATTERN_INJECTION_CONTEXT);
+ if (map == null) {
+ map = new SoftFactoryMap<Class[], PsiFile>() {
+
+ @Override
+ protected PsiFile create(Class[] key) {
+ String text = PatternCompilerFactory.getFactory().getPatternCompiler(key).dumpContextDeclarations();
+ return PsiFileFactory.getInstance(project).createFileFromText("context.groovy", GroovyFileType.GROOVY_FILE_TYPE, text);
+ }
+ };
+ project.putUserData(PATTERN_INJECTION_CONTEXT, map);
+ }
+ return map.get(classes);
}
- @Nullable
- private static CachedValueProvider<List<PsiElement>> createDevProvider(final PsiFile file) {
+ private static boolean processDevContext(final PsiFile file, Processor<PsiElement> processor) {
final XmlTag tag = getTagByInjectedFile(file);
final XmlTag parentTag = tag == null ? null : tag.getParentTag();
final String parentTagName = parentTag == null ? null : parentTag.getName();
final String name = tag == null ? null : tag.getName();
- if ("place".equals(name) && "injection".equals(parentTagName) && parentTag != null) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- final XmlTag tag = getTagByInjectedFile(file);
- final XmlTag parentTag = tag == null ? null : tag.getParentTag();
- if (parentTag == null) return Result.create(Collections.<PsiElement>emptyList(), file);
- return new Result<List<PsiElement>>(getRootsByClassNames(file, parentTag.getAttributeValue("injector-id")), parentTag.getContainingFile());
- }
- };
+ if ("place".equals(name) && "injection".equals(parentTagName)) {
+ return processRootsByClassNames(file, parentTag.getAttributeValue("injector-id"), processor);
}
else if ("pattern".equals(name) && parentTag != null) {
- return new CachedValueProvider<List<PsiElement>>() {
- @Override
- public Result<List<PsiElement>> compute() {
- final XmlTag tag = getTagByInjectedFile(file);
- if (tag == null) return Result.create(Collections.<PsiElement>emptyList(), file);
- return new Result<List<PsiElement>>(getRootsByClassNames(file, tag.getAttributeValue("type")), tag.getContainingFile());
- }
- };
+ return processRootsByClassNames(file, tag.getAttributeValue("type"), processor);
}
- else return null;
+ return true;
}
@Nullable
@@ -135,22 +122,48 @@ public class PatternEditorContextMembersProvider extends NonCodeMembersContribut
return element instanceof XmlText ? ((XmlText)element).getParentTag() : null;
}
- private static List<PsiElement> getRootsByClassNames(PsiFile file, String type) {
- final List<PsiElement> roots = ContainerUtil.createLockFreeCopyOnWriteList();
+ private static boolean processRootsByClassNames(@NotNull PsiFile file, @Nullable String type, @NotNull Processor<PsiElement> processor) {
+ Project project = file.getProject();
+ Set<String> classNames = collectDevPatternClassNames(project);
+ if (!classNames.isEmpty()) {
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
+ for (String className : classNames) {
+ PsiClass patternClass = psiFacade.findClass(className, GlobalSearchScope.allScope(project));
+ if (patternClass != null && !processor.process(patternClass)) return false;
+ }
+ }
+ Class[] classes = StringUtil.isEmpty(type) ? ArrayUtil.EMPTY_CLASS_ARRAY : PatternCompilerFactory.getFactory().getPatternClasses(type);
+ return classes.length == 0 || processor.process(getRootByClasses(file, classes));
+ }
+
+ private static Set<String> collectDevPatternClassNames(@NotNull final Project project) {
+ CachedValue<Set<String>> cachedValue = project.getUserData(PATTERN_CLASSES);
+ if (cachedValue == null) {
+ cachedValue = CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider<Set<String>>() {
+ @Nullable
+ @Override
+ public Result<Set<String>> compute() {
+ return Result.create(calcDevPatternClassNames(project), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
+ }
+ }, false);
+ project.putUserData(PATTERN_CLASSES, cachedValue);
+ }
+ return cachedValue.getValue();
+ }
- final Project project = file.getProject();
- final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
- final PsiClass beanClass = psiFacade.findClass(PatternClassBean.class.getName(), GlobalSearchScope.allScope(project));
+ private static Set<String> calcDevPatternClassNames(@NotNull final Project project) {
+ final List<String> roots = ContainerUtil.createLockFreeCopyOnWriteList();
+ JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
+ PsiClass beanClass = psiFacade.findClass(PatternClassBean.class.getName(), GlobalSearchScope.allScope(project));
if (beanClass != null) {
- final GlobalSearchScope scope =
- GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), StdFileTypes.XML);
+ GlobalSearchScope scope = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), StdFileTypes.XML);
final TextOccurenceProcessor occurenceProcessor = new TextOccurenceProcessor() {
@Override
public boolean execute(@NotNull PsiElement element, int offsetInElement) {
- final XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
- final String className = tag == null ? null : tag.getAttributeValue("className");
- if (className != null && tag.getLocalName().endsWith("patternClass")) {
- ContainerUtil.addIfNotNull(psiFacade.findClass(className, GlobalSearchScope.allScope(project)), roots);
+ XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
+ String className = tag == null ? null : tag.getAttributeValue("className");
+ if (StringUtil.isNotEmpty(className) && tag.getLocalName().endsWith("patternClass")) {
+ roots.add(className);
}
return true;
}
@@ -159,17 +172,13 @@ public class PatternEditorContextMembersProvider extends NonCodeMembersContribut
CacheManager.SERVICE.getInstance(beanClass.getProject()).processFilesWithWord(new Processor<PsiFile>() {
@Override
public boolean process(PsiFile psiFile) {
- LowLevelSearchUtil
- .processElementsContainingWordInElement(occurenceProcessor, psiFile, searcher, true, new EmptyProgressIndicator());
+ LowLevelSearchUtil.processElementsContainingWordInElement(occurenceProcessor, psiFile, searcher, true,
+ new EmptyProgressIndicator());
return true;
}
}, searcher.getPattern(), UsageSearchContext.IN_FOREIGN_LANGUAGES, scope, searcher.isCaseSensitive());
}
- final Class[] classes = PatternCompilerFactory.getFactory().getPatternClasses(type);
- if (classes.length != 0) {
- roots.add(getRootByClasses(classes, project));
- }
- return roots;
+ return ContainerUtil.newHashSet(roots);
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
index f273be1b3d6e..2db660e1cf04 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerConfigurable.java
@@ -67,7 +67,7 @@ public class GroovyCompilerConfigurable implements SearchableConfigurable, Confi
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
- return super.isFileVisible(file, showHiddenFiles) && !index.isIgnored(file);
+ return super.isFileVisible(file, showHiddenFiles) && !index.isExcluded(file);
}
};
descriptor.setRoots(ContainerUtil.concat(
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java
deleted file mode 100644
index 8d84f9f5b531..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/GroovyCompilerExtension.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2000-2009 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.compiler;
-
-import com.intellij.compiler.impl.javaCompiler.ModuleChunk;
-import com.intellij.util.PathsList;
-import com.intellij.openapi.extensions.ExtensionPointName;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-/**
- * @author peter
- */
-public abstract class GroovyCompilerExtension {
- public static final ExtensionPointName<GroovyCompilerExtension> EP_NAME = ExtensionPointName.create("org.intellij.groovy.compilerExtension");
-
- public abstract void enhanceCompilationClassPath(@NotNull ModuleChunk chunk, @NotNull PathsList classPath);
-
- @NotNull public abstract List<String> getCompilationUnitPatchers(@NotNull ModuleChunk chunk);
-
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java
deleted file mode 100644
index 4c673957c36a..000000000000
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/compiler/generator/TopLevelDependencyValidityState.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2000-2014 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.compiler.generator;
-
-import com.intellij.openapi.compiler.ValidityState;
-import com.intellij.openapi.diagnostic.Logger;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * User: Dmitry.Krasilschikov
- * Date: 20.08.2007
- */
-class TopLevelDependencyValidityState implements ValidityState {
- private final long myTimestamp;
- private final List<String> myMembers; //fields
-
- private static final Logger LOG = Logger.getInstance("org.jetbrains.plugins.groovy.compiler.generator.TopLevelDependencyValidityState");
-
- TopLevelDependencyValidityState(long timestamp, List<String> members) {
-// use signature of method and access modifiers
- this.myMembers = members;
- myTimestamp = timestamp;
- }
-
- @Override
- public boolean equalsTo(ValidityState validityState) {
- if (!(validityState instanceof TopLevelDependencyValidityState)) return false;
-
- return ((TopLevelDependencyValidityState) validityState).myTimestamp == this.myTimestamp
- && myMembers.equals(((TopLevelDependencyValidityState) validityState).myMembers);
- }
-
- @Override
- public void save(DataOutput out) throws IOException {
- out.writeLong(myTimestamp);
- out.writeChar('\n');
-
- for (String member : myMembers) {
- out.writeChar('\n');
- out.writeUTF(member);
- }
- }
-
- public static TopLevelDependencyValidityState load(DataInputStream is) throws IOException {
- long timestamp = -1;
-
- Reader reader = new InputStreamReader(is);
- StreamTokenizer tokenizer = new StreamTokenizer(reader);
-// tokenizer.whitespaceChars(' ', ' ');
-// tokenizer.whitespaceChars('\t', '\t');
-// tokenizer.whitespaceChars('\f', '\f');
-// tokenizer.whitespaceChars('\n', '\n');
-// tokenizer.whitespaceChars('\r', '\r');
-
- List<String> members = new ArrayList<String>();
- while (true) {
- int ttype = tokenizer.nextToken();
- switch (ttype) {
- case StreamTokenizer.TT_NUMBER: {
- try {
- timestamp = (long) tokenizer.nval;
- } catch (NumberFormatException e) {
- LOG.error(e);
- }
- break;
- }
- case StreamTokenizer.TT_WORD: {
- members.add(tokenizer.sval);
- break;
- }
- case StreamTokenizer.TT_EOL:
- break;
- case StreamTokenizer.TT_EOF:
- default:
- break;
- }
- if (ttype == StreamTokenizer.TT_EOF)
- break;
- }
- return new TopLevelDependencyValidityState(timestamp, members);
- }
-}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java
index 34830b9a8988..7b734a4654b5 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerClassFilterProvider.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerClassFilterProvider.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.groovy.debugger.filters;
+package org.jetbrains.plugins.groovy.debugger;
import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.ui.classFilter.DebuggerClassFilterProvider;
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java
index dbadd515c140..273fd4cb8531 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettings.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.groovy.debugger.filters;
+package org.jetbrains.plugins.groovy.debugger;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.xmlb.XmlSerializerUtil;
import com.intellij.xdebugger.settings.XDebuggerSettings;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* @author ilyas
@@ -35,7 +36,6 @@ import org.jetbrains.annotations.NotNull;
)}
)
public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> {
-
public Boolean DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = true;
public boolean ENABLE_GROOVY_HOTSWAP = Registry.is("enable.groovy.hotswap");
@@ -49,6 +49,15 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett
return new GroovyDebuggerSettingsConfigurable(this);
}
+ @Nullable
+ @Override
+ public Configurable createConfigurable(@NotNull Category category) {
+ if (category == Category.STEPPING) {
+ return new GroovySteppingConfigurable();
+ }
+ return null;
+ }
+
@Override
public GroovyDebuggerSettings getState() {
return this;
@@ -62,5 +71,4 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett
public static GroovyDebuggerSettings getInstance() {
return getInstance(GroovyDebuggerSettings.class);
}
-
-}
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form
index a91ac8c1dae7..171170b00571 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.form
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettingsConfigurable">
- <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.GroovyDebuggerSettingsConfigurable">
+ <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="661" height="400"/>
@@ -8,22 +8,14 @@
<properties/>
<border type="none"/>
<children>
- <component id="84a2f" class="javax.swing.JCheckBox" binding="myIgnoreGroovyMethods">
- <constraints>
- <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
- </constraints>
- <properties>
- <text resource-bundle="org/jetbrains/plugins/groovy/GroovyBundle" key="groovy.debug.disable.specific.methods"/>
- </properties>
- </component>
<vspacer id="30909">
<constraints>
- <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="908a2" class="com.intellij.ui.components.JBLabel">
<constraints>
- <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
</constraints>
<properties>
<componentStyle value="SMALL"/>
@@ -33,7 +25,7 @@
<grid id="bd4f0" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="2" left="0" bottom="0" right="0"/>
<constraints>
- <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java
index 4638aca4bdc9..8f143d9a5fd1 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/filters/GroovyDebuggerSettingsConfigurable.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.groovy.debugger.filters;
+package org.jetbrains.plugins.groovy.debugger;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
@@ -29,7 +29,6 @@ import java.awt.event.ActionListener;
* @author ilyas
*/
public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurable {
- private JCheckBox myIgnoreGroovyMethods;
private JPanel myPanel;
private JCheckBox myEnableHotSwap;
private boolean isModified = false;
@@ -37,19 +36,13 @@ public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurabl
public GroovyDebuggerSettingsConfigurable(final GroovyDebuggerSettings settings) {
mySettings = settings;
- final Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
- myIgnoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
- myIgnoreGroovyMethods.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP);
- ActionListener listener = new ActionListener() {
+ myEnableHotSwap.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
- isModified = mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS.booleanValue() != myIgnoreGroovyMethods.isSelected() ||
- mySettings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected();
+ isModified = mySettings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected();
}
- };
- myIgnoreGroovyMethods.addActionListener(listener);
- myEnableHotSwap.addActionListener(listener);
+ });
}
@Override
@@ -59,6 +52,7 @@ public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurabl
}
@Override
+ @NotNull
public String getHelpTopic() {
return "reference.idesettings.debugger.groovy";
}
@@ -87,7 +81,6 @@ public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurabl
@Override
public void apply() throws ConfigurationException {
if (isModified) {
- mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = myIgnoreGroovyMethods.isSelected();
mySettings.ENABLE_GROOVY_HOTSWAP = myEnableHotSwap.isSelected();
}
isModified = false;
@@ -95,8 +88,6 @@ public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurabl
@Override
public void reset() {
- final Boolean flag = mySettings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
- myIgnoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
myEnableHotSwap.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP);
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
index bd0398bf5dd1..95b93362c14d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapper.java
@@ -41,7 +41,6 @@ import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
-import org.jetbrains.plugins.groovy.debugger.filters.GroovyDebuggerSettings;
import java.io.File;
import java.io.IOException;
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java
new file mode 100644
index 000000000000..0e5d99552d47
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java
@@ -0,0 +1,37 @@
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.options.ConfigurableBase;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.GroovyBundle;
+
+class GroovySteppingConfigurable extends ConfigurableBase<GroovySteppingConfigurableUi, GroovyDebuggerSettings> {
+ @Override
+ protected GroovyDebuggerSettings getSettings() {
+ return GroovyDebuggerSettings.getInstance();
+ }
+
+ @Override
+ protected GroovySteppingConfigurableUi createUi() {
+ return new GroovySteppingConfigurableUi();
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return "debugger.stepping.groovy";
+ }
+
+ @Nls
+ @Override
+ public String getDisplayName() {
+ return GroovyBundle.message("groovy.debug.caption");
+ }
+
+ @Nullable
+ @Override
+ public String getHelpTopic() {
+ return "reference.idesettings.debugger.groovy";
+ }
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form
new file mode 100644
index 000000000000..ac93a675fc77
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.form
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.GroovySteppingConfigurableUi">
+ <grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <xy x="20" y="20" width="500" height="400"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="821e8" class="javax.swing.JCheckBox" binding="ignoreGroovyMethods">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text resource-bundle="org/jetbrains/plugins/groovy/GroovyBundle" key="groovy.debug.disable.specific.methods"/>
+ </properties>
+ </component>
+ <vspacer id="209fe">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </vspacer>
+ </children>
+ </grid>
+</form>
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java
new file mode 100644
index 000000000000..d0e9e9e766cb
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurableUi.java
@@ -0,0 +1,33 @@
+package org.jetbrains.plugins.groovy.debugger;
+
+import com.intellij.openapi.options.ConfigurableUi;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+class GroovySteppingConfigurableUi implements ConfigurableUi<GroovyDebuggerSettings> {
+ private JCheckBox ignoreGroovyMethods;
+ private JPanel rootPanel;
+
+ @Override
+ public void reset(@NotNull GroovyDebuggerSettings settings) {
+ Boolean flag = settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS;
+ ignoreGroovyMethods.setSelected(flag == null || flag.booleanValue());
+ }
+
+ @Override
+ public boolean isModified(@NotNull GroovyDebuggerSettings settings) {
+ return settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS.booleanValue() != ignoreGroovyMethods.isSelected();
+ }
+
+ @Override
+ public void apply(@NotNull GroovyDebuggerSettings settings) {
+ settings.DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = ignoreGroovyMethods.isSelected();
+ }
+
+ @NotNull
+ @Override
+ public JComponent getComponent() {
+ return rootPanel;
+ }
+} \ No newline at end of file
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
index e84361b0f57d..2c05dd7a3589 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GrMethodMergingContributor.java
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.lookup.LookupItem;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiType;
-import com.intellij.psi.ResolveResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
@@ -46,13 +45,9 @@ public class GrMethodMergingContributor extends CompletionContributor {
final LookupElement[] items = context.getItems();
if (items.length > 1) {
String commonName = null;
- LookupElement best = null;
final ArrayList<PsiMethod> allMethods = new ArrayList<PsiMethod>();
for (LookupElement item : items) {
- Object o = item.getObject();
- if (o instanceof ResolveResult) {
- o = ((ResolveResult)o).getElement();
- }
+ Object o = item.getPsiElement();
if (item.getUserData(LookupItem.FORCE_SHOW_SIGNATURE_ATTR) != null || !(o instanceof PsiMethod)) {
return AutoCompletionDecision.SHOW_LOOKUP;
}
@@ -76,17 +71,11 @@ public class GrMethodMergingContributor extends CompletionContributor {
return AutoCompletionDecision.SHOW_LOOKUP;
}
- if (best == null && method.getParameterList().getParametersCount() > 0) {
- best = item;
- }
commonName = name;
allMethods.add(method);
item.putUserData(JavaCompletionUtil.ALL_METHODS_ATTRIBUTE, allMethods);
}
- if (best == null) {
- best = items[0];
- }
- return AutoCompletionDecision.insertItem(best);
+ return AutoCompletionDecision.insertItem(JavaMethodMergingContributor.findBestOverload(items));
}
return super.handleAutoCompletionPossibility(context);
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
new file mode 100644
index 000000000000..626983ab635a
--- /dev/null
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/resolve/providers/GroovyReferenceContributor.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 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.lang.resolve.providers;
+
+import com.intellij.patterns.PlatformPatterns;
+import com.intellij.psi.PsiReferenceContributor;
+import com.intellij.psi.PsiReferenceRegistrar;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationNameValuePair;
+import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral;
+import org.jetbrains.plugins.groovy.lang.psi.patterns.GroovyPatterns;
+import org.jetbrains.plugins.groovy.spock.SpockUnrollReferenceProvider;
+
+/**
+ * @author Dmitry.Krasilschikov
+ */
+public class GroovyReferenceContributor extends PsiReferenceContributor {
+ @Override
+ public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
+ registrar.registerReferenceProvider(PlatformPatterns.psiElement(GrLiteral.class), new PropertiesReferenceProvider());
+
+ registrar.registerReferenceProvider(GroovyPatterns.stringLiteral().withParent(GrAnnotationNameValuePair.class),
+ new SpockUnrollReferenceProvider());
+
+ }
+}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
index e21a367eac62..2bfa261f420c 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
@@ -143,9 +143,15 @@ public class MvcModuleStructureUtil {
}
public static void removeSrcFolderFromRoots(final VirtualFile file,
- List<Consumer<ContentEntry>> actions,
- Map<VirtualFile, JpsModuleSourceRootType<?>> sourceRoots) {
- if (sourceRoots.containsKey(file)) {
+ @NotNull List<Consumer<ContentEntry>> actions,
+ @NotNull Map<VirtualFile, JpsModuleSourceRootType<?>> sourceRoots) {
+ removeSrcFolderFromRoots(file, actions, sourceRoots.keySet());
+ }
+
+ public static void removeSrcFolderFromRoots(final VirtualFile file,
+ @NotNull List<Consumer<ContentEntry>> actions,
+ @NotNull Collection<VirtualFile> sourceRoots) {
+ if (sourceRoots.contains(file)) {
actions.add(new Consumer<ContentEntry>() {
@Override
public void consume(ContentEntry contentEntry) {
@@ -163,7 +169,7 @@ public class MvcModuleStructureUtil {
@Nullable
public static Consumer<ModifiableRootModel> addJarDirectory(VirtualFile root, Module module, final String libName) {
final VirtualFile libDir = root.findFileByRelativePath("lib");
- if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isIgnored(libDir)) {
+ if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isExcluded(libDir)) {
return null;
}
@@ -350,16 +356,17 @@ public class MvcModuleStructureUtil {
private static void removeInvalidSourceRoots(List<Consumer<ModifiableRootModel>> actions, MvcProjectStructure structure) {
final Set<SourceFolder> toRemove = ContainerUtil.newTroveSet();
- final Set<ContentEntry> toRemoveContent = ContainerUtil.newTroveSet();
+ final Set<String> toRemoveContent = ContainerUtil.newTroveSet();
for (ContentEntry entry : ModuleRootManager.getInstance(structure.myModule).getContentEntries()) {
final VirtualFile file = entry.getFile();
if (file == null || !structure.isValidContentRoot(file)) {
- toRemoveContent.add(entry);
+ toRemoveContent.add(entry.getUrl());
}
-
- for (SourceFolder folder : entry.getSourceFolders()) {
- if (folder.getFile() == null) {
- toRemove.add(folder);
+ else {
+ for (SourceFolder folder : entry.getSourceFolders()) {
+ if (folder.getFile() == null) {
+ toRemove.add(folder);
+ }
}
}
}
@@ -368,14 +375,15 @@ public class MvcModuleStructureUtil {
actions.add(new Consumer<ModifiableRootModel>() {
@Override
public void consume(ModifiableRootModel model) {
- for (final ContentEntry entry : toRemoveContent) {
- model.removeContentEntry(entry);
- }
-
for (ContentEntry entry : model.getContentEntries()) {
- for (SourceFolder folder : entry.getSourceFolders()) {
- if (toRemove.remove(folder)) {
- entry.removeSourceFolder(folder);
+ if (toRemoveContent.remove(entry.getUrl())) {
+ model.removeContentEntry(entry);
+ }
+ else {
+ for (SourceFolder folder : entry.getSourceFolders()) {
+ if (toRemove.remove(folder)) {
+ entry.removeSourceFolder(folder);
+ }
}
}
}