use of com.microsoft.tooling.msservices.helpers.Name in project azure-tools-for-java by Microsoft.
the class CreateFunctionAppAction method openDialog.
@AzureOperation(name = "function.open_creation_dialog", type = AzureOperation.Type.ACTION)
private void openDialog(final Project project, @Nullable final FunctionAppConfig data) {
final FunctionAppCreationDialog dialog = new FunctionAppCreationDialog(project);
if (Objects.nonNull(data)) {
dialog.setData(data);
}
dialog.setOkActionListener((config) -> {
dialog.close();
this.createFunctionApp(config).subscribe(functionApp -> {
}, (error) -> {
final String title = String.format("Reopen dialog \"%s\"", dialog.getTitle());
final Consumer<Object> act = t -> AzureTaskManager.getInstance().runLater("open dialog", () -> this.openDialog(project, config));
final Action<?> action = new Action<>(act, new ActionView.Builder(title));
AzureMessager.getMessager().error(error, null, action);
});
});
dialog.show();
}
use of com.microsoft.tooling.msservices.helpers.Name in project azure-tools-for-java by Microsoft.
the class Node method initActions.
// sub-classes are expected to override this method and
// add code for initializing node-specific actions; this
// method is called when the node is being constructed and
// is guaranteed to be called only once per node
// NOTE: The Class<?> objects returned by this method MUST be
// public inner classes of the sub-class. We assume that they are.
protected Map<String, Class<? extends NodeActionListener>> initActions() {
List<Class<? extends NodeActionListener>> actions = node2Actions.get(this.getClass());
if (actions != null) {
try {
for (Class<? extends NodeActionListener> actionClazz : actions) {
NodeActionListener actionListener = createNodeActionListener(actionClazz);
if (Objects.nonNull(actionListener.getAction())) {
addAction(new DelegateActionListener.BasicActionListener(actionListener, actionListener.getAction()));
continue;
}
Name nameAnnotation = actionClazz.getAnnotation(Name.class);
if (nameAnnotation != null) {
addAction(nameAnnotation.value(), actionListener);
}
}
} catch (final InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
DefaultLoader.getUIHelper().showException(e.getMessage(), e, "MS Services - Error", true, false);
}
}
return null;
}
Aggregations