本文整理汇总了Java中com.intellij.openapi.wm.IdeFrame类的典型用法代码示例。如果您正苦于以下问题:Java IdeFrame类的具体用法?Java IdeFrame怎么用?Java IdeFrame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IdeFrame类属于com.intellij.openapi.wm包,在下文中一共展示了IdeFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSettingsChange
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
@Override
@SuppressWarnings("ConstantConditions")
public void onSettingsChange() {
prepareTemplateSettings();
for (IdeFrame frame : WindowManager.getInstance().getAllProjectFrames()) {
if (frame.getProject() != null) {
String projectTitle = getProjectTitle(frame.getProject());
((IdeFrameImpl)frame).setTitle(projectTitle);
try {
File currentFile = (File)((IdeFrameImpl) frame).getRootPane().getClientProperty("Window.documentFile");
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByIoFile(currentFile);
IdeFrameImpl.updateTitle((IdeFrameImpl) frame, projectTitle, getFileTitle(frame.getProject(), virtualFile), currentFile);
} catch (Exception e) {
IdeFrameImpl.updateTitle((IdeFrameImpl) frame, projectTitle, null, null);
}
}
}
}
示例2: centerOnIdeFrameOrScreen
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
private void centerOnIdeFrameOrScreen(@NotNull AnActionEvent actionEvent) {
WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
IdeFrame frame = windowManager.getFrame(actionEvent.getProject());
int x = 0;
int y = 0;
if (frame != null) {
Component frameComponent = frame.getComponent();
if (frameComponent != null) {
Point origin = frameComponent.getLocationOnScreen();
x = (int)(origin.getX() + (frameComponent.getWidth() - this.getWidth()) / 2);
y = (int)(origin.getY() + (frameComponent.getHeight() - this.getHeight()) / 2);
}
}
else {
Rectangle screenBounds = windowManager.getScreenBounds();
x = (int)(screenBounds.getX() + (screenBounds.getWidth() - this.getWidth()) / 2);
y = (int)(screenBounds.getY() + (screenBounds.getHeight() - this.getHeight()) / 2);
}
this.setLocation(x, y);
}
示例3: showIncomingChatInvitation
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public void showIncomingChatInvitation(@NotNull ChatInvitation chatInvitation, @NotNull IncomingChatInvitationNotification notification) {
IncomingChatInvitationPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingChatInvitationPopup(chatInvitation);
IncomingChatInvitationPopup popup = new IncomingChatInvitationPopup(popupModel);
IncomingChatInvitationPopupListener incomingChatInvitationPopupListener = new IncomingChatInvitationPopupListener(this, chatInvitation);
ListenerService.putListenerToComponent(popup, IIncomingChatInvitationPopup.Listener.class, incomingChatInvitationPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例4: showIncomingChatInvitation
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public void showIncomingChatInvitation(@NotNull IncomingAnswer incomingTip, @NotNull IncomingTipNotification notification) {
IIncomingTipPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingTipPopup(incomingTip);
IncomingTipPopup popup = new IncomingTipPopup(popupModel);
DataService.putData(popup, TrackingKeys.Location, new Locations.TipAnswerNotification(incomingTip.getSolution().getId()));
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
data.put(popup, incomingTip);
notifications.put(popup, notification);
balloons.put(popup, balloon);
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例5: showIncomingHelpRequest
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public void showIncomingHelpRequest(@NotNull IncomingHelpRequest helpRequest, @NotNull IncomingHelpRequestNotification notification) {
IHelpRequestPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertHelpRequestPopup(helpRequest);
HelpRequestPopup popup = new HelpRequestPopup(popupModel);
DataService.putData(popup, TrackingKeys.Location, new Locations.HelpRequestNotification(helpRequest.getMatch().getHelpRequest().getId()));
DataService.putData(popup, TrackingKeys.WriteTipTransaction, Funnels.newTransactionId());
HelpRequestPopupListener helpRequestPopupListener = new HelpRequestPopupListener(this);
ListenerService.putListenerToComponent(popup, IHelpRequestPopup.Listener.class, helpRequestPopupListener);
BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
balloonBuilder.setShadow(true);
IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
RelativePoint pointToShowPopup = null;
if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
Balloon balloon = balloonBuilder.createBalloon();
data.put(popup, helpRequest);
notifications.put(popup, notification);
balloons.put(popup, balloon);
balloon.show(pointToShowPopup, Balloon.Position.atLeft);
TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
示例6: applicationActivated
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
@Override
public void applicationActivated(final IdeFrame ideFrame) {
final Runnable processClipboard = new Runnable() {
@Override
public void run() {
final String clipboard = AnalyzeStacktraceUtil.getTextInClipboard();
if (clipboard != null && clipboard.length() < MAX_STACKTRACE_SIZE && !clipboard.equals(stacktrace)) {
stacktrace = clipboard;
final Project project = ideFrame.getProject();
if (project != null && isStacktrace(stacktrace)) {
final UnscrambleDialog dialog = new UnscrambleDialog(project);
dialog.createNormalizeTextAction().actionPerformed(null);
dialog.doOKAction();
}
}
}
};
if (Patches.SLOW_GETTING_CLIPBOARD_CONTENTS) {
//IDEA's clipboard is synchronized with the system clipboard on frame activation so we need to postpone clipboard processing
new Alarm().addRequest(processClipboard, 300);
}
else {
processClipboard.run();
}
}
示例7: showBalloonForActiveFrame
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public static void showBalloonForActiveFrame(@NotNull final String message, final MessageType type) {
final Runnable runnable = new Runnable() {
public void run() {
final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
if (frame == null) {
final Project[] projects = ProjectManager.getInstance().getOpenProjects();
final Project project = projects == null || projects.length == 0 ? ProjectManager.getInstance().getDefaultProject() : projects[0];
final JFrame jFrame = WindowManager.getInstance().getFrame(project);
if (jFrame != null) {
showBalloonForComponent(jFrame, message, type, true, project);
} else {
LOG.info("Can not get component to show message: " + message);
}
return;
}
showBalloonForComponent(frame.getComponent(), message, type, true, frame.getProject());
}
};
UIUtil.invokeLaterIfNeeded(runnable);
}
示例8: selectInNavBar
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
private static void selectInNavBar() {
DataManager.getInstance().getDataContextFromFocus()
.doWhenDone(new Consumer<DataContext>() {
@Override
public void consume(DataContext context) {
final IdeFrame frame = IdeFrame.KEY.getData(context);
if (frame != null) {
final IdeRootPaneNorthExtension navBarExt = frame.getNorthExtension(NavBarRootPaneExtension.NAV_BAR);
if (navBarExt != null) {
final JComponent c = navBarExt.getComponent();
final NavBarPanel panel = (NavBarPanel)c.getClientProperty("NavBarPanel");
panel.rebuildAndSelectTail(true);
}
}
}
});
}
示例9: execute
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
@Nullable
@Override
public String execute(@NotNull QueryStringDecoder urlDecoder, @NotNull FullHttpRequest request, @NotNull ChannelHandlerContext context)
throws IOException {
final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame();
if (frame instanceof Window) {
sendOk(request, context);
Runnable runnable = new Runnable() {
public void run() {
Window window = (Window)frame;
window.toFront();
window.requestFocusInWindow();
AppIcon.getInstance().requestFocus(frame);
}
};
//noinspection SSBasedInspection
SwingUtilities.invokeLater(runnable);
return "Success";
}
sendStatus(HttpResponseStatus.NOT_FOUND, false, context.channel());
return "Can't find IDE Frame";
}
示例10: isFullScreenSupported
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public static boolean isFullScreenSupported() {
if (X11 == null) return false;
if (Patches.SUN_BUG_ID_8013359) {
String wmName = getWmName();
if (wmName != null &&
(wmName.startsWith("Mutter") || newHashSet("Metacity", "GNOME Shell", "Muffin", "Marco").contains(wmName))) {
return false; // Metacity clones suffer from child window placement bug
}
}
IdeFrame[] frames = WindowManager.getInstance().getAllProjectFrames();
if (frames.length == 0) return true; // no frame to check the property so be optimistic here
return frames[0] instanceof JFrame && hasWindowProperty((JFrame)frames[0], X11.NET_WM_ALLOWED_ACTIONS, X11.NET_WM_ACTION_FULLSCREEN);
}
示例11: getIdeFrame
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
@Override
public IdeFrame getIdeFrame(@Nullable final Project project) {
if (project != null) {
return getFrame(project);
}
final Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
final Component parent = UIUtil.findUltimateParent(window);
if (parent instanceof IdeFrame) return (IdeFrame)parent;
final Frame[] frames = Frame.getFrames();
for (Frame each : frames) {
if (each instanceof IdeFrame) {
return (IdeFrame)each;
}
}
return null;
}
示例12: updateFileName
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
void updateFileName(final VirtualFile updatedFile) {
final EditorWindow[] windows = getWindows();
for (int i = 0; i != windows.length; ++ i) {
windows [i].updateFileName(updatedFile);
}
Project project = myManager.getProject();
final IdeFrame frame = getFrame(project);
if (frame != null) {
VirtualFile file = getCurrentFile();
File ioFile = file == null ? null : new File(file.getPresentableUrl());
String fileTitle = null;
if (file != null) {
fileTitle = DumbService.isDumb(project) ? file.getName()
: FrameTitleBuilder.getInstance().getFileTitle(project, file);
}
frame.setFileTitle(fileTitle, ioFile);
}
}
示例13: updateStatusBar
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
private void updateStatusBar() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
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);
}
}
});
}
示例14: PlaybackRunner
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
public PlaybackRunner(String script, StatusCallback callback, final boolean useDirectActionCall, boolean stopOnAppDeactivation, boolean useTypingTargets) {
myScript = script;
myCallback = callback;
myUseDirectActionCall = useDirectActionCall;
myUseTypingTargets = useTypingTargets;
myStopOnAppDeactivation = stopOnAppDeactivation;
myAppListener = new ApplicationActivationListener.Adapter() {
@Override
public void applicationDeactivated(IdeFrame ideFrame) {
if (myStopOnAppDeactivation) {
myCallback.message(null, "App lost focus, stopping...", StatusCallback.Type.message);
stop();
}
}
};
}
示例15: fillMenu
import com.intellij.openapi.wm.IdeFrame; //导入依赖的package包/类
private void fillMenu() {
DataContext context;
boolean mayContextBeInvalid;
if (myContext != null) {
context = myContext;
mayContextBeInvalid = false;
}
else {
@SuppressWarnings("deprecation") DataContext contextFromFocus = DataManager.getInstance().getDataContext();
context = contextFromFocus;
if (PlatformDataKeys.CONTEXT_COMPONENT.getData(context) == null) {
IdeFrame frame = UIUtil.getParentOfType(IdeFrame.class, this);
context = DataManager.getInstance().getDataContext(IdeFocusManager.getGlobalInstance().getLastFocusedFor(frame));
}
mayContextBeInvalid = true;
}
Utils.fillMenu(myGroup.getAction(), this, myMnemonicEnabled, myPresentationFactory, context, myPlace, true, mayContextBeInvalid);
}