Skip to content

Commit

Permalink
Draw result table in the beginning #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
maurpa committed Jan 11, 2022
1 parent 5d8b021 commit d315ace
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class StateMachineSimulationView extends ViewPart {
private static final String CURRENT_STATE_COLUMN = "Current State";
private static final String NEXT_STATE_COLUMN = "Next State";
private static final String BUTTON_RELOAD_STATEMACHINES = "Reaload StateMachines";
private Table outputtable;

private static final String EXPORT_REQUEST = "Do you want to export the simulation history ?";

Expand Down Expand Up @@ -206,6 +207,7 @@ public void widgetSelected(SelectionEvent event) {
});

loadAllStateMachines();
createOutputWindow("Simulation");

}

Expand Down Expand Up @@ -246,10 +248,10 @@ private void loadAllStateMachines() {
* @param runtime
* @param deadlocktraces
*/
private void createOutputWindow(String type, GlobalState currentState) {
private void createOutputWindow(String type) {

viewer = new TableViewer(swtAwtComposite, SWT.BORDER | SWT.FULL_SELECTION);
final Table outputtable = viewer.getTable();
outputtable = viewer.getTable();
GridData gd = new GridData(SWT.BORDER, SWT.BORDER, true, true, 1, 1);
gd.heightHint = DEFAULT_HEIGHT;
gd.widthHint = DEFAULT_WIDTH;
Expand All @@ -265,9 +267,7 @@ private void createOutputWindow(String type, GlobalState currentState) {
TableViewerColumn nextStateColumn = new TableViewerColumn(viewer, SWT.NONE);
nextStateColumn.getColumn().setText(NEXT_STATE_COLUMN);
nextStateColumn.getColumn().pack();
nextStateColumn.getColumn().setWidth(WIDTH);

createNewSimulationTrace(outputtable, currentState);
nextStateColumn.getColumn().setWidth(WIDTH);

}

Expand Down Expand Up @@ -323,6 +323,8 @@ public void widgetDefaultSelected(SelectionEvent e) {
}

}
swtAwtComposite.update();
swtAwtComposite.redraw();

}

Expand All @@ -338,14 +340,8 @@ private void addButtonSelectionListeners(Composite composite) {
@Override
public void widgetSelected(SelectionEvent e) {

if (viewer != null) {

viewer.getTable().dispose();
viewer = null;

if (!simulationhistory.isEmpty()) {
if (simulationhistory != null && !simulationhistory.isEmpty()) {
openSimulationHistoryExportShell();
}
}


Expand All @@ -362,7 +358,8 @@ public void widgetSelected(SelectionEvent e) {

GlobalState gs = simulator.initialSimulationComputation(sm);
simulationhistory = new PriorityQueue<String>();
createOutputWindow("Simulation", gs);
createNewSimulationTrace(outputtable, gs);

}


Expand Down Expand Up @@ -404,8 +401,8 @@ private void openSimulationHistoryExportShell() {
SimulationTraceExporter exporter = new SimulationTraceExporter();
exporter.export(simulationhistory);
simulationhistory.clear();
outputtable.removeAll();
break;

case SWT.NO:
simulationhistory.clear();
break;
Expand Down

0 comments on commit d315ace

Please sign in to comment.