use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class GpuMonitorView method getToolbarActions.
@Override
@NotNull
public ActionGroup getToolbarActions() {
DefaultActionGroup group = new DefaultActionGroup();
group.add(new RecordingAction(this));
group.add(new Separator());
group.add(new BrowserHelpAction("GPU monitor", PROFILING_URL));
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.
the class MonitorPanel method setupToolbar.
@NotNull
private ActionToolbarImpl setupToolbar(@NotNull ActionGroup actions, @NotNull BaseMonitorView monitor) {
DefaultActionGroup viewActions = new DefaultActionGroup();
viewActions.addAll(actions);
viewActions.add(new MonitorMoveAction(this, monitor, -1));
viewActions.add(new MonitorMoveAction(this, monitor, 1));
viewActions.add(new MinimizeAction(this, monitor));
ActionToolbarImpl toolbar = new ActionToolbarImpl(ActionPlaces.UNKNOWN, viewActions, true, false, DataManager.getInstance(), ActionManagerEx.getInstanceEx(), KeymapManagerEx.getInstanceEx());
toolbar.setBorder(BorderFactory.createEmptyBorder());
toolbar.setMinimumSize(new Dimension(0, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE.height));
toolbar.setPreferredSize(new Dimension(Integer.MAX_VALUE, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE.height));
toolbar.setMaximumSize(toolbar.getPreferredSize());
return toolbar;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class GitBranchPopupActions method createActions.
ActionGroup createActions(@Nullable DefaultActionGroup toInsert, @NotNull String repoInfo, boolean firstLevelGroup) {
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
List<GitRepository> repositoryList = Collections.singletonList(myRepository);
popupGroup.addAction(new GitNewBranchAction(myProject, repositoryList));
popupGroup.addAction(new CheckoutRevisionActions(myProject, repositoryList));
if (toInsert != null) {
popupGroup.addAll(toInsert);
}
popupGroup.addSeparator("Local Branches" + repoInfo);
List<BranchActionGroup> localBranchActions = myRepository.getBranches().getLocalBranches().stream().sorted().filter(branch -> !branch.equals(myRepository.getCurrentBranch())).map(branch -> new LocalBranchActions(myProject, repositoryList, branch.getName(), myRepository)).collect(toList());
// if there are only a few local favorites -> show all; for remotes it's better to show only favorites;
wrapWithMoreActionIfNeeded(myProject, popupGroup, ContainerUtil.sorted(localBranchActions, FAVORITE_BRANCH_COMPARATOR), getNumOfTopShownBranches(localBranchActions), firstLevelGroup ? GitBranchPopup.SHOW_ALL_LOCALS_KEY : null, firstLevelGroup);
popupGroup.addSeparator("Remote Branches" + repoInfo);
List<BranchActionGroup> remoteBranchActions = myRepository.getBranches().getRemoteBranches().stream().sorted().map(remoteBranch -> new RemoteBranchActions(myProject, repositoryList, remoteBranch.getName(), myRepository)).collect(toList());
wrapWithMoreActionIfNeeded(myProject, popupGroup, ContainerUtil.sorted(remoteBranchActions, FAVORITE_BRANCH_COMPARATOR), getNumOfTopShownBranches(remoteBranchActions), firstLevelGroup ? GitBranchPopup.SHOW_ALL_REMOTES_KEY : null);
return popupGroup;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class SurroundWithTemplateHandler method invoke.
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
if (!EditorModificationUtil.checkModificationAllowed(editor))
return;
DefaultActionGroup group = createActionGroup(project, editor, file);
if (group == null)
return;
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(CodeInsightBundle.message("templates.select.template.chooser.title"), group, DataManager.getInstance().getDataContext(editor.getContentComponent()), JBPopupFactory.ActionSelectionAid.MNEMONICS, false);
popup.showInBestPositionFor(editor);
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ContentEntryTreeEditor method setContentEntryEditor.
/**
* @param contentEntryEditor : null means to clear the editor
*/
public void setContentEntryEditor(final ContentEntryEditor contentEntryEditor) {
if (myContentEntryEditor != null && myContentEntryEditor.equals(contentEntryEditor)) {
return;
}
if (myFileSystemTree != null) {
Disposer.dispose(myFileSystemTree);
myFileSystemTree = null;
}
if (myContentEntryEditor != null) {
myContentEntryEditor.removeContentEntryEditorListener(myContentEntryEditorListener);
myContentEntryEditor = null;
}
if (contentEntryEditor == null) {
((DefaultTreeModel) myTree.getModel()).setRoot(EMPTY_TREE_ROOT);
myTreePanel.setVisible(false);
if (myFileSystemTree != null) {
Disposer.dispose(myFileSystemTree);
}
return;
}
myTreePanel.setVisible(true);
myContentEntryEditor = contentEntryEditor;
myContentEntryEditor.addContentEntryEditorListener(myContentEntryEditorListener);
final ContentEntry entry = contentEntryEditor.getContentEntry();
assert entry != null : contentEntryEditor;
final VirtualFile file = entry.getFile();
if (file != null) {
myDescriptor.setRoots(file);
} else {
String path = VfsUtilCore.urlToPath(entry.getUrl());
myDescriptor.setTitle(FileUtil.toSystemDependentName(path));
}
final Runnable init = () -> {
//noinspection ConstantConditions
myFileSystemTree.updateTree();
myFileSystemTree.select(file, null);
};
myFileSystemTree = new FileSystemTreeImpl(myProject, myDescriptor, myTree, getContentEntryCellRenderer(), init, null) {
@Override
protected AbstractTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, AbstractTreeStructure treeStructure, Comparator<NodeDescriptor> comparator, FileChooserDescriptor descriptor, final Runnable onInitialized) {
return new MyFileTreeBuilder(tree, treeModel, treeStructure, comparator, descriptor, onInitialized);
}
};
myFileSystemTree.showHiddens(true);
Disposer.register(myProject, myFileSystemTree);
final NewFolderAction newFolderAction = new MyNewFolderAction();
final DefaultActionGroup mousePopupGroup = new DefaultActionGroup();
mousePopupGroup.add(myEditingActionsGroup);
mousePopupGroup.addSeparator();
mousePopupGroup.add(newFolderAction);
myFileSystemTree.registerMouseListener(mousePopupGroup);
}
Aggregations