Java 类com.intellij.openapi.actionSystem.impl.ActionToolbarImpl 实例源码

项目:intellij-ce-playground    文件:XFramesView.java   
private ActionToolbarImpl createToolbar() {
  final DefaultActionGroup framesGroup = new DefaultActionGroup();

  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
  framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));

  framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP));

  final ActionToolbarImpl toolbar =
    (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  toolbar.setAddSeparatorFirst(true);
  toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
  return toolbar;
}
项目:tools-idea    文件:DarculaInstaller.java   
private static void update() {
  UISettings.getInstance().fireUISettingsChanged();
  EditorFactory.getInstance().refreshAllEditors();

  Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
  for (Project openProject : openProjects) {
    FileStatusManager.getInstance(openProject).fileStatusesChanged();
    DaemonCodeAnalyzer.getInstance(openProject).restart();
  }
  for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) {
    if (frame instanceof IdeFrameImpl) {
      ((IdeFrameImpl)frame).updateView();
    }
  }
  //Editor[] editors = EditorFactory.getInstance().getAllEditors();
  //for (Editor editor : editors) {
  //  ((EditorEx)editor).reinitSettings();
  //}
  ActionToolbarImpl.updateAllToolbarsImmediately();

  restart(); //todo[kb] remove when get fixed ToolbarDecorator and toolwindow tabs
}
项目:consulo    文件:KeymapPanel.java   
@Override
public void apply() throws ConfigurationException {
  ensureNonEmptyKeymapNames();
  ensureUniqueKeymapNames();
  final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance();
  keymapManager.removeAllKeymapsExceptUnmodifiable();
  for (int i = 0; i < myKeymapListModel.getSize(); i++) {
    final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i);
    if (modelKeymap.canModify()) {
      final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true);
      keymapManager.addKeymap(keymapToAdd);
    }
  }
  keymapManager.setActiveKeymap(mySelectedKeymap);
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:consulo    文件:ContextMenuImpl.java   
private ActionToolbar createToolbar(final ActionGroup group) {
  final ActionToolbarImpl actionToolbar =
          new ActionToolbarImpl(ActionPlaces.CONTEXT_TOOLBAR, group, true, DataManager.getInstance(), ActionManagerEx.getInstanceEx(),
                                KeymapManagerEx.getInstanceEx()) {

            @Override
            protected ActionButton createToolbarButton(final AnAction action,
                                                       boolean minimalMode,
                                                       boolean decorateButtons,
                                                       final String place,
                                                       final Presentation presentation,
                                                       final Dimension minimumSize) {
              final ActionButton result = new ActionButton(action, presentation, place, minimumSize);
              result.setMinimalMode(minimalMode);
              result.setDecorateButtons(decorateButtons);
              return result;
            }
          };

  actionToolbar.setTargetComponent(myEditor.getContentComponent());
  return actionToolbar;
}
项目:consulo    文件:LafManagerImpl.java   
private static void fireUpdate() {

    UISettings.getInstance().fireUISettingsChanged();
    EditorFactory.getInstance().refreshAllEditors();

    Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
    for (Project openProject : openProjects) {
      FileStatusManager.getInstance(openProject).fileStatusesChanged();
      DaemonCodeAnalyzer.getInstance(openProject).restart();
    }
    for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) {
      if (frame instanceof IdeFrameEx) {
        ((IdeFrameEx)frame).updateView();
      }
    }
    ActionToolbarImpl.updateAllToolbarsImmediately();
  }
项目:consulo    文件:XFramesView.java   
private ActionToolbarImpl createToolbar() {
  final DefaultActionGroup framesGroup = new DefaultActionGroup();

  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesList));
  framesGroup.add(actionsManager.createNextOccurenceAction(myFramesList));

  framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP));

  final ActionToolbarImpl toolbar =
          (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  toolbar.setAddSeparatorFirst(true);
  toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
  return toolbar;
}
项目:intellij-swagger    文件:SwaggerUIToolbar.java   
private static ActionToolbar createToolbarFromGroupId(final String groupId) {
    final ActionManager actionManager = ActionManager.getInstance();

    if (!actionManager.isGroup(groupId)) {
        throw new IllegalStateException(groupId + " should have been a group");
    }
    final ActionGroup group = ((ActionGroup)actionManager.getAction(groupId));
    final ActionToolbarImpl editorToolbar =
            ((ActionToolbarImpl)actionManager.createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
    editorToolbar.setOpaque(false);
    editorToolbar.setBorder(new JBEmptyBorder(0, 2, 0, 2));

    return editorToolbar;
}
项目:intellij-ce-playground    文件:KeymapPanel.java   
@Override
public void apply() throws ConfigurationException {
  myEditor.ensureNonEmptyNames(KeyMapBundle.message("configuration.all.keymaps.should.have.non.empty.names.error.message"));

  ensureUniqueKeymapNames();
  KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance();
  // we must specify the same filter, which was used to get original items
  keymapManager.setKeymaps(myEditor.apply(), myEditor.getModel().getSelected(), KEYMAP_FILTER);
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl createSearchToolbar1(@NotNull DefaultActionGroup group) {
  ActionToolbarImpl toolbar = createToolbar(group);
  toolbar.setForceMinimumSize(true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  toolbar.setSecondaryButtonPopupStateModifier(mySearchToolbar1PopupStateModifier);
  toolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");
  new ShowMoreOptions(toolbar, mySearchFieldWrapper);
  return toolbar;
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl createReplaceToolbar1(@NotNull DefaultActionGroup group) {
  ActionToolbarImpl toolbar = createToolbar(group);
  toolbar.setForceMinimumSize(true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  return toolbar;
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl tweakToolbar(@NotNull ActionToolbarImpl toolbar) {
  toolbar.setTargetComponent(this);
  toolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY);
  toolbar.setBorder(null);
  toolbar.setOpaque(false);
  Utils.setSmallerFontForChildren(toolbar);
  return toolbar;
}
项目:intellij-ce-playground    文件:SearchEverywhereAction.java   
private ActionCallback onFocusLost() {
  final ActionCallback result = new ActionCallback();
  //noinspection SSBasedInspection
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        if (myCalcThread != null) {
          myCalcThread.cancel();
          //myCalcThread = null;
        }
        myAlarm.cancelAllRequests();
        if (myBalloon != null && !myBalloon.isDisposed() && myPopup != null && !myPopup.isDisposed()) {
          myBalloon.cancel();
          myPopup.cancel();
        }

        //noinspection SSBasedInspection
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            ActionToolbarImpl.updateAllToolbarsImmediately();
          }
        });
      }
      finally {
        result.setDone();
      }
    }
  });
  return result;
}
项目:material-theme-jetbrains    文件:MTAbstractAccentAction.java   
@Override
public final void actionPerformed(final AnActionEvent e) {
  MTConfig.getInstance().setAccentColor(this.getAccentColor());
  MTThemeManager.getInstance().applyAccents(true);
  IconReplacer.replaceIcons(AllIcons.class, "/icons");
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:material-theme-jetbrains    文件:MTThemeManager.java   
public void updateFileIcons() {
  ApplicationManager.getApplication().runWriteAction(() -> {
    final FileTypeManagerEx instanceEx = FileTypeManagerEx.getInstanceEx();
    instanceEx.fireFileTypesChanged();
    ActionToolbarImpl.updateAllToolbarsImmediately();
  });
}
项目:tools-idea    文件:FramesPanel.java   
private ActionToolbar createToolbar() {
  final DefaultActionGroup framesGroup = new DefaultActionGroup();
  framesGroup.addSeparator();

  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator()));
  framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator()));
  framesGroup.add(new ShowLibraryFramesAction());

  final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  ((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
  toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
  return toolbar;
}
项目:tools-idea    文件:KeymapPanel.java   
public void apply() throws ConfigurationException{
  ensureNonEmptyKeymapNames();
  ensureUniqueKeymapNames();
  final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance();
  keymapManager.removeAllKeymapsExceptUnmodifiable();
  for(int i = 0; i < myKeymapListModel.getSize(); i++){
    final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i);
    if(modelKeymap.canModify()) {
      final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true);
      keymapManager.addKeymap(keymapToAdd);
    }
  }
  keymapManager.setActiveKeymap(mySelectedKeymap);
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:tools-idea    文件:XFramesView.java   
private ActionToolbarImpl createToolbar() {
  final DefaultActionGroup framesGroup = new DefaultActionGroup();

  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
  framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));

  final ActionToolbarImpl toolbar =
    (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  toolbar.setAddSeparatorFirst(true);
  toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
  return toolbar;
}
项目:tools-idea    文件:ShowMoreOptions.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final ActionButton secondaryActions = ((ActionToolbarImpl)myToolbarComponent).getSecondaryActionsButton();
  if (secondaryActions != null) {
    secondaryActions.click();
  }
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl createSearchToolbar1(@Nonnull DefaultActionGroup group) {
  ActionToolbarImpl toolbar = createToolbar(group);
  toolbar.setForceMinimumSize(true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  toolbar.setSecondaryButtonPopupStateModifier(mySearchToolbar1PopupStateModifier);
  toolbar.setSecondaryActionsTooltip("More Options(" + ShowMoreOptions.SHORT_CUT + ")");
  new ShowMoreOptions(toolbar, mySearchFieldWrapper);
  return toolbar;
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl createReplaceToolbar1(@Nonnull DefaultActionGroup group) {
  ActionToolbarImpl toolbar = createToolbar(group);
  toolbar.setForceMinimumSize(true);
  toolbar.setReservePlaceAutoPopupIcon(false);
  return toolbar;
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl tweakToolbar(@Nonnull ActionToolbarImpl toolbar) {
  toolbar.setTargetComponent(this);
  toolbar.setLayoutPolicy(ActionToolbar.AUTO_LAYOUT_POLICY);
  toolbar.setBorder(null);
  Utils.setSmallerFontForChildren(toolbar);
  return toolbar;
}
项目:consulo    文件:FindPopupPanel.java   
public static ActionToolbarImpl createToolbar(AnAction... actions) {
  ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance()
          .createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, new DefaultActionGroup(actions), true);
  toolbar.setForceMinimumSize(true);
  toolbar.setLayoutPolicy(ActionToolbar.NOWRAP_LAYOUT_POLICY);
  return toolbar;
}
项目:consulo    文件:SearchEverywhereAction.java   
private ActionCallback onFocusLost() {
  final ActionCallback result = new ActionCallback();
  //noinspection SSBasedInspection
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        if (myCalcThread != null) {
          myCalcThread.cancel();
          //myCalcThread = null;
        }
        myAlarm.cancelAllRequests();
        if (myBalloon != null && !myBalloon.isDisposed() && myPopup != null && !myPopup.isDisposed()) {
          myBalloon.cancel();
          myPopup.cancel();
        }

        //noinspection SSBasedInspection
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            ActionToolbarImpl.updateAllToolbarsImmediately();
          }
        });
      }
      finally {
        result.setDone();
      }
    }
  });
  return result;
}
项目:intellij-ce-playground    文件:DarculaInstaller.java   
protected static void update() {
  UISettings.getInstance().fireUISettingsChanged();
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:intellij-ce-playground    文件:ShowMoreOptions.java   
public ShowMoreOptions(ActionToolbarImpl toolbarComponent, JComponent shortcutHolder) {
  this.myToolbarComponent = toolbarComponent;
  registerCustomShortcutSet(new CustomShortcutSet(SHORT_CUT), shortcutHolder);
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
private void updateBindings(@NotNull ActionToolbarImpl toolbar, @NotNull JComponent shortcutHolder) {
  updateBindings(toolbar.getActions(true), shortcutHolder);
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl createSearchToolbar2(@NotNull DefaultActionGroup group) {
  return createToolbar(group);
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl createReplaceToolbar2(@NotNull DefaultActionGroup group) {
  return createToolbar(group);
}
项目:intellij-ce-playground    文件:SearchReplaceComponent.java   
@NotNull
private ActionToolbarImpl createToolbar(@NotNull ActionGroup group) {
  return tweakToolbar((ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
}
项目:intellij-ce-playground    文件:TaskUiTest.java   
private static Presentation doTest(AnAction action, ActionToolbarImpl toolbar) {
  TestActionEvent event = new TestActionEvent(toolbar.getPresentation(action));
  action.update(event);
  return event.getPresentation();
}
项目:material-theme-jetbrains    文件:MTAbstractArrowsAction.java   
@Override
public final void actionPerformed(final AnActionEvent e) {
  MTConfig.getInstance().setArrowsStyle(getArrowsStyle());
  ActionToolbarImpl.updateAllToolbarsImmediately();
}
项目:consulo    文件:XWatchesViewImpl.java   
public XWatchesViewImpl(@Nonnull XDebugSessionImpl session, boolean watchesInVariables) {
  super(session);
  myWatchesInVariables = watchesInVariables;

  XDebuggerTree tree = getTree();
  createNewRootNode(null);

  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XNEW_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XREMOVE_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XCOPY_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XEDIT_WATCH, tree, myDisposables);

  EmptyAction.registerWithShortcutSet(XDebuggerActions.XNEW_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD), tree);
  EmptyAction.registerWithShortcutSet(XDebuggerActions.XREMOVE_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE), tree);

  DnDManager.getInstance().registerTarget(this, tree);

  new AnAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      Object contents = CopyPasteManager.getInstance().getContents(XWatchTransferable.EXPRESSIONS_FLAVOR);
      if (contents instanceof List) {
        for (Object item : ((List)contents)){
          if (item instanceof XExpression) {
            addWatchExpression(((XExpression)item), -1, true);
          }
        }
      }
    }
  }.registerCustomShortcutSet(CommonShortcuts.getPaste(), tree, myDisposables);

  ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(
          ActionPlaces.DEBUGGER_TOOLBAR,
          DebuggerSessionTabBase.getCustomizedActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP),
          !myWatchesInVariables);
  toolbar.setBorder(new CustomLineBorder(CaptionPanel.CNT_ACTIVE_BORDER_COLOR, 0, 0,
                                         myWatchesInVariables ? 0 : 1,
                                         myWatchesInVariables ? 1 : 0));
  toolbar.setTargetComponent(tree);

  if (!myWatchesInVariables) {
    getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches"));
  }
  getPanel().add(toolbar.getComponent(), myWatchesInVariables ? BorderLayout.WEST : BorderLayout.NORTH);

  installEditListeners();
}
项目:consulo    文件:ShowMoreOptions.java   
public ShowMoreOptions(ActionToolbarImpl toolbarComponent, JComponent shortcutHolder) {
  this.myToolbarComponent = toolbarComponent;
  registerCustomShortcutSet(new CustomShortcutSet(SHORT_CUT), shortcutHolder);
}
项目:consulo    文件:SearchReplaceComponent.java   
private void updateBindings(@Nonnull ActionToolbarImpl toolbar, @Nonnull JComponent shortcutHolder) {
  updateBindings(toolbar.getActions(true), shortcutHolder);
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl createSearchToolbar2(@Nonnull DefaultActionGroup group) {
  return createToolbar(group);
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl createReplaceToolbar2(@Nonnull DefaultActionGroup group) {
  return createToolbar(group);
}
项目:consulo    文件:SearchReplaceComponent.java   
@Nonnull
private ActionToolbarImpl createToolbar(@Nonnull ActionGroup group) {
  return tweakToolbar((ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
}
项目:consulo    文件:SearchEverywhereAction.java   
@SuppressWarnings("SSBasedInspection")
private void updatePopup() {
  check();
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      myListModel.update();
      myList.revalidate();
      myList.repaint();

      myRenderer.recalculateWidth();
      if (myBalloon == null || myBalloon.isDisposed()) {
        return;
      }
      if (myPopup == null || !myPopup.isVisible()) {
        final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList);
        JBScrollPane content = new JBScrollPane(myList);
        content.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(content, null);
        myPopup = builder.setRequestFocus(false).setCancelKeyEnabled(false).setCancelCallback(new Computable<Boolean>() {
          @Override
          public Boolean compute() {
            return myBalloon == null || myBalloon.isDisposed() || (!getField().getTextEditor().hasFocus() && !mySkipFocusGain);
          }
        }).createPopup();
        myPopup.setMinimumSize(new Dimension(myBalloon.getSize().width, 30));
        myPopup.getContent().setBorder(new EmptyBorder(0, 0, 0, 0));
        Disposer.register(myPopup, new Disposable() {
          @Override
          public void dispose() {
            callback.setDone();
            resetFields();
            myNonProjectCheckBox.setSelected(false);
            ActionToolbarImpl.updateAllToolbarsImmediately();
            if (myActionEvent != null && myActionEvent.getInputEvent() instanceof MouseEvent) {
              final Component component = myActionEvent.getInputEvent().getComponent();
              if (component != null) {
                final JLabel label = UIUtil.getParentOfType(JLabel.class, component);
                if (label != null) {
                  label.setIcon(AllIcons.Actions.FindPlain);
                }
              }
            }
            myActionEvent = null;
          }
        });
        myPopup.show(new RelativePoint(getField().getParent(), new Point(0, getField().getParent().getHeight())));
        //updatePopupBounds();

        ActionManager.getInstance().addAnActionListener(new AnActionListener.Adapter() {
          @Override
          public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
            if (action instanceof TextComponentEditorAction) {
              return;
            }
            myPopup.cancel();
          }
        }, myPopup);
      }
      else {
        myList.revalidate();
        myList.repaint();
      }
      ScrollingUtil.ensureSelectionExists(myList);
      if (myList.getModel().getSize() > 0) {
        updatePopupBounds();
      }
    }
  });
}