mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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<T extends ModuleBasedConfig
|
||||
}
|
||||
|
||||
protected ExecutionResult startSMRunner(Executor executor) throws ExecutionException {
|
||||
if (!Registry.is(getFrameworkId() + "_sm_runner")) {
|
||||
if (!isSmRunnerUsed()) {
|
||||
return null;
|
||||
}
|
||||
getJavaParameters().getVMParametersList().addProperty("idea." + getFrameworkId() + ".sm_runner");
|
||||
@@ -103,15 +106,18 @@ public abstract class JavaTestFrameworkRunnableState<T extends ModuleBasedConfig
|
||||
final OSProcessHandler handler = createHandler(executor);
|
||||
consoleView.attachToProcess(handler);
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void startNotified(ProcessEvent event) {
|
||||
if (getConfiguration().isSaveOutputToFile()) {
|
||||
viewer.getRoot().setOutputFilePath(getConfiguration().getOutputFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
if (viewer.hasTestSuites() ||
|
||||
!ResetConfigurationModuleAdapter.tryWithAnotherModule(getConfiguration(), testConsoleProperties.isDebug())) {
|
||||
TestsUIUtil.notifyByBalloon(testConsoleProperties.getProject(), viewer.hasTestSuites(), viewer.getRoot(), testConsoleProperties, null);
|
||||
}
|
||||
|
||||
viewer.getRoot().flush();
|
||||
deleteTempFiles();
|
||||
clear();
|
||||
}
|
||||
@@ -137,6 +143,10 @@ public abstract class JavaTestFrameworkRunnableState<T extends ModuleBasedConfig
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean isSmRunnerUsed() {
|
||||
return Registry.is(getFrameworkId() + "_sm_runner");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final JavaParameters javaParameters = new JavaParameters();
|
||||
|
||||
+14
-3
@@ -22,16 +22,17 @@ package com.intellij.execution.testframework;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.execution.CommonJavaRunConfigurationParameters;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.JavaRunConfigurationModule;
|
||||
import com.intellij.execution.configurations.ModuleBasedConfiguration;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.config.Storage;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class JavaAwareTestConsoleProperties extends SMTRunnerConsoleProperties {
|
||||
public abstract class JavaAwareTestConsoleProperties<T extends ModuleBasedConfiguration<JavaRunConfigurationModule> & 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());
|
||||
|
||||
+2
-3
@@ -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)) {
|
||||
|
||||
+1
-5
@@ -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);
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+11
@@ -118,5 +118,16 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
myFixture.checkResult("map.entrySet()<caret>");
|
||||
}
|
||||
|
||||
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<caret>"
|
||||
PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment(text, context, null, true);
|
||||
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
|
||||
myFixture.completeBasic()
|
||||
assert !myFixture.lookupElementStrings.contains('valueOf')
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+10
-17
@@ -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() }
|
||||
|
||||
+1
-11
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-7
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -90,7 +90,9 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase {
|
||||
super(context, request);
|
||||
|
||||
List<DiffContent> 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;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,8 +74,14 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, 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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
+4
@@ -161,4 +161,8 @@ public class SMTRunnerConsoleProperties extends TestConsoleProperties implements
|
||||
|
||||
return new OpenFileDescriptor(project, file, offset);
|
||||
}
|
||||
|
||||
public boolean fixEmptySuite() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-110
@@ -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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -273,7 +273,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
|
||||
@Override
|
||||
public void onSuiteTreeNodeAdded(SMTestProxy testProxy) {
|
||||
updateOnTestStarted(false);
|
||||
myTotalTestCount++;
|
||||
_addTestOrSuite(testProxy);
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -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<TestStatusListener> 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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+8
-1
@@ -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<CommittedChangeList, FilePath> 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+1
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -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) {
|
||||
|
||||
+1
-12
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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 ? "<select module>" : GroovyConsoleUtil.getTitle(module);
|
||||
return module == null || module.isDisposed() ? "Select module..." : GroovyConsoleUtil.getTitle(module);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,6 @@ public class GroovyShellRunnerImpl extends AbstractConsoleRunnerWithHistory<Lang
|
||||
toolbarActions.add(rebuildAction);
|
||||
List<AnAction> actions = super.fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor);
|
||||
actions.add(rebuildAction);
|
||||
Disposer.register(getConsoleView(), rebuildAction);
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ import com.intellij.rt.execution.junit.RepeatCount;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import jetbrains.buildServer.messages.serviceMessages.ServiceMessageTypes;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.serialization.PathMacroUtil;
|
||||
@@ -467,6 +468,9 @@ public abstract class TestObject extends JavaTestFrameworkRunnableState<JUnitCon
|
||||
if (classpath == null) {
|
||||
final JavaParameters parameters = new JavaParameters();
|
||||
configureAdditionalClasspath(parameters);
|
||||
if (isSmRunnerUsed()) {
|
||||
parameters.getClassPath().add(PathUtil.getJarPathForClass(ServiceMessageTypes.class));
|
||||
}
|
||||
JavaParametersUtil.configureModule(module, parameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS,
|
||||
getConfiguration().isAlternativeJrePathEnabled() ? getConfiguration()
|
||||
.getAlternativeJrePath() : null);
|
||||
|
||||
@@ -23,10 +23,16 @@ import com.intellij.execution.configurations.RuntimeConfigurationWarning;
|
||||
import com.intellij.execution.junit2.ui.model.JUnitRunningModel;
|
||||
import com.intellij.execution.junit2.ui.properties.JUnitConsoleProperties;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.testframework.*;
|
||||
import com.intellij.execution.testframework.ResetConfigurationModuleAdapter;
|
||||
import com.intellij.execution.testframework.SearchForTestsTask;
|
||||
import com.intellij.execution.testframework.SourceScope;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PackageScope;
|
||||
@@ -129,7 +135,21 @@ public class TestPackage extends TestObject {
|
||||
}
|
||||
|
||||
protected GlobalSearchScope filterScope(final JUnitConfiguration.Data data) throws CantRunException {
|
||||
final PsiPackage aPackage = getPackage(data);
|
||||
final Ref<CantRunException> ref = new Ref<CantRunException>();
|
||||
final PsiPackage aPackage = ApplicationManager.getApplication().runReadAction(new Computable<PsiPackage>() {
|
||||
@Override
|
||||
public PsiPackage compute() {
|
||||
try {
|
||||
return getPackage(data);
|
||||
}
|
||||
catch (CantRunException e) {
|
||||
ref.set(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
final CantRunException exception = ref.get();
|
||||
if (exception != null) throw exception;
|
||||
return PackageScope.packageScope(aPackage, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.intellij.execution.junit2.ui.model.JUnitRunningModel;
|
||||
import com.intellij.execution.junit2.ui.properties.JUnitConsoleProperties;
|
||||
import com.intellij.execution.testframework.AbstractTestProxy;
|
||||
import com.intellij.execution.testframework.Printable;
|
||||
import com.intellij.execution.testframework.TestStatusListener;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -220,7 +219,6 @@ public class TestsPacketsReceiver implements OutputPacketProcessor, Disposable {
|
||||
final JUnitRunningModel model = getModel();
|
||||
if (model != null) {
|
||||
model.getNotifier().fireRunnerStateChanged(new CompletionEvent(true, reader.readInt()));
|
||||
TestStatusListener.notifySuiteFinished(model.getRoot(), model.getProject());
|
||||
terminateStillRunning(model);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class JUnitConsoleProperties extends JavaAwareTestConsoleProperties {
|
||||
public class JUnitConsoleProperties extends JavaAwareTestConsoleProperties<JUnitConfiguration> {
|
||||
|
||||
private final JUnitConfiguration myConfiguration;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class SMTestSender extends RunListener {
|
||||
|
||||
public void testRunStarted(Description description) throws Exception {
|
||||
myCurrentClassName = myIgnoreTopSuite ? description.toString() : null;
|
||||
System.out.println("##teamcity[enteredTheMatrix]");
|
||||
}
|
||||
|
||||
public void testRunFinished(Result result) throws Exception {
|
||||
@@ -119,7 +120,9 @@ class SMTestSender extends RunListener {
|
||||
}
|
||||
|
||||
public synchronized void testIgnored(Description description) throws Exception {
|
||||
testStarted(description);
|
||||
prepareIgnoreMessage(description, true);
|
||||
testFinished(description);
|
||||
}
|
||||
|
||||
private static void prepareIgnoreMessage(Description description, boolean commentMessage) {
|
||||
|
||||
@@ -76,7 +76,7 @@ class ForkedVMWrapper extends DataOutputStream {
|
||||
boolean afterDelimiter = false;
|
||||
while (stream.available() > 0) {
|
||||
char read = (char)stream.read();
|
||||
if (read == '/') {
|
||||
if (!afterSymbol && read == '/') {
|
||||
afterSymbol = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.rt.execution.junit;
|
||||
|
||||
import com.intellij.rt.execution.CommandLineWrapper;
|
||||
import com.intellij.rt.execution.junit.segments.OutputObjectRegistry;
|
||||
import com.intellij.rt.execution.junit.segments.SegmentedOutputStream;
|
||||
|
||||
import java.io.*;
|
||||
@@ -93,7 +94,7 @@ public class JUnitForkedStarter {
|
||||
final Object description = testRunner.getTestToStart(args, params);
|
||||
if (description == null) return -1;
|
||||
|
||||
TreeSender.sendTree(testRunner, description, true);
|
||||
TreeSender.sendTree(testRunner, description, !JUnitStarter.SM_RUNNER);
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
@@ -129,9 +130,10 @@ public class JUnitForkedStarter {
|
||||
File tempFile = File.createTempFile("idea_junit", ".tmp");
|
||||
tempFile.deleteOnExit();
|
||||
JUnitStarter.printClassesList(classNames, packageName + ", working directory: \'" + workingDir + "\'", "", tempFile);
|
||||
final OutputObjectRegistry registry = testRunner.getRegistry();
|
||||
final String startIndex = String.valueOf(registry != null ? registry.getKnownObject(rootDescriptor) - 1 : -1);
|
||||
childResult =
|
||||
runChild(isJUnit4, listeners, out, err, parameters, "@" + tempFile.getAbsolutePath(), dir,
|
||||
String.valueOf(testRunner.getRegistry().getKnownObject(rootDescriptor) - 1), classpath, dynamicClasspath);
|
||||
runChild(isJUnit4, listeners, out, err, parameters, "@" + tempFile.getAbsolutePath(), dir, startIndex, classpath, dynamicClasspath);
|
||||
} else {
|
||||
final List children = new ArrayList(testRunner.getChildTests(description));
|
||||
for (Iterator iterator = children.iterator(); iterator.hasNext(); ) {
|
||||
@@ -155,7 +157,7 @@ public class JUnitForkedStarter {
|
||||
}
|
||||
|
||||
time = System.currentTimeMillis() - time;
|
||||
new TimeSender(testRunner.getRegistry()).printHeader(time);
|
||||
if (!JUnitStarter.SM_RUNNER) new TimeSender(testRunner.getRegistry()).printHeader(time);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -188,7 +190,8 @@ public class JUnitForkedStarter {
|
||||
final List childTests = testRunner.getChildTests(child);
|
||||
final int childResult;
|
||||
if (childTests.isEmpty() || !forkTillMethod) {
|
||||
final int startIndex = testRunner.getRegistry().getKnownObject(child);
|
||||
final OutputObjectRegistry registry = testRunner.getRegistry();
|
||||
final int startIndex = registry != null ? registry.getKnownObject(child) : -1;
|
||||
childResult =
|
||||
runChild(isJUnit4, listeners, out, err, parameters, testRunner.getStartDescription(child), workingDir, String.valueOf(startIndex), classpath, dynamicClasspath);
|
||||
}
|
||||
@@ -213,6 +216,7 @@ public class JUnitForkedStarter {
|
||||
String dynamicClasspath) throws IOException, InterruptedException {
|
||||
//noinspection SSBasedInspection
|
||||
final File tempFile = File.createTempFile("fork", "test");
|
||||
tempFile.deleteOnExit();
|
||||
final String testOutputPath = tempFile.getAbsolutePath();
|
||||
|
||||
final ProcessBuilder builder = new ProcessBuilder();
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.theoryinpractice.testng.configuration.TestNGConfiguration;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class TestNGConsoleProperties extends JavaAwareTestConsoleProperties {
|
||||
public class TestNGConsoleProperties extends JavaAwareTestConsoleProperties<TestNGConfiguration> {
|
||||
private final TestNGConfiguration myConfiguration;
|
||||
|
||||
public TestNGConsoleProperties(TestNGConfiguration config, Executor executor)
|
||||
|
||||
@@ -23,14 +23,11 @@
|
||||
package com.theoryinpractice.testng.ui;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.testframework.*;
|
||||
import com.intellij.execution.testframework.actions.ScrollToTestSourceAction;
|
||||
import com.intellij.execution.testframework.ui.TestResultsPanel;
|
||||
import com.intellij.execution.testframework.ui.TestsProgressAnimator;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.progress.util.ColorProgressBar;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -44,7 +41,6 @@ import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.table.TableView;
|
||||
import com.intellij.util.OpenSourceUtil;
|
||||
import com.intellij.util.config.ToggleBooleanProperty;
|
||||
import com.theoryinpractice.testng.configuration.TestNGConfiguration;
|
||||
import com.theoryinpractice.testng.model.*;
|
||||
import com.theoryinpractice.testng.util.TestNGUtil;
|
||||
@@ -389,7 +385,6 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn
|
||||
myStatusLine.setStatusColor(ColorProgressBar.GREEN);
|
||||
}
|
||||
rootNode.setInProgress(false);
|
||||
TestStatusListener.notifySuiteFinished(rootNode, project);
|
||||
if (TestNGConsoleProperties.SELECT_FIRST_DEFECT.value(myProperties)) {
|
||||
selectTest(rootNode.getFirstDefect());
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener
|
||||
}
|
||||
|
||||
public void onStart(ISuite suite) {
|
||||
System.out.println("##teamcity[enteredTheMatrix]");
|
||||
System.out.println("##teamcity[testSuiteStarted name =\'" + suite.getName() + "\']");
|
||||
}
|
||||
|
||||
|
||||
@@ -161,8 +161,11 @@ public class DomFileDescription<T> {
|
||||
|
||||
/**
|
||||
* The right place to call
|
||||
* {@link #registerNamespacePolicy(String, String...)}
|
||||
* and {@link #registerTypeChooser(java.lang.reflect.Type, TypeChooser)}.
|
||||
* <ul>
|
||||
* <li>{@link #registerNamespacePolicy(String, String...)}</li>
|
||||
* <li>{@link #registerTypeChooser(java.lang.reflect.Type, TypeChooser)}</li>
|
||||
* <li>{@link #registerReferenceInjector(DomReferenceInjector)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
protected void initializeFileDescription() {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user