use of com.microsoft.azure.toolkit.lib.common.action.ActionGroup 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.microsoft.azure.toolkit.lib.common.action.ActionGroup in project azure-tools-for-java by Microsoft.
the class ResourceConnectionActionsContributor method registerGroups.
@Override
public void registerGroups(AzureActionManager am) {
final ActionGroup moduleActions = new ActionGroup(ADD_CONNECTION);
am.registerGroup(MODULE_ACTIONS, moduleActions);
final ActionGroup connectionActions = new ActionGroup("", EDIT_CONNECTION, REMOVE_CONNECTION);
am.registerGroup(CONNECTION_ACTIONS, connectionActions);
}
use of com.microsoft.azure.toolkit.lib.common.action.ActionGroup in project azure-tools-for-java by Microsoft.
the class VirtualMachineActionsContributor method registerGroups.
@Override
public void registerGroups(AzureActionManager am) {
final ActionGroup serviceActionGroup = new ActionGroup(ResourceCommonActionsContributor.SERVICE_REFRESH, ResourceCommonActionsContributor.CREATE);
am.registerGroup(SERVICE_ACTIONS, serviceActionGroup);
final ActionGroup accountActionGroup = new ActionGroup(ResourceCommonActionsContributor.REFRESH, ResourceCommonActionsContributor.OPEN_PORTAL_URL, "---", ResourceCommonActionsContributor.START, ResourceCommonActionsContributor.STOP, ResourceCommonActionsContributor.RESTART, ResourceCommonActionsContributor.DELETE);
am.registerGroup(VM_ACTIONS, accountActionGroup);
}
use of com.microsoft.azure.toolkit.lib.common.action.ActionGroup in project azure-tools-for-java by Microsoft.
the class SpringCloudActionsContributor method registerGroups.
@Override
public void registerGroups(AzureActionManager am) {
final ActionGroup serviceActionGroup = new ActionGroup(ResourceCommonActionsContributor.SERVICE_REFRESH);
am.registerGroup(SERVICE_ACTIONS, serviceActionGroup);
final ActionGroup clusterActionGroup = new ActionGroup(ResourceCommonActionsContributor.OPEN_PORTAL_URL, ResourceCommonActionsContributor.CREATE, ResourceCommonActionsContributor.REFRESH);
am.registerGroup(CLUSTER_ACTIONS, clusterActionGroup);
final ActionGroup appActionGroup = new ActionGroup(ResourceCommonActionsContributor.OPEN_PORTAL_URL, SpringCloudActionsContributor.OPEN_PUBLIC_URL, SpringCloudActionsContributor.OPEN_TEST_URL, "---", ResourceCommonActionsContributor.START, ResourceCommonActionsContributor.STOP, ResourceCommonActionsContributor.RESTART, ResourceCommonActionsContributor.DELETE, "---", ResourceCommonActionsContributor.DEPLOY, "---", ResourceCommonActionsContributor.SHOW_PROPERTIES, ResourceCommonActionsContributor.REFRESH, "---", SpringCloudActionsContributor.STREAM_LOG);
am.registerGroup(APP_ACTIONS, appActionGroup);
}
use of com.microsoft.azure.toolkit.lib.common.action.ActionGroup in project azure-tools-for-java by Microsoft.
the class StorageActionsContributor method registerGroups.
@Override
public void registerGroups(AzureActionManager am) {
final ActionGroup serviceActionGroup = new ActionGroup(ResourceCommonActionsContributor.SERVICE_REFRESH, ResourceCommonActionsContributor.CREATE);
am.registerGroup(SERVICE_ACTIONS, serviceActionGroup);
final ActionGroup accountActionGroup = new ActionGroup(ResourceCommonActionsContributor.OPEN_PORTAL_URL, StorageActionsContributor.OPEN_STORAGE_EXPLORER, "---", ResourceCommonActionsContributor.CONNECT, "---", ResourceCommonActionsContributor.DELETE);
am.registerGroup(ACCOUNT_ACTIONS, accountActionGroup);
}
Aggregations