Java 类com.intellij.openapi.actionSystem.ActionPlaces 实例源码

项目:intellij-ce-playground    文件:CallHierarchyBrowser.java   
@Override
protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) {
  ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
  final JTree tree1 = createTree(false);
  PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
  type2TreeMap.put(CALLEE_TYPE, tree1);

  final JTree tree2 = createTree(false);
  PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
  type2TreeMap.put(CALLER_TYPE, tree2);
}
项目:intellij-ce-playground    文件:ConsoleManager.java   
private void createConsole(@NotNull final NetService netService) {
  TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
  netService.configureConsole(consoleBuilder);
  console = consoleBuilder.getConsole();

  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      ActionGroup actionGroup = netService.getConsoleToolWindowActions();
      ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);

      SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
      toolWindowPanel.setContent(console.getComponent());
      toolWindowPanel.setToolbar(toolbar.getComponent());

      ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject())
        .registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
      toolWindow.setIcon(netService.getConsoleToolWindowIcon());

      Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
      Disposer.register(content, console);

      toolWindow.getContentManager().addContent(content);
    }
  }, netService.getProject().getDisposed());
}
项目:intellij-ce-playground    文件:ModifierKeyDoubleClickHandler.java   
private void run(KeyEvent event) {
  myIsRunningAction = true;
  try {
    ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    AnAction action = actionManager.getAction(myActionId);
    DataContext context = DataManager.getInstance().getDataContext(IdeFocusManager.findInstance().getFocusOwner());
    AnActionEvent anActionEvent = AnActionEvent.createFromAnAction(action, event, ActionPlaces.MAIN_MENU, context);

    actionManager.fireBeforeActionPerformed(action, anActionEvent.getDataContext(), anActionEvent);
    action.actionPerformed(anActionEvent);
    actionManager.fireAfterActionPerformed(action, anActionEvent.getDataContext(), anActionEvent);
  }
  finally {
    myIsRunningAction = false;
  }
}
项目:intellij-ce-playground    文件:MacDockDelegate.java   
@Override
public void updateRecentProjectsMenu () {
  RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
  if (projectsManager == null) return;
  final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
项目:intellij-ce-playground    文件:OpenModuleSettingsAction.java   
protected static boolean isModuleInProjectViewPopup(AnActionEvent e) {
  if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace())) {
    final Project project = getEventProject(e);
    final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
    if (project != null && module != null) {
      final VirtualFile moduleFolder = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
      if (moduleFolder == null) {
        return false;
      }
      if (ProjectRootsUtil.isModuleContentRoot(moduleFolder, project) || ProjectRootsUtil.isModuleSourceRoot(moduleFolder, project)) {
        return true;
      }
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:ToggleFullScreenAction.java   
@Override
public void update(@NotNull final AnActionEvent e) {
  Presentation p = e.getPresentation();

  IdeFrameEx frame = null;
  boolean isApplicable = WindowManager.getInstance().isFullScreenSupportedInCurrentOS() && (frame = getFrame()) != null;

  if (e.getPlace() != ActionPlaces.MAIN_TOOLBAR) {
    p.setVisible(isApplicable);
  }
  p.setEnabled(isApplicable);

  if (isApplicable) {
    p.setText(frame.isInFullScreen() ? TEXT_EXIT_FULL_SCREEN : TEXT_ENTER_FULL_SCREEN);
  }
}
项目:intellij-ce-playground    文件:XDebuggerActionBase.java   
@Override
public void update(final AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  boolean hidden = isHidden(event);
  if (hidden) {
    presentation.setEnabledAndVisible(false);
    return;
  }

  boolean enabled = isEnabled(event);
  if (myHideDisabledInPopup && ActionPlaces.isPopupPlace(event.getPlace())) {
    presentation.setVisible(enabled);
  }
  else {
    presentation.setVisible(true);
  }
  presentation.setEnabled(enabled);
}
项目: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;
}
项目:intellij-ce-playground    文件:AbstractCommitChangesAction.java   
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  if (presentation.isVisible() && presentation.isEnabled()) {
    final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
    final Change[] selectedChanges = vcsContext.getSelectedChanges();
    if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
      if (selectedChangeLists != null && selectedChangeLists.length > 0) {
        presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
      }
      else {
        presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
      }
    }
    if (presentation.isEnabled() && selectedChanges != null) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
      for(Change c: selectedChanges) {
        if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
          presentation.setEnabled(false);
          break;
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:SearchTextArea.java   
public SearchTextArea(boolean search) {
  myTextArea = new JTextArea();
  setBorder(JBUI.Borders.empty(6, 6, 6, 8));
  setLayout(new BorderLayout(JBUI.scale(4), 0));
  myTextArea.addPropertyChangeListener("background", this);
  myTextArea.addFocusListener(this);
  myTextArea.setBorder(null);
  myTextArea.setOpaque(false);
  JBScrollPane scrollPane = new JBScrollPane(myTextArea,
                                             ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                             ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.getVerticalScrollBar().setBackground(UIUtil.TRANSPARENT_COLOR);
  scrollPane.getViewport().setBorder(null);
  scrollPane.getViewport().setOpaque(false);
  scrollPane.setBorder(JBUI.Borders.emptyRight(2));
  scrollPane.setOpaque(false);
  ShowHistoryAction historyAction = new ShowHistoryAction(search);
  ActionButton button =
    new ActionButton(historyAction, historyAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, new Dimension(JBUI.scale(16), JBUI.scale(16)));
  button.setLook(new InplaceActionButtonLook());
  JPanel p = new NonOpaquePanel(new BorderLayout());
  p.add(button, BorderLayout.NORTH);
  add(p, BorderLayout.WEST);
  add(scrollPane, BorderLayout.CENTER);
}
项目:intellij-ce-playground    文件:CopyReferenceAction.java   
@Override
public void update(AnActionEvent e) {
  boolean plural = false;
  boolean enabled;

  DataContext dataContext = e.getDataContext();
  Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
  if (editor != null && FileDocumentManager.getInstance().getFile(editor.getDocument()) != null) {
    enabled = true;
  }
  else {
    List<PsiElement> elements = getElementsToCopy(editor, dataContext);
    enabled = !elements.isEmpty();
    plural = elements.size() > 1;
  }

  e.getPresentation().setEnabled(enabled);
  if (ActionPlaces.isPopupPlace(e.getPlace())) {
    e.getPresentation().setVisible(enabled);
  }
  else {
    e.getPresentation().setVisible(true);
  }
  e.getPresentation().setText(plural ? "Cop&y References" : "Cop&y Reference");
}
项目:intellij-ce-playground    文件:OpenFileInDefaultBrowserAction.java   
@Override
public void update(@NotNull AnActionEvent e) {
  Presentation presentation = e.getPresentation();

  OpenInBrowserRequest result = BaseOpenInBrowserAction.doUpdate(e);
  if (result == null) {
    return;
  }

  String description = getTemplatePresentation().getDescription();
  if (HtmlUtil.isHtmlFile(result.getFile())) {
    description += " (hold Shift to open URL of local file)";
  }

  presentation.setText(getTemplatePresentation().getText());
  presentation.setDescription(description);

  WebBrowser browser = findUsingBrowser();
  if (browser != null) {
    presentation.setIcon(browser.getIcon());
  }

  if (ActionPlaces.isPopupPlace(e.getPlace())) {
    presentation.setVisible(presentation.isEnabled());
  }
}
项目:intellij-ce-playground    文件:GradleConsoleView.java   
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
  //Create runner UI layout
  RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
  RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);

  // Adding actions
  DefaultActionGroup group = new DefaultActionGroup();
  layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

  Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
  AnAction[] consoleActions = myConsoleView.createConsoleActions();
  for (AnAction action : consoleActions) {
    if (!shouldIgnoreAction(action)) {
      group.add(action);
    }
  }
  layoutUi.addContent(console, 0, PlaceInGrid.right, false);

  JComponent layoutComponent = layoutUi.getComponent();
  myConsolePanel.add(layoutComponent, BorderLayout.CENTER);

  //noinspection ConstantConditions
  Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
  toolWindow.getContentManager().addContent(content);
}
项目:intellij-ce-playground    文件:StatisticsPanel.java   
public StatisticsPanel() {
    super(new BorderLayout(0, 0));
    myChildInfo = new StatisticsTable(TestColumnInfo.COLUMN_NAMES);
    myTable = new TableView(myChildInfo) {
      @Override
      public TableCellRenderer getCellRenderer(int row, int column) {
        return new TestTableRenderer(TestColumnInfo.COLUMN_NAMES);
      }
    };
    EditSourceOnDoubleClickHandler.install(myTable);
    PopupHandler.installPopupHandler(myTable,
                        IdeActions.GROUP_TESTSTATISTICS_POPUP,
                        ActionPlaces.TESTSTATISTICS_VIEW_POPUP);
//    add(myTestCaseInfo, BorderLayout.NORTH);
    add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
    final JPanel eastPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));

    myTotalLabel = new SimpleColoredComponent();
    eastPanel.add(myTotalLabel);

    myTimeLabel = new SimpleColoredComponent();
    eastPanel.add(myTimeLabel);

    add(eastPanel, BorderLayout.SOUTH);
  }
项目:intellij-ce-playground    文件:MvcConsole.java   
private Content setUpToolWindow() {
  //Create runner UI layout
  final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
  final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);

  // Adding actions
  DefaultActionGroup group = new DefaultActionGroup();
  group.add(myKillAction);
  group.addSeparator();

  layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

  final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
  layoutUi.addContent(console, 0, PlaceInGrid.right, false);

  final JComponent uiComponent = layoutUi.getComponent();
  myPanel.add(uiComponent, BorderLayout.CENTER);

  final ContentManager manager = myToolWindow.getContentManager();
  final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
  final Content content = contentFactory.createContent(uiComponent, null, true);
  manager.addContent(content);
  return content;
}
项目:intellij    文件:OpenCorrespondingBuildFile.java   
@Override
protected void updateForBlazeProject(Project project, AnActionEvent e) {
  Presentation presentation = e.getPresentation();

  DataContext dataContext = e.getDataContext();
  VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
  BlazePackage blazePackage = getBuildFile(project, virtualFile);
  if (blazePackage != null && virtualFile.equals(blazePackage.buildFile.getVirtualFile())) {
    presentation.setEnabledAndVisible(false);
    return;
  }

  boolean visible = virtualFile != null;
  boolean enabled = blazePackage != null;
  presentation.setVisible(visible || ActionPlaces.isMainMenuOrActionSearch(e.getPlace()));
  presentation.setEnabled(enabled);
}
项目:aem-ide-tooling-4-intellij    文件:SlingServerTreeManager.java   
private void popupInvoked(final Component comp, final int x, final int y) {
    Object userObject = null;
    final TreePath path = tree.getSelectionPath();
    if(path != null) {
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
        if(node != null) {
            userObject = node.getUserObject();
        }
    }
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup group = new DefaultActionGroup();
    if(
        userObject instanceof SlingServerNodeDescriptor ||
            userObject instanceof SlingServerModuleNodeDescriptor
        ) {
        group.add(actionManager.getAction("AEM.Connection.Popup"));
    } else {
        group.add(actionManager.getAction("AEM.Root.Popup"));
    }
    final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_EXPLORER_POPUP, group);
    popupMenu.getComponent().show(comp, x, y);
}
项目:embeddedlinux-jvmdebugger-intellij    文件:EmbeddedLinuxJVMConsoleView.java   
/**
 * Creats the tool window content
 * @param toolWindow
 */
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    //Create runner UI layout
    RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
    RunnerLayoutUi layoutUi = factory.create("", "", "session", project);

    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

    Content console = layoutUi.createContent(EmbeddedLinuxJVMToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
    AnAction[] consoleActions = consoleView.createConsoleActions();
    for (AnAction action : consoleActions) {
        if (!shouldIgnoreAction(action)) {
            group.add(action);
        }
    }
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);

    JComponent layoutComponent = layoutUi.getComponent();
    myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
    Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
    toolWindow.getContentManager().addContent(content);
}
项目:Buck-IntelliJ-Plugin    文件:BuckToolWindowFactory.java   
@Override
public void createToolWindowContent(
    @NotNull final Project project, @NotNull ToolWindow toolWindow) {
  toolWindow.setAvailable(true, null);
  toolWindow.setToHideOnEmptyContent(true);

  RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
  Content consoleContent = createConsoleContent(runnerLayoutUi, project);

  runnerLayoutUi.addContent(consoleContent, 0, PlaceInGrid.center, false);
  runnerLayoutUi.getOptions().setLeftToolbar(
      getLeftToolbarActions(project), ActionPlaces.UNKNOWN);

  runnerLayoutUi.updateActionsNow();

  final ContentManager contentManager = toolWindow.getContentManager();
  Content content = contentManager.getFactory().createContent(
      runnerLayoutUi.getComponent(), "", true);
  contentManager.addContent(content);

  updateBuckToolWindowTitle(project);
}
项目:google-cloud-intellij    文件:BreakpointConfigurationPanel.java   
/** Executes the standard add and remove watch from the watch list. */
private void executeAction(@NotNull String watch) {
  AnAction action = ActionManager.getInstance().getAction(watch);
  Presentation presentation = action.getTemplatePresentation().clone();
  DataContext context = DataManager.getInstance().getDataContext(treePanel.getTree());

  AnActionEvent actionEvent =
      new AnActionEvent(
          null,
          context,
          ActionPlaces.DEBUGGER_TOOLBAR,
          presentation,
          ActionManager.getInstance(),
          0);
  action.actionPerformed(actionEvent);
}
项目:netconsole-idea-plugin    文件:NetConsoleToolWindowFactory.java   
@Override
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
    final Document document = new PlainDocument();
    final NetConsoleClient netConsole = new NetConsoleClient(document);

    final JXTextArea textArea = new JXTextArea();
    textArea.setDocument(document);
    textArea.setEditable(false);

    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    actionGroup.addAction(new AutoScrollAction(netConsole, textArea));
    actionGroup.addAction(new ClearAction(netConsole));
    actionGroup.addAction(new DisableAction(netConsole, textArea));

    final SimpleToolWindowPanel netConsolePanel = new SimpleToolWindowPanel(false, false);
    final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN,
            actionGroup, false);
    netConsolePanel.setToolbar(toolbar.getComponent());
    netConsolePanel.setContent(new JBScrollPane(textArea));

    final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    final Content content = contentFactory.createContent(netConsolePanel, "", true);
    toolWindow.getContentManager().addContent(content);
}
项目:intellij-ocaml    文件:OCamlTopLevelConsoleView.java   
public OCamlTopLevelConsoleView(@NotNull final Project project, @NotNull final ContentManager contentManager, final Sdk topLevelSdk) throws ExecutionException {
    super(project, contentManager);
    myConsoleNumber = ++ourLastConsoleNumber;

    final GeneralCommandLine cmd = createCommandLine(topLevelSdk);
    myConsoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    myProcessHandler = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString());
    myConsoleView.attachToProcess(myProcessHandler);
    ProcessTerminatedListener.attach(myProcessHandler);

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(getOCamlToolWindowOpenCloseAction(true, false));
    group.addAll(myConsoleView.createConsoleActions());
    group.add(getOCamlToolWindowSettingsAction());
    group.add(getOCamlToolWindowOpenCloseAction(false, true));
    final JComponent toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent();
    toolbar.setMaximumSize(new Dimension(toolbar.getPreferredSize().width, Integer.MAX_VALUE));

    add(toolbar);
    add(myConsoleView.getComponent());

    myConsoleView.getComponent().requestFocus();
    myProcessHandler.startNotify();
}
项目:tools-idea    文件:PopFrameAction.java   
public void update(AnActionEvent e) {
  boolean enable = false;
  StackFrameProxyImpl stackFrameProxy = getStackFrameProxy(e);

  if(stackFrameProxy != null && isAtBreakpoint(e)) {
    VirtualMachineProxyImpl virtualMachineProxy = stackFrameProxy.getVirtualMachine();
    enable = virtualMachineProxy.canPopFrames();
  }

  if(ActionPlaces.MAIN_MENU.equals(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
    e.getPresentation().setEnabled(enable);
  }
  else {
    e.getPresentation().setVisible(enable);
  }
}
项目:tools-idea    文件:CallHierarchyBrowser.java   
@Override
protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) {
  ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
  final JTree tree1 = createTree(false);
  PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
  type2TreeMap.put(CALLEE_TYPE, tree1);

  final JTree tree2 = createTree(false);
  PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
  type2TreeMap.put(CALLER_TYPE, tree2);
}
项目:tools-idea    文件:EditorActionUtil.java   
public static EditorPopupHandler createEditorPopupHandler(final String groupId) {
  return new EditorPopupHandler() {
    @Override
    public void invokePopup(final EditorMouseEvent event) {
      if (!event.isConsumed() && event.getArea() == EditorMouseEventArea.EDITING_AREA) {
        ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(groupId);
        ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group);
        MouseEvent e = event.getMouseEvent();
        final Component c = e.getComponent();
        if (c != null && c.isShowing()) {
          popupMenu.getComponent().show(c, e.getX(), e.getY());
        }
        e.consume();
      }
    }
  };
}
项目:tools-idea    文件:MacDockDelegate.java   
public void updateRecentProjectsMenu () {
  final AnAction[] recentProjectActions = RecentProjectsManagerBase.getInstance().getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(new AnActionEvent(null, DataManager.getInstance().getDataContext(null),
                                                 ActionPlaces.DOCK_MENU, action.getTemplatePresentation(),
                                                 ActionManager.getInstance(), 0));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
项目:tools-idea    文件:OpenModuleSettingsAction.java   
protected static boolean isModuleInProjectViewPopup(AnActionEvent e) {
  if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace())) {
    final Project project = getEventProject(e);
    final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
    if (project != null && module != null) {
      final VirtualFile moduleFolder = PlatformDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
      if (moduleFolder == null) {
        return false;
      }
      if (ProjectRootsUtil.isModuleContentRoot(moduleFolder, project)
          || ProjectRootsUtil.isSourceOrTestRoot(moduleFolder, project)) {
        return true;
      }
    }
  }
  return false;
}
项目:tools-idea    文件:ResumeAction.java   
@Override
protected boolean isEnabled(AnActionEvent e) {
  Project project = e.getData(PlatformDataKeys.PROJECT);
  if (project == null) return false;

  boolean haveCurrentSession = false;
  for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
    final AbstractDebuggerSession session = support.getCurrentSession(project);
    if (session != null && !session.isStopped()) {
      haveCurrentSession = true;
      if (session.isPaused()) {
        return true;
      }
    }
  }
  return !ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace()) && !haveCurrentSession;
}
项目:tools-idea    文件:AbstractCommitChangesAction.java   
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  if (presentation.isVisible() && presentation.isEnabled()) {
    final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
    final Change[] selectedChanges = vcsContext.getSelectedChanges();
    if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
      if (selectedChangeLists != null && selectedChangeLists.length > 0) {
        presentation.setEnabled(selectedChangeLists.length == 1);
      }
      else {
        presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
      }
    }
    if (presentation.isEnabled() && selectedChanges != null) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
      for(Change c: selectedChanges) {
        if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
          presentation.setEnabled(false);
          break;
        }
      }
    }
  }
}
项目:tools-idea    文件:StatisticsPanel.java   
public StatisticsPanel() {
    super(new BorderLayout(0, 0));
    myChildInfo = new StatisticsTable(TestColumnInfo.COLUMN_NAMES);
    myTable = new TableView(myChildInfo) {
      @Override
      public TableCellRenderer getCellRenderer(int row, int column) {
        return new TestTableRenderer(TestColumnInfo.COLUMN_NAMES);
      }
    };
    EditSourceOnDoubleClickHandler.install(myTable);
    PopupHandler.installPopupHandler(myTable,
                        IdeActions.GROUP_TESTSTATISTICS_POPUP,
                        ActionPlaces.TESTSTATISTICS_VIEW_POPUP);
//    add(myTestCaseInfo, BorderLayout.NORTH);
    add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
    final JPanel eastPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));

    myTotalLabel = new SimpleColoredComponent();
    eastPanel.add(myTotalLabel);

    myTimeLabel = new SimpleColoredComponent();
    eastPanel.add(myTimeLabel);

    add(eastPanel, BorderLayout.SOUTH);
  }
项目:tools-idea    文件:MvcConsole.java   
private Content setUpToolWindow() {
  //Create runner UI layout
  final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
  final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);

  // Adding actions
  DefaultActionGroup group = new DefaultActionGroup();
  group.add(myKillAction);
  group.addSeparator();

  layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

  final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
  layoutUi.addContent(console, 0, PlaceInGrid.right, false);

  final JComponent uiComponent = layoutUi.getComponent();
  myPanel.add(uiComponent, BorderLayout.CENTER);

  final ContentManager manager = myToolWindow.getContentManager();
  final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
  final Content content = contentFactory.createContent(uiComponent, null, true);
  manager.addContent(content);
  return content;
}
项目:consulo-ui-designer    文件:GridCaptionPanel.java   
private boolean checkShowPopupMenu(final MouseEvent e)
{
    int cell = getCellAt(e.getPoint());

    if(cell >= 0 && e.isPopupTrigger())
    {
        if(!mySelectionModel.isSelectedIndex(cell))
        {
            mySelectionModel.setSelectionInterval(cell, cell);
        }
        ActionGroup group = mySelectedContainer.getGridLayoutManager().getCaptionActions();
        if(group != null)
        {
            final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
            popupMenu.getComponent().show(GridCaptionPanel.this, e.getX(), e.getY());
            return true;
        }
    }
    return false;
}
项目:consulo    文件:MacDockDelegate.java   
@Override
public void updateRecentProjectsMenu () {
  RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
  if (projectsManager == null) return;
  final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext((Component)null)));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
项目:consulo    文件:AbstractCommitChangesAction.java   
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
  super.update(vcsContext, presentation);
  if (presentation.isVisible() && presentation.isEnabled()) {
    final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
    final Change[] selectedChanges = vcsContext.getSelectedChanges();
    if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
      if (selectedChangeLists != null && selectedChangeLists.length > 0) {
        presentation.setEnabled(selectedChangeLists.length == 1);
      }
      else {
        presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
      }
    }
    if (presentation.isEnabled() && selectedChanges != null) {
      final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
      for(Change c: selectedChanges) {
        if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
          presentation.setEnabled(false);
          break;
        }
      }
    }
  }
}
项目:consulo    文件:CopyReferenceAction.java   
@Override
public void update(AnActionEvent e) {
  boolean plural = false;
  boolean enabled;

  DataContext dataContext = e.getDataContext();
  Editor editor = dataContext.getData(CommonDataKeys.EDITOR);
  if (editor != null && FileDocumentManager.getInstance().getFile(editor.getDocument()) != null) {
    enabled = true;
  }
  else {
    List<PsiElement> elements = getElementsToCopy(editor, dataContext);
    enabled = !elements.isEmpty();
    plural = elements.size() > 1;
  }

  e.getPresentation().setEnabled(enabled);
  if (ActionPlaces.isPopupPlace(e.getPlace())) {
    e.getPresentation().setVisible(enabled);
  }
  else {
    e.getPresentation().setVisible(true);
  }
  e.getPresentation().setText(plural ? "Cop&y References" : "Cop&y Reference");
}
项目:consulo-xml    文件:DomCollectionControl.java   
protected void initialize(final DomTableView boundComponent) {
  if (boundComponent == null) {
    myCollectionPanel = new DomTableView(getProject(), getEmptyPaneText(), getHelpId());
  }
  else {
    myCollectionPanel = boundComponent;
  }
  myCollectionPanel.setToolbarActions(new AddAction(), new EditAction(), new RemoveAction());
  myCollectionPanel.installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, createPopupActionGroup());
  myCollectionPanel.initializeTable();
  myCollectionPanel.addCustomDataProvider(this);
  myCollectionPanel.addChangeListener(new DomTableView.ChangeListener() {
    public void changed() {
      reset();
    }
  });
  reset();
}
项目:consulo-xml    文件:AbstractTableView.java   
public final void setToolbarActions(final AnAction... actions) {
  final DefaultActionGroup actionGroup = new DefaultActionGroup();
  for (final AnAction action : actions) {
    actionGroup.add(action);
  }
  if (getHelpId() != null) {
    actionGroup.add(AnSeparator.getInstance());
    actionGroup.add(new ContextHelpAction(getHelpId()));
  }

  final ActionManager actionManager = ActionManager.getInstance();
  final ToolbarPosition position = getToolbarPosition();
  final ActionToolbar myActionToolbar = actionManager.createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, actionGroup, position == ToolbarPosition.TOP || position == ToolbarPosition.BOTTOM);
  myActionToolbar.setTargetComponent(myInnerPanel);
  final JComponent toolbarComponent = myActionToolbar.getComponent();
  final MatteBorder matteBorder = BorderFactory.createMatteBorder(0, 0, position == ToolbarPosition.TOP ? 1 : 0, 0, JBColor.DARK_GRAY);
  toolbarComponent.setBorder(BorderFactory.createCompoundBorder(matteBorder, toolbarComponent.getBorder()));

  getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      myActionToolbar.updateActionsImmediately();
    }
  });

  add(toolbarComponent, position.getPosition());
}
项目:consulo-java    文件:CallHierarchyBrowser.java   
@Override
protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) {
  ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
  final JTree tree1 = createTree(false);
  PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
  type2TreeMap.put(CALLEE_TYPE, tree1);

  final JTree tree2 = createTree(false);
  PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
  baseOnThisMethodAction
    .registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
  type2TreeMap.put(CALLER_TYPE, tree2);
}
项目:consulo-java    文件:PopFrameAction.java   
public void update(AnActionEvent e) {
  boolean enable = false;
  StackFrameProxyImpl stackFrameProxy = getStackFrameProxy(e);

  if(stackFrameProxy != null && isAtBreakpoint(e)) {
    VirtualMachineProxyImpl virtualMachineProxy = stackFrameProxy.getVirtualMachine();
    enable = virtualMachineProxy.canPopFrames();
  }

  if(ActionPlaces.MAIN_MENU.equals(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
    e.getPresentation().setEnabled(enable);
  }
  else {
    e.getPresentation().setVisible(enable);
  }
}
项目:jfrog-idea-plugin    文件:ComponentUtils.java   
public static ActionToolbar createActionToolbar(Tree componentsTree) {
    DefaultActionGroup defaultActionGroup = new DefaultActionGroup();
    defaultActionGroup.addAction(ActionManager.getInstance().getAction("Xray.Refresh"));
    defaultActionGroup.addAction(new CollapseAllAction(componentsTree));
    defaultActionGroup.addAction(new ExpandAllAction(componentsTree));
    return ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, defaultActionGroup, true);
}