Search in sources :

Example 46 with Notification

use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.

the class FlexmojosImporter method doShowFlexConfigWarning.

private synchronized void doShowFlexConfigWarning(final Project project) {
    final NotificationListener listener = new NotificationListener() {

        public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
            Messages.showWarningDialog(project, FlexBundle.message("flexmojos.warning.detailed"), FlexBundle.message("flexmojos.project.import"));
            notification.expire();
        }
    };
    myFlexConfigNotification = new Notification("Maven", FlexBundle.message("flexmojos.project.import"), FlexBundle.message("flexmojos.warning.short"), NotificationType.WARNING, listener);
    myFlexConfigNotification.notify(project);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 47 with Notification

use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.

the class Flexmojos4GenerateConfigTask method showWarningWithDetails.

private static void showWarningWithDetails(final Project project, final String details) {
    final NotificationListener listener = new NotificationListener.Adapter() {

        @Override
        protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
            Messages.showErrorDialog(project, FlexBundle.message("flexmojos4.details.start", details), FlexBundle.message("flexmojos.project.import"));
            notification.expire();
        }
    };
    new Notification("Maven", FlexBundle.message("flexmojos.project.import"), FlexBundle.message("flexmojos4.warning.with.link"), NotificationType.WARNING, listener).notify(project);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) MavenRootModelAdapter(org.jetbrains.idea.maven.importing.MavenRootModelAdapter) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 48 with Notification

use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.

the class FlexDebugProcess method openFlexUnitConnections.

private void openFlexUnitConnections(final int socketPolicyPort, final int port) {
    try {
        myPolicyFileConnection = new SwfPolicyFileConnection();
        myPolicyFileConnection.open(socketPolicyPort);
        myFlexUnitConnection = new FlexUnitConnection();
        myFlexUnitConnection.addListener(new FlexUnitConnection.Listener() {

            @Override
            public void statusChanged(FlexUnitConnection.ConnectionStatus status) {
                if (status == FlexUnitConnection.ConnectionStatus.CONNECTION_FAILED) {
                    getSession().stop();
                }
            }

            @Override
            public void onData(String line) {
                getProcessHandler().notifyTextAvailable(line + "\n", ProcessOutputTypes.STDOUT);
            }

            @Override
            public void onFinish() {
                getProcessHandler().detachProcess();
            }
        });
        myFlexUnitConnection.open(port);
    } catch (ExecutionException e) {
        Notifications.Bus.notify(new Notification(DEBUGGER_GROUP_ID, FlexBundle.message("flex.debugger.startup.error"), FlexBundle.message("flexunit.startup.error", e.getMessage()), NotificationType.ERROR), getSession().getProject());
        myFlexUnitConnection = null;
        myPolicyFileConnection = null;
    }
}
Also used : SwfPolicyFileConnection(com.intellij.lang.javascript.flex.flexunit.SwfPolicyFileConnection) FlexUnitConnection(com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection) ExecutionException(com.intellij.execution.ExecutionException) Notification(com.intellij.notification.Notification)

Example 49 with Notification

use of com.intellij.notification.Notification in project intellij-plugins by JetBrains.

the class DesignerApplicationManager method notifyUser.

static void notifyUser(boolean debug, @NotNull String text, @NotNull Project project, @Nullable final Consumer<String> handler) {
    Notification notification = new Notification(FlashUIDesignerBundle.message("plugin.name"), getOpenActionTitle(debug), text, NotificationType.ERROR, handler == null ? null : new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
                return;
            }
            notification.expire();
            if ("help".equals(event.getDescription())) {
                HelpManager.getInstance().invokeHelp("flex.ui.designer.launch");
            } else {
                handler.consume(event.getDescription());
            }
        }
    });
    notification.notify(project);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 50 with Notification

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

the class InstantRunTest method changeManifest.

/**
   * Verifies that instant run works as expected when AndroidManifest is changed.
   * <p>
   * This is run to qualify releases. Please involve the test team in substantial changes.
   * <p>
   * TR ID: C14581585
   * <p>
   *   <pre>
   *   Test Steps:
   *   1. Import SimpleApplication.
   *   2. Update the gradle plugin version if necessary for testing purpose.
   *   3. Create an AVD with a system image API 21 or above.
   *   4. Run on the AVD
   *   5. Verify 1.
   *   6. Edit AndroidManifest.
   *   7. Run again.
   *   8. Verify 2.
   *   Verify:
   *   1. Make sure the right app is installed and started in Run tool window.
   *   2. Make sure the instant run is applied in EventLog tool window.
   *   </pre>
   */
@RunIn(TestGroup.QA)
@Test
public void changeManifest() throws Exception {
    IdeFrameFixture ideFrameFixture = guiTest.importSimpleApplication();
    updateGradleVersion(guiTest.getProjectPath());
    createAVD();
    ideFrameFixture.runApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
    ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
    ideFrameFixture.getEditor().open("app/src/main/AndroidManifest.xml", EditorFixture.Tab.EDITOR).moveBetween("", "<application").enterText("<uses-permission android:name=\"android.permission.INTERNET\" /\n");
    ideFrameFixture.waitForGradleProjectSyncToFinish().findRunApplicationButton().click();
    ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
    Wait.seconds(1).expecting("The notification is showing").until(() -> {
        try {
            Notification notification = Iterables.getLast(EventLog.getLogModel(ideFrameFixture.getProject()).getNotifications());
            assertThat(notification.getContent()).matches(INSTANT_RUN_NOTIFICATION_REGEX);
            return true;
        } catch (Exception e) {
            System.out.println(e.getClass().toString());
            return false;
        }
    });
}
Also used : IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) PatternTextMatcher(org.fest.swing.util.PatternTextMatcher) Notification(com.intellij.notification.Notification) IOException(java.io.IOException) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

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