Search in sources :

Example 41 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 42 with IdeFrame

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

the class PopupUtil method getActiveComponent.

public static Component getActiveComponent() {
    Window[] windows = Window.getWindows();
    for (Window each : windows) {
        if (each.isActive()) {
            return each;
        }
    }
    final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
    if (frame != null)
        return frame.getComponent();
    return JOptionPane.getRootFrame();
}
Also used : IdeFrame(com.intellij.openapi.wm.IdeFrame)

Example 43 with IdeFrame

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

the class EditorsSplitters method getFrame.

protected IdeFrame getFrame(Project project) {
    final WindowManagerEx windowManagerEx = WindowManagerEx.getInstanceEx();
    final IdeFrame frame = windowManagerEx.getFrame(project);
    LOG.assertTrue(ApplicationManager.getApplication().isUnitTestMode() || frame != null);
    return frame;
}
Also used : WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx) IdeFrame(com.intellij.openapi.wm.IdeFrame)

Example 44 with IdeFrame

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

the class RenameProcessor method performRefactoring.

@Override
public void performRefactoring(@NotNull UsageInfo[] usages) {
    List<Runnable> postRenameCallbacks = new ArrayList<>();
    final MultiMap<PsiElement, UsageInfo> classified = classifyUsages(myAllRenames.keySet(), usages);
    for (final PsiElement element : myAllRenames.keySet()) {
        String newName = myAllRenames.get(element);
        final RefactoringElementListener elementListener = getTransaction().getElementListener(element);
        final RenamePsiElementProcessor renamePsiElementProcessor = RenamePsiElementProcessor.forElement(element);
        Runnable postRenameCallback = renamePsiElementProcessor.getPostRenameCallback(element, newName, elementListener);
        final Collection<UsageInfo> infos = classified.get(element);
        try {
            RenameUtil.doRename(element, newName, infos.toArray(new UsageInfo[infos.size()]), myProject, elementListener);
        } catch (final IncorrectOperationException e) {
            RenameUtil.showErrorMessage(e, element, myProject);
            return;
        }
        if (postRenameCallback != null) {
            postRenameCallbacks.add(postRenameCallback);
        }
    }
    for (Runnable runnable : postRenameCallbacks) {
        runnable.run();
    }
    List<NonCodeUsageInfo> nonCodeUsages = new ArrayList<>();
    for (UsageInfo usage : usages) {
        if (usage instanceof NonCodeUsageInfo) {
            nonCodeUsages.add((NonCodeUsageInfo) usage);
        }
    }
    myNonCodeUsages = nonCodeUsages.toArray(new NonCodeUsageInfo[nonCodeUsages.size()]);
    if (!mySkippedUsages.isEmpty()) {
        if (!ApplicationManager.getApplication().isUnitTestMode() && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
            ApplicationManager.getApplication().invokeLater(() -> {
                final IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(myProject);
                if (ideFrame != null) {
                    StatusBarEx statusBar = (StatusBarEx) ideFrame.getStatusBar();
                    HyperlinkListener listener = new HyperlinkListener() {

                        @Override
                        public void hyperlinkUpdate(HyperlinkEvent e) {
                            if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED)
                                return;
                            Messages.showMessageDialog("<html>Following usages were safely skipped:<br>" + StringUtil.join(mySkippedUsages, unresolvableCollisionUsageInfo -> unresolvableCollisionUsageInfo.getDescription(), "<br>") + "</html>", "Not All Usages Were Renamed", null);
                        }
                    };
                    statusBar.notifyProgressByBalloon(MessageType.WARNING, "<html><body>Unable to rename certain usages. <a href=\"\">Browse</a></body></html>", null, listener);
                }
            }, ModalityState.NON_MODAL);
        }
    }
}
Also used : DescriptiveNameUtil(com.intellij.lang.findUsages.DescriptiveNameUtil) IdeFrame(com.intellij.openapi.wm.IdeFrame) java.util(java.util) MessageType(com.intellij.openapi.ui.MessageType) HyperlinkEvent(javax.swing.event.HyperlinkEvent) ModalityState(com.intellij.openapi.application.ModalityState) RefactoringElementListener(com.intellij.refactoring.listeners.RefactoringElementListener) NonNls(org.jetbrains.annotations.NonNls) Computable(com.intellij.openapi.util.Computable) UsageInfo(com.intellij.usageView.UsageInfo) RefactoringBundle(com.intellij.refactoring.RefactoringBundle) BaseRefactoringProcessor(com.intellij.refactoring.BaseRefactoringProcessor) RefactoringEventListener(com.intellij.refactoring.listeners.RefactoringEventListener) AutomaticRenamer(com.intellij.refactoring.rename.naming.AutomaticRenamer) ContainerUtil(com.intellij.util.containers.ContainerUtil) CopyFilesOrDirectoriesHandler(com.intellij.refactoring.copy.CopyFilesOrDirectoriesHandler) Project(com.intellij.openapi.project.Project) Messages(com.intellij.openapi.ui.Messages) RefactoringEventData(com.intellij.refactoring.listeners.RefactoringEventData) Logger(com.intellij.openapi.diagnostic.Logger) MultiMap(com.intellij.util.containers.MultiMap) Extensions(com.intellij.openapi.extensions.Extensions) ProgressManager(com.intellij.openapi.progress.ProgressManager) HyperlinkListener(javax.swing.event.HyperlinkListener) IncorrectOperationException(com.intellij.util.IncorrectOperationException) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx) StringUtil(com.intellij.openapi.util.text.StringUtil) WindowManager(com.intellij.openapi.wm.WindowManager) MoveRenameUsageInfo(com.intellij.refactoring.util.MoveRenameUsageInfo) LightElement(com.intellij.psi.impl.light.LightElement) AutomaticRenamerFactory(com.intellij.refactoring.rename.naming.AutomaticRenamerFactory) UsageViewUtil(com.intellij.usageView.UsageViewUtil) UsageViewDescriptor(com.intellij.usageView.UsageViewDescriptor) CommonRefactoringUtil(com.intellij.refactoring.util.CommonRefactoringUtil) Nullable(org.jetbrains.annotations.Nullable) NonCodeUsageInfo(com.intellij.refactoring.util.NonCodeUsageInfo) ConflictsDialog(com.intellij.refactoring.ui.ConflictsDialog) ApplicationManager(com.intellij.openapi.application.ApplicationManager) RelatedUsageInfo(com.intellij.refactoring.util.RelatedUsageInfo) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) HyperlinkEvent(javax.swing.event.HyperlinkEvent) RefactoringElementListener(com.intellij.refactoring.listeners.RefactoringElementListener) NonCodeUsageInfo(com.intellij.refactoring.util.NonCodeUsageInfo) IdeFrame(com.intellij.openapi.wm.IdeFrame) HyperlinkListener(javax.swing.event.HyperlinkListener) IncorrectOperationException(com.intellij.util.IncorrectOperationException) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx) UsageInfo(com.intellij.usageView.UsageInfo) MoveRenameUsageInfo(com.intellij.refactoring.util.MoveRenameUsageInfo) NonCodeUsageInfo(com.intellij.refactoring.util.NonCodeUsageInfo) RelatedUsageInfo(com.intellij.refactoring.util.RelatedUsageInfo)

Example 45 with IdeFrame

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

the class HttpConfigurable method writeExternal.

@Deprecated
public void writeExternal(Element element) throws WriteExternalException {
    XmlSerializer.serializeInto(getState(), element);
    if (USE_PROXY_PAC && USE_HTTP_PROXY && !ApplicationManager.getApplication().isDisposed()) {
        ApplicationManager.getApplication().invokeLater(() -> {
            IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
            if (frame != null) {
                USE_PROXY_PAC = false;
                Messages.showMessageDialog(frame.getComponent(), "Proxy: both 'use proxy' and 'autodetect proxy' settings were set." + "\nOnly one of these options should be selected.\nPlease re-configure.", "Proxy Setup", Messages.getWarningIcon());
                editConfigurable(frame.getComponent());
            }
        }, ModalityState.NON_MODAL);
    }
}
Also used : 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