Java Code Examples for com.intellij.openapi.actionSystem.impl.ActionButton#setVisible()

The following examples show how to use com.intellij.openapi.actionSystem.impl.ActionButton#setVisible() . 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: ArrangementListRowDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ArrangementListRowDecorator(@Nonnull ArrangementUiComponent delegate,
                                   @Nonnull ArrangementMatchingRulesControl control)
{
  myDelegate = delegate;
  myControl = control;

  mySortLabel.setVisible(false);

  AnAction action = ActionManager.getInstance().getAction("Arrangement.Rule.Edit");
  Presentation presentation = action.getTemplatePresentation().clone();
  Icon editIcon = presentation.getIcon();
  Dimension buttonSize = new Dimension(editIcon.getIconWidth(), editIcon.getIconHeight());
  myEditButton = new ActionButton(action, presentation, ArrangementConstants.MATCHING_RULES_CONTROL_PLACE, buttonSize);
  myEditButton.setVisible(false);

  FontMetrics metrics = getFontMetrics(getFont());
  int maxWidth = 0;
  for (int i = 0; i <= 99; i++) {
    maxWidth = Math.max(metrics.stringWidth(String.valueOf(i)), maxWidth);
  }
  int height = metrics.getHeight() - metrics.getDescent() - metrics.getLeading();
  int diameter = Math.max(maxWidth, height) * 5 / 3;
  myRowIndexControl = new ArrangementRuleIndexControl(diameter, height);

  setOpaque(true);
  init();
}
 
Example 2
Source File: LookupUi.java    From consulo with Apache License 2.0 4 votes vote down vote up
LookupUi(@Nonnull LookupImpl lookup, Advertiser advertiser, JBList list) {
  myLookup = lookup;
  myAdvertiser = advertiser;
  myList = list;

  myProcessIcon.setVisible(false);
  myLookup.resort(false);

  MenuAction menuAction = new MenuAction();
  menuAction.add(new ChangeSortingAction());
  menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC)) {
    @Override
    public void update(@Nonnull AnActionEvent e) {
      e.getPresentation().setVisible(!CodeInsightSettings.getInstance().AUTO_POPUP_JAVADOC_INFO);
    }
  });
  menuAction.add(new DelegatedAction(ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_IMPLEMENTATIONS)));

  Presentation presentation = new Presentation();
  presentation.setIcon(AllIcons.Actions.More);
  presentation.putClientProperty(ActionButton.HIDE_DROPDOWN_ICON, Boolean.TRUE);

  myMenuButton = new ActionButton(menuAction, presentation, ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE);

  AnAction hintAction = new HintAction();
  myHintButton = new ActionButton(hintAction, hintAction.getTemplatePresentation(), ActionPlaces.EDITOR_POPUP, ActionToolbar.NAVBAR_MINIMUM_BUTTON_SIZE);
  myHintButton.setVisible(false);

  myBottomPanel = new NonOpaquePanel(new LookupBottomLayout());
  myBottomPanel.add(myAdvertiser.getAdComponent());
  myBottomPanel.add(myProcessIcon);
  myBottomPanel.add(myHintButton);
  myBottomPanel.add(myMenuButton);

  LookupLayeredPane layeredPane = new LookupLayeredPane();
  layeredPane.mainPanel.add(myBottomPanel, BorderLayout.SOUTH);

  myScrollPane = ScrollPaneFactory.createScrollPane(lookup.getList(), true);
  myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
  UIUtil.putClientProperty(myScrollPane.getVerticalScrollBar(), JBScrollPane.IGNORE_SCROLLBAR_IN_INSETS, true);

  lookup.getComponent().add(layeredPane, BorderLayout.CENTER);

  layeredPane.mainPanel.add(myScrollPane, BorderLayout.CENTER);

  myModalityState = ModalityState.stateForComponent(lookup.getTopLevelEditor().getComponent());

  addListeners();

  Disposer.register(lookup, myProcessIcon);
  Disposer.register(lookup, myHintAlarm);
}