diff --git a/build/cucumber-test-runner/src/com/intellij/cucumber/CucumberMain.java b/build/cucumber-test-runner/src/com/intellij/cucumber/CucumberMain.java index f68c30693561..8372b59aca08 100644 --- a/build/cucumber-test-runner/src/com/intellij/cucumber/CucumberMain.java +++ b/build/cucumber-test-runner/src/com/intellij/cucumber/CucumberMain.java @@ -16,13 +16,14 @@ package com.intellij.cucumber; import com.intellij.idea.IdeaTestApplication; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Ref; import cucumber.io.MultiLoader; import cucumber.runtime.Runtime; import cucumber.runtime.RuntimeOptions; +import java.awt.*; + /** * @author Dennis.Ushakov */ @@ -33,25 +34,31 @@ public class CucumberMain { } public static void main(final String[] args) { - IdeaTestApplication.getInstance(null); final Ref errorRef = new Ref(); final Ref runtimeRef = new Ref(); - ApplicationManager.getApplication().invokeAndWait(new Runnable() { - @Override - public void run() { - try { - final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - RuntimeOptions runtimeOptions = new RuntimeOptions(System.getProperties(), args); - cucumber.runtime.Runtime runtime = new Runtime(new MultiLoader(classLoader), classLoader, runtimeOptions); - runtimeRef.set(runtime); - runtime.writeStepdefsJson(); - runtime.run(); - } catch (Throwable throwable) { - errorRef.set(throwable); - Logger.getInstance(CucumberMain.class).error(throwable); + try { + EventQueue.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + RuntimeOptions runtimeOptions = new RuntimeOptions(System.getProperties(), args); + Runtime runtime = new Runtime(new MultiLoader(classLoader), classLoader, runtimeOptions); + runtimeRef.set(runtime); + runtime.writeStepdefsJson(); + runtime.run(); + } catch (Throwable throwable) { + errorRef.set(throwable); + Logger.getInstance(CucumberMain.class).error(throwable); + } } - } - }, ApplicationManager.getApplication().getDefaultModalityState()); + }); + } + catch (Throwable t) { + errorRef.set(t); + Logger.getInstance(CucumberMain.class).error(t); + } + final Throwable throwable = errorRef.get(); if (throwable != null) { throwable.printStackTrace(); diff --git a/plugins/git4idea/git4idea.iml b/plugins/git4idea/git4idea.iml index b6b41c387096..56997779b16d 100644 --- a/plugins/git4idea/git4idea.iml +++ b/plugins/git4idea/git4idea.iml @@ -67,6 +67,7 @@ + diff --git a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java index 6c267d7fec4e..7872072f7c3c 100644 --- a/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java +++ b/plugins/git4idea/test-stepdefs/git4idea/GitCucumberWorld.java @@ -1,6 +1,7 @@ package git4idea; import com.intellij.dvcs.test.MockVcsHelper; +import com.intellij.idea.IdeaTestApplication; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ProjectComponent; import com.intellij.openapi.components.ServiceManager; @@ -82,6 +83,7 @@ public class GitCucumberWorld { @Order(0) public void setUp() throws Throwable { System.setProperty(PlatformUtils.PLATFORM_PREFIX_KEY, "PlatformLangXml"); + IdeaTestApplication.getInstance(null); String tempFileName = getClass().getName() + "-" + new Random().nextInt(); myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(tempFileName).getFixture(); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRepositorySelectorComponent.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRepositorySelectorComponent.java index 89fc834de60b..1660a8feda5d 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRepositorySelectorComponent.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgRepositorySelectorComponent.java @@ -64,9 +64,22 @@ public class HgRepositorySelectorComponent { return repo.getPresentableUrl(); } + @Override - public boolean equals(Object obj) { - return obj instanceof RepositoryDisplay && this.repo.equals(((RepositoryDisplay)obj).repo); + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + RepositoryDisplay display = (RepositoryDisplay)o; + + if (repo != null ? !repo.equals(display.repo) : display.repo != null) return false; + + return true; + } + + @Override + public int hashCode() { + return repo != null ? repo.hashCode() : 0; } @Override