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);
}
});
}
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();
}
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;
}
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);
}
}
}
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);
}
}
Aggregations