From 36f74586cc61f5899c16b6f84a04be37688cc719 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 18 May 2008 23:20:08 +0000 Subject: TaskManager bugfixes. --- sources/prefs/editors/VSProcessEditor.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'sources/prefs/editors/VSProcessEditor.java') diff --git a/sources/prefs/editors/VSProcessEditor.java b/sources/prefs/editors/VSProcessEditor.java index dcbe376..4103624 100644 --- a/sources/prefs/editors/VSProcessEditor.java +++ b/sources/prefs/editors/VSProcessEditor.java @@ -66,7 +66,17 @@ public class VSProcessEditor extends VSEditorFrame { private JPanel createProtocolSelector() { JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createLineBorder(Color.black)); - Vector registeredProtocols = VSRegisteredEvents.getProtocolNames(); + + Vector registeredProtocolsNames = VSRegisteredEvents.getProtocolNames(); + Vector registeredProtocolsShortnames = new Vector(); + final HashMap eventNames = new HashMap(); + + for (String protocolName : registeredProtocolsNames) { + String protocolClassname = VSRegisteredEvents.getClassname(protocolName); + String protocolShortname = VSRegisteredEvents.getShortname(protocolClassname); + registeredProtocolsShortnames.add(protocolShortname); + eventNames.put(protocolShortname, protocolName); + } GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.HORIZONTAL; @@ -75,7 +85,8 @@ public class VSProcessEditor extends VSEditorFrame { constraints.insets = new Insets(5, 0, 5, 0); constraints.ipadx = 10; constraints.ipady = 10; - final JComboBox comboBox = new JComboBox(registeredProtocols); + + final JComboBox comboBox = new JComboBox(registeredProtocolsShortnames); comboBox.setBackground(Color.WHITE); panel.add(comboBox, constraints); constraints.gridy = 1; @@ -83,7 +94,8 @@ public class VSProcessEditor extends VSEditorFrame { button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equals(prefs.getString("lang.edit"))) { - String eventName = (String) comboBox.getSelectedItem(); + String eventShortname = (String) comboBox.getSelectedItem(); + String eventName = eventNames.get(eventShortname); String eventClassname = VSRegisteredEvents.getClassname(eventName); VSProtocol protocol = null; if (process.objectExists(eventClassname)) { @@ -96,6 +108,7 @@ public class VSProcessEditor extends VSEditorFrame { protocol = (VSProtocol) VSRegisteredEvents.createEventInstanceByName(eventName, process); process.setObject(eventClassname, protocol); } + new VSProtocolEditor(prefs, frame, protocol); } } -- cgit v1.2.3