Java Code Examples for com.intellij.util.ui.EmptyIcon#create()

The following examples show how to use com.intellij.util.ui.EmptyIcon#create() . 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: AdvancedSettingsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static int calculateCheckBoxIndent() {
  JCheckBox checkBox = new JCheckBox();
  Icon icon = checkBox.getIcon();
  int indent = 0;
  if (icon == null) {
    icon = UIManager.getIcon("CheckBox.icon");
  }
  if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
    icon = EmptyIcon.create(20, 18);
  }
  if (icon != null) {
    final Insets i = checkBox.getInsets();
    final Rectangle r = checkBox.getBounds();
    final Rectangle r1 = new Rectangle();
    r1.x = i.left;
    r1.y = i.top;
    r1.width = r.width - (i.right + r1.x);
    r1.height = r.height - (i.bottom + r1.y);
    final Rectangle iconRect = new Rectangle();
    SwingUtilities.layoutCompoundLabel(checkBox, checkBox.getFontMetrics(checkBox.getFont()), checkBox.getText(), icon, checkBox.getVerticalAlignment(), checkBox.getHorizontalAlignment(),
                                       checkBox.getVerticalTextPosition(), checkBox.getHorizontalTextPosition(), r1, new Rectangle(), iconRect,
                                       checkBox.getText() == null ? 0 : checkBox.getIconTextGap());
    indent = iconRect.x;
  }
  return indent + checkBox.getIconTextGap();
}
 
Example 2
Source File: SimpleTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Deprecated
public Icon getEmptyHandle() {
  if (myEmptyHandle == null) {
    final Icon expand = getExpandedHandle();
    myEmptyHandle = expand != null ? EmptyIcon.create(expand) : EmptyIcon.create(0);
  }
  return myEmptyHandle;
}
 
Example 3
Source File: ActionStepBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void buildGroup(@Nonnull ActionGroup actionGroup) {
  calcMaxIconSize(actionGroup);
  myEmptyIcon = myMaxIconHeight != -1 && myMaxIconWidth != -1 ? EmptyIcon.create(myMaxIconWidth, myMaxIconHeight) : null;

  appendActionsFromGroup(actionGroup);

  if (myListModel.isEmpty()) {
    myListModel.add(new PopupFactoryImpl.ActionItem(Utils.EMPTY_MENU_FILLER, Utils.NOTHING_HERE, null, false, null, null, false, null));
  }
}
 
Example 4
Source File: GtkMenuItemUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void installUI(final JComponent c) {
  super.installUI(c);

  myHiddenItem = new JCheckBoxMenuItem();
  myOriginalUI.installUI(myHiddenItem);
  menuItem.setBorder(myHiddenItem.getBorder());
  final Icon icon = getCheckIconFromContext(myOriginalUI, myHiddenItem);
  checkIcon = isCheckBoxItem() ? icon : EmptyIcon.create(icon);
}
 
Example 5
Source File: LookupCellRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
int updateMaximumWidth(final LookupElementPresentation p, LookupElement item) {
  final Icon icon = p.getIcon();
  if (icon != null && (icon.getIconWidth() > myEmptyIcon.getIconWidth() || icon.getIconHeight() > myEmptyIcon.getIconHeight())) {
    myEmptyIcon = EmptyIcon.create(Math.max(icon.getIconWidth(), myEmptyIcon.getIconWidth()), Math.max(icon.getIconHeight(), myEmptyIcon.getIconHeight()));
  }

  return RealLookupElementPresentation.calculateWidth(p, getRealFontMetrics(item, false), getRealFontMetrics(item, true)) + calcSpacing(myTailComponent, null) + calcSpacing(myTypeLabel, null);
}
 
Example 6
Source File: ModernMenuUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
  super.installDefaults();
  Integer integer = UIUtil.getPropertyMaxGutterIconWidth(getPropertyPrefix());
  if (integer != null) {
    myMaxGutterIconWidth = JBUI.scale(integer.intValue());
  }
  arrowIcon = EmptyIcon.create(myMaxGutterIconWidth);
}
 
Example 7
Source File: JBComboBoxTableCellEditorComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private Icon getEmptyIcon() {
  if (myEmptyIcon == null) {
    myEmptyIcon = EmptyIcon.create(getIcon(true).getIconWidth());
  }
  return myEmptyIcon;
}
 
Example 8
Source File: TooltipReferencesPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private static Icon createEmptyIcon(int height) {
  return EmptyIcon.create(LabelIcon.getWidth(height, 2), height);
}
 
Example 9
Source File: StructureFilterPopupComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private SelectFromHistoryAction(@Nonnull VcsLogStructureFilter filter) {
  super(getStructureActionText(filter), getTooltipTextForFilePaths(filter.getFiles(), false).replace("\n", " "), null);
  myFilter = filter;
  myIcon = new SizedIcon(PlatformIcons.CHECK_ICON_SMALL, CHECKBOX_ICON_SIZE, CHECKBOX_ICON_SIZE);
  myEmptyIcon = EmptyIcon.create(CHECKBOX_ICON_SIZE);
}