本文整理汇总了Java中com.intellij.openapi.actionSystem.ActionManager类的典型用法代码示例。如果您正苦于以下问题:Java ActionManager类的具体用法?Java ActionManager怎么用?Java ActionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionManager类属于com.intellij.openapi.actionSystem包,在下文中一共展示了ActionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBPMNModelMenu
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
public void initBPMNModelMenu() {
DefaultActionGroup modelMenu = (DefaultActionGroup) ActionManager.getInstance().getAction("yaoqiang.actions.BPMNModelMenu");
AppMenu model = new ModelMenu();
for (int i = 0; i < model.getItemCount(); i++) {
JMenuItem item = model.getItem(i);
if (item == null) {
modelMenu.addSeparator();
} else {
AnAction action = new AnAction(item.getText()) {
@Override
public void actionPerformed(AnActionEvent e) {
item.getAction().actionPerformed(new ActionEvent(e, 0, ""));
}
};
modelMenu.add(action);
}
}
}
示例2: apply
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
PropertiesComponent prop = PropertiesComponent.getInstance();
prop.setValue(FOLDER, imageFolder.getText());
String timeExecutionValue = timeExecution.getText();
prop.setValue(TIME_EXECUTION, timeExecutionValue);
int opcity = opacity.getValue();
prop.setValue(OPACITY, String.valueOf(opcity));
boolean isDisabled = disabled.isSelected();
prop.setValue(DISABLED, isDisabled);
ScheduledExecutorServiceHandler.shutdownExecution();
if(isDisabled) {
ActionManager.getInstance().getAction("clearBackgroundImage").actionPerformed(null);
}else {
ActionManager.getInstance().getAction("randomBackgroundImage").actionPerformed(null);
}
}
示例3: getListCellRendererComponent
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Override
public JLabel getListCellRendererComponent(JList<? extends StatisticsItem> list, StatisticsItem value, int index, boolean isSelected, boolean cellHasFocus) {
final Color foreground = list.getForeground();
final String message = KeyPromoterBundle.message(
"kp.list.item",
value.getShortcut(),
value.description,
value.count,
value.count == 1 ? "time" : "times"
);
setText(message);
setForeground(foreground);
setBorder(new EmptyBorder(2,10,2,10));
if (value.ideaActionID != null && !"".equals(value.ideaActionID)) {
final AnAction action = ActionManager.getInstance().getAction(value.ideaActionID);
if (action != null) {
final Icon icon = action.getTemplatePresentation().getIcon();
if (icon != null) {
setIcon(icon);
}
}
}
return this;
}
示例4: 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;
}
示例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: actionPerformed
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
ActionManager am = ActionManager.getInstance();
DefaultActionGroup actionGroup = (DefaultActionGroup) am.getAction(LaunchSearchActionRegistration.COMPONENT_GROUP);
// https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Popups
// https://github.com/linux-china/idea-string-manipulation/blob/master/src/main/java/osmedile/intellij/stringmanip/PopupChoiceAction.java#L23
JBPopupFactory
.getInstance()
.createActionGroupPopup("OnlineSearch",
actionGroup,
e.getDataContext(),
JBPopupFactory.ActionSelectionAid.NUMBERING,
false)
.showInBestPositionFor(e.getDataContext());
}
示例7: computeChildren
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@NotNull
@Override
protected AnAction[] computeChildren(@NotNull ActionManager manager) {
CheckoutProvider[] providers = CheckoutProvider.EXTENSION_POINT_NAME.getExtensions();
if (providers.length == 0) {
return EMPTY_ARRAY;
}
Arrays.sort(providers, new CheckoutProvider.CheckoutProviderComparator());
AnAction[] children = new AnAction[providers.length];
for (int i = 0; i < providers.length; i++) {
CheckoutProvider provider = providers[i];
children[i] = createAction(provider);
}
return children;
}
示例8: addVcsSpecificActions
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Override
protected void addVcsSpecificActions(@NotNull ActionManager manager, @NotNull List<AnAction> actions) {
add("Git.Branches", manager, actions);
add("Vcs.Push", manager, actions);
add("Git.Stash", manager, actions);
add("Git.Unstash", manager, actions);
add("ChangesView.AddUnversioned", manager, actions);
add("Git.ResolveConflicts", manager, actions);
// Github
addSeparator(actions);
final AnAction githubRebase = manager.getAction("Github.Rebase");
if (githubRebase != null) {
actions.add(new Separator(GitBundle.message("vcs.popup.git.github.section")));
actions.add(githubRebase);
}
}
示例9: createConsole
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
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());
}
示例10: getGoalActionId
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Nullable
private static String getGoalActionId(DataContext context) {
final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
if (goals == null || goals.size() != 1) {
return null;
}
MavenProject project = MavenActionUtil.getMavenProject(context);
if (project == null) return null;
String goal = goals.get(0);
final MavenShortcutsManager shortcutsManager = getShortcutsManager(context);
String actionId = shortcutsManager != null ? shortcutsManager.getActionId(project.getPath(), goal) : null;
if (actionId != null) {
AnAction action = ActionManager.getInstance().getAction(actionId);
if (action == null) {
MavenKeymapExtension.getOrRegisterAction(project, actionId, goal);
}
}
return actionId;
}
示例11: createCopyAction
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
private Action createCopyAction() {
ActionManager actionManager = ActionManager.getInstance();
if (actionManager == null) return null;
AnAction action = actionManager.getAction(IdeActions.ACTION_COPY);
if (action == null) return null;
return new AbstractAction(action.getTemplatePresentation().getText(), action.getTemplatePresentation().getIcon()) {
@Override
public void actionPerformed(ActionEvent e) {
StringSelection content = new StringSelection(getText());
ClipboardSynchronizer.getInstance().setContent(content, content);
}
@Override
public boolean isEnabled() {
return !getText().isEmpty();
}
};
}
示例12: createTreePanel
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@NotNull static JPanel createTreePanel(@NotNull CheckboxTreeView tree) {
JPanel treePanel = new JPanel(new BorderLayout());
DefaultActionGroup group = new DefaultActionGroup();
CommonActionsManager actions = CommonActionsManager.getInstance();
group.addAll(actions.createExpandAllAction(tree, treePanel), actions.createCollapseAllAction(tree, treePanel));
ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar("", group, true);
JPanel buttonsPanel = new JPanel(new BorderLayout());
buttonsPanel.add(actionToolBar.getComponent(), BorderLayout.CENTER);
buttonsPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.TOP | SideBorder.LEFT | SideBorder.RIGHT, 1));
treePanel.add(buttonsPanel, BorderLayout.NORTH);
treePanel.add(ScrollPaneFactory.createScrollPane(tree), BorderLayout.CENTER);
return treePanel;
}
示例13: RunnerLayoutUiImpl
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
public RunnerLayoutUiImpl(@NotNull Project project,
@NotNull Disposable parent,
@NotNull String runnerId,
@NotNull String runnerTitle,
@NotNull String sessionName) {
myLayout = RunnerLayoutSettings.getInstance().getLayout(runnerId);
Disposer.register(parent, this);
myContentUI = new RunnerContentUi(project, this, ActionManager.getInstance(), IdeFocusManager.getInstance(project), myLayout,
runnerTitle + " - " + sessionName);
Disposer.register(this, myContentUI);
myViewsContentManager = getContentFactory().createContentManager(myContentUI.getContentUI(), false, project);
myViewsContentManager.addDataProvider(this);
Disposer.register(this, myViewsContentManager);
}
示例14: beforeActionPerformed
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
@Override
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
final InputEvent input = event.getInputEvent();
if (input instanceof MouseEvent) {
final String id = ActionManager.getInstance().getId(action);
final ShortcutPromoterEP ep = myExtensions.get(id);
if (ep != null) {
PromoterState state = myState.get(id);
if (state == null) {
state = new PromoterState();
myState.put(id, state);
}
state.incClicks();
}
}
}
示例15: getCorrectedAction
import com.intellij.openapi.actionSystem.ActionManager; //导入依赖的package包/类
public AnAction getCorrectedAction(String id) {
if (! myIdToNameList.contains(new Pair(id, ""))){
return ActionManager.getInstance().getAction(id);
}
if (myIdToActionGroup.get(id) == null) {
for (Pair pair : myIdToNameList) {
if (pair.first.equals(id)){
final ActionGroup actionGroup = (ActionGroup)ActionManager.getInstance().getAction(id);
if (actionGroup != null) { //J2EE/Commander plugin was disabled
myIdToActionGroup.put(id, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second, pair.second));
}
}
}
}
return myIdToActionGroup.get(id);
}