Author: tfmorris Date: 2010-04-17 14:32:02-0700 New Revision: 18281 Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectSettingsTabProfile.java trunk/src/argouml-app/src/org/argouml/ui/SettingsTabProfile.java
Log: STARTED - task 5408: Multiple selection doesn't work in profile selection dialog http://argouml.tigris.org/issues/show_bug.cgi?id=5408 Modified: trunk/src/argouml-app/src/org/argouml/ui/ProjectSettingsTabProfile.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/ProjectSettingsTabProfile.java?view=diff&pathrev=18281&r1=18280&r2=18281 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/ui/ProjectSettingsTabProfile.java (original) +++ trunk/src/argouml-app/src/org/argouml/ui/ProjectSettingsTabProfile.java 2010-04-17 14:32:02-0700 @@ -1,12 +1,13 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2007-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: + * Marcos Aurelio - design and initial implementation * thn * euluis ***************************************************************************** @@ -48,6 +49,7 @@ import java.awt.event.ItemListener; import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import javax.swing.BoxLayout; @@ -244,6 +246,7 @@ private JList createProfileList() { JList list = new JList(); list.setMinimumSize(new Dimension(50, 50)); + // TODO: Add double click listener return list; } private void refreshLists() { @@ -282,9 +285,9 @@ ((MutableComboBoxModel) usedList.getModel()); if (arg0.getSource() == addButton) { - if (availableList.getSelectedIndex() != -1) { - Profile selected = (Profile) modelAvailable - .getElementAt(availableList.getSelectedIndex()); + Object[] selections = availableList.getSelectedValues(); + for (Object s : selections) { + Profile selected = (Profile) s; modelUsed.addElement(selected); modelAvailable.removeElement(selected); @@ -294,11 +297,10 @@ } } } else if (arg0.getSource() == removeButton) { - if (usedList.getSelectedIndex() != -1) { - Profile selected = (Profile) modelUsed.getElementAt(usedList - .getSelectedIndex()); - - List<Profile> dependents = getActiveDependents(selected); + Object[] selections = usedList.getSelectedValues(); + for (Object s : selections) { + Profile selected = (Profile) s; + Collection<Profile> dependents = getActiveDependents(selected); boolean remove = true; if (!dependents.isEmpty()) { @@ -340,9 +342,9 @@ } } } else if (arg0.getSource() == unregisterProfile) { - if (availableList.getSelectedIndex() != -1) { - Profile selected = (Profile) modelAvailable - .getElementAt(availableList.getSelectedIndex()); + Object[] selections = availableList.getSelectedValues(); + for (Object s : selections) { + Profile selected = (Profile) s; if (selected instanceof UserDefinedProfile) { ProfileFacade.getManager().removeProfile(selected); modelAvailable.removeElement(selected); Modified: trunk/src/argouml-app/src/org/argouml/ui/SettingsTabProfile.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/ui/SettingsTabProfile.java?view=diff&pathrev=18281&r1=18280&r2=18281 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/ui/SettingsTabProfile.java (original) +++ trunk/src/argouml-app/src/org/argouml/ui/SettingsTabProfile.java 2010-04-17 14:32:02-0700 @@ -1,12 +1,13 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2007-2010 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: + * Marcos Aur�lio - Design and initial implementation * thn * euluis ***************************************************************************** @@ -344,17 +345,16 @@ .getModel()); if (arg0.getSource() == addButton) { - if (availableList.getSelectedIndex() != -1) { - Profile selected = (Profile) modelAvl - .getElementAt(availableList.getSelectedIndex()); + Object[] selections = availableList.getSelectedValues(); + for (Object s : selections) { + Profile selected = (Profile) s; modelUsd.addElement(selected); modelAvl.removeElement(selected); } } else if (arg0.getSource() == removeButton) { - if (defaultList.getSelectedIndex() != -1) { - Profile selected = (Profile) modelUsd.getElementAt(defaultList - .getSelectedIndex()); - + Object[] selections = defaultList.getSelectedValues(); + for (Object s : selections) { + Profile selected = (Profile) s; if (selected == ProfileFacade.getManager().getUMLProfile() && Model.getFacade().getUmlVersion().charAt(0) != '1') { JOptionPane.showMessageDialog(this, Translator @@ -392,10 +392,9 @@ } else if (arg0.getSource() == removeDirectory) { MutableComboBoxModel model = ((MutableComboBoxModel) directoryList.getModel()); - int[] indices = directoryList.getSelectedIndices(); - for (int i = indices.length-1; i >=0; i--) { - int idx = indices[i]; - model.removeElementAt(idx); + Object[] selections = directoryList.getSelectedValues(); + for (Object o : selections) { + model.removeElement(o); } } else if (arg0.getSource() == refreshProfiles) { boolean refresh = JOptionPane.showConfirmDialog(this, Translator ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2587094 To unsubscribe from this discussion, e-mail: [[email protected]].
