Search in sources :

Example 51 with Notification

use of com.intellij.notification.Notification in project android by JetBrains.

the class MultiModuleThemeEditorTest method testModuleWithoutThemes.

@Test
public void testModuleWithoutThemes() throws IOException {
    guiTest.importProjectAndWaitForProjectSyncToFinish("MultiAndroidModule");
    final ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
    final JComboBoxFixture modulesComboBox = themeEditor.getModulesComboBox();
    modulesComboBox.selectItem("app");
    themeEditor.getThemesComboBox().selectItem("AppTheme");
    themeEditor.waitForThemeSelection("AppTheme");
    modulesComboBox.selectItem("nothemeslibrary");
    guiTest.robot().waitForIdle();
    final LogModel logModel = EventLog.getLogModel(guiTest.ideFrame().getProject());
    for (Notification notification : logModel.getNotifications()) {
        assertThat(notification.getType()).isNotEqualTo(NotificationType.ERROR);
    }
}
Also used : JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) LogModel(com.intellij.notification.LogModel) ThemeEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.theme.ThemeEditorFixture) Notification(com.intellij.notification.Notification) Test(org.junit.Test)

Example 52 with Notification

use of com.intellij.notification.Notification in project android by JetBrains.

the class GetAdbAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Notifications.Bus.notify(new Notification("Android", "ADB", "ADB requested.", NotificationType.INFORMATION));
    Project project = getEventProject(e);
    File adb = project == null ? null : AndroidSdkUtils.getAdb(project);
    if (adb == null) {
        return;
    }
    ListenableFuture<AndroidDebugBridge> bridge = AdbService.getInstance().getDebugBridge(adb);
    Futures.addCallback(bridge, new FutureCallback<AndroidDebugBridge>() {

        @Override
        public void onSuccess(AndroidDebugBridge result) {
            Notifications.Bus.notify(new Notification("Android", "ADB", "ADB obtained", NotificationType.INFORMATION));
        }

        @Override
        public void onFailure(Throwable t) {
            Notifications.Bus.notify(new Notification("Android", "ADB", "ADB error: " + t.toString(), NotificationType.INFORMATION));
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) File(java.io.File) Notification(com.intellij.notification.Notification) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge)

Example 53 with Notification

use of com.intellij.notification.Notification in project android by JetBrains.

the class TerminateAdbAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    Notifications.Bus.notify(new Notification("Android", "ADB", "ADB terminated", NotificationType.INFORMATION));
    AdbService.getInstance().terminateDdmlib();
}
Also used : Notification(com.intellij.notification.Notification)

Example 54 with Notification

use of com.intellij.notification.Notification in project android by JetBrains.

the class AndroidGradleNotification method showBalloon.

public void showBalloon(@NotNull String title, @NotNull String text, @NotNull NotificationType type, @NotNull NotificationGroup group, @Nullable NotificationListener listener) {
    Notification notification = group.createNotification(title, text, type, listener);
    Runnable notificationTask = () -> {
        if (!myProject.isDisposed() && myProject.isOpen()) {
            Notification old = myNotification;
            if (old != null) {
                boolean similar = Objects.equal(notification.getContent(), old.getContent());
                if (similar) {
                    old.expire();
                }
            }
            myNotification = notification;
            notification.notify(myProject);
        }
    };
    Application application = ApplicationManager.getApplication();
    if (application.isDispatchThread()) {
        notificationTask.run();
    } else {
        application.invokeLater(notificationTask);
    }
}
Also used : Application(com.intellij.openapi.application.Application) Notification(com.intellij.notification.Notification)

Example 55 with Notification

use of com.intellij.notification.Notification in project Intellij-Plugin by getgauge.

the class GaugeComponent method projectOpened.

@Override
public void projectOpened() {
    if (isGaugeProjectDir(new File(this.project.getBasePath()))) {
        if (!GaugeVersion.isGreaterOrEqual(MIN_GAUGE_VERSION, false)) {
            Notification notification = new Notification("Error", "Unsupported Gauge Version", String.format("This version of Gauge Intellij plugin only works with Gauge version >= %s", MIN_GAUGE_VERSION), NotificationType.ERROR);
            Notifications.Bus.notify(notification, this.project);
        }
    }
}
Also used : File(java.io.File) Notification(com.intellij.notification.Notification)

Aggregations

Notification (com.intellij.notification.Notification)114 HyperlinkEvent (javax.swing.event.HyperlinkEvent)34 NotNull (org.jetbrains.annotations.NotNull)34 NotificationListener (com.intellij.notification.NotificationListener)33 Project (com.intellij.openapi.project.Project)20 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 File (java.io.File)11 IOException (java.io.IOException)11 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)8 Nullable (org.jetbrains.annotations.Nullable)8 Task (com.intellij.openapi.progress.Task)7 Module (com.intellij.openapi.module.Module)6 ExecutionException (com.intellij.execution.ExecutionException)4 NotificationAction (com.intellij.notification.NotificationAction)4 NotificationType (com.intellij.notification.NotificationType)4 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)4 Application (com.intellij.openapi.application.Application)3 Library (com.intellij.openapi.roots.libraries.Library)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ArrayList (java.util.ArrayList)3