Example usage for com.intellij.openapi.ui TestDialog TestDialog

List of usage examples for com.intellij.openapi.ui TestDialog TestDialog

Introduction

In this page you can find the example usage for com.intellij.openapi.ui TestDialog TestDialog.

Prototype

TestDialog

Source Link

Usage

From source file:org.consulo.compiler.server.Main.java

License:Apache License

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_PLUGINS_PATH, "G:\\target_for_build\\distMain\\plugins");
    System.setProperty(PathManager.PROPERTY_HOME_PATH, "G:\\target_for_build\\distMain");
    System.setProperty(FileWatcher.PROPERTY_WATCHER_DISABLED, "true");

    LOGGER.info("Data dir: " + t.getAbsolutePath());

    CompilerServerInterfaceImpl server = createServer();

    ApplicationEx app = CompilerServerApplication.createApplication();
    Messages.setTestDialog(new TestDialog() {
        @Override//ww  w.  ja va2  s  . c  o  m
        public int show(String message) {
            LOGGER.info(message);
            return 0;
        }
    });

    app.load(PathManager.getOptionsPath());

    setupSdk("JDK", "1.6", "I:\\Programs\\jdk6");
    setupSdk("JDK", "1.7", "I:\\Programs\\jdk7");
    setupSdk("Consulo Plugin SDK", "Consulo 1.SNAPSHOT", "G:\\target_for_build\\distMainn");

    server.compile(new CompilerClientInterface() {
        @Override
        public void addMessage(@NotNull CompilerMessageCategory category, String message, String url,
                int lineNum, int columnNum) throws RemoteException {
            LOGGER.info(category + ": " + message + ". Url: " + url);
        }

        @Override
        public void compilationFinished(boolean aborted, int errors, int warnings) throws RemoteException {
        }

        @NotNull
        @Override
        public String getProjectDir() {
            return "G:\\target_for_build\\consulo";
        }
    });
}

From source file:org.consulo.compiler.server.MainTest.java

License:Apache License

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(FileWatcher.PROPERTY_WATCHER_DISABLED, "true");

    initLogger();/*  w  w w . ja  v  a 2s  .c  o m*/

    ApplicationEx app = CompilerServerApplication.createApplication();
    Messages.setTestDialog(new TestDialog() {
        @Override
        public int show(String message) {
            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("org/consulo/module/extension/ui"));
}

From source file:org.jetbrains.idea.maven.MavenImportingTestCase.java

License:Apache License

protected static AtomicInteger configConfirmationForYesAnswer() {
    final AtomicInteger counter = new AtomicInteger();
    Messages.setTestDialog(new TestDialog() {
        @Override//from ww w.j ava  2 s  .  co m
        public int show(String message) {
            counter.set(counter.get() + 1);
            return 0;
        }
    });
    return counter;
}

From source file:org.jetbrains.idea.maven.MavenImportingTestCase.java

License:Apache License

protected static AtomicInteger configConfirmationForNoAnswer() {
    final AtomicInteger counter = new AtomicInteger();
    Messages.setTestDialog(new TestDialog() {
        @Override//  w w  w  .  j  a va2 s.c  om
        public int show(String message) {
            counter.set(counter.get() + 1);
            return 1;
        }
    });
    return counter;
}