Java Code Examples for com.intellij.openapi.util.SystemInfo#isMacOSLeopard()

The following examples show how to use com.intellij.openapi.util.SystemInfo#isMacOSLeopard() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NewProjectAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
protected JPanel createSouthPanel() {
  JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, SystemInfo.isMacOSLeopard ? 0 : 5, 0));

  myCancelButton = new JButton(CommonBundle.getCancelButtonText());
  myCancelButton.addActionListener(e -> doCancelAction());

  buttonsPanel.add(myCancelButton);

  myOkButton = new JButton(CommonBundle.getOkButtonText()) {
    @Override
    public boolean isDefaultButton() {
      return true;
    }
  };
  myOkButton.setEnabled(false);

  myOkButton.addActionListener(e -> doOkAction());
  buttonsPanel.add(myOkButton);

  return JBUI.Panels.simplePanel().addToRight(buttonsPanel);
}
 
Example 2
Source File: DesktopWindowManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void setAlphaMode(Window window, float ratio) {
  try {
    if (SystemInfo.isMacOSLeopard) {
      if (window instanceof JWindow) {
        ((JWindow)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
      }
      else if (window instanceof JDialog) {
        ((JDialog)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
      }
      else if (window instanceof JFrame) {
        ((JFrame)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
      }
    }
    else if (isTranslucencySupported()) {
      window.setOpacity(1.0f - ratio);
    }
    else {
      WindowUtils.setWindowAlpha(window, 1.0f - ratio);
    }
  }
  catch (Throwable e) {
    LOG.debug(e);
  }
}
 
Example 3
Source File: LafManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * The following code is a trick! By default Swing uses lightweight and "medium" weight
 * popups to show JPopupMenu. The code below force the creation of real heavyweight menus -
 * this increases speed of popups and allows to get rid of some drawing artifacts.
 */
private static void fixPopupWeight() {
  int popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
  String property = System.getProperty("idea.popup.weight");
  if (property != null) property = property.toLowerCase().trim();
  if (SystemInfo.isMacOSLeopard) {
    // force heavy weight popups under Leopard, otherwise they don't have shadow or any kind of border.
    popupWeight = OurPopupFactory.WEIGHT_HEAVY;
  }
  else if (property == null) {
    // use defaults if popup weight isn't specified
    if (SystemInfo.isWindows) {
      popupWeight = OurPopupFactory.WEIGHT_HEAVY;
    }
  }
  else {
    if ("light".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_LIGHT;
    }
    else if ("medium".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_MEDIUM;
    }
    else if ("heavy".equals(property)) {
      popupWeight = OurPopupFactory.WEIGHT_HEAVY;
    }
    else {
      LOG.error("Illegal value of property \"idea.popup.weight\": " + property);
    }
  }

  PopupFactory factory = PopupFactory.getSharedInstance();
  if (!(factory instanceof OurPopupFactory)) {
    factory = new OurPopupFactory(factory);
    PopupFactory.setSharedInstance(factory);
  }
  PopupUtil.setPopupType(factory, popupWeight);
}
 
Example 4
Source File: SearchTextField.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected boolean isSearchControlUISupported() {
  return (SystemInfo.isMacOSLeopard && UIUtil.isUnderAquaLookAndFeel()) || UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF();
}