diff --git a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java index 2b909ea2def4..b4f1acaf96d7 100644 --- a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java +++ b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java @@ -21,7 +21,10 @@ import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.process.ProcessAdapter; import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.runners.ExecutionEnvironment; -import com.intellij.execution.testframework.*; +import com.intellij.execution.testframework.JavaTestLocationProvider; +import com.intellij.execution.testframework.SearchForTestsTask; +import com.intellij.execution.testframework.TestConsoleProperties; +import com.intellij.execution.testframework.TestFrameworkRunningModel; import com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction; import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties; @@ -84,7 +87,7 @@ public abstract class JavaTestFrameworkRunnableState & CommonJavaRunConfigurationParameters> extends SMTRunnerConsoleProperties { public JavaAwareTestConsoleProperties(final String testFrameworkName, RunConfiguration configuration, Executor executor) { super(configuration, testFrameworkName, executor, false); } @@ -42,6 +43,16 @@ public abstract class JavaAwareTestConsoleProperties extends SMTRunnerConsolePro return debuggerSession != null && debuggerSession.isPaused(); } + @Override + public T getConfiguration() { + return (T)super.getConfiguration(); + } + + @Override + public boolean fixEmptySuite() { + return ResetConfigurationModuleAdapter.tryWithAnotherModule(getConfiguration(), isDebug()); + } + @Nullable public DebuggerSession getDebugSession() { final DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(getProject()); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java index 5435422a5383..68a74f887f3f 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java @@ -767,8 +767,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool { private static class ReplaceOptionalOfWithOfNullableFix implements LocalQuickFix { - public static final String GUAVA_OPTIONAL = "com.google.common.base.Optional"; - public static final String JAVA_OPTIONAL = "java.util.Optional"; + private static final String GUAVA_OPTIONAL = "com.google.common.base.Optional"; private final String myTargetMethodName; public ReplaceOptionalOfWithOfNullableFix(final String targetMethodName) { @@ -785,7 +784,7 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool { final PsiClass containingClass = method.getContainingClass(); if ("of".equals(method.getName()) && containingClass != null) { final String qualifiedName = containingClass.getQualifiedName(); - if (JAVA_OPTIONAL.equals(qualifiedName)) { + if (CommonClassNames.JAVA_UTIL_OPTIONAL.equals(qualifiedName)) { return new ReplaceOptionalOfWithOfNullableFix("ofNullable"); } else if (GUAVA_OPTIONAL.equals(qualifiedName)) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java index d62907af849e..4c99fbdcc9ab 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java @@ -15,7 +15,6 @@ */ package com.intellij.codeInsight.completion.scope; -import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.codeInsight.completion.CompletionUtil; import com.intellij.codeInsight.daemon.ImplicitUsageProvider; import com.intellij.codeInspection.SuppressManager; @@ -94,9 +93,6 @@ public class JavaCompletionProcessor extends BaseScopeProcessor implements Eleme scope = scope.getContext(); } myScope = scope; - if (!(element.getContainingFile() instanceof PsiJavaFile)) { - myMembersFlag = true; - } PsiElement elementParent = element.getContext(); if (elementParent instanceof PsiReferenceExpression) { @@ -131,7 +127,7 @@ public class JavaCompletionProcessor extends BaseScopeProcessor implements Eleme myNonInitializedFields.addAll(getNonInitializedFields(element)); } - myAllowStaticWithInstanceQualifier = !options.filterStaticAfterInstance || CodeInsightSettings.getInstance().SHOW_STATIC_AFTER_INSTANCE || + myAllowStaticWithInstanceQualifier = !options.filterStaticAfterInstance || SuppressManager.getInstance() .isSuppressedFor(element, AccessStaticViaInstanceBase.ACCESS_STATIC_VIA_INSTANCE); diff --git a/java/java-psi-api/src/com/intellij/codeInsight/JavaCodeInsightSettingsFacade.java b/java/java-psi-api/src/com/intellij/codeInsight/JavaCodeInsightSettingsFacade.java index 42178ffd10b2..7021f152bda1 100644 --- a/java/java-psi-api/src/com/intellij/codeInsight/JavaCodeInsightSettingsFacade.java +++ b/java/java-psi-api/src/com/intellij/codeInsight/JavaCodeInsightSettingsFacade.java @@ -19,6 +19,8 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.project.Project; public abstract class JavaCodeInsightSettingsFacade { + /** todo remove in IDEA 16 */ + @Deprecated public abstract boolean isShowStaticAfterInstance(); public static JavaCodeInsightSettingsFacade getInstance(Project project) { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/DotCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/DotCompletionTest.java index e15953db7fb5..9b5bde7ae7b8 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/DotCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/DotCompletionTest.java @@ -16,7 +16,6 @@ package com.intellij.codeInsight.completion; import com.intellij.JavaTestUtil; -import com.intellij.codeInsight.CodeInsightSettings; import org.jetbrains.annotations.NotNull; /** @@ -49,18 +48,10 @@ public class DotCompletionTest extends LightCompletionTestCase { } public void testShowStatic() throws Exception { - CodeInsightSettings settings = CodeInsightSettings.getInstance(); - boolean oldSetting = settings.SHOW_STATIC_AFTER_INSTANCE; - settings.SHOW_STATIC_AFTER_INSTANCE = false; - try { - configureByFile("Dot4.java"); - assertEquals("", myPrefix); - assertContainsItems("foo"); - assertNotContainItems("a"); - } - finally { - settings.SHOW_STATIC_AFTER_INSTANCE = oldSetting; - } + configureByFile("Dot4.java"); + assertEquals("", myPrefix); + assertContainsItems("foo"); + assertNotContainItems("a"); } public void testImports() throws Exception { diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy index 8af7639f2826..4a5a6d0db3ea 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/FragmentCompletionTest.groovy @@ -118,5 +118,16 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.checkResult("map.entrySet()"); } + public void "test no static after instance in expression fragment"() { + def ctxFile = myFixture.addClass("package foo; public class Class {{\n int a = 2; }}").containingFile + def context = ctxFile.findElementAt(ctxFile.text.indexOf('int')) + + def text = "Double.valueOf(2).v" + PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment(text, context, null, true); + myFixture.configureFromExistingVirtualFile(file.getVirtualFile()); + myFixture.completeBasic() + assert !myFixture.lookupElementStrings.contains('valueOf') + } + } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy index 5f5870b2d34c..9e51e2a5d79a 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy @@ -1099,24 +1099,17 @@ public class ListUtils { } public void testSuggestMembersOfStaticallyImportedClassesUnqualifiedOnly() throws Exception { - def old = CodeInsightSettings.instance.SHOW_STATIC_AFTER_INSTANCE - CodeInsightSettings.instance.SHOW_STATIC_AFTER_INSTANCE = true - - try { - myFixture.addClass("""package foo; - public class Foo { - public static void foo() {} - public static void bar() {} - } - """) - configure() - assertOneElement(myFixture.getLookupElements()) - myFixture.type '\t' - checkResult() - } - finally { - CodeInsightSettings.instance.SHOW_STATIC_AFTER_INSTANCE = old + myFixture.addClass("""package foo; + public class Foo { + public static void foo() {} + public static void bar() {} } + """) + configure() + complete() + assertOneElement(myFixture.getLookupElements()) + myFixture.type '\t' + checkResult() } public void testInstanceMagicMethod() throws Exception { doTest() } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java index 22ed4e891375..5708b69d4bfb 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SecondSmartTypeCompletionTest.java @@ -1,7 +1,6 @@ package com.intellij.codeInsight.completion; import com.intellij.JavaTestUtil; -import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.codeInsight.lookup.LookupElementDecorator; import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.lookup.LookupItem; @@ -143,16 +142,7 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas public void testCastInstanceofedQualifier() throws Throwable { doTest(); } - public void testNoLeftRecursion() throws Throwable { - final boolean old = CodeInsightSettings.getInstance().SHOW_STATIC_AFTER_INSTANCE; - CodeInsightSettings.getInstance().SHOW_STATIC_AFTER_INSTANCE = true; - try { - doAntiTest(); - } - finally { - CodeInsightSettings.getInstance().SHOW_STATIC_AFTER_INSTANCE = old; - } - } + public void testNoLeftRecursion() { doAntiTest(); } public void testNoRedundantCasts() throws Throwable { configure(); diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java index 73aec7c9cf20..a857f612cb5e 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java @@ -240,19 +240,20 @@ public abstract class DiffRequestProcessor implements Disposable { // Abstract // - @Nullable private ApplyData myApplyData; + @Nullable private ApplyData myQueuedApplyRequest; @CalledInAwt protected void applyRequest(@NotNull DiffRequest request, boolean force, @Nullable ScrollToPolicy scrollToChangePolicy) { myIterationState = IterationState.NONE; - myApplyData = new ApplyData(request, force || (myApplyData != null && myApplyData.force), scrollToChangePolicy); - IdRunnable task = new IdRunnable(this) { + force = force || (myQueuedApplyRequest != null && myQueuedApplyRequest.force); + myQueuedApplyRequest = new ApplyData(request, force, scrollToChangePolicy); + Runnable task = new Runnable() { @Override public void run() { - if (myApplyData == null || myDisposed) return; - doApplyRequest(myApplyData.request, myApplyData.force, myApplyData.scrollToChangePolicy); - myApplyData = null; + if (myQueuedApplyRequest == null || myDisposed) return; + doApplyRequest(myQueuedApplyRequest.request, myQueuedApplyRequest.force, myQueuedApplyRequest.scrollToChangePolicy); + myQueuedApplyRequest = null; } }; diff --git a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffViewer.java index c302171a4832..4ef791fc1d6d 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/fragmented/OnesideDiffViewer.java @@ -629,7 +629,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase { assert next != null; - DiffUtil.scrollToLineAnimated(myEditor, next.getLine1()); + DiffUtil.scrollEditor(myEditor, next.getLine1(), true); } @Override @@ -661,7 +661,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase { if (prev == null) prev = diffChanges.get(diffChanges.size() - 1); - DiffUtil.scrollToLineAnimated(myEditor, prev.getLine1()); + DiffUtil.scrollEditor(myEditor, prev.getLine1(), true); } } @@ -1006,7 +1006,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase { DiffUtil.scrollToPoint(myEditor, myEditorPosition.myPoints[0]); } else { - DiffUtil.scrollToCaret(myEditor); + DiffUtil.scrollToCaret(myEditor, false); } myShouldScroll = false; } @@ -1024,7 +1024,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase { private boolean doScrollToLine(@NotNull Side side, @NotNull LogicalPosition position) { int onesideLine = transferLineToOneside(side, position.line); - DiffUtil.scrollEditor(myEditor, onesideLine, position.column); + DiffUtil.scrollEditor(myEditor, onesideLine, position.column, false); return true; } @@ -1045,7 +1045,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase { throw new IllegalArgumentException(scrollToChangePolicy.name()); } - DiffUtil.scrollEditor(myEditor, targetChange.getLine1()); + DiffUtil.scrollEditor(myEditor, targetChange.getLine1(), false); return true; } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java index 97b302c7ad69..761a7ce8467f 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java @@ -392,6 +392,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { @Override protected boolean doScrollToChange(@NotNull ScrollToPolicy scrollToPolicy) { if (myDiffChanges.isEmpty()) return false; + if (myEditor1 == null || myEditor2 == null) return true; SimpleDiffChange targetChange; switch (scrollToPolicy) { @@ -405,13 +406,19 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { throw new IllegalArgumentException(scrollToPolicy.name()); } - EditorEx editor = getCurrentEditor(); - int line = targetChange.getStartLine(getCurrentSide()); - DiffUtil.scrollEditor(editor, line); + doScrollToChange(targetChange, false); return true; } + private void doScrollToChange(@NotNull SimpleDiffChange change, boolean animated) { + if (myEditor1 == null || myEditor2 == null) return; + + EditorEx editor = getCurrentEditor(); + int line = change.getStartLine(getCurrentSide()); + DiffUtil.scrollEditor(editor, line, animated); + } + @Override protected boolean doScrollToContext(@NotNull DiffNavigationContext context) { if (myEditor2 == null) return false; @@ -522,8 +529,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { } assert next != null; - - DiffUtil.scrollToLineAnimated(editor, next.getStartLine(getCurrentSide())); + doScrollToChange(next, true); } @Override @@ -559,8 +565,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { } assert prev != null; - - DiffUtil.scrollToLineAnimated(editor, prev.getStartLine(getCurrentSide())); + doScrollToChange(prev, true); } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java index 3ca25bd7ab2e..64e54c98258b 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleThreesideDiffViewer.java @@ -340,13 +340,17 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer { throw new IllegalArgumentException(scrollToPolicy.name()); } - EditorEx editor = getCurrentEditor(); - int line = targetChange.getStartLine(getCurrentSide()); - DiffUtil.scrollEditor(editor, line); + doScrollToChange(targetChange, false); return true; } + private void doScrollToChange(@NotNull SimpleThreesideDiffChange change, boolean animated) { + EditorEx editor = getCurrentEditor(); + int line = change.getStartLine(getCurrentSide()); + DiffUtil.scrollEditor(editor, line, animated); + } + @NotNull private IgnorePolicy getIgnorePolicy() { IgnorePolicy policy = getTextSettings().getIgnorePolicy(); @@ -427,8 +431,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer { } assert next != null; - - DiffUtil.scrollToLineAnimated(editor, getCurrentStartLine(next)); + doScrollToChange(next, true); } @Override @@ -464,8 +467,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer { } assert prev != null; - - DiffUtil.scrollToLineAnimated(editor, getCurrentStartLine(prev)); + doScrollToChange(prev, true); } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/threeside/ThreesideTextDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/util/threeside/ThreesideTextDiffViewer.java index 076134271e1d..f64ae039f871 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/threeside/ThreesideTextDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/threeside/ThreesideTextDiffViewer.java @@ -90,7 +90,9 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase { super(context, request); List contents = myRequest.getContents(); - myActualContents = ContainerUtil.newArrayList((DocumentContent)contents.get(0), (DocumentContent)contents.get(1), (DocumentContent)contents.get(2)); + myActualContents = ContainerUtil.newArrayList((DocumentContent)contents.get(0), + (DocumentContent)contents.get(1), + (DocumentContent)contents.get(2)); myEditors = createEditors(); @@ -285,7 +287,7 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase { @CalledInAwt protected void scrollToLine(@NotNull ThreeSide side, int line) { Editor editor = side.select(myEditors); - DiffUtil.scrollEditor(editor, line); + DiffUtil.scrollEditor(editor, line, false); myCurrentSide = side; } @@ -515,7 +517,7 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase { } } else { - DiffUtil.scrollToCaret(getCurrentEditor()); + DiffUtil.scrollToCaret(getCurrentEditor(), false); } return true; } @@ -527,7 +529,7 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase { if (side.select(myEditors) == null) return false; myCurrentSide = side; - DiffUtil.scrollEditor(getCurrentEditor(), line); + DiffUtil.scrollEditor(getCurrentEditor(), line, false); return true; } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/util/twoside/TwosideTextDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/util/twoside/TwosideTextDiffViewer.java index f9677539376a..cc81f9d39742 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/util/twoside/TwosideTextDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/util/twoside/TwosideTextDiffViewer.java @@ -334,7 +334,7 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase { protected void scrollToLine(@NotNull Side side, int line) { Editor editor = side.select(myEditor1, myEditor2); if (editor == null) return; - DiffUtil.scrollEditor(editor, line); + DiffUtil.scrollEditor(editor, line, false); myCurrentSide = side; } @@ -569,7 +569,7 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase { } } else { - DiffUtil.scrollToCaret(getCurrentEditor()); + DiffUtil.scrollToCaret(getCurrentEditor(), false); } return true; } @@ -581,7 +581,7 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase { if (side.select(myEditor1, myEditor2) == null) return false; myCurrentSide = side; - DiffUtil.scrollEditor(getCurrentEditor(), line); + DiffUtil.scrollEditor(getCurrentEditor(), line, false); return true; } } diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index 290d7833903f..b2af70e18c92 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -191,27 +191,15 @@ public class DiffUtil { // Scrolling // - public static void scrollEditor(@Nullable final Editor editor, int line) { - scrollEditor(editor, line, 0); + public static void scrollEditor(@Nullable final Editor editor, int line, boolean animated) { + scrollEditor(editor, line, 0, animated); } - public static void scrollEditor(@Nullable final Editor editor, int line, int column) { - scrollEditor(editor, new LogicalPosition(line, column)); - } - - public static void scrollEditor(@Nullable final Editor editor, @NotNull LogicalPosition position) { + public static void scrollEditor(@Nullable final Editor editor, int line, int column, boolean animated) { if (editor == null) return; editor.getCaretModel().removeSecondaryCarets(); - editor.getCaretModel().moveToLogicalPosition(position); - scrollToCaret(editor); - } - - public static void scrollToLineAnimated(@Nullable final Editor editor, int line) { - if (editor == null) return; - editor.getCaretModel().removeSecondaryCarets(); - editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(line, 0)); - ScrollingModel scrollingModel = editor.getScrollingModel(); - scrollingModel.scrollToCaret(ScrollType.CENTER); + editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(line, column)); + scrollToCaret(editor, animated); } public static void scrollToPoint(@Nullable Editor editor, @NotNull Point point) { @@ -222,11 +210,11 @@ public class DiffUtil { editor.getScrollingModel().enableAnimation(); } - public static void scrollToCaret(@Nullable Editor editor) { + public static void scrollToCaret(@Nullable Editor editor, boolean animated) { if (editor == null) return; - editor.getScrollingModel().disableAnimation(); + if (!animated) editor.getScrollingModel().disableAnimation(); editor.getScrollingModel().scrollToCaret(ScrollType.CENTER); - editor.getScrollingModel().enableAnimation(); + if (!animated) editor.getScrollingModel().enableAnimation(); } @NotNull diff --git a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java index 7a5ceb8ef1d0..dc353cf3abf1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java @@ -74,8 +74,14 @@ public class CodeInsightSettings implements PersistentStateComponent, C public boolean SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false; public boolean AUTOCOMPLETE_ON_CODE_COMPLETION = true; public boolean AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = true; + + /** todo remove in IDEA 16 */ @Deprecated public boolean AUTOCOMPLETE_ON_CLASS_NAME_COMPLETION = false; + public boolean AUTOCOMPLETE_COMMON_PREFIX = true; + + /** todo remove in IDEA 16 */ + @Deprecated public boolean SHOW_STATIC_AFTER_INSTANCE = false; public boolean SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO = false; diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java index 5fed8076f49f..6d5befb3f6d9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java @@ -214,8 +214,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra @Deprecated public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper,final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) { - this(wrapper, owner, canBeParent, - applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT); + this(wrapper, owner, canBeParent, applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT); } @Override @@ -302,6 +301,10 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra } } + private boolean isProgressDialog() { + return myWrapper.isModalProgress(); + } + @Override @Nullable public Container getContentPane() { @@ -449,7 +452,9 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra ApplicationManager.getApplication() != null ? (CommandProcessorEx)CommandProcessor.getInstance() : null; final boolean appStarted = commandProcessor != null; - if (myDialog.isModal() && appStarted) { + boolean changeModalityState = appStarted && myDialog.isModal() + && !isProgressDialog(); // ProgressWindow starts a modality state itself + if (changeModalityState) { commandProcessor.enterModal(); LaterInvocator.enterModal(myDialog); } @@ -462,7 +467,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra myDialog.show(); } finally { - if (myDialog.isModal() && appStarted) { + if (changeModalityState) { commandProcessor.leaveModal(); LaterInvocator.leaveModal(myDialog); } diff --git a/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties b/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties index 51a4ef7ed62d..43a78f4263a2 100644 --- a/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties +++ b/platform/platform-resources-en/src/messages/SMTestsRunnerBundle.properties @@ -46,13 +46,4 @@ sm.test.runner.magnitude.assertion.failed.title=Assertion failed sm.test.runner.magnitude.testerror.title=Error sm.test.runner.states.suite.is.empty=Empty test suite. -sm.test.runner.states.test.is.ignored=Test ignored. - -sm.test.runner.notifications.tests.passed=Tests passed -sm.test.runner.notifications.tests.passed.with.errors=Tests passed with errors -sm.test.runner.notifications.tests.failed=Tests failed -sm.test.runner.notifications.tests.failed.with.errors=Tests failed with errors -sm.test.runner.notifications.tests.skipped=Tests skipped -sm.test.runner.notifications.tests.skipped.with.errors=Tests skipped with errors -sm.test.runner.notifications.tests.not.run=Tests were not started -sm.test.runner.notifications.tests.not.run.with.errors=Tests were not started with errors. Errors occurred +sm.test.runner.states.test.is.ignored=Test ignored. \ No newline at end of file diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java index dcc23d09d43e..b3be04b6ddfd 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerConsoleProperties.java @@ -161,4 +161,8 @@ public class SMTRunnerConsoleProperties extends TestConsoleProperties implements return new OpenFileDescriptor(project, file, offset); } + + public boolean fixEmptySuite() { + return false; + } } diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java index 7b4a539a4721..d29f3bd81b05 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java @@ -16,135 +16,33 @@ package com.intellij.execution.testframework.sm.runner.ui; import com.intellij.execution.testframework.TestConsoleProperties; -import com.intellij.execution.testframework.TestStatusListener; import com.intellij.execution.testframework.TestsUIUtil; -import com.intellij.execution.testframework.sm.SMTestsRunnerBundle; +import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties; import com.intellij.execution.testframework.sm.runner.SMTRunnerEventsAdapter; import com.intellij.execution.testframework.sm.runner.SMTestProxy; -import com.intellij.execution.testframework.sm.runner.states.TestStateInfo; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.MessageType; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.wm.ToolWindowId; -import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.ui.SystemNotifications; import org.jetbrains.annotations.NotNull; -import javax.swing.*; - /** * @author Roman Chernyatchik */ public class SMTRunnerNotificationsHandler extends SMTRunnerEventsAdapter { private final TestConsoleProperties myConsoleProperties; - //private boolean myFirstDefectWasFound; + private boolean myStarted = false; public SMTRunnerNotificationsHandler(@NotNull final TestConsoleProperties consoleProperties) { myConsoleProperties = consoleProperties; } public void onTestingStarted(@NotNull SMTestProxy.SMRootTestProxy testsRoot) { - //myFirstDefectWasFound = false; + myStarted = true; } public void onTestingFinished(@NotNull SMTestProxy.SMRootTestProxy testsRoot) { - final String msg; - final MessageType type; - - final TestStateInfo.Magnitude magnitude = testsRoot.getMagnitudeInfo(); - //noinspection EnumSwitchStatementWhichMissesCases - switch (magnitude) { - case SKIPPED_INDEX: - case IGNORED_INDEX: - msg = testsRoot.hasErrors() ? SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.skipped.with.errors") - : SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.skipped"); - - type = MessageType.WARNING; - break; - - case NOT_RUN_INDEX: - msg = testsRoot.hasErrors() ? SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.not.run.with.errors") - : SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.not.run"); - type = MessageType.WARNING; - break; - - case FAILED_INDEX: - case ERROR_INDEX: - msg = testsRoot.hasErrors() ? SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.failed.with.errors") - : SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.failed"); - type = MessageType.ERROR; - break; - case COMPLETE_INDEX: - if (testsRoot.getChildren().size() == 0 && !testsRoot.isLeaf()) { - msg = testsRoot.hasErrors() ? SMTestsRunnerBundle.message("sm.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found.with.errors") - : testsRoot.isTestsReporterAttached() - ? SMTestsRunnerBundle.message("sm.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found") - : SMTestsRunnerBundle.message("sm.test.runner.ui.tests.tree.presentation.labels.test.reporter.not.attached"); - type = MessageType.ERROR; - break; - } else if (testsRoot.isEmptySuite()) { - msg = SMTestsRunnerBundle.message("sm.test.runner.ui.tests.tree.presentation.labels.empty.test.suite"); - type = MessageType.WARNING; - break; - } - // else same as: PASSED_INDEX - case PASSED_INDEX: - msg = testsRoot.hasErrors() ? SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.passed.with.errors") - : SMTestsRunnerBundle.message("sm.test.runner.notifications.tests.passed"); - type = MessageType.INFO; - break; - - default: - msg = null; - type = null; + if (testsRoot.isEmptySuite() && + myConsoleProperties instanceof SMTRunnerConsoleProperties && + ((SMTRunnerConsoleProperties)myConsoleProperties).fixEmptySuite()) { + return; } - - TestStatusListener.notifySuiteFinished(testsRoot, myConsoleProperties.getProject()); - - if (msg != null) { - notify(msg, type, testsRoot); - } - } - - public void onTestFailed(@NotNull SMTestProxy test) { - // TODO : if user doesn't close this balloon then user will not see 'tests failed' balloon - //if (!myFirstDefectWasFound) { - // // notify about defect on the fly - // if (test.isDefect()) { - // final TestStateInfo.Magnitude magnitude = test.getMagnitudeInfo(); - // //noinspection EnumSwitchStatementWhichMissesCases - // switch (magnitude) { - // case FAILED_INDEX: - // case ERROR_INDEX: - // myFirstDefectWasFound = true; - // notify("Tests will fail", MessageType.WARNING); - // break; - // default: - // // Do nothing - // } - // } - //} - } - - private void notify(final String msg, final MessageType type, final SMTestProxy.SMRootTestProxy testsRoot) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - final Project project = myConsoleProperties.getProject(); - if ( project.isDisposed()) { - return; - } - - if (myConsoleProperties == null) { - return; - } - final String testRunDebugId = myConsoleProperties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; - final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); - if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { - toolWindowManager.notifyByBalloon(testRunDebugId, type, msg, null, null); - } - TestsUIUtil.NOTIFICATION_GROUP.createNotification(msg, type).notify(project); - SystemNotifications.getInstance().notify("TestRunner", msg, TestsUIUtil.getTestShortSummary(testsRoot)); - } - }); + TestsUIUtil.notifyByBalloon(myConsoleProperties.getProject(), myStarted, testsRoot, myConsoleProperties, null); } } \ No newline at end of file diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java index 4a75ec6fb7fe..550614e82a05 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTestRunnerResultsForm.java @@ -273,7 +273,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel @Override public void onSuiteTreeNodeAdded(SMTestProxy testProxy) { - updateOnTestStarted(false); + myTotalTestCount++; _addTestOrSuite(testProxy); } diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestStatusListener.java b/platform/testRunner/src/com/intellij/execution/testframework/TestStatusListener.java index 08130de9b495..06a1bf5e4122 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestStatusListener.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestStatusListener.java @@ -18,13 +18,14 @@ package com.intellij.execution.testframework; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.Nullable; public abstract class TestStatusListener { public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.testStatusListener"); - public abstract void testSuiteFinished(AbstractTestProxy root); + public abstract void testSuiteFinished(@Nullable AbstractTestProxy root); - public void testSuiteFinished(AbstractTestProxy root, Project project) { + public void testSuiteFinished(@Nullable AbstractTestProxy root, Project project) { testSuiteFinished(root); } @@ -36,7 +37,7 @@ public abstract class TestStatusListener { } } - public static void notifySuiteFinished(AbstractTestProxy root, Project project) { + public static void notifySuiteFinished(@Nullable AbstractTestProxy root, Project project) { for (TestStatusListener statusListener : Extensions.getExtensions(EP_NAME)) { statusListener.testSuiteFinished(root, project); } diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java index 59e30a064581..177ca6793d49 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java @@ -115,6 +115,8 @@ public class TestsUIUtil { if (project.isDisposed()) return; if (properties == null) return; + TestStatusListener.notifySuiteFinished(root, properties.getProject()); + final String testRunDebugId = properties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/annotate/ShowAllAffectedGenericAction.java b/platform/vcs-api/src/com/intellij/openapi/vcs/annotate/ShowAllAffectedGenericAction.java index 4759b915aea4..b707b664f7bf 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/annotate/ShowAllAffectedGenericAction.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/annotate/ShowAllAffectedGenericAction.java @@ -33,6 +33,8 @@ import com.intellij.openapi.vcs.history.VcsFileRevision; import com.intellij.openapi.vcs.history.VcsRevisionNumber; import com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings; import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList; +import com.intellij.openapi.vcs.vfs.VcsFileSystem; +import com.intellij.openapi.vcs.vfs.VcsVirtualFile; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; @@ -85,6 +87,7 @@ public class ShowAllAffectedGenericAction extends AnAction implements DumbAware ? ((ShortVcsRevisionNumber) revision).toShortString() : revision.asString()); final CommittedChangeList[] list = new CommittedChangeList[1]; + final FilePath[] targetPath = new FilePath[1]; final VcsException[] exc = new VcsException[1]; Task.Backgroundable task = new Task.Backgroundable(project, title, true, BackgroundFromStartOption.getInstance()) { @Override @@ -95,6 +98,7 @@ public class ShowAllAffectedGenericAction extends AnAction implements DumbAware final Pair pair = provider.getOneList(virtualFile, revision); if (pair != null) { list[0] = pair.getFirst(); + targetPath[0] = pair.getSecond(); } } else { @@ -141,7 +145,10 @@ public class ShowAllAffectedGenericAction extends AnAction implements DumbAware Messages.showErrorDialog(project, failedText(virtualFile, revision), getTitle()); } else { - instance.showChangesListBrowser(list[0], virtualFile, title); + VirtualFile navigateToFile = targetPath[0] != null ? + new VcsVirtualFile(targetPath[0].getPath(), null, VcsFileSystem.getInstance()) : + virtualFile; + instance.showChangesListBrowser(list[0], navigateToFile, title); } } }; diff --git a/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java b/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java index 758f83249519..34e466b94967 100644 --- a/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java +++ b/plugins/generate-tostring/src/org/jetbrains/java/generate/element/GenerationHelper.java @@ -16,11 +16,9 @@ package org.jetbrains.java.generate.element; import com.intellij.openapi.project.Project; -import com.intellij.psi.*; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.JavaCodeStyleManager; import com.intellij.psi.codeStyle.VariableKind; -import com.intellij.psi.util.PropertyUtil; import java.util.List; @@ -59,6 +57,6 @@ public class GenerationHelper { public static String getPropertyName(FieldElement fieldElement, Project project) { String name = fieldElement.getName(); JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project); - return codeStyleManager.variableNameToPropertyName(name, VariableKind.FIELD); + return codeStyleManager.variableNameToPropertyName(name, fieldElement.isModifierStatic() ? VariableKind.STATIC_FIELD : VariableKind.FIELD); } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrStaticChecker.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrStaticChecker.java index c9d17cb3afb3..c8d566162c6d 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrStaticChecker.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/util/GrStaticChecker.java @@ -15,7 +15,6 @@ */ package org.jetbrains.plugins.groovy.lang.psi.util; -import com.intellij.codeInsight.JavaCodeInsightSettingsFacade; import com.intellij.psi.*; import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; @@ -120,7 +119,7 @@ public class GrStaticChecker { return checkJavaLangClassMember(place, containingClass, member) || member.hasModifierProperty(PsiModifier.STATIC); } - return !isStatic || !filterStaticAfterInstanceQualifier || JavaCodeInsightSettingsFacade.getInstance(member.getProject()).isShowStaticAfterInstance(); + return !isStatic || !filterStaticAfterInstanceQualifier; } PsiElement qualifierResolved = ((GrReferenceExpression)qualifier).resolve(); @@ -142,7 +141,7 @@ public class GrStaticChecker { if (member instanceof PsiClass) { return false; } - return !isStatic || !filterStaticAfterInstanceQualifier || JavaCodeInsightSettingsFacade.getInstance(member.getProject()).isShowStaticAfterInstance(); + return !isStatic || !filterStaticAfterInstanceQualifier; } private static boolean checkJavaLangClassMember(PsiElement place, PsiClass containingClass, PsiModifierListOwner member) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/BuildAndRestartConsoleAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/BuildAndRestartConsoleAction.java index c59123daa286..c772033362af 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/BuildAndRestartConsoleAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/BuildAndRestartConsoleAction.java @@ -20,7 +20,6 @@ import com.intellij.execution.Executor; import com.intellij.execution.process.ProcessHandler; import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.icons.AllIcons; -import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.compiler.CompileContext; @@ -34,7 +33,7 @@ import org.jetbrains.annotations.NotNull; /** * Created by Max Medvedev on 21/03/14 */ -public class BuildAndRestartConsoleAction extends AnAction implements Disposable { +public class BuildAndRestartConsoleAction extends AnAction { private Module myModule; private Project myProject; @@ -82,14 +81,4 @@ public class BuildAndRestartConsoleAction extends AnAction implements Disposable }); } } - - - @Override - public void dispose() { - myModule = null; - myRestarter = null; - myProject = null; - myExecutor = null; - myContentDescriptor = null; - } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsole.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsole.java index d6af9efd6ead..5e80030caa93 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsole.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsole.java @@ -131,14 +131,14 @@ public class GroovyConsole { }; final Module module = GroovyConsoleStateService.getInstance(project).getSelectedModule(contentFile); - if (module != null) { - // if module for console is already selected, then use it for creation - initializer.consume(module); - } - else { + if (module == null || module.isDisposed()) { // if not, then select module, then run initializer GroovyConsoleUtil.selectModuleAndRun(project, initializer); } + else { + // if module for console is already selected, then use it for creation + initializer.consume(module); + } } @Nullable diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java index 693d4433fecd..7d2003db4500 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleResolveScopeProvider.java @@ -30,6 +30,6 @@ public class GroovyConsoleResolveScopeProvider extends ResolveScopeProvider { public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, Project project) { final GroovyConsoleStateService projectConsole = GroovyConsoleStateService.getInstance(project); final Module module = projectConsole.getSelectedModule(file); - return module == null ? null : module.getModuleWithDependenciesAndLibrariesScope(false); + return module == null || module.isDisposed() ? null : module.getModuleWithDependenciesAndLibrariesScope(false); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrSelectModuleAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrSelectModuleAction.java index 883af820e0a2..ef42d563b50c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrSelectModuleAction.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/actions/GrSelectModuleAction.java @@ -26,8 +26,8 @@ import com.intellij.util.Consumer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.console.GroovyConsole; -import org.jetbrains.plugins.groovy.console.GroovyConsoleUtil; import org.jetbrains.plugins.groovy.console.GroovyConsoleStateService; +import org.jetbrains.plugins.groovy.console.GroovyConsoleUtil; public class GrSelectModuleAction extends AnAction { @@ -58,7 +58,7 @@ public class GrSelectModuleAction extends AnAction { @NotNull public static String getText(@Nullable Module module) { - return module == null ? "