本文整理汇总了Java中com.intellij.openapi.actionSystem.ActionPlaces类的典型用法代码示例。如果您正苦于以下问题:Java ActionPlaces类的具体用法?Java ActionPlaces怎么用?Java ActionPlaces使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionPlaces类属于com.intellij.openapi.actionSystem包,在下文中一共展示了ActionPlaces类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTrees
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
protected void createTrees(@NotNull final Map<String, JTree> type2TreeMap) {
ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_CALL_HIERARCHY_POPUP);
final JTree tree1 = createTree(false);
PopupHandler.installPopupHandler(tree1, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
final BaseOnThisMethodAction baseOnThisMethodAction = new BaseOnThisMethodAction();
baseOnThisMethodAction
.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree1);
type2TreeMap.put(CALLEE_TYPE, tree1);
final JTree tree2 = createTree(false);
PopupHandler.installPopupHandler(tree2, group, ActionPlaces.CALL_HIERARCHY_VIEW_POPUP, ActionManager.getInstance());
baseOnThisMethodAction
.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_CALL_HIERARCHY).getShortcutSet(), tree2);
type2TreeMap.put(CALLER_TYPE, tree2);
}
示例2: createConsole
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的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());
}
示例3: run
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
private void run(KeyEvent event) {
myIsRunningAction = true;
try {
ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
AnAction action = actionManager.getAction(myActionId);
DataContext context = DataManager.getInstance().getDataContext(IdeFocusManager.findInstance().getFocusOwner());
AnActionEvent anActionEvent = AnActionEvent.createFromAnAction(action, event, ActionPlaces.MAIN_MENU, context);
actionManager.fireBeforeActionPerformed(action, anActionEvent.getDataContext(), anActionEvent);
action.actionPerformed(anActionEvent);
actionManager.fireAfterActionPerformed(action, anActionEvent.getDataContext(), anActionEvent);
}
finally {
myIsRunningAction = false;
}
}
示例4: updateRecentProjectsMenu
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
public void updateRecentProjectsMenu () {
RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
if (projectsManager == null) return;
final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
recentProjectsMenu.removeAll();
for (final AnAction action : recentProjectActions) {
MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
}
});
recentProjectsMenu.add(menuItem);
}
}
示例5: isModuleInProjectViewPopup
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
protected static boolean isModuleInProjectViewPopup(AnActionEvent e) {
if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace())) {
final Project project = getEventProject(e);
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
if (project != null && module != null) {
final VirtualFile moduleFolder = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
if (moduleFolder == null) {
return false;
}
if (ProjectRootsUtil.isModuleContentRoot(moduleFolder, project) || ProjectRootsUtil.isModuleSourceRoot(moduleFolder, project)) {
return true;
}
}
}
return false;
}
示例6: update
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
public void update(@NotNull final AnActionEvent e) {
Presentation p = e.getPresentation();
IdeFrameEx frame = null;
boolean isApplicable = WindowManager.getInstance().isFullScreenSupportedInCurrentOS() && (frame = getFrame()) != null;
if (e.getPlace() != ActionPlaces.MAIN_TOOLBAR) {
p.setVisible(isApplicable);
}
p.setEnabled(isApplicable);
if (isApplicable) {
p.setText(frame.isInFullScreen() ? TEXT_EXIT_FULL_SCREEN : TEXT_ENTER_FULL_SCREEN);
}
}
示例7: update
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
public void update(final AnActionEvent event) {
Presentation presentation = event.getPresentation();
boolean hidden = isHidden(event);
if (hidden) {
presentation.setEnabledAndVisible(false);
return;
}
boolean enabled = isEnabled(event);
if (myHideDisabledInPopup && ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(enabled);
}
else {
presentation.setVisible(true);
}
presentation.setEnabled(enabled);
}
示例8: createToolbar
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
private ActionToolbarImpl createToolbar() {
final DefaultActionGroup framesGroup = new DefaultActionGroup();
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));
framesGroup.addAll(ActionManager.getInstance().getAction(XDebuggerActions.FRAMES_TOP_TOOLBAR_GROUP));
final ActionToolbarImpl toolbar =
(ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
toolbar.setReservePlaceAutoPopupIcon(false);
toolbar.setAddSeparatorFirst(true);
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
return toolbar;
}
示例9: update
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
protected void update(final VcsContext vcsContext, final Presentation presentation) {
super.update(vcsContext, presentation);
if (presentation.isVisible() && presentation.isEnabled()) {
final ChangeList[] selectedChangeLists = vcsContext.getSelectedChangeLists();
final Change[] selectedChanges = vcsContext.getSelectedChanges();
if (vcsContext.getPlace().equals(ActionPlaces.CHANGES_VIEW_POPUP)) {
if (selectedChangeLists != null && selectedChangeLists.length > 0) {
presentation.setEnabled(selectedChangeLists.length == 1 && !ContainerUtil.isEmpty(selectedChangeLists[0].getChanges()));
}
else {
presentation.setEnabled (selectedChanges != null && selectedChanges.length > 0);
}
}
if (presentation.isEnabled() && selectedChanges != null) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(vcsContext.getProject());
for(Change c: selectedChanges) {
if (c.getFileStatus() == FileStatus.HIJACKED && changeListManager.getChangeList(c) == null) {
presentation.setEnabled(false);
break;
}
}
}
}
}
示例10: SearchTextArea
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
public SearchTextArea(boolean search) {
myTextArea = new JTextArea();
setBorder(JBUI.Borders.empty(6, 6, 6, 8));
setLayout(new BorderLayout(JBUI.scale(4), 0));
myTextArea.addPropertyChangeListener("background", this);
myTextArea.addFocusListener(this);
myTextArea.setBorder(null);
myTextArea.setOpaque(false);
JBScrollPane scrollPane = new JBScrollPane(myTextArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.getVerticalScrollBar().setBackground(UIUtil.TRANSPARENT_COLOR);
scrollPane.getViewport().setBorder(null);
scrollPane.getViewport().setOpaque(false);
scrollPane.setBorder(JBUI.Borders.emptyRight(2));
scrollPane.setOpaque(false);
ShowHistoryAction historyAction = new ShowHistoryAction(search);
ActionButton button =
new ActionButton(historyAction, historyAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, new Dimension(JBUI.scale(16), JBUI.scale(16)));
button.setLook(new InplaceActionButtonLook());
JPanel p = new NonOpaquePanel(new BorderLayout());
p.add(button, BorderLayout.NORTH);
add(p, BorderLayout.WEST);
add(scrollPane, BorderLayout.CENTER);
}
示例11: update
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
boolean plural = false;
boolean enabled;
DataContext dataContext = e.getDataContext();
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
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");
}
示例12: update
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
OpenInBrowserRequest result = BaseOpenInBrowserAction.doUpdate(e);
if (result == null) {
return;
}
String description = getTemplatePresentation().getDescription();
if (HtmlUtil.isHtmlFile(result.getFile())) {
description += " (hold Shift to open URL of local file)";
}
presentation.setText(getTemplatePresentation().getText());
presentation.setDescription(description);
WebBrowser browser = findUsingBrowser();
if (browser != null) {
presentation.setIcon(browser.getIcon());
}
if (ActionPlaces.isPopupPlace(e.getPlace())) {
presentation.setVisible(presentation.isEnabled());
}
}
示例13: createToolWindowContent
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
//Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
AnAction[] consoleActions = myConsoleView.createConsoleActions();
for (AnAction action : consoleActions) {
if (!shouldIgnoreAction(action)) {
group.add(action);
}
}
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
JComponent layoutComponent = layoutUi.getComponent();
myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
//noinspection ConstantConditions
Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
toolWindow.getContentManager().addContent(content);
}
示例14: StatisticsPanel
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
public StatisticsPanel() {
super(new BorderLayout(0, 0));
myChildInfo = new StatisticsTable(TestColumnInfo.COLUMN_NAMES);
myTable = new TableView(myChildInfo) {
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
return new TestTableRenderer(TestColumnInfo.COLUMN_NAMES);
}
};
EditSourceOnDoubleClickHandler.install(myTable);
PopupHandler.installPopupHandler(myTable,
IdeActions.GROUP_TESTSTATISTICS_POPUP,
ActionPlaces.TESTSTATISTICS_VIEW_POPUP);
// add(myTestCaseInfo, BorderLayout.NORTH);
add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
final JPanel eastPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
myTotalLabel = new SimpleColoredComponent();
eastPanel.add(myTotalLabel);
myTimeLabel = new SimpleColoredComponent();
eastPanel.add(myTimeLabel);
add(eastPanel, BorderLayout.SOUTH);
}
示例15: setUpToolWindow
import com.intellij.openapi.actionSystem.ActionPlaces; //导入依赖的package包/类
private Content setUpToolWindow() {
//Create runner UI layout
final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
group.add(myKillAction);
group.addSeparator();
layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
final JComponent uiComponent = layoutUi.getComponent();
myPanel.add(uiComponent, BorderLayout.CENTER);
final ContentManager manager = myToolWindow.getContentManager();
final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
final Content content = contentFactory.createContent(uiComponent, null, true);
manager.addContent(content);
return content;
}