Search in sources :

Example 46 with IdeFrame

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

the class LineEndingsManager method updateStatusBar.

private void updateStatusBar() {
    ApplicationManager.getApplication().invokeLater(() -> {
        IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject);
        StatusBar statusBar = frame != null ? frame.getStatusBar() : null;
        StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;
        if (widget instanceof LineSeparatorPanel) {
            FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(myProject), null, null, null, null);
            ((LineSeparatorPanel) widget).selectionChanged(event);
        }
    });
}
Also used : StatusBarWidget(com.intellij.openapi.wm.StatusBarWidget) LineSeparatorPanel(com.intellij.openapi.wm.impl.status.LineSeparatorPanel) FileEditorManagerEvent(com.intellij.openapi.fileEditor.FileEditorManagerEvent) IdeFrame(com.intellij.openapi.wm.IdeFrame) StatusBar(com.intellij.openapi.wm.StatusBar)

Example 47 with IdeFrame

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

the class EditorConfigConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    myEnabled = new JBCheckBox("Enable EditorConfig support");
    final JPanel result = new JPanel();
    result.setLayout(new BoxLayout(result, BoxLayout.LINE_AXIS));
    final JPanel panel = new JPanel(new VerticalFlowLayout());
    result.setBorder(IdeBorderFactory.createTitledBorder("EditorConfig", false));
    panel.add(myEnabled);
    final JLabel warning = new JLabel("EditorConfig may override the IDE code style settings");
    warning.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
    warning.setBorder(IdeBorderFactory.createEmptyBorder(0, 20, 0, 0));
    panel.add(warning);
    panel.setAlignmentY(Component.TOP_ALIGNMENT);
    result.add(panel);
    final JButton export = new JButton("Export");
    export.addActionListener((event) -> {
        final Component parent = UIUtil.findUltimateParent(result);
        if (parent instanceof IdeFrame) {
            Utils.export(((IdeFrame) parent).getProject());
        }
    });
    export.setAlignmentY(Component.TOP_ALIGNMENT);
    result.add(export);
    return result;
}
Also used : IdeFrame(com.intellij.openapi.wm.IdeFrame) JBCheckBox(com.intellij.ui.components.JBCheckBox) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout) Nullable(org.jetbrains.annotations.Nullable)

Example 48 with IdeFrame

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

the class DocumentProblemManager method report.

// Notification.notify is not suitable for us -
// 1) it is not suitable for content with <ul> tags (due to <p> around message, see NotificationsUtil.buildHtml)
// 2) it is buggy - balloon disappeared while user selects message text
// 3) in any case, event log cannot show our message, may be due to <ul> tags?
// todo fix platform Notification impl or how use it correctly?
public void report(@Nullable final Project project, String message, MessageType messageType) {
    //Notification notification = new Notification(FlashUIDesignerBundle.message("plugin.name"),
    //  title == null ? FlashUIDesignerBundle.message("plugin.name") : title, message, NotificationType.ERROR);
    //notification.notify(project);
    final Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType, BrowserHyperlinkListener.INSTANCE).setShowCallout(false).setHideOnAction(false).createBalloon();
    ApplicationManager.getApplication().invokeLater(() -> {
        Window window = WindowManager.getInstance().getFrame(project);
        if (window == null) {
            window = JOptionPane.getRootFrame();
        }
        if (window instanceof IdeFrame) {
            BalloonLayout layout = ((IdeFrame) window).getBalloonLayout();
            if (layout != null) {
                layout.add(balloon);
            }
        }
    });
}
Also used : BalloonLayout(com.intellij.ui.BalloonLayout) Balloon(com.intellij.openapi.ui.popup.Balloon) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Example 49 with IdeFrame

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

the class DartFeedbackBuilder method showErrorNotification.

private static void showErrorNotification(@NotNull Notification notification, @NotNull Project project) {
    // Adapted from IdeMessagePanel.showErrorNotification()
    IdeFrame myFrame = WindowManager.getInstance().getIdeFrame(project);
    BalloonLayout layout = myFrame.getBalloonLayout();
    assert layout != null;
    BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
    layoutData.fadeoutTime = 5000;
    layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
    layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
    Balloon balloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
    layout.add(balloon);
}
Also used : BalloonLayout(com.intellij.ui.BalloonLayout) BalloonLayoutData(com.intellij.ui.BalloonLayoutData) Balloon(com.intellij.openapi.ui.popup.Balloon) JBColor(com.intellij.ui.JBColor) 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