mainWindow.getShell().setText(((Model)domain).getName() + " - NBO Client 0.1");
if (domain instanceof ResourceAllocation) {
lastSelection = selection;
ResourceAllocation ra = (ResourceAllocation)domain;
ResourceAllocationPerspective perspective = mainWindow.getRAPerspective();
String textSolution = ra.getSolution().get(ra.getName());
String log = ra.getLog();
mainWindow.changePerspective(perspective);
perspective.setSummaryText(ra.getSummary());
perspective.setSourceTables(ra);
perspective.setSolutionTables(ra);
if (perspective.getContent().getSelection() == null)
perspective.getContent().setSelection(0);
if (textSolution != null)
perspective.setSolutionText(textSolution);
else
perspective.clearText();
if (log != null)
perspective.setServerOutputText(log);
else
perspective.clearText();
if ((ra.isSolved() || ra.isFailed()) && !ra.isAcknowledged()) {
ra.setState(Model.ACKNOWLEDGED);
mainWindow.getProblemBrowserTree().getTreeViewer().refresh();
}
if (ra.isStarted() && !ra.isFailed()) {
perspective.getAlgSelector().setEnabled(false);
perspective.getOptionsGroup().setEnabled(false);
}
else {
perspective.getAlgSelector().setEnabled(true);
perspective.getOptionsGroup().setEnabled(true);
}
Combo selector = perspective.getAlgSelector();
Text mText =
(Text)perspective.getOptionsGroup().getChildren()[ResourceAllocationPerspective.M_TEXT];
Text l1Text =
(Text)perspective.getOptionsGroup().getChildren()[ResourceAllocationPerspective.L1_TEXT];
Text l2Text =
(Text)perspective.getOptionsGroup().getChildren()[ResourceAllocationPerspective.L2_TEXT];
Text KText =
(Text)perspective.getOptionsGroup().getChildren()[ResourceAllocationPerspective.K_TEXT];
Text rText =
(Text)perspective.getOptionsGroup().getChildren()[ResourceAllocationPerspective.R_TEXT];
selector.select(ra.getAlgorithmIndex(ra.getAlgorithm()));
if (ra.getAlgorithm().equals("greedy4")) {
String m = ra.getAlgParams().get("m");
mText.setEnabled(true);
if (m != null) mText.setText(m);
}
else {
mText.setText("1");
mText.setEnabled(false);
}
if (ra.getAlgorithm().equals("greedy1_delta4") || ra.getAlgorithm().equals("greedy3_delta4")) {
String l1 = ra.getAlgParams().get("l1");
String l2 = ra.getAlgParams().get("l2");
l1Text.setEnabled(true);
l2Text.setEnabled(true);
if (l1 != null) l1Text.setText(l1);
if (l2 != null) l2Text.setText(l2);
}
else {
l1Text.setEnabled(false);
l1Text.setText("1");
l2Text.setEnabled(false);
l2Text.setText("1");
}
if (ra.getAlgorithm().equals("greedy2mod")) {
String K = ra.getAlgParams().get("K");
String r = ra.getAlgParams().get("r");
KText.setEnabled(true);
rText.setEnabled(true);
if (K != null) KText.setText(K);