Java 类com.intellij.openapi.ui.TestDialog 实例源码

项目:intellij-ce-playground    文件:GradleImportingTestCase.java   
@Override
public void tearDown() throws Exception {
  if (myJdkHome == null) {
    //super.setUp() wasn't called
    return;
  }

  try {
    new WriteAction() {
      @Override
      protected void run(@NotNull Result result) throws Throwable {
        Sdk old = ProjectJdkTable.getInstance().findJdk(GRADLE_JDK_NAME);
        if (old != null) {
          SdkConfigurationUtil.removeSdk(old);
        }
      }
    }.execute();
    Messages.setTestDialog(TestDialog.DEFAULT);
    FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
  }
  finally {
    super.tearDown();
  }
}
项目:intellij-ce-playground    文件:GithubShareProjectTest.java   
public void testGithubAlreadyExists() throws Throwable {
  final boolean[] dialogShown = new boolean[1];
  TestDialog oldTestDialog = Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      dialogShown[0] = message.contains("Successfully connected to") && message.contains("Do you want to proceed anyway?");
      return 1;
    }
  });

  try {
    registerDefaultShareDialogHandler();
    registerDefaultUntrackedFilesDialogHandler();

    createProjectFiles();
    GithubShareAction.shareProjectOnGithub(myProject, myProjectRoot);
    assertFalse(dialogShown[0]);

    GithubShareAction.shareProjectOnGithub(myProject, myProjectRoot);
    assertTrue(dialogShown[0]);
  }
  finally {
    Messages.setTestDialog(oldTestDialog);
  }
}
项目:ali-idea-plugin    文件:IntellijTest.java   
@After
public void done() throws Throwable {
    testApplication.waitForBackgroundActivityToFinish();
    if(handler != null) {
        handler.finish();
    }
    Assert.assertTrue("Unhandled messages: " + testMessages.asString(), testMessages.isEmpty());
    Messages.setTestDialog(TestDialog.DEFAULT);
    List<Exception> ex = errorService._shiftErrors();
    Assert.assertTrue("Unhandled exceptions: " + ex.toString(), ex.isEmpty());
    for(EntityListener listener: entityListeners) {
        entityService.removeEntityListener(listener);
    }
    getComponent(DetailUtil.class)._restore();
    if(isIsolated()) {
        handler.getServer().stop();
    }
}
项目:intellij-ce-playground    文件:ExternalSystemImportingTestCase.java   
protected static AtomicInteger configConfirmationForYesAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 0;
    }
  });
  return counter;
}
项目:intellij-ce-playground    文件:ExternalSystemImportingTestCase.java   
protected static AtomicInteger configConfirmationForNoAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 1;
    }
  });
  return counter;
}
项目:intellij-ce-playground    文件:MavenImportingTestCase.java   
@Override
protected void tearDown() throws Exception {
  try {
    if (myGlobalSettingsFile != null) {
      VfsRootAccess.disallowRootAccess(myGlobalSettingsFile.getAbsolutePath());
    }
    VfsRootAccess.disallowRootAccess(PathManager.getConfigPath());
    Messages.setTestDialog(TestDialog.DEFAULT);
    removeFromLocalRepository("test");
    FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
  }
  finally {
    super.tearDown();
  }
}
项目:intellij-ce-playground    文件:MavenImportingTestCase.java   
protected static AtomicInteger configConfirmationForYesAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 0;
    }
  });
  return counter;
}
项目:intellij-ce-playground    文件:MavenImportingTestCase.java   
protected static AtomicInteger configConfirmationForNoAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 1;
    }
  });
  return counter;
}
项目:intellij-ce-playground    文件:SvnTestCase.java   
protected void undo() {
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      final TestDialog oldTestDialog = Messages.setTestDialog(TestDialog.OK);
      try {
        UndoManager.getInstance(myProject).undo(null);
      }
      finally {
        Messages.setTestDialog(oldTestDialog);
      }
    }
  });
}
项目:intellij-pants-plugin    文件:PantsIntegrationTestCase.java   
@Override
public void tearDown() throws Exception {
  // TODO thread leak either a IJ bug https://youtrack.jetbrains.com/issue/IDEA-155496
  // or a pants plugin bug https://github.com/pantsbuild/intellij-pants-plugin/issues/130
  // Temporarily ignore the following 'leaking' threads to pass CI.
  ThreadTracker.longRunningThreadCreated(
    ApplicationManager.getApplication(),
    "BaseDataReader",
    "ProcessWaitFor",
    "Timer"
  );
  try {
    if (myCompilerTester != null) {
      myCompilerTester.tearDown();
    }

    // Kill nailgun after usage as memory on travis is limited, at a cost of slower later builds.
    killNailgun();
    cleanProjectRoot();
    Messages.setTestDialog(TestDialog.DEFAULT);

    // TODO(cosmicexplorer): after updating from 172.4343.14 to 173.3531.6,
    // intellij's provided test class sometimes yells about a leaky jdk
    // table. i don't think this indicates any problems, so for now if tests
    // fail with leaky sdk errors, broaden this to include the leaked sdks.
    removeJdks(jdk -> jdk.getName().contains("pants"));
    super.tearDown();
  }
  catch (Throwable throwable) {
    // Discard error containing "Already disposed".
    if (!throwable.getMessage().contains("Already disposed")) {
      throw throwable;
    }
  }
}
项目:tools-idea    文件:MavenImportingTestCase.java   
@Override
protected void tearDown() throws Exception {
  Messages.setTestDialog(TestDialog.DEFAULT);
  myProjectsManager.projectClosed();
  removeFromLocalRepository("test");
  if (useJps()) {
    FileUtil.delete(BuildManager.getInstance().getBuildSystemDirectory());
  }
  super.tearDown();
}
项目:tools-idea    文件:MavenImportingTestCase.java   
protected static AtomicInteger configConfirmationForYesAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 0;
    }
  });
  return counter;
}
项目:tools-idea    文件:MavenImportingTestCase.java   
protected static AtomicInteger configConfirmationForNoAnswer() {
  final AtomicInteger counter = new AtomicInteger();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      counter.set(counter.get() + 1);
      return 1;
    }
  });
  return counter;
}
项目:tools-idea    文件:SvnTestCase.java   
protected void undo() {
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      final TestDialog oldTestDialog = Messages.setTestDialog(TestDialog.OK);
      try {
        UndoManager.getInstance(myProject).undo(null);
      }
      finally {
        Messages.setTestDialog(oldTestDialog);
      }
    }
  });
}
项目:intellij-haxe    文件:HaxeFindUsagesTest.java   
public void doOverrideTest(String testFile, TestDialog answer) throws Throwable {
  Messages.setTestDialog(answer);
  myFixture.configureByFiles(testFile, "com/bar/TestSearchOverrides.hx");
  myFixture.copyFileToProject(getResultsPath());
  compareExpectedUsages(findUsages());
}
项目:lombok-intellij-plugin    文件:LombokLoggerActionTest.java   
public void testLogSimple() throws Exception {
  Messages.setTestDialog(TestDialog.DEFAULT);
  doTest();
}
项目:lombok-intellij-plugin    文件:LombokLoggerActionTest.java   
public void testLogRename() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
项目:lombok-intellij-plugin    文件:LombokLoggerActionTest.java   
public void testLogPublic() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
项目:lombok-intellij-plugin    文件:LombokLoggerActionTest.java   
public void testLogNonStatic() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
项目:lombok-intellij-plugin    文件:LombokLoggerActionTest.java   
public void testLogNonFinal() throws Exception {
  Messages.setTestDialog(TestDialog.OK);
  doTest();
}
项目:consulo    文件:MainTest.java   
public static void main(String[] args) throws Exception{
  File t = FileUtil.createTempDirectory("consulo", "data");
  System.setProperty(PathManager.PROPERTY_CONFIG_PATH, t.getAbsolutePath() + "/config");
  System.setProperty(PathManager.PROPERTY_SYSTEM_PATH, t.getAbsolutePath() + "/system");
  //System.setProperty(PathManager.PROPERTY_CONFIG_PATH, "C:\\Users\\VISTALL\\.ConsuloData\\config");
 // System.setProperty(PathManager.PROPERTY_SYSTEM_PATH, "C:\\Users\\VISTALL\\.ConsuloData\\system");
  System.setProperty(PathManager.PROPERTY_HOME_PATH, "F:\\github.com\\consulo\\consulo\\out\\artifacts\\dist");
  System.setProperty("idea.filewatcher.disabled", "true");

  initLogger();

  ApplicationEx app = CompilerServerApplication.createApplication();
  Messages.setTestDialog(new TestDialog() {
    @Override
    public int show(String message) {
      MainTest.LOGGER.info(message);
      return 0;
    }
  }) ;

  app.load(PathManager.getOptionsPath());

  System.out.println("---------------------------------------------------------------------------------------------------------");

 /* File file = new File("../../../platform/compiler-server-impl/testData/zip1.zip");

  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);

  VirtualFile jarRootForLocalFile = ArchiveVfsUtil.getJarRootForLocalFile(virtualFile);


  StringBuilder builder = new StringBuilder();
  printTree(jarRootForLocalFile, 0, builder);
  System.out.println(builder);    */

  File file = new File("F:\\github.com\\consulo\\consulo\\out\\artifacts\\dist\\lib\\idea.jar");

  VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(file);

  VirtualFile archiveRootForLocalFile = ArchiveVfsUtil.getArchiveRootForLocalFile(virtualFile);

  System.out.println(archiveRootForLocalFile.findFileByRelativePath("consulo/module/extension/ui"));
}