diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-24 19:12:20 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-24 19:12:20 +0000 |
| commit | 61e38d3236ead0b32f8fa1a78901e9d0c75c91ea (patch) | |
| tree | 3d2dde8fa15b4a554a3dc9d90a44df4e38f0d876 /sources/simulator/VSSimulation.java | |
| parent | a028afa5f47ed024e792ca11155cd159a146b1e5 (diff) | |
Processes are now deletable.
Diffstat (limited to 'sources/simulator/VSSimulation.java')
| -rw-r--r-- | sources/simulator/VSSimulation.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sources/simulator/VSSimulation.java b/sources/simulator/VSSimulation.java index cc0ba16..17400cb 100644 --- a/sources/simulator/VSSimulation.java +++ b/sources/simulator/VSSimulation.java @@ -822,15 +822,7 @@ public class VSSimulation extends JPanel { } private int getSelectedProcessNum() { - try { - String string = (String) processesComboBox.getSelectedItem(); - int cutLen = prefs.getString("lang.process").length() + 1; - string = string.substring(cutLen); - return Integer.parseInt(string) - 1; - } catch (NumberFormatException e) { - } - - return simulationCanvas.getNumProcesses(); + return processesComboBox.getSelectedIndex(); } private VSProcess getSelectedProcess() { @@ -879,7 +871,7 @@ public class VSSimulation extends JPanel { return simulationCanvas; } - public VSFrame getSimulatorFrame() { + public VSSimulatorFrame getSimulatorFrame() { return simulatorFrame; } @@ -888,6 +880,13 @@ public class VSSimulation extends JPanel { simulationCanvas.updateFromPrefs(); } + public void removeProcessAtIndex(int index) { + globalPIDComboBox.removeItemAt(index); + localPIDComboBox.removeItemAt(index); + processesComboBox.removeItemAt(index); + simulatorFrame.updateEditMenu(); + } + public void fireExpertModeChanged() { boolean expertMode = prefs.getBoolean("sim.mode.expert"); |
