Search in sources :

Example 1 with TestDialog

use of com.intellij.openapi.ui.TestDialog in project intellij-community by JetBrains.

the class MavenImportingTestCase method configConfirmationForNoAnswer.

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;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestDialog(com.intellij.openapi.ui.TestDialog)

Example 2 with TestDialog

use of com.intellij.openapi.ui.TestDialog in project kotlin by JetBrains.

the class MavenImportingTestCase method configConfirmationForNoAnswer.

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;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestDialog(com.intellij.openapi.ui.TestDialog)

Example 3 with TestDialog

use of com.intellij.openapi.ui.TestDialog in project intellij-community by JetBrains.

the class ExternalSystemImportingTestCase method configConfirmationForNoAnswer.

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;
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestDialog(com.intellij.openapi.ui.TestDialog)

Example 4 with TestDialog

use of com.intellij.openapi.ui.TestDialog in project intellij-community by JetBrains.

the class GithubShareProjectTest method testGithubAlreadyExists.

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);
    }
}
Also used : TestDialog(com.intellij.openapi.ui.TestDialog)

Example 5 with TestDialog

use of com.intellij.openapi.ui.TestDialog in project android by JetBrains.

the class ForcedPluginPreviewVersionUpgradeDialog method setTestDialog.

@TestOnly
public static TestDialog setTestDialog(@NotNull TestDialog newValue) {
    Application application = ApplicationManager.getApplication();
    if (application != null) {
        getLog().assertTrue(application.isUnitTestMode(), "This method is available for tests only");
    }
    TestDialog oldValue = ourTestImplementation;
    ourTestImplementation = newValue;
    return oldValue;
}
Also used : TestDialog(com.intellij.openapi.ui.TestDialog) Application(com.intellij.openapi.application.Application) TestOnly(org.jetbrains.annotations.TestOnly)

Aggregations

TestDialog (com.intellij.openapi.ui.TestDialog)8 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)6 Application (com.intellij.openapi.application.Application)1 TestOnly (org.jetbrains.annotations.TestOnly)1