本文整理匯總了Java中com.intellij.openapi.actionSystem.ActionManager.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionManager.getInstance方法的具體用法?Java ActionManager.getInstance怎麽用?Java ActionManager.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.actionSystem.ActionManager
的用法示例。
在下文中一共展示了ActionManager.getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTaskDescriptionActionGroup
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@NotNull
default DefaultActionGroup getTaskDescriptionActionGroup() {
final DefaultActionGroup group = new DefaultActionGroup();
String[] ids = new String[]{
StudyCheckAction.ACTION_ID,
StudyPreviousTaskAction.ACTION_ID,
StudyNextTaskAction.ACTION_ID,
StudyRefreshTaskFileAction.ACTION_ID,
StudyShowHintAction.ACTION_ID
};
ActionManager actionManager = ActionManager.getInstance();
Arrays.stream(ids)
.map(actionManager::getAction)
.filter(Objects::nonNull)
.forEach(group::add);
group.add(new StudyEditInputAction());
return group;
}
示例2: doOKAction
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@Override
protected void doOKAction() {
final ActionManager actionManager = ActionManager.getInstance();
TreeUtil.traverseDepth((TreeNode)myTree.getModel().getRoot(), new TreeUtil.Traverse() {
@Override
public boolean accept(Object node) {
if (node instanceof DefaultMutableTreeNode) {
final DefaultMutableTreeNode mutableNode = (DefaultMutableTreeNode)node;
final Object userObject = mutableNode.getUserObject();
if (userObject instanceof Pair) {
String actionId = (String)((Pair)userObject).first;
final AnAction action = actionManager.getAction(actionId);
Icon icon = (Icon)((Pair)userObject).second;
action.getTemplatePresentation().setIcon(icon);
action.setDefaultIcon(icon == null);
editToolbarIcon(actionId, mutableNode);
}
}
return true;
}
});
super.doOKAction();
CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
}
示例3: getVcsActions
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@Nullable
public List<AnAction> getVcsActions(@Nullable Project project, @Nullable AbstractVcs activeVcs,
@Nullable DataContext dataContext) {
if (activeVcs == null || !getVcsName().equals(activeVcs.getName())) {
return null;
}
final ActionManager manager = ActionManager.getInstance();
final List<AnAction> actions = new ArrayList<AnAction>();
actions.add(new Separator(activeVcs.getDisplayName()));
add("CheckinProject", manager, actions);
add("CheckinFiles", manager, actions);
add("ChangesView.Revert", manager, actions);
addSeparator(actions);
add("Vcs.ShowTabbedFileHistory", manager, actions);
add("Annotate", manager, actions);
add("Compare.SameVersion", manager, actions);
addSeparator(actions);
addVcsSpecificActions(manager, actions);
return actions;
}
示例4: createActions
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
private static void createActions(Project project, Collection<DataNode<TaskData>> taskNodes) {
ActionManager actionManager = ActionManager.getInstance();
final ExternalSystemShortcutsManager shortcutsManager = ExternalProjectsManager.getInstance(project).getShortcutsManager();
if (actionManager != null) {
for (DataNode<TaskData> each : taskNodes) {
final DataNode<ModuleData> moduleData = ExternalSystemApiUtil.findParent(each, ProjectKeys.MODULE);
if (moduleData == null || moduleData.isIgnored()) continue;
TaskData taskData = each.getData();
ExternalSystemTaskAction eachAction = new ExternalSystemTaskAction(project, moduleData.getData().getInternalName(), taskData);
actionManager.unregisterAction(eachAction.getId());
if (shortcutsManager.hasShortcuts(taskData.getLinkedExternalProjectPath(), taskData.getName())) {
actionManager.registerAction(eachAction.getId(), eachAction);
}
}
}
}
示例5: processKeymap
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
private static void processKeymap(final Element configurableElement){
final ActionManager actionManager = ActionManager.getInstance();
final String componentName = actionManager.getComponentName();
final SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
final Set<String> ids = ((ActionManagerImpl)actionManager).getActionIds();
final TreeSet<OptionDescription> options = new TreeSet<OptionDescription>();
for (String id : ids) {
final AnAction anAction = actionManager.getAction(id);
final String text = anAction.getTemplatePresentation().getText();
if (text != null) {
collectOptions(searchableOptionsRegistrar, options, text, componentName);
}
final String description = anAction.getTemplatePresentation().getDescription();
if (description != null) {
collectOptions(searchableOptionsRegistrar, options, description, componentName);
}
}
writeOptions(configurableElement, options);
}
示例6: initToolWindow
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
private void initToolWindow() {
initTree();
JPanel panel = new SeedStackNavigatorPanel(myProject, tree);
final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
toolWindow = (ToolWindowEx) manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT, myProject, true);
toolWindow.setIcon(SeedStackIcons.LOGO);
final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
final Content content = contentFactory.createContent(panel, "", false);
ContentManager contentManager = toolWindow.getContentManager();
contentManager.addContent(content);
contentManager.setSelectedContent(content, false);
final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
boolean wasVisible = false;
@Override
public void stateChanged() {
if (toolWindow.isDisposed()) return;
boolean visible = toolWindow.isVisible();
if (!visible) {
return;
}
scheduleStructureUpdate(null);
}
};
manager.addToolWindowManagerListener(listener, myProject);
ActionManager actionManager = ActionManager.getInstance();
DefaultActionGroup group = new DefaultActionGroup();
toolWindow.setAdditionalGearActions(group);
}
示例7: SeedStackNavigatorPanel
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
SeedStackNavigatorPanel(Project project, SimpleTree tree) {
super(true, true);
this.project = project;
this.tree = tree;
final ActionManager actionManager = ActionManager.getInstance();
ActionToolbar actionToolbar = actionManager.createActionToolbar(
"SeedStack Navigator Toolbar",
(DefaultActionGroup) actionManager.getAction("SeedStack.NavigatorActionsToolbar"),
true
);
actionToolbar.setTargetComponent(tree);
setToolbar(actionToolbar.getComponent());
setContent(ScrollPaneFactory.createScrollPane(tree));
}
示例8: executeAction
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
public static void executeAction(String actionId, InputEvent e) {
ActionManager actionManager = ActionManager.getInstance();
AnAction action = actionManager.getAction(actionId);
if (action != null) {
Presentation presentation = new Presentation();
AnActionEvent event = new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
action.update(event);
if (presentation.isEnabled()) {
action.actionPerformed(event);
}
}
}
示例9: initComponent
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@Override
public void initComponent() {
checkAndCreateRootDir();
ActionManager am = ActionManager.getInstance();
ArrayList<PackageTemplate> listPackageTemplate = PackageTemplateHelper.getListPackageTemplate();
for (PackageTemplate pt : listPackageTemplate) {
if (!pt.isShouldRegisterAction()) {
continue;
}
RunTemplateAction action = new RunTemplateAction(pt.getName(), pt);
am.registerAction(Const.ACTION_PREFIX + action.getName(), action);
}
}
示例10: swipedRight
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@Override
public void swipedRight(SwipeEvent event) {
ActionManager actionManager = ActionManager.getInstance();
AnAction back = actionManager.getAction("Back");
if (back == null) return;
actionManager.tryToExecute(back, createMouseEventWrapper(myFrame), null, null, false);
}
示例11: initContent
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
public void initContent() {
final ActionManager actionManager = ActionManager.getInstance();
final ActionGroup actionGroup = (ActionGroup)actionManager.getAction(TOOL_WINDOW_TOOLBAR_ID);
ActionToolbar actionToolbar = actionManager.createActionToolbar(myPlace, actionGroup, true);
JPanel toolbarControl = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.weightx = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.WEST;
toolbarControl.add(actionToolbar.getComponent(), constraints);
for (JComponent component : getToolbarControls()) {
component.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
toolbarControl.add(component, constraints);
}
setToolbar(toolbarControl);
final JComponent payloadControl = buildContent();
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(payloadControl);
JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
scrollBar.setUnitIncrement(scrollBar.getUnitIncrement() * 7);
myContent.add(scrollPane, CONTENT_CARD_NAME);
RichTextControlBuilder builder = new RichTextControlBuilder();
builder.setBackgroundColor(payloadControl.getBackground());
builder.setForegroundColor(UIUtil.getInactiveTextColor());
builder.setFont(payloadControl.getFont());
builder.setText(GradleBundle.message("gradle.toolwindow.text.no.linked.project"));
final JComponent noLinkedProjectControl = builder.build();
myContent.add(noLinkedProjectControl, NON_LINKED_CARD_NAME);
update();
}
示例12: executeAction
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
public static void executeAction(final String actionId, final InputEvent e) {
final ActionManager actionManager = ActionManager.getInstance();
final AnAction action = actionManager.getAction(actionId);
if (action != null) {
final Presentation presentation = new Presentation();
final AnActionEvent event =
new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
action.update(event);
if (presentation.isEnabled()) {
action.actionPerformed(event);
}
}
}
示例13: initActionIcons
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
private void initActionIcons() {
ActionManager actionManager = ActionManager.getInstance();
for (String actionId : myIconCustomizations.keySet()) {
final AnAction anAction = actionManager.getAction(actionId);
if (anAction != null) {
Icon icon;
final String iconPath = myIconCustomizations.get(actionId);
if (iconPath != null && new File(FileUtil.toSystemDependentName(iconPath)).exists()) {
Image image = null;
try {
image = ImageLoader.loadFromStream(VfsUtilCore.convertToURL(VfsUtil.pathToUrl(iconPath)).openStream());
}
catch (IOException e) {
LOG.debug(e);
}
icon = image == null ? null : new JBImageIcon(image);
}
else {
icon = AllIcons.Toolbar.Unknown;
}
anAction.getTemplatePresentation().setIcon(icon);
anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(icon));
anAction.setDefaultIcon(false);
}
}
final IdeFrameImpl frame = WindowManagerEx.getInstanceEx().getFrame(null);
if (frame != null) {
frame.updateView();
}
}
示例14: consumeTopHits
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
@Override
public void consumeTopHits(String pattern, Consumer<Object> collector, Project project) {
final ActionManager actionManager = ActionManager.getInstance();
for (String[] strings : getActionsMatrix()) {
if (StringUtil.isBetween(pattern, strings[0], strings[1])) {
for (int i = 2; i < strings.length; i++) {
collector.consume(actionManager.getAction(strings[i]));
}
}
}
}
示例15: getOrRegisterAction
import com.intellij.openapi.actionSystem.ActionManager; //導入方法依賴的package包/類
public static ExternalSystemAction getOrRegisterAction(Project project, String group, TaskData taskData) {
ExternalSystemTaskAction action = new ExternalSystemTaskAction(project, group, taskData);
ActionManager manager = ActionManager.getInstance();
AnAction anAction = manager.getAction(action.getId());
if (anAction instanceof ExternalSystemTaskAction && action.equals(anAction)) {
return (ExternalSystemAction)anAction;
}
manager.unregisterAction(action.getId());
manager.registerAction(action.getId(), action);
return action;
}