Search in sources :

Example 21 with IdeFrame

use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.

the class PluginManager method reportPluginError.

public static void reportPluginError() {
    if (myPluginError != null) {
        String title = IdeBundle.message("title.plugin.error");
        Notifications.Bus.notify(new Notification(title, title, myPluginError, NotificationType.ERROR, new NotificationListener() {

            @SuppressWarnings("AssignmentToStaticFieldFromInstanceMethod")
            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                notification.expire();
                String description = event.getDescription();
                if (EDIT.equals(description)) {
                    PluginManagerConfigurable configurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance());
                    IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
                    ShowSettingsUtil.getInstance().editConfigurable((JFrame) ideFrame, configurable);
                    return;
                }
                List<String> disabledPlugins = getDisabledPlugins();
                if (myPlugins2Disable != null && DISABLE.equals(description)) {
                    for (String pluginId : myPlugins2Disable) {
                        if (!disabledPlugins.contains(pluginId)) {
                            disabledPlugins.add(pluginId);
                        }
                    }
                } else if (myPlugins2Enable != null && ENABLE.equals(description)) {
                    disabledPlugins.removeAll(myPlugins2Enable);
                    PluginManagerMain.notifyPluginsUpdated(null);
                }
                try {
                    saveDisabledPlugins(disabledPlugins, false);
                } catch (IOException ignore) {
                }
                myPlugins2Enable = null;
                myPlugins2Disable = null;
            }
        }));
        myPluginError = null;
    }
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) IOException(java.io.IOException) NotNull(org.jetbrains.annotations.NotNull) IdeFrame(com.intellij.openapi.wm.IdeFrame) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 22 with IdeFrame

use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.

the class WindowSystemPlaybackCall method findProject.

public static AsyncResult<Project> findProject() {
    final AsyncResult<Project> project = new AsyncResult<>();
    final IdeFocusManager fm = IdeFocusManager.getGlobalInstance();
    fm.doWhenFocusSettlesDown(() -> {
        Component parent = UIUtil.findUltimateParent(fm.getFocusOwner());
        if (parent instanceof IdeFrame) {
            IdeFrame frame = (IdeFrame) parent;
            if (frame.getProject() != null) {
                project.setDone(frame.getProject());
                return;
            }
        }
        project.setRejected();
    });
    return project;
}
Also used : Project(com.intellij.openapi.project.Project) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager) AsyncResult(com.intellij.openapi.util.AsyncResult) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Example 23 with IdeFrame

use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.

the class DumbServiceImpl method showDumbModeNotification.

@Override
public void showDumbModeNotification(@NotNull final String message) {
    UIUtil.invokeLaterIfNeeded(() -> {
        final IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(myProject);
        if (ideFrame != null) {
            StatusBarEx statusBar = (StatusBarEx) ideFrame.getStatusBar();
            statusBar.notifyProgressByBalloon(MessageType.WARNING, message, null, null);
        }
    });
}
Also used : IdeFrame(com.intellij.openapi.wm.IdeFrame) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Example 24 with IdeFrame

use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.

the class AnnotateDiffViewerAction method showNotification.

private static void showNotification(@NotNull DiffViewerBase viewer, @NotNull Notification notification) {
    JComponent component = viewer.getComponent();
    Window window = UIUtil.getWindow(component);
    if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
        notification.notify(viewer.getProject());
        return;
    }
    Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true, BalloonLayoutData.fullContent(), viewer);
    Dimension componentSize = component.getSize();
    Dimension balloonSize = balloon.getPreferredSize();
    int width = Math.min(balloonSize.width, componentSize.width);
    int height = Math.min(balloonSize.height, componentSize.height);
    // top-right corner, 20px to the edges
    RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
    balloon.show(point, Balloon.Position.above);
}
Also used : Balloon(com.intellij.openapi.ui.popup.Balloon) RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) IdeFrame(com.intellij.openapi.wm.IdeFrame) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 25 with IdeFrame

use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.

the class GitCheckoutProcessor method checkout.

@Override
public boolean checkout(@NotNull final Map<String, String> parameters, @NotNull final VirtualFile parentDirectory, @NotNull String directoryName) {
    ProgressManager.getInstance().getProgressIndicator().setText(DvcsBundle.message("cloning.repository", parameters));
    IdeFrame frame = IdeFocusManager.getGlobalInstance().getLastFocusedFrame();
    Project project = frame == null || frame.getProject() == null ? ProjectManager.getInstance().getDefaultProject() : frame.getProject();
    return GitCheckoutProvider.doClone(project, Git.getInstance(), directoryName, parentDirectory.getPath(), parameters.get("url"));
}
Also used : Project(com.intellij.openapi.project.Project) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Aggregations

IdeFrame (com.intellij.openapi.wm.IdeFrame)49 Project (com.intellij.openapi.project.Project)13 Nullable (org.jetbrains.annotations.Nullable)7 Balloon (com.intellij.openapi.ui.popup.Balloon)5 IdeFocusManager (com.intellij.openapi.wm.IdeFocusManager)5 NotNull (org.jetbrains.annotations.NotNull)5 ProgressManager (com.intellij.openapi.progress.ProgressManager)4 MessageType (com.intellij.openapi.ui.MessageType)3 StatusBarEx (com.intellij.openapi.wm.ex.StatusBarEx)3 IdeFrameImpl (com.intellij.openapi.wm.impl.IdeFrameImpl)3 RelativePoint (com.intellij.ui.awt.RelativePoint)3 HyperlinkEvent (javax.swing.event.HyperlinkEvent)3 Application (com.intellij.openapi.application.Application)2 ApplicationActivationListener (com.intellij.openapi.application.ApplicationActivationListener)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 ModalityState (com.intellij.openapi.application.ModalityState)2 Extensions (com.intellij.openapi.extensions.Extensions)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Ref (com.intellij.openapi.util.Ref)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2