diff options
Diffstat (limited to 'plugins/groovy/src/org/jetbrains/plugins/groovy')
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java | 43 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java | 97 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.form (renamed from plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form) | 3 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.java | 50 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java | 37 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyReferenceCopyPasteProcessor.java | 2 | ||||
-rw-r--r-- | plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java | 6 |
7 files changed, 84 insertions, 154 deletions
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java index 273fd4cb8531..c2538426a871 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettings.java @@ -19,23 +19,31 @@ import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.components.StoragePathMacros; import com.intellij.openapi.options.Configurable; +import com.intellij.openapi.options.SimpleConfigurable; +import com.intellij.openapi.util.Getter; import com.intellij.openapi.util.registry.Registry; import com.intellij.util.xmlb.XmlSerializerUtil; +import com.intellij.xdebugger.settings.DebuggerSettingsCategory; import com.intellij.xdebugger.settings.XDebuggerSettings; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.plugins.groovy.GroovyBundle; + +import java.util.Collection; +import java.util.Collections; + +import static java.util.Collections.singletonList; /** * @author ilyas */ @State( - name = "GroovyDebuggerSettings", - storages = { + name = "GroovyDebuggerSettings", + storages = { @Storage( - file = StoragePathMacros.APP_CONFIG + "/groovy_debug.xml" + file = StoragePathMacros.APP_CONFIG + "/groovy_debug.xml" )} ) -public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> { +public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSettings> implements Getter<GroovyDebuggerSettings> { public Boolean DEBUG_DISABLE_SPECIFIC_GROOVY_METHODS = true; public boolean ENABLE_GROOVY_HOTSWAP = Registry.is("enable.groovy.hotswap"); @@ -43,19 +51,19 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett super("groovy_debugger"); } - @Override @NotNull - public Configurable createConfigurable() { - return new GroovyDebuggerSettingsConfigurable(this); - } - - @Nullable + @SuppressWarnings("EnumSwitchStatementWhichMissesCases") @Override - public Configurable createConfigurable(@NotNull Category category) { - if (category == Category.STEPPING) { - return new GroovySteppingConfigurable(); + public Collection<? extends Configurable> createConfigurables(@NotNull DebuggerSettingsCategory category) { + switch (category) { + case STEPPING: + return singletonList(SimpleConfigurable.create("reference.idesettings.debugger.groovy", GroovyBundle.message("groovy.debug.caption"), + "reference.idesettings.debugger.groovy", GroovySteppingConfigurableUi.class, this)); + case HOTSWAP: + return singletonList(SimpleConfigurable.create("reference.idesettings.debugger.groovy", GroovyBundle.message("groovy.debug.caption"), + "reference.idesettings.debugger.groovy", GroovyHotSwapConfigurableUi.class, this)); } - return null; + return Collections.emptyList(); } @Override @@ -71,4 +79,9 @@ public class GroovyDebuggerSettings extends XDebuggerSettings<GroovyDebuggerSett public static GroovyDebuggerSettings getInstance() { return getInstance(GroovyDebuggerSettings.class); } + + @Override + public GroovyDebuggerSettings get() { + return this; + } }
\ No newline at end of file diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java deleted file mode 100644 index 8f143d9a5fd1..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.java +++ /dev/null @@ -1,97 +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.debugger; - -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.groovy.GroovyBundle; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * @author ilyas - */ -public class GroovyDebuggerSettingsConfigurable implements SearchableConfigurable { - private JPanel myPanel; - private JCheckBox myEnableHotSwap; - private boolean isModified = false; - private final GroovyDebuggerSettings mySettings; - - public GroovyDebuggerSettingsConfigurable(final GroovyDebuggerSettings settings) { - mySettings = settings; - - myEnableHotSwap.addActionListener(new ActionListener() { - @Override - public void actionPerformed(final ActionEvent e) { - isModified = mySettings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected(); - } - }); - } - - @Override - @Nls - public String getDisplayName() { - return GroovyBundle.message("groovy.debug.caption"); - } - - @Override - @NotNull - public String getHelpTopic() { - return "reference.idesettings.debugger.groovy"; - } - - @Override - @NotNull - public String getId() { - return getHelpTopic(); - } - - @Override - public Runnable enableSearch(String option) { - return null; - } - - @Override - public JComponent createComponent() { - return myPanel; - } - - @Override - public boolean isModified() { - return isModified; - } - - @Override - public void apply() throws ConfigurationException { - if (isModified) { - mySettings.ENABLE_GROOVY_HOTSWAP = myEnableHotSwap.isSelected(); - } - isModified = false; - } - - @Override - public void reset() { - myEnableHotSwap.setSelected(mySettings.ENABLE_GROOVY_HOTSWAP); - } - - @Override - public void disposeUIResources() { - } -} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.form index 171170b00571..cbe2154a9d31 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyDebuggerSettingsConfigurable.form +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.form @@ -1,5 +1,5 @@ <?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.GroovyDebuggerSettingsConfigurable"> +<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.plugins.groovy.debugger.GroovyHotSwapConfigurableUi"> <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> @@ -19,6 +19,7 @@ </constraints> <properties> <componentStyle value="SMALL"/> + <fontColor value="BRIGHTER"/> <text value="May cause serialization issues in the debugged application"/> </properties> </component> diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.java new file mode 100644 index 000000000000..400d344bb156 --- /dev/null +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyHotSwapConfigurableUi.java @@ -0,0 +1,50 @@ +/* + * 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.debugger; + +import com.intellij.openapi.options.ConfigurableUi; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; + +/** + * @author ilyas + */ +class GroovyHotSwapConfigurableUi implements ConfigurableUi<GroovyDebuggerSettings> { + private JPanel myPanel; + private JCheckBox myEnableHotSwap; + + @NotNull + @Override + public JComponent getComponent() { + return myPanel; + } + + @Override + public boolean isModified(@NotNull GroovyDebuggerSettings settings) { + return settings.ENABLE_GROOVY_HOTSWAP != myEnableHotSwap.isSelected(); + } + + @Override + public void apply(@NotNull GroovyDebuggerSettings settings) { + settings.ENABLE_GROOVY_HOTSWAP = myEnableHotSwap.isSelected(); + } + + @Override + public void reset(@NotNull GroovyDebuggerSettings settings) { + myEnableHotSwap.setSelected(settings.ENABLE_GROOVY_HOTSWAP); + } +} diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java deleted file mode 100644 index 0e5d99552d47..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovySteppingConfigurable.java +++ /dev/null @@ -1,37 +0,0 @@ -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/editor/GroovyReferenceCopyPasteProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyReferenceCopyPasteProcessor.java index 63784b58f298..d4b67e1540bf 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyReferenceCopyPasteProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/editor/GroovyReferenceCopyPasteProcessor.java @@ -97,7 +97,7 @@ public class GroovyReferenceCopyPasteProcessor extends CopyPasteReferenceProcess } else { if (reference instanceof GrReferenceExpression) { - PsiElement referent = reference.resolve(); + PsiElement referent = resolveReferenceIgnoreOverriding(reference); if (!(referent instanceof PsiNamedElement) || !data.staticMemberName.equals(((PsiNamedElement)referent).getName()) || !(referent instanceof PsiMember) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java index 84b96c39fd78..19649574c2bc 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java @@ -23,7 +23,6 @@ import com.intellij.ide.util.projectWizard.ModuleWizardStep; import com.intellij.ide.util.projectWizard.WizardContext; import com.intellij.ide.wizard.CommitStepException; import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModifiableRootModel; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer; @@ -51,8 +50,9 @@ public abstract class GroovySdkWizardStepBase extends ModuleWizardStep { public GroovySdkWizardStepBase(@Nullable final MvcFramework framework, WizardContext wizardContext, String basePath) { myBasePath = basePath; - final Project project = wizardContext.getProject(); - myLibrariesContainer = LibrariesContainerFactory.createContainer(project); + myLibrariesContainer = wizardContext.getModulesProvider() == null + ? LibrariesContainerFactory.createContainer(wizardContext.getProject()) + : LibrariesContainerFactory.createContainer(wizardContext, wizardContext.getModulesProvider()); myFramework = framework; } |