本文整理汇总了Java中com.intellij.openapi.wm.IdeFrame.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java IdeFrame.getComponent方法的具体用法?Java IdeFrame.getComponent怎么用?Java IdeFrame.getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.wm.IdeFrame
的用法示例。
在下文中一共展示了IdeFrame.getComponent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: remove
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
public void remove(IdeFrame frame) {
if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;
if (SystemInfo.isMacOSSnowLeopard) {
try {
Object listener = myListeners.get(frame);
JComponent cmp = frame.getComponent();
myListeners.remove(frame);
if (listener != null && cmp != null && cmp.isShowing()) {
((MacGestureAdapter)listener).remove(cmp);
}
}
catch (Throwable e) {
LOG.debug(e);
}
}
}
示例3: updateInWelcomePage
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
public static void updateInWelcomePage(@Nullable Component component) {
if (!ApplicationManager.getApplication().isUnitTestMode() && ProjectManager.getInstance().getOpenProjects().length == 0) {
// If there are no open projects, the "SDK Manager" configurable was invoked from the "Welcome Page". We need to update the
// "SDK Manager" action to enable it.
ActionManager actionManager = ActionManager.getInstance();
AnAction sdkManagerAction = actionManager.getAction("WelcomeScreen.RunAndroidSdkManager");
if (sdkManagerAction instanceof RunAndroidSdkManagerAction) {
Presentation presentation = sdkManagerAction.getTemplatePresentation();
IdeFrame frame = WelcomeFrame.getInstance();
if (frame == null) {
return;
}
Component c = component != null ? component : frame.getComponent();
DataContext dataContext = DataManager.getInstance().getDataContext(c);
//noinspection ConstantConditions
AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.WELCOME_SCREEN, presentation, actionManager, 0);
sdkManagerAction.update(event);
}
}
}
示例4: getActiveComponent
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
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();
}
示例5: getActiveProject
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
@Nullable
private Project getActiveProject() {
// a better way of finding a project would be great
for (Project project : ProjectManager.getInstance().getOpenProjects()) {
IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(project);
if (ideFrame != null) {
final JComponent frame = ideFrame.getComponent();
if (SwingUtilities.isDescendingFrom(myTextPanel, frame)) {
return project;
}
}
}
return null;
}
示例6: getBlockerForFrame
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
public static JDialog getBlockerForFrame(final IdeFrame ideFrame) {
if (ideFrame == null) return null;
Component c = ideFrame.getComponent();
if (c == null) return null;
Window window = SwingUtilities.getWindowAncestor(c);
if (window == null) return null;
if (!isModalBlocked(window)) return null;
return getModalBlockerFor(window);
}
示例7: reportMessage
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
private boolean reportMessage(final AbstractMessage logMessage, final boolean dialogClosed) {
final ErrorReportSubmitter submitter = getSubmitter(logMessage.getThrowable());
if (submitter == null) return false;
logMessage.setSubmitting(true);
if (!dialogClosed) {
updateControls();
}
Container parentComponent;
if (dialogClosed) {
IdeFrame ideFrame = UIUtil.getParentOfType(IdeFrame.class, getContentPane());
parentComponent = ideFrame.getComponent();
}
else {
parentComponent = getContentPane();
}
return submitter.submit(
getEvents(logMessage), logMessage.getAdditionalInfo(), parentComponent, new Consumer<SubmittedReportInfo>() {
@Override
public void consume(final SubmittedReportInfo submittedReportInfo) {
logMessage.setSubmitting(false);
logMessage.setSubmitted(submittedReportInfo);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (!dialogClosed) {
updateOnSubmit();
}
}
});
}
});
}
示例8: showAlreadyChecking
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
private boolean showAlreadyChecking() {
final IdeFrame frameFor = WindowManagerEx.getInstanceEx().findFrameFor(myProject);
if (frameFor != null) {
final JComponent component = frameFor.getComponent();
Point point = component.getMousePosition();
if (point == null) {
point = new Point((int)(component.getWidth() * 0.7), 0);
}
SwingUtilities.convertPointToScreen(point, component);
JBPopupFactory.getInstance().createHtmlTextBalloonBuilder("Already checking...", MessageType.WARNING, null).
createBalloon().show(new RelativePoint(point), Balloon.Position.below);
}
return false;
}
示例9: createMouseEventWrapper
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
private static MouseEvent createMouseEventWrapper(IdeFrame frame) {
return new MouseEvent(frame.getComponent(), ActionEvent.ACTION_PERFORMED, System.currentTimeMillis(), 0, 0, 0, 0, false, 0);
}
示例10: getFocusedComponent
import com.intellij.openapi.wm.IdeFrame; //导入方法依赖的package包/类
@Nullable
private Component getFocusedComponent() {
if (myWindowManager == null) {
return null;
}
Window activeWindow = myWindowManager.getMostRecentFocusedWindow();
if (activeWindow == null) {
activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if (activeWindow == null) {
activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
if (activeWindow == null) return null;
}
}
if (Registry.is("actionSystem.noContextComponentWhileFocusTransfer")) {
IdeFocusManager fm = IdeFocusManager.findInstanceByComponent(activeWindow);
if (fm.isFocusBeingTransferred()) {
return null;
}
}
// In case we have an active floating toolwindow and some component in another window focused,
// we want this other component to receive key events.
// Walking up the window ownership hierarchy from the floating toolwindow would have led us to the main IdeFrame
// whereas we want to be able to type in other frames as well.
if (activeWindow instanceof FloatingDecorator) {
IdeFocusManager ideFocusManager = IdeFocusManager.findInstanceByComponent(activeWindow);
IdeFrame lastFocusedFrame = ideFocusManager.getLastFocusedFrame();
JComponent frameComponent = lastFocusedFrame != null ? lastFocusedFrame.getComponent() : null;
Window lastFocusedWindow = frameComponent != null ? SwingUtilities.getWindowAncestor(frameComponent) : null;
boolean toolWindowIsNotFocused = myWindowManager.getFocusedComponent(activeWindow) == null;
if (toolWindowIsNotFocused && lastFocusedWindow != null) {
activeWindow = lastFocusedWindow;
}
}
// try to find first parent window that has focus
Window window = activeWindow;
Component focusedComponent = null;
while (window != null) {
focusedComponent = myWindowManager.getFocusedComponent(window);
if (focusedComponent != null) {
break;
}
window = window.getOwner();
}
if (focusedComponent == null) {
focusedComponent = activeWindow;
}
return focusedComponent;
}