Java Code Examples for com.intellij.openapi.actionSystem.ActionPlaces#isPopupPlace()
The following examples show how to use
com.intellij.openapi.actionSystem.ActionPlaces#isPopupPlace() .
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: CopyReferenceAction.java From consulo with Apache License 2.0 | 6 votes |
@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"); }
Example 2
Source File: ManageWorkspacesAction.java From azure-devops-intellij with MIT License | 5 votes |
@Override public void update(final AnActionEvent e) { final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); if (ActionPlaces.isPopupPlace(e.getPlace())) { e.getPresentation().setVisible(project != null); } else { e.getPresentation().setEnabled(project != null); } }
Example 3
Source File: CreateVirtualFolderAction.java From azure-devops-intellij with MIT License | 5 votes |
@Override public void update(final AnActionEvent e) { boolean isEnabled = isEnabled(e); if (ActionPlaces.isPopupPlace(e.getPlace())) { e.getPresentation().setVisible(isEnabled); } else { e.getPresentation().setEnabled(isEnabled); } }
Example 4
Source File: BasicAction.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Disable the action if the event does not apply in this context. * * @param e The update event */ @Override public void update(@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { presentation.setEnabled(false); presentation.setVisible(false); return; } VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); if (vFiles == null || vFiles.length == 0) { presentation.setEnabled(false); presentation.setVisible(true); return; } P4Vcs vcs = P4Vcs.getInstance(project); boolean enabled = ProjectLevelVcsManager.getInstance(project).checkAllFilesAreUnder(vcs, vFiles) && isEnabled(project, vcs, vFiles); // only enable action if all the targets are under the vcs and the action supports all of them presentation.setEnabled(enabled); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(enabled); } else { presentation.setVisible(true); } }
Example 5
Source File: ActiveConnectionPanel.java From p4ic4idea with Apache License 2.0 | 5 votes |
@Override public void update(@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); boolean enabled = isEnabled(); presentation.setEnabled(enabled); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(enabled); } else { presentation.setVisible(true); } }
Example 6
Source File: BaseShowDiffAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void update(@Nonnull AnActionEvent e) { Presentation presentation = e.getPresentation(); boolean canShow = isAvailable(e); presentation.setEnabled(canShow); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(canShow); } }
Example 7
Source File: SimplePasteAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(AnActionEvent e) { super.update(e); if (ActionPlaces.isPopupPlace(e.getPlace())) { Presentation presentation = e.getPresentation(); presentation.setVisible(presentation.isEnabled()); } }