Java 类com.intellij.ui.plaf.beg.IdeaMenuUI 实例源码

项目:intellij-ce-playground    文件:ActionMenu.java   
@Override
public void updateUI() {
  boolean isAmbiance = UIUtil.isUnderGTKLookAndFeel() && "Ambiance".equalsIgnoreCase(UIUtil.getGtkThemeName());
  if (myTopLevel && !isAmbiance && UIUtil.GTK_AMBIANCE_TEXT_COLOR.equals(getForeground())) {
    setForeground(null);
  }

  if (UIUtil.isStandardMenuLAF()) {
    super.updateUI();
  }
  else {
    setUI(IdeaMenuUI.createUI(this));
    setFont(UIUtil.getMenuFont());

    JPopupMenu popupMenu = getPopupMenu();
    if (popupMenu != null) {
      popupMenu.updateUI();
    }
  }

  if (myTopLevel && isAmbiance) {
    setForeground(UIUtil.GTK_AMBIANCE_TEXT_COLOR);
  }

  if (myTopLevel && UIUtil.isUnderGTKLookAndFeel()) {
    Insets insets = getInsets();
    Insets newInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right);
    if (insets.top + insets.bottom < 6) {
      newInsets.top = newInsets.bottom = 3;
    }
    if (insets.left + insets.right < 12) {
      newInsets.left = newInsets.right = 6;
    }
    if (!newInsets.equals(insets)) {
      setBorder(BorderFactory.createEmptyBorder(newInsets.top, newInsets.left, newInsets.bottom, newInsets.right));
    }
  }
}
项目:tools-idea    文件:ActionMenu.java   
@Override
public void updateUI() {
  boolean isAmbiance = UIUtil.isUnderGTKLookAndFeel() && "Ambiance".equalsIgnoreCase(UIUtil.getGtkThemeName());
  if (myTopLevel && !isAmbiance && UIUtil.GTK_AMBIANCE_TEXT_COLOR.equals(getForeground())) {
    setForeground(null);
  }

  if (UIUtil.isStandardMenuLAF()) {
    super.updateUI();
  }
  else {
    setUI(IdeaMenuUI.createUI(this));
    setFont(UIUtil.getMenuFont());

    JPopupMenu popupMenu = getPopupMenu();
    if (popupMenu != null) {
      popupMenu.updateUI();
    }
  }

  if (myTopLevel && isAmbiance) {
    setForeground(UIUtil.GTK_AMBIANCE_TEXT_COLOR);
  }

  if (myTopLevel && UIUtil.isUnderGTKLookAndFeel()) {
    Insets insets = getInsets();
    Insets newInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right);
    if (insets.top + insets.bottom < 6) {
      newInsets.top = newInsets.bottom = 3;
    }
    if (insets.left + insets.right < 12) {
      newInsets.left = newInsets.right = 6;
    }
    if (!newInsets.equals(insets)) {
      setBorder(BorderFactory.createEmptyBorder(newInsets.top, newInsets.left, newInsets.bottom, newInsets.right));
    }
  }
}
项目:consulo    文件:ActionMenu.java   
@Override
public void updateUI() {
  boolean isAmbiance = UIUtil.isUnderGTKLookAndFeel() && "Ambiance".equalsIgnoreCase(UIUtil.getGtkThemeName());
  if (myTopLevel && !isAmbiance && UIUtil.GTK_AMBIANCE_TEXT_COLOR.equals(getForeground())) {
    setForeground(null);
  }

  if (UIUtil.isStandardMenuLAF()) {
    super.updateUI();
  }
  else {
    setUI(IdeaMenuUI.createUI(this));
    setFont(UIUtil.getMenuFont());

    JPopupMenu popupMenu = getPopupMenu();
    if (popupMenu != null) {
      popupMenu.updateUI();
    }
  }

  if (myTopLevel && isAmbiance) {
    setForeground(UIUtil.GTK_AMBIANCE_TEXT_COLOR);
  }

  if (myTopLevel && UIUtil.isUnderGTKLookAndFeel()) {
    Insets insets = getInsets();
    Insets newInsets = new Insets(insets.top, insets.left, insets.bottom, insets.right);
    if (insets.top + insets.bottom < 6) {
      newInsets.top = newInsets.bottom = 3;
    }
    if (insets.left + insets.right < 12) {
      newInsets.left = newInsets.right = 6;
    }
    if (!newInsets.equals(insets)) {
      setBorder(BorderFactory.createEmptyBorder(newInsets.top, newInsets.left, newInsets.bottom, newInsets.right));
    }
  }
}