public void widgetSelected(SelectionEvent arg0) {
try {
viewer.setGraph(controller.createGraphFromOntoSpreadState(controller.next()));
updateGraph();
if(!controller.hasNext()){
EndDialog end = new EndDialog(shell);
end.open();
}
} catch (Exception e) {
createErrorDialog(e);
}
}
});
previousMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
try {
viewer.setGraph(controller.createGraphFromOntoSpreadState(controller.previous()));
updateGraph();
} catch (Exception e) {
createErrorDialog(e);
}
}
});
lastMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
try {
viewer.setGraph(controller.createGraphFromOntoSpreadState(controller.last()));
updateGraph();
EndDialog end = new EndDialog(shell);
end.open();
} catch (Exception e) {
createErrorDialog(e);
}
}
});
currentMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
try {
viewer.setGraph(controller.createGraphFromOntoSpreadState(controller.current()));
updateGraph();
} catch (Exception e) {
createErrorDialog(e);
}
}
});
playMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
stopMenuItem.setEnabled(true);
stopToolBarItem.setEnabled(true);
showMenuItem.setEnabled(false);
newItemToolItem.setEnabled(false);
newItemToolItem_1.setEnabled(false);
//Deactivate all buttons
configMenuItem.setEnabled(false);
loadMenuItem.setEnabled(false);
loadToolBarItem.setEnabled(false);
setInitialConceptMenuItem.setEnabled(false);
initialToolBarItem.setEnabled(false);
inspectorToolBarItem.setEnabled(false);
conceptToolBarItem.setEnabled(false);
activeToolBarItem.setEnabled(false);
spreadToolBarItem.setEnabled(false);
firstToolBarItem.setEnabled(false);
nextToolBarItem.setEnabled(false);
previousToolBarItem.setEnabled(false);
lastToolBarItem.setEnabled(false);
currentToolBarItem.setEnabled(false);
//MENU
showMenuItem.setEnabled(false);
runMenuItem.setEnabled(false);
inspectorMenuItem.setEnabled(false);
showConceptMenuItem.setEnabled(false);
conceptPathMenuItem.setEnabled(false);
showPathMenuItem.setEnabled(false);
firstMenuItem.setEnabled(false);
nextMenuItem.setEnabled(false);
previousMenuItem.setEnabled(false);
lastMenuItem.setEnabled(false);
currentMenuItem.setEnabled(false);
//End deactivate buttons
try{
hasEnd = false;
controller.first();
while(!isEnd() && controller.hasNext()){
viewer.setGraph(controller.createGraphFromOntoSpreadState(controller.next()));
updateGraph();
Thread.sleep(timeToWait.timeToWait());
}
EndDialog end = new EndDialog(shell);
end.open();
} catch (Exception e) {
createErrorDialog(e);
}finally{
stopMenuItem.notifyListeners(SWT.Selection, createEvent(arg0));