List of usage examples for com.intellij.openapi.actionSystem ActionPlaces EDITOR_TAB_POPUP
String EDITOR_TAB_POPUP
To view the source code for com.intellij.openapi.actionSystem ActionPlaces EDITOR_TAB_POPUP.
Click Source Link
From source file:com.intellij.ide.actions.CloseEditorAction.java
License:Apache License
@Override public void update(final AnActionEvent event) { final Presentation presentation = event.getPresentation(); final Project project = event.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false);/* w w w.ja va 2 s .co m*/ return; } if (ActionPlaces.EDITOR_POPUP.equals(event.getPlace()) || ActionPlaces.EDITOR_TAB_POPUP.equals(event.getPlace())) { presentation.setText(IdeBundle.message("action.close")); } EditorWindow window = event.getData(EditorWindow.DATA_KEY); if (window == null) { window = getEditorManager(project).getActiveWindow().getResult(); } presentation.setEnabled(window != null && window.getTabCount() > 0); }
From source file:com.intellij.ide.actions.PinActiveTabAction.java
License:Apache License
public void update(AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); DataContext context = e.getDataContext(); if (getFile(context) != null) { presentation.setEnabledAndVisible(true); } else {//from w w w .ja v a2 s .c om Content content = getContent(context); presentation.setEnabledAndVisible(content != null && content.isPinnable()); } if (ActionPlaces.EDITOR_TAB_POPUP.equals(e.getPlace()) || ViewContext.CELL_POPUP_PLACE.equals(e.getPlace())) { presentation.setText( isSelected(e) ? IdeBundle.message("action.unpin.tab") : IdeBundle.message("action.pin.tab")); } else { presentation.setText(isSelected(e) ? IdeBundle.message("action.unpin.active.tab") : IdeBundle.message("action.pin.active.tab")); } }
From source file:com.intellij.tools.BaseExternalToolsGroup.java
License:Apache License
private boolean isToolVisible(T tool, String context) { if (!tool.isEnabled()) return false; if (ActionPlaces.EDITOR_POPUP.equals(context) || ActionPlaces.EDITOR_TAB_POPUP.equals(context)) { return tool.isShownInEditor(); } else if (ActionPlaces.PROJECT_VIEW_POPUP.equals(context) || ActionPlaces.COMMANDER_POPUP.equals(context) || ActionPlaces.J2EE_VIEW_POPUP.equals(context) || ActionPlaces.TYPE_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.CALL_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.METHOD_HIERARCHY_VIEW_POPUP.equals(context) || ActionPlaces.FAVORITES_VIEW_POPUP.equals(context) || ActionPlaces.SCOPE_VIEW_POPUP.equals(context) || ActionPlaces.NAVIGATION_BAR.equals(context)) { return tool.isShownInProjectViews(); } else if (ActionPlaces.MAIN_MENU.equals(context)) { return tool.isShownInMainMenu(); } else if (ActionPlaces.USAGE_VIEW_POPUP.equals(context)) { return tool.isShownInSearchResultsPopup(); }//from w w w. j a va 2s . c o m return false; }
From source file:com.mediaworx.intellij.opencmsplugin.actions.tools.ActionTools.java
License:Open Source License
/** * Sets the text for the event's action depending on the user's selection in the project tree. E.g. if the user * selects mutiple files the resulting text is "[textPrefix] selected Files", if the user selects multiple folders * and one file the resulting text is "[textPrefix] selected Folders/File", if the user selects modules only the * resulting text is "[textPrefix] selected Modules". * @param event the action event provided by IntelliJ * @param plugin the current OpenCms plugin instance * @param textPrefix the text prefix to use *///from w w w. ja va2 s .co m public static void setSelectionSpecificActionText(AnActionEvent event, OpenCmsPlugin plugin, String textPrefix) { boolean enableAction = false; String actionPlace = event.getPlace(); VirtualFile[] selectedFiles = event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY); FileTypeCounter fileTypeCounter = new FileTypeCounter(plugin); if (selectedFiles != null && selectedFiles.length > 0) { fileTypeCounter.count(selectedFiles); if (fileTypeCounter.hasEntities()) { enableAction = true; } } if (!actionPlace.equals(ActionPlaces.EDITOR_POPUP) && !actionPlace.equals(ActionPlaces.EDITOR_TAB_POPUP)) { String actionText = textPrefix + " selected " + fileTypeCounter.getEntityNames(); event.getPresentation().setText(actionText); } if (enableAction) { event.getPresentation().setEnabled(true); } else { event.getPresentation().setEnabled(false); } }