当前位置: 首页>>代码示例>>Java>>正文


Java WindowManagerEx类代码示例

本文整理汇总了Java中com.intellij.openapi.wm.ex.WindowManagerEx的典型用法代码示例。如果您正苦于以下问题:Java WindowManagerEx类的具体用法?Java WindowManagerEx怎么用?Java WindowManagerEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WindowManagerEx类属于com.intellij.openapi.wm.ex包,在下文中一共展示了WindowManagerEx类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: centerOnIdeFrameOrScreen

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的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);
}
 
开发者ID:dyadix,项目名称:typengo,代码行数:21,代码来源:CommandInputForm.java

示例2: showPopup

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : PlatformDataKeys.CONTEXT_COMPONENT.getData(context);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:WelcomePopupAction.java

示例3: show

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
public final void show(){
  setFocusableWindowState(myInfo.isActive());

  super.show();
  final UISettings uiSettings=UISettings.getInstance();
  if(uiSettings.ENABLE_ALPHA_MODE){
    final WindowManagerEx windowManager=WindowManagerEx.getInstanceEx();
    windowManager.setAlphaModeEnabled(this,true);
    if(myInfo.isActive()){
      windowManager.setAlphaModeRatio(this,0.0f);
    }else{
      windowManager.setAlphaModeRatio(this,uiSettings.ALPHA_MODE_RATIO);
    }
  }
  paint(getGraphics()); // This prevents annoying flick

  setFocusableWindowState(true);

  uiSettings.addUISettingsListener(myUISettingsListener, myDelayAlarm);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:FloatingDecorator.java

示例4: createNotification

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
public static Notification createNotification(@NotNull final String groupDisplayId, @Nullable NotificationListener listener) {

    final String productName = ApplicationNamesInfo.getInstance().getProductName();

    Window recentFocusedWindow = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();

    String text =
      "<html>We have found out that you are using a non-english keyboard layout. You can <a href='enable'>enable</a> smart layout support for " +
      KeyboardSettingsExternalizable.getDisplayLanguageNameForComponent(recentFocusedWindow) + " language." +
      "You can change this option in the settings of " + productName + " <a href='settings'>more...</a></html>";

    String title = "Enable smart keyboard internalization for " + productName + ".";

    return new Notification(groupDisplayId, title,
                            text,
                            NotificationType.INFORMATION,
                            listener);
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:KeyboardInternationalizationNotificationManager.java

示例5: hyperlinkUpdate

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
  if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
    final String description = event.getDescription();
    if ("enable".equals(description)) {
      KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
    }
    else if ("settings".equals(description)) {
      final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
      IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
      //util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
      util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class);
    }

    NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false);
    notification.expire();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:KeyboardInternationalizationNotificationManager.java

示例6: noIntersections

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
private boolean noIntersections(Rectangle bounds) {
  Window owner = SwingUtilities.getWindowAncestor(myComponent);
  Window popup = SwingUtilities.getWindowAncestor(myTipComponent);
  Window focus = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
  boolean focused = SystemInfo.isWindows || owner.isFocused();
  for (Window other : owner.getOwnedWindows()) {
    if (!focused && !SystemInfo.isWindows) {
      focused = other.isFocused();
    }
    if (popup != other && other.isVisible() && bounds.x + 10 >= other.getX() && bounds.intersects(other.getBounds())) {
      return false;
    }
    if (focus == other) {
      focus = null; // already checked
    }
  }
  return focused && (focus == owner || focus == null || !owner.getBounds().intersects(focus.getBounds()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AbstractExpandableItemsHandler.java

示例7: hasFocus2

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
/**
 * @return true if window ancestor of component was most recent focused window and most recent focused component
 * in that window was descended from component
 */
public static boolean hasFocus2(Component component) {
  WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
  Window activeWindow=null;
  if (windowManager != null) {
    activeWindow = windowManager.getMostRecentFocusedWindow();
  }
  if(activeWindow==null){
    return false;
  }
  Component focusedComponent = windowManager.getFocusedComponent(activeWindow);
  if (focusedComponent == null) {
    return false;
  }

  return SwingUtilities.isDescendingFrom(focusedComponent, component);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IJSwingUtilities.java

示例8: projectOpened

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
@Override
public void projectOpened() {
  myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
  myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
      setActiveWindow(myIdeFrame);
    }
  });

  final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
  myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      myEditorFactoryListener.executeOnRelease(null);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:EditorTracker.java

示例9: showPopup

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : PlatformDataKeys.CONTEXT_COMPONENT.getData(context);
  if (focusedComponent != null) {
    popup.showUnderneathOf(focusedComponent);
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:WelcomePopupAction.java

示例10: show

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
/**
 * Shows the hint as the window.
 */
@Override
public void show(@NotNull JComponent parentComponent, int x, int y, @Nullable JComponent focusBackComponent, @Nullable HintHint hh) {
  myParentComponent = parentComponent;
  LOG.assertTrue(parentComponent.isShowing());

  Window windowAncestor = SwingUtilities.getWindowAncestor(parentComponent);
  LOG.assertTrue(windowAncestor != null);

  myWindow = new JWindow(windowAncestor);
  myWindow.setFocusableWindowState(myFocusableWindowState);
  WindowManagerEx.getInstanceEx().setWindowShadow(myWindow, WindowManagerEx.WindowShadowMode.DISABLED);

  myWindow.getContentPane().setLayout(new BorderLayout());
  myWindow.getContentPane().add(myComponent, BorderLayout.CENTER);

  updateBounds(x, y);
  myWindow.setVisible(true);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:HeavyweightHint.java

示例11: updateMaskAndAlpha

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
private Window updateMaskAndAlpha(Window window) {
  if (window == null) return window;

  final WindowManagerEx wndManager = getWndManager();
  if (wndManager == null) return window;

  if (!wndManager.isAlphaModeEnabled(window)) return window;

  if (myAlpha != myLastAlpha) {
    wndManager.setAlphaModeRatio(window, myAlpha);
    myLastAlpha = myAlpha;
  }

  if (myMaskProvider != null) {
    final Dimension size = window.getSize();
    Shape mask = myMaskProvider.getMask(size);
    wndManager.setWindowMask(window, mask);
  }

  WindowManagerEx.WindowShadowMode mode =
    myShadowed ? WindowManagerEx.WindowShadowMode.NORMAL : WindowManagerEx.WindowShadowMode.DISABLED;
  WindowManagerEx.getInstanceEx().setWindowShadow(window, mode);

  return window;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:AbstractPopup.java

示例12: update

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
private static void update() {
  UISettings.getInstance().fireUISettingsChanged();
  EditorFactory.getInstance().refreshAllEditors();

  Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
  for (Project openProject : openProjects) {
    FileStatusManager.getInstance(openProject).fileStatusesChanged();
    DaemonCodeAnalyzer.getInstance(openProject).restart();
  }
  for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) {
    if (frame instanceof IdeFrameImpl) {
      ((IdeFrameImpl)frame).updateView();
    }
  }
  //Editor[] editors = EditorFactory.getInstance().getAllEditors();
  //for (Editor editor : editors) {
  //  ((EditorEx)editor).reinitSettings();
  //}
  ActionToolbarImpl.updateAllToolbarsImmediately();

  restart(); //todo[kb] remove when get fixed ToolbarDecorator and toolwindow tabs
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:DarculaInstaller.java

示例13: projectOpened

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
@Override
public void projectOpened() {
  myIdeFrame = ((WindowManagerEx)myWindowManager).getFrame(myProject);
  myProject.getMessageBus().connect(myProject).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerAdapter() {
    @Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      if (myIdeFrame == null || myIdeFrame.getFocusOwner() == null) return;
      setActiveWindow(myIdeFrame);
    }
  });

  final MyEditorFactoryListener myEditorFactoryListener = new MyEditorFactoryListener();
  myEditorFactory.addEditorFactoryListener(myEditorFactoryListener,myProject);
  Disposer.register(myProject, new Disposable() {
    @Override
    public void dispose() {
      myEditorFactoryListener.dispose(null);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:EditorTracker.java

示例14: updateShowDialogSetting

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
public static void updateShowDialogSetting(LayoutCodeDialog dialog, String title) {
  if (dialog.isDoNotAskMe()) {
    Notifications.Bus.notify(new Notification("Reformat Code", title,
                                              "<html>You can re-enable the dialog on the <a href=''>IDE Settings -> Editor</a> pane</html>",
                                              NotificationType.INFORMATION, new NotificationListener() {
        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
          if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
            IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
            util.editConfigurable((JFrame)ideFrame, new EditorOptions());
          }
        }
      }));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ReformatCodeAction.java

示例15: showPopup

import com.intellij.openapi.wm.ex.WindowManagerEx; //导入依赖的package包/类
protected void showPopup(DataContext context, ListPopup popup, JComponent contextComponent) {
  Component focusedComponent = contextComponent != null ? contextComponent : context.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (focusedComponent != null) {
    if (popup instanceof PopupFactoryImpl.ActionGroupPopup && focusedComponent instanceof JLabel) {
      ((PopupFactoryImpl.ActionGroupPopup)popup).showUnderneathOfLabel((JLabel)focusedComponent);
    } else {
      popup.showUnderneathOf(focusedComponent);
    }
  }
  else {
    Rectangle r;
    int x;
    int y;
    focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent((Project)null);
    r = WindowManagerEx.getInstanceEx().getScreenBounds();
    x = r.x + r.width / 2;
    y = r.y + r.height / 2;
    Point point = new Point(x, y);
    SwingUtilities.convertPointToScreen(point, focusedComponent.getParent());

    popup.showInScreenCoordinates(focusedComponent.getParent(), point);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:WelcomePopupAction.java


注:本文中的com.intellij.openapi.wm.ex.WindowManagerEx类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。