From 61e38d3236ead0b32f8fa1a78901e9d0c75c91ea Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 24 May 2008 19:12:20 +0000 Subject: Processes are now deletable. --- sources/simulator/VSSimulation.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'sources/simulator/VSSimulation.java') 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"); -- cgit v1.2.3