Example usage for com.intellij.openapi.ui Messages setTestDialog

List of usage examples for com.intellij.openapi.ui Messages setTestDialog

Introduction

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

Prototype

@TestOnly
    public static TestDialog setTestDialog(TestDialog newValue) 

Source Link

Usage

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// w  w  w.ja  v a2s.c o  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/*from  w  w w .  j  av a 2 s .  c  o m*/
        public int show(String message) {
            counter.set(counter.get() + 1);
            return 1;
        }
    });
    return counter;
}

From source file:org.jetbrains.idea.SvnTestCase.java

License:Apache License

protected void undo() {
    UIUtil.invokeAndWaitIfNeeded(new Runnable() {
        @Override//www . j a v a  2 s. c om
        public void run() {
            final TestDialog oldTestDialog = Messages.setTestDialog(TestDialog.OK);
            try {
                UndoManager.getInstance(myProject).undo(null);
            } finally {
                Messages.setTestDialog(oldTestDialog);
            }
        }
    });
}

From source file:org.jetbrains.kotlin.idea.codeInsight.gradle.GradleImportingTestCase.java

License:Apache License

@Override
public void tearDown() throws Exception {
    if (myJdkHome == null) {
        //super.setUp() wasn't called
        return;//from ww w.  ja v a2s  .co m
    }

    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();
    }
}

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

License:Apache License

@Override
protected void tearDown() throws Exception {
    try {/*from  w ww. j  av a  2  s .c o m*/
        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();
    }
}