Java 类com.intellij.openapi.ui.popup.util.MinimizeButton 实例源码

项目:intellij-ce-playground    文件:ProcessPopup.java   
public void show(boolean requestFocus) {
  JComponent toFocus = myRootContent.getTargetComponent() == myActiveContentComponent ? myActiveFocusedContent : myInactiveContentComponent;

  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myRootContent, toFocus);
  builder.addListener(new JBPopupAdapter() {
    public void onClosed(LightweightWindowEvent event) {
      myProgressPanel.hideProcessPopup();
    }
  });
  builder.setMovable(true);
  builder.setResizable(true);
  builder.setTitle(IdeBundle.message("progress.window.title"));
  builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
  builder.setCancelOnClickOutside(false);
  builder.setRequestFocus(requestFocus);
  builder.setBelongsToGlobalPopupStack(false);
  builder.setLocateByContent(true);

  builder.setCancelButton(new MinimizeButton("Hide"));

  JFrame frame = (JFrame)UIUtil.findUltimateParent(myProgressPanel);

  updateContentUI();
  myActiveContentComponent.setBorder(null);
  if (frame != null) {
    Dimension contentSize = myRootContent.getPreferredSize();
    Rectangle bounds = frame.getBounds();
    int width = Math.max(bounds.width / 4, contentSize.width);
    int height = Math.min(bounds.height / 4, contentSize.height);

    int x = (int)(bounds.getMaxX() - width);
    int y = (int)(bounds.getMaxY() - height);
    myPopup = builder.createPopup();

    StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar();
    if (sb.isVisible()) {
      y -= sb.getSize().height;
    }

    myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
  } else {
    myPopup = builder.createPopup();
    myPopup.showInCenterOf(myProgressPanel.getRootPane());
  }
}
项目:intellij-ce-playground    文件:RegExHelpPopup.java   
public static JBPopup createRegExHelpPopup() throws BadLocationException {
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(new RegExHelpPopup(), null);
  return builder.setCancelOnClickOutside(false).setBelongsToGlobalPopupStack(true).setFocusable(true).setRequestFocus(true).setMovable(true).setResizable(true)
    .setCancelOnOtherWindowOpen(false).setCancelButton(new MinimizeButton("Hide"))
    .setTitle("Regular expressions syntax").setDimensionServiceKey(null, "RegExHelpPopup", true).createPopup();
}
项目:tools-idea    文件:ProcessPopup.java   
public void show(boolean requestFocus) {
  JComponent toFocus = myRootContent.getTargetComponent() == myActiveContentComponent ? myActiveFocusedContent : myInactiveContentComponent;

  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myRootContent, toFocus);
  builder.addListener(new JBPopupAdapter() {
    public void onClosed(LightweightWindowEvent event) {
      myProgressPanel.hideProcessPopup();
    }
  });
  builder.setMovable(true);
  builder.setResizable(true);
  builder.setTitle(IdeBundle.message("progress.window.title"));
  builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
  builder.setMinSize(getMinSize());
  builder.setCancelOnClickOutside(false);
  builder.setRequestFocus(requestFocus);
  builder.setBelongsToGlobalPopupStack(false);
  builder.setLocateByContent(true);

  builder.setCancelButton(new MinimizeButton("Hide"));

  JFrame frame = (JFrame)UIUtil.findUltimateParent(myProgressPanel);
  Dimension contentSize = myRootContent.getPreferredSize();
  if (frame != null) {
    Rectangle bounds = frame.getBounds();
    int width = Math.max(bounds.width / 4, contentSize.width);
    int height = Math.min(bounds.height / 4, contentSize.height);

    int x = (int)(bounds.getMaxX() - width);
    int y = (int)(bounds.getMaxY() - height);
    builder.setMinSize(new Dimension(width, height));
    myPopup = builder.createPopup();

    StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar();
    if (sb.isVisible()) {
      y -= sb.getSize().height;
    }


    myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
  } else {
    myPopup = builder.createPopup();
    myPopup.showInCenterOf(myProgressPanel.getRootPane());
  }
}
项目:tools-idea    文件:RegExHelpPopup.java   
public static JBPopup createRegExHelpPopup() throws BadLocationException {
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(new RegExHelpPopup(), null);
  return builder.setCancelOnClickOutside(false).setBelongsToGlobalPopupStack(true).setFocusable(true).setRequestFocus(true).setMovable(true).setResizable(true)
    .setCancelOnOtherWindowOpen(false).setCancelButton(new MinimizeButton("Hide"))
    .setTitle("Regular expressions syntax").setDimensionServiceKey(null, "RegExHelpPopup", true).createPopup();
}
项目:consulo    文件:ProcessPopup.java   
public void show(boolean requestFocus) {
  JComponent toFocus = myRootContent.getTargetComponent() == myActiveContentComponent ? myActiveFocusedContent : myInactiveContentComponent;

  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myRootContent, toFocus);
  builder.addListener(new JBPopupAdapter() {
    @Override
    public void onClosed(LightweightWindowEvent event) {
      myProgressPanel.hideProcessPopup();
    }
  });
  builder.setMovable(true);
  builder.setResizable(true);
  builder.setTitle(IdeBundle.message("progress.window.title"));
  builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
  builder.setMinSize(getMinSize());
  builder.setCancelOnClickOutside(false);
  builder.setRequestFocus(requestFocus);
  builder.setBelongsToGlobalPopupStack(false);
  builder.setLocateByContent(true);

  builder.setCancelButton(new MinimizeButton("Hide"));

  JFrame frame = (JFrame)UIUtil.findUltimateParent(myProgressPanel);
  Dimension contentSize = myRootContent.getPreferredSize();
  if (frame != null) {
    Rectangle bounds = frame.getBounds();
    int width = Math.max(bounds.width / 4, contentSize.width);
    int height = Math.min(bounds.height / 4, contentSize.height);

    int x = (int)(bounds.getMaxX() - width);
    int y = (int)(bounds.getMaxY() - height);
    builder.setMinSize(new Dimension(width, height));
    myPopup = builder.createPopup();

    StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar();
    if (sb.isVisible()) {
      y -= sb.getSize().height;
    }


    myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
  } else {
    myPopup = builder.createPopup();
    myPopup.showInCenterOf(myProgressPanel.getRootPane());
  }
}
项目:consulo    文件:RegExHelpPopup.java   
public static JBPopup createRegExHelpPopup() throws BadLocationException {
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(new RegExHelpPopup(), null);
  return builder.setCancelOnClickOutside(false).setBelongsToGlobalPopupStack(true).setFocusable(true).setRequestFocus(true).setMovable(true).setResizable(true)
          .setCancelOnOtherWindowOpen(false).setCancelButton(new MinimizeButton("Hide"))
          .setTitle("Regular expressions syntax").setDimensionServiceKey(null, "RegExHelpPopup", true).createPopup();
}