コード例 #1
0
  public final IdeFrameImpl allocateFrame(final Project project) {
    LOG.assertTrue(!myProject2Frame.containsKey(project));

    final IdeFrameImpl frame;
    if (myProject2Frame.containsKey(null)) {
      frame = myProject2Frame.get(null);
      myProject2Frame.remove(null);
      myProject2Frame.put(project, frame);
      frame.setProject(project);
    } else {
      frame =
          new IdeFrameImpl(
              (ApplicationInfoEx) ApplicationInfo.getInstance(),
              ActionManagerEx.getInstanceEx(),
              UISettings.getInstance(),
              DataManager.getInstance(),
              ApplicationManager.getApplication());
      final Rectangle bounds = ProjectFrameBounds.getInstance(project).getBounds();
      if (bounds != null) {
        frame.setBounds(bounds);
      } else if (myFrameBounds != null) {
        frame.setBounds(myFrameBounds);
      }
      frame.setExtendedState(myFrameExtendedState);
      frame.setProject(project);
      myProject2Frame.put(project, frame);
      frame.setVisible(true);
    }

    frame.addWindowListener(myActivationListener);

    myEventDispatcher.getMulticaster().frameCreated(frame);

    return frame;
  }
コード例 #2
0
  public void showFrame() {
    final IdeFrameImpl frame =
        new IdeFrameImpl(
            myApplicationInfoEx,
            myActionManager,
            myUiSettings,
            myDataManager,
            ApplicationManager.getApplication());
    myProject2Frame.put(null, frame);

    if (myFrameBounds == null
        || !ScreenUtil.isVisible(
            myFrameBounds)) { // avoid situations when IdeFrame is out of all screens
      Rectangle rect = ScreenUtil.getScreenRectangle(0, 0);
      int yParts = rect.height / 6;
      int xParts = rect.width / 5;
      myFrameBounds = new Rectangle(xParts, yParts, xParts * 3, yParts * 4);
    }

    frame.setBounds(myFrameBounds);
    frame.setVisible(true);
    frame.setExtendedState(myFrameExtendedState);
  }
コード例 #3
0
  public void setFullScreen(IdeFrameImpl frame, boolean fullScreen) {
    if (!isFullScreenSupportedInCurrentOS() || frame.isInFullScreen() == fullScreen) return;

    try {
      if (SystemInfo.isMacOSLion) {
        frame.getFrameDecorator().toggleFullScreen(fullScreen);
        return;
      }

      if (SystemInfo.isWindows) {
        GraphicsDevice device = ScreenUtil.getScreenDevice(frame.getBounds());
        if (device == null) return;
        try {
          frame.getRootPane().putClientProperty(ScreenUtil.DISPOSE_TEMPORARY, Boolean.TRUE);
          if (fullScreen) {
            frame.getRootPane().putClientProperty("oldBounds", frame.getBounds());
          }
          frame.dispose();
          frame.setUndecorated(fullScreen);
        } finally {
          if (fullScreen) {
            frame.setBounds(device.getDefaultConfiguration().getBounds());
          } else {
            Object o = frame.getRootPane().getClientProperty("oldBounds");
            if (o instanceof Rectangle) {
              frame.setBounds((Rectangle) o);
            }
          }
          frame.setVisible(true);
          frame.getRootPane().putClientProperty(ScreenUtil.DISPOSE_TEMPORARY, null);
        }
      }
    } finally {
      frame.storeFullScreenStateIfNeeded(fullScreen);
    }
  }