Search in sources :

Example 1 with ExternalProjectsView

use of com.intellij.openapi.externalSystem.view.ExternalProjectsView in project intellij-community by JetBrains.

the class ExternalSystemNotificationManager method showNotification.

public void showNotification(@NotNull final ProjectSystemId externalSystemId, @NotNull final NotificationData notificationData) {
    myUpdater.submit(() -> {
        if (myProject.isDisposed())
            return;
        final Application app = ApplicationManager.getApplication();
        Runnable action = () -> {
            if (!initializedExternalSystem.contains(externalSystemId)) {
                app.runWriteAction(() -> {
                    if (myProject.isDisposed())
                        return;
                    ExternalSystemUtil.ensureToolWindowContentInitialized(myProject, externalSystemId);
                    initializedExternalSystem.add(externalSystemId);
                });
            }
            if (myProject.isDisposed())
                return;
            NotificationGroup group;
            if (notificationData.getBalloonGroup() == null) {
                ExternalProjectsView externalProjectsView = ExternalProjectsManager.getInstance(myProject).getExternalProjectsView(externalSystemId);
                group = externalProjectsView instanceof ExternalProjectsViewImpl ? ((ExternalProjectsViewImpl) externalProjectsView).getNotificationGroup() : null;
            } else {
                final NotificationGroup registeredGroup = NotificationGroup.findRegisteredGroup(notificationData.getBalloonGroup());
                group = registeredGroup != null ? registeredGroup : NotificationGroup.balloonGroup(notificationData.getBalloonGroup());
            }
            if (group == null)
                return;
            final Notification notification = group.createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType(), notificationData.getListener());
            myNotifications.add(notification);
            if (notificationData.isBalloonNotification()) {
                applyNotification(notification);
            } else {
                addMessage(notification, externalSystemId, notificationData);
            }
        };
        app.invokeLater(action, ModalityState.defaultModalityState(), myProject.getDisposed());
    });
}
Also used : ExternalProjectsViewImpl(com.intellij.openapi.externalSystem.view.ExternalProjectsViewImpl) ExternalProjectsView(com.intellij.openapi.externalSystem.view.ExternalProjectsView) NotificationGroup(com.intellij.notification.NotificationGroup) Application(com.intellij.openapi.application.Application) Notification(com.intellij.notification.Notification)

Example 2 with ExternalProjectsView

use of com.intellij.openapi.externalSystem.view.ExternalProjectsView in project intellij-community by JetBrains.

the class ExternalProjectsManager method getState.

@NotNull
@Override
public ExternalProjectsState getState() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    for (ExternalProjectsView externalProjectsView : myProjectsViews) {
        if (externalProjectsView instanceof ExternalProjectsViewImpl) {
            final ExternalProjectsViewState externalProjectsViewState = ((ExternalProjectsViewImpl) externalProjectsView).getState();
            final ExternalProjectsState.State state = myState.getExternalSystemsState().get(externalProjectsView.getSystemId().getId());
            assert state != null;
            state.setProjectsViewState(externalProjectsViewState);
        }
    }
    return myState;
}
Also used : ExternalProjectsViewImpl(com.intellij.openapi.externalSystem.view.ExternalProjectsViewImpl) ExternalProjectsView(com.intellij.openapi.externalSystem.view.ExternalProjectsView) ExternalProjectsViewState(com.intellij.openapi.externalSystem.view.ExternalProjectsViewState) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExternalProjectsView (com.intellij.openapi.externalSystem.view.ExternalProjectsView)2 ExternalProjectsViewImpl (com.intellij.openapi.externalSystem.view.ExternalProjectsViewImpl)2 Notification (com.intellij.notification.Notification)1 NotificationGroup (com.intellij.notification.NotificationGroup)1 Application (com.intellij.openapi.application.Application)1 ExternalProjectsViewState (com.intellij.openapi.externalSystem.view.ExternalProjectsViewState)1 NotNull (org.jetbrains.annotations.NotNull)1