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);
}
}
});
}
use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.
the class ActionMacroManager method playbackMacro.
private void playbackMacro(ActionMacro macro) {
final IdeFrame frame = WindowManager.getInstance().getIdeFrame(null);
assert frame != null;
StringBuffer script = new StringBuffer();
ActionMacro.ActionDescriptor[] actions = macro.getActions();
for (ActionMacro.ActionDescriptor each : actions) {
each.generateTo(script);
}
final PlaybackRunner runner = new PlaybackRunner(script.toString(), new PlaybackRunner.StatusCallback.Edt() {
@Override
public void messageEdt(PlaybackContext context, String text, Type type) {
if (type == Type.message || type == Type.error) {
StatusBar statusBar = frame.getStatusBar();
if (statusBar != null) {
if (context != null) {
text = "Line " + context.getCurrentLine() + ": " + text;
}
statusBar.setInfo(text);
}
}
}
}, Registry.is("actionSystem.playback.useDirectActionCall"), true, Registry.is("actionSystem.playback.useTypingTargets"));
myIsPlaying = true;
runner.run().doWhenDone(() -> {
StatusBar statusBar = frame.getStatusBar();
statusBar.setInfo("Script execution finished");
}).doWhenProcessed(() -> myIsPlaying = false);
}
use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.
the class IdeEventQueue method storeLastFocusedComponent.
private static void storeLastFocusedComponent(@NotNull WindowEvent we) {
final Window eventWindow = we.getWindow();
if (we.getID() == WindowEvent.WINDOW_DEACTIVATED || we.getID() == WindowEvent.WINDOW_LOST_FOCUS) {
Component frame = UIUtil.findUltimateParent(eventWindow);
Component focusOwnerInDeactivatedWindow = eventWindow.getMostRecentFocusOwner();
IdeFrame[] allProjectFrames = WindowManager.getInstance().getAllProjectFrames();
if (focusOwnerInDeactivatedWindow != null) {
for (IdeFrame ideFrame : allProjectFrames) {
JFrame aFrame = WindowManager.getInstance().getFrame(ideFrame.getProject());
if (aFrame.equals(frame)) {
IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance();
if (focusManager instanceof FocusManagerImpl) {
((FocusManagerImpl) focusManager).setLastFocusedAtDeactivation(ideFrame, focusOwnerInDeactivatedWindow);
}
}
}
}
}
}
use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.
the class ApplicationActivationStateManager method setActive.
private static boolean setActive(Application application, Window window) {
IdeFrame ideFrame = getIdeFrameFromWindow(window);
state = State.ACTIVE;
LOG.debug("The app is in the active state");
if (ideFrame != null) {
application.getMessageBus().syncPublisher(ApplicationActivationListener.TOPIC).applicationActivated(ideFrame);
return true;
}
return false;
}
use of com.intellij.openapi.wm.IdeFrame in project intellij-community by JetBrains.
the class CommandLineProcessor method findBestProject.
@NotNull
private static Project findBestProject(VirtualFile virtualFile, Project[] projects) {
for (Project aProject : projects) {
if (ProjectRootManager.getInstance(aProject).getFileIndex().isInContent(virtualFile)) {
return aProject;
}
}
IdeFrame frame = IdeFocusManager.getGlobalInstance().getLastFocusedFrame();
Project project = frame == null ? null : frame.getProject();
return project != null ? project : projects[0];
}
Aggregations