Icon startIcon = IconManager.getIcon(IconIdentifier.PLAY_SMALL, "start");
Icon pauseIcon = IconManager.getIcon(IconIdentifier.PAUSE_SMALL, "pause");
Icon stopIcon = IconManager.getIcon(IconIdentifier.STOP_SMALL, "stop");
IAction action =
new AbstractAction("simulation.start", "start", startIcon,
new String[] { "" }, null, null, this) {
@Override
public void execute() {
synchronized (this) {
ISimulationServer simServer = (ISimulationServer) getServer();
ComputationTaskIDObject info =
(ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
try {
simServer.startSimulationRun(info);
} catch (RemoteException e) {
SimSystem.report(e);
}
}
}
};
action.setEnabled(getSelectedNodeInfo() != null);
actions.add(action);
action =
new AbstractAction("simulation.pause", "pause", pauseIcon,
new String[] { "" }, null, null, this) {
@Override
public void execute() {
synchronized (this) {
ISimulationServer simServer = (ISimulationServer) getServer();
ComputationTaskIDObject info =
(ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
try {
simServer.executeRunnableCommand(info, "pause", null);
} catch (RemoteException e) {
SimSystem.report(e);
}
}
}
};
action.setEnabled(getSelectedNodeInfo() != null);
actions.add(action);
action =
new AbstractAction("simulation.stop", "stop", stopIcon,
new String[] { "" }, null, null, this) {
@Override
public void execute() {
synchronized (this) {
ISimulationServer simServer = (ISimulationServer) getServer();
ComputationTaskIDObject info =
(ComputationTaskIDObject) getSelectedNodeInfo().getInfo();
try {
simServer.stopProc(info);
} catch (RemoteException e) {
SimSystem.report(e);
}
}
}
};
action.setEnabled(getSelectedNodeInfo() != null);
actions.add(action);
return actions.toArray(new IAction[actions.size()]);
}