use of com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener in project azure-tools-for-java by Microsoft.
the class QueueFileEditor method createFileEditorVirtualNode.
private FileEditorVirtualNode createFileEditorVirtualNode(final String name) {
FileEditorVirtualNode fileEditorVirtualNode = new FileEditorVirtualNode(this, name);
fileEditorVirtualNode.addAction(REFRESH, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
fillGrid();
}
});
fileEditorVirtualNode.addAction(DEQUEUE, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
dequeueFirstMessage();
}
});
fileEditorVirtualNode.addAction(ADD_MESSAGE, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
QueueMessageForm queueMessageForm = new QueueMessageForm(project);
queueMessageForm.setQueue(queue);
queueMessageForm.setStorageAccount(storageAccount);
queueMessageForm.setOnAddedMessage(new Runnable() {
@Override
public void run() {
fillGrid();
}
});
queueMessageForm.show();
}
});
fileEditorVirtualNode.addAction(CLEAR_QUEUE, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
int optionDialog = JOptionPane.showOptionDialog(null, "Are you sure you want to clear the queue \"" + queue.getName() + "\"?", "Azure Explorer", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Yes", "No" }, null);
if (optionDialog == JOptionPane.YES_OPTION) {
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Clearing queue messages", false) {
@Override
public void run(@NotNull ProgressIndicator progressIndicator) {
/* try {
StorageClientSDKManager.getManager().clearQueue(storageAccount, queue);
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
fillGrid();
}
});
} catch (AzureCmdException e) {
String msg = "An error occurred while attempting to clear queue messages." + "\n" + String.format(message("webappExpMsg"), e.getMessage());
PluginUtil.displayErrorDialogAndLog(message("errTtl"), msg, e);
}*/
}
});
}
}
});
fileEditorVirtualNode.addAction(OPEN, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
viewMessageText();
}
});
return fileEditorVirtualNode;
}
use of com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener in project azure-tools-for-java by Microsoft.
the class TableFileEditor method createFileEditorVirtualNode.
private FileEditorVirtualNode createFileEditorVirtualNode(final String name) {
FileEditorVirtualNode fileEditorVirtualNode = new FileEditorVirtualNode(this, name);
fileEditorVirtualNode.addAction(EDIT, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
editEntity();
}
});
fileEditorVirtualNode.addAction(DELETE, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
deleteSelection();
}
});
fileEditorVirtualNode.addAction(QUERY, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
fillGrid();
}
});
fileEditorVirtualNode.addAction(QUERY_DESIGNER, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
final TablesQueryDesigner form = new TablesQueryDesigner(project);
form.setOnFinish(new Runnable() {
@Override
public void run() {
queryTextField.setText(form.getQueryText());
}
});
form.show();
}
});
fileEditorVirtualNode.addAction(NEW_ENTITY, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
final TableEntityForm form = new TableEntityForm(project);
form.setTableName(table.getName());
form.setStorageAccount(storageAccount);
form.setTableEntity(null);
form.setTableEntityList(tableEntities);
form.setTitle("Add Entity");
form.setOnFinish(new Runnable() {
@Override
public void run() {
tableEntities.add(form.getTableEntity());
refreshGrid();
}
});
form.show();
}
});
return fileEditorVirtualNode;
}
use of com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener in project azure-tools-for-java by Microsoft.
the class ClusterNode method loadActions.
@Override
protected void loadActions() {
super.loadActions();
addAction("Open Spark History UI", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String sparkHistoryUrl = clusterDetail.isEmulator() ? ((EmulatorClusterDetail) clusterDetail).getSparkHistoryEndpoint() : String.format("https://%s.azurehdinsight.net/sparkhistory", clusterDetail.getName());
openUrlLink(sparkHistoryUrl);
}
});
addAction("Open Cluster Management Portal(Ambari)", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String ambariUrl = clusterDetail.isEmulator() ? ((EmulatorClusterDetail) clusterDetail).getAmbariEndpoint() : String.format(CommonConstant.DEFAULT_CLUSTER_ENDPOINT, clusterDetail.getName());
openUrlLink(ambariUrl);
}
});
if (clusterDetail instanceof ClusterDetail) {
addAction("Open Jupyter Notebook", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String jupyterUrl = String.format("https://%s.azurehdinsight.net/jupyter/tree", clusterDetail.getName());
openUrlLink(jupyterUrl);
}
});
addAction("Open Azure Management Portal", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
String resourceGroupName = clusterDetail.getResourceGroup();
if (resourceGroupName != null) {
String webPortHttpLink = String.format("https://portal.azure.com/#resource/subscriptions/%s/resourcegroups/%s/providers/Microsoft.HDInsight/clusters/%s", clusterDetail.getSubscription().getSubscriptionId(), resourceGroupName, clusterDetail.getName());
openUrlLink(webPortHttpLink);
} else {
DefaultLoader.getUIHelper().showError("Failed to get resource group name.", "HDInsight Explorer");
}
}
});
}
if (clusterDetail instanceof HDInsightAdditionalClusterDetail) {
addAction("Unlink", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
boolean choice = DefaultLoader.getUIHelper().showConfirmation("Do you really want to unlink the HDInsight cluster?", "Unlink HDInsight Cluster", new String[] { "Yes", "No" }, null);
if (choice) {
ClusterManagerEx.getInstance().removeHDInsightAdditionalCluster((HDInsightAdditionalClusterDetail) clusterDetail);
((HDInsightRootModule) getParent()).refreshWithoutAsync();
}
}
});
}
if (clusterDetail instanceof EmulatorClusterDetail) {
addAction("Unlink", new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) {
boolean choice = DefaultLoader.getUIHelper().showConfirmation("Do you really want to unlink the Emulator cluster?", "Unlink HDInsight Cluster", new String[] { "Yes", "No" }, null);
if (choice) {
ClusterManagerEx.getInstance().removeEmulatorCluster((EmulatorClusterDetail) clusterDetail);
((HDInsightRootModule) getParent()).refreshWithoutAsync();
}
}
});
}
}
use of com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener in project azure-tools-for-java by Microsoft.
the class TableFileEditor method createVirtualNode.
private FileEditorVirtualNode<EditorPart> createVirtualNode(final String name) {
final FileEditorVirtualNode<EditorPart> node = new FileEditorVirtualNode<EditorPart>(this, name);
node.addAction(DELETE, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
deleteSelection();
}
});
node.addAction(REFRESH, new NodeActionListener() {
@Override
protected void actionPerformed(NodeActionEvent e) throws AzureCmdException {
fillGrid();
}
});
return node;
}
use of com.microsoft.tooling.msservices.serviceexplorer.NodeActionListener in project azure-tools-for-java by Microsoft.
the class ExternalStorageNode method refreshItems.
@Override
protected void refreshItems() throws AzureCmdException {
if (storageAccount.getPrimaryKey().isEmpty()) {
try {
NodeActionListener listener = node2Actions.get(this.getClass()).get(0).getConstructor().newInstance();
listener.actionPerformedAsync(new NodeActionEvent(new NodeAction(this, this.getName()))).get();
} catch (Throwable t) {
throw new AzureCmdException("Error opening external storage", t);
}
} else {
fillChildren();
}
}
Aggregations