diff options
Diffstat (limited to 'plugins/groovy/src/org/jetbrains')
14 files changed, 186 insertions, 198 deletions
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); + } } } } |