}
});
// TODO add a wizard...
addAction = new ActionSupport(Messages.jcloud_addNodeButton, Messages.jcloud_addNodeButtonTooktip, FabricPlugin.getPlugin().getImageDescriptor("add_obj.gif")) {
@Override
public void run() {
// TODO open a wizard to choose an image to start..
}
};
openTerminalAction = new ActionSupport(Messages.jcloud_openTerminalLabel, Messages.jcloud_openTerminalTooltip, FabricPlugin.getPlugin().getImageDescriptor("terminal_view.gif")) {
@Override
public void run() {
openTerminal();
}
};
suspendAction = new ActionSupport(Messages.jcloud_suspendNodeButton, Messages.jcloud_suspendNodeButtonTooktip, FabricPlugin.getPlugin().getImageDescriptor("stop_task.gif")) {
@Override
public void run() {
final List<ComputeMetadata> selectedNodes = getSelectedNodes();
String message = makeNodesString(selectedNodes, "Suspending ", "");
Jobs.schedule(message, new Runnable() {
@Override
public void run() {
foreachNode(selectedNodes, "Suspend node failed", new Function<ComputeMetadata, Void>() {
@Override
public Void apply(ComputeMetadata node) {
String id = JClouds.id(node);
if (id != null) {
getComputeService().suspendNode(id);
}
return null;
}
});
asyncReload();
}
});
}
};
resumeAction = new ActionSupport(Messages.jcloud_resumeNodeButton, Messages.jcloud_resumeNodeButtonTooktip, FabricPlugin.getPlugin().getImageDescriptor("start_task.gif")) {
@Override
public void run() {
final List<ComputeMetadata> selectedNodes = getSelectedNodes();
String message = makeNodesString(selectedNodes, "Resuming ", "");
Jobs.schedule(message, new Runnable() {
@Override
public void run() {
foreachNode(selectedNodes, "Resume node failed", new Function<ComputeMetadata, Void>() {
@Override
public Void apply(ComputeMetadata node) {
String id = JClouds.id(node);
if (id != null) {
getComputeService().resumeNode(id);
}
return null;
}
});
asyncReload();
}
});
}
};
rebootAction = new ActionSupport(Messages.jcloud_rebootNodeButton, Messages.jcloud_rebootNodeButtonTooktip, FabricPlugin.getPlugin().getImageDescriptor("restart_task.gif")) {
@Override
public void run() {
final List<ComputeMetadata> selectedNodes = getSelectedNodes();
String message = makeNodesString(selectedNodes, "Rebooting ", "");
Jobs.schedule(message, new Runnable() {
@Override
public void run() {
foreachNode(selectedNodes, "Reboot node failed", new Function<ComputeMetadata, Void>() {
@Override
public Void apply(ComputeMetadata node) {
String id = JClouds.id(node);
if (id != null) {
getComputeService().rebootNode(id);
}
return null;
}
});
asyncReload();
}
});
}
};
destroyAction = new ActionSupport(Messages.jcloud_destroyNodeButton, Messages.jcloud_destroyNodeButtonTooktip, FabricPlugin.getPlugin().getImageDescriptor("delete.gif")) {
@Override
public void run() {
final List<ComputeMetadata> selectedNodes = getSelectedNodes();
if (!selectedNodes.isEmpty()) {