use of com.intellij.openapi.actionSystem.ActionManager in project azure-tools-for-java by Microsoft.
the class AzureActionsListener method appFrameCreated.
@Override
public void appFrameCreated(@NotNull List<String> commandLineArgs) {
DefaultLoader.setPluginComponent(this);
DefaultLoader.setUiHelper(new UIHelperImpl());
DefaultLoader.setIdeHelper(new IDEHelperImpl());
AzureTaskManager.register(new IntellijAzureTaskManager());
AzureRxTaskManager.register();
AzureMessager.setDefaultMessager(new IntellijAzureMessager());
IntellijAzureActionManager.register();
Node.setNode2Actions(NodeActionsMap.NODE_ACTIONS);
SchedulerProviderFactory.getInstance().init(new AppSchedulerProvider());
MvpUIHelperFactory.getInstance().init(new MvpUIHelperImpl());
HDInsightLoader.setHHDInsightHelper(new HDInsightHelperImpl());
AzureStoreManager.register(new DefaultMachineStore(PluginHelper.getTemplateFile("azure.json")), IntellijStore.getInstance(), IntelliJSecureStore.getInstance());
try {
loadPluginSettings();
} catch (IOException e) {
PluginUtil.displayErrorDialogAndLog("Error", "An error occurred while attempting to load settings", e);
}
AzureInitializer.initialize();
if (!AzurePlugin.IS_ANDROID_STUDIO) {
// enable spark serverless node subscribe actions
ServiceManager.setServiceProvider(CosmosSparkClusterOpsCtrl.class, new CosmosSparkClusterOpsCtrl(CosmosSparkClusterOps.getInstance()));
ServiceManager.setServiceProvider(TrustStrategy.class, IdeaTrustStrategy.INSTANCE);
initAuthManage();
ActionManager am = ActionManager.getInstance();
DefaultActionGroup toolbarGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_MAIN_TOOLBAR);
toolbarGroup.addAll((DefaultActionGroup) am.getAction("AzureToolbarGroup"));
DefaultActionGroup popupGroup = (DefaultActionGroup) am.getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP);
popupGroup.add(am.getAction("AzurePopupGroup"));
}
try {
PlatformDependent.isAndroid();
} catch (Throwable ignored) {
DefaultLoader.getUIHelper().showError("A problem with your Android Support plugin setup is preventing the" + " Azure Toolkit from functioning correctly (Retrofit2 and RxJava failed to initialize)" + ".\nTo fix this issue, try disabling the Android Support plugin or installing the " + "Android SDK", "Azure Toolkit for IntelliJ");
// DefaultLoader.getUIHelper().showException("Android Support Error: isAndroid() throws " + ignored
// .getMessage(), ignored, "Error Android", true, false);
}
}
use of com.intellij.openapi.actionSystem.ActionManager in project azure-tools-for-java by Microsoft.
the class Tree method installPopupMenu.
public static void installPopupMenu(JTree tree) {
final MouseAdapter popupHandler = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
final TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY());
if (path == null) {
return;
}
final Object node = path.getLastPathComponent();
if (node instanceof TreeNode) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (((TreeNode<?>) node).inner.hasChildren() && ((TreeNode<?>) node).loaded == null) {
((TreeNode<?>) node).refreshChildren();
tree.expandPath(path);
}
} else if (SwingUtilities.isRightMouseButton(e) || e.isPopupTrigger()) {
final ActionGroup actions = ((TreeNode<?>) node).inner.actions();
if (Objects.nonNull(actions)) {
final ActionManager am = ActionManager.getInstance();
final ActionPopupMenu menu = am.createActionPopupMenu("azure.component.tree", toIntellijActionGroup(actions));
menu.setTargetComponent(tree);
menu.getComponent().show(tree, e.getX(), e.getY());
}
}
}
}
private com.intellij.openapi.actionSystem.ActionGroup toIntellijActionGroup(ActionGroup actions) {
final ActionManager am = ActionManager.getInstance();
if (actions instanceof ActionGroup.Proxy) {
final String id = ((ActionGroup.Proxy) actions).id();
if (Objects.nonNull(id)) {
return (com.intellij.openapi.actionSystem.ActionGroup) am.getAction(id);
}
}
return new IntellijAzureActionManager.ActionGroupWrapper(actions);
}
};
tree.addMouseListener(popupHandler);
}
use of com.intellij.openapi.actionSystem.ActionManager in project ideavim by JetBrains.
the class ChangeGroup method runEnterAction.
private void runEnterAction(Editor editor, @NotNull DataContext context) {
CommandState state = CommandState.getInstance(editor);
if (state.getMode() != CommandState.Mode.REPEAT) {
final ActionManager actionManager = ActionManager.getInstance();
final AnAction action = actionManager.getAction("EditorEnter");
if (action != null) {
strokes.add(action);
KeyHandler.executeAction(action, context);
}
}
}
use of com.intellij.openapi.actionSystem.ActionManager in project android by JetBrains.
the class TreeGridTest method setUp.
@Before
public void setUp() {
myDisposable = Disposer.newDisposable();
Application application = mock(Application.class);
DataManager dataManager = mock(DataManager.class);
DataContext dataContext = mock(DataContext.class);
ActionManager actionManager = mock(ActionManager.class);
ApplicationManager.setApplication(application, myDisposable);
when(application.getAnyModalityState()).thenReturn(ModalityState.NON_MODAL);
when(application.getComponent(eq(DataManager.class))).thenReturn(dataManager);
when(dataManager.getDataContext(any(Component.class))).thenReturn(dataContext);
when(application.getComponent(eq(ActionManager.class))).thenReturn(actionManager);
myGrid = new TreeGrid<>();
myGrid.setSize(140, 800);
myGrid.setModel(createTree());
myGrid.setLayoutOrientation(JList.HORIZONTAL_WRAP);
myGrid.setFixedCellWidth(40);
myGrid.setFixedCellHeight(40);
myGrid.doLayout();
BufferedImage image = UIUtil.createImage(1000, 1000, TYPE_INT_ARGB);
myGrid.paint(image.getGraphics());
List<JList<String>> lists = myGrid.getLists();
myGroup1 = lists.get(0);
myGroup2 = lists.get(1);
myGroup3 = lists.get(2);
}
use of com.intellij.openapi.actionSystem.ActionManager in project android by JetBrains.
the class NlActionsToolbar method createToolbarComponent.
private JComponent createToolbarComponent() {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
// Create a layout where there are three toolbars:
// +----------------------------------------------------------------------------+
// | Normal toolbar, minus dynamic actions |
// +---------------------------------------------+------------------------------+
// | Dynamic layout actions | Zoom actions and file status |
// +---------------------------------------------+------------------------------+
ConfigurationHolder context = new NlEditorPanel.NlConfigurationHolder(mySurface);
ActionGroup configGroup = createConfigActions(context, mySurface);
ActionManager actionManager = ActionManager.getInstance();
myActionToolbar = actionManager.createActionToolbar("NlConfigToolbar", configGroup, true);
myActionToolbar.getComponent().setName("NlConfigToolbar");
myActionToolbar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY);
JComponent actionToolbarComponent = myActionToolbar.getComponent();
actionToolbarComponent.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
panel.add(actionToolbarComponent, BorderLayout.NORTH);
final ActionToolbar layoutToolBar = actionManager.createActionToolbar("NlLayoutToolbar", myDynamicGroup, true);
layoutToolBar.getComponent().setName("NlLayoutToolbar");
layoutToolBar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY);
JPanel bottom = new JPanel(new BorderLayout());
bottom.add(layoutToolBar.getComponent(), BorderLayout.WEST);
JPanel combined = new JPanel(new BorderLayout());
ActionToolbar zoomToolBar = actionManager.createActionToolbar("NlRhsToolbar", getRhsActions(mySurface), true);
combined.add(zoomToolBar.getComponent(), BorderLayout.WEST);
bottom.add(combined, BorderLayout.EAST);
panel.add(bottom, BorderLayout.SOUTH);
mySurface.addListener(this);
updateViewActions();
return panel;
}
Aggregations