Changeset 4586 in josm
- Timestamp:
- 2011-11-07T13:09:42+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r4248 r4586 100 100 } 101 101 102 void selectPreferencesTabByName(String name) { 103 tpPreferences.selectTabByName(name); 104 } 105 102 106 class CancelAction extends AbstractAction { 103 107 public CancelAction() { -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r4512 r4586 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Component; 6 7 import java.awt.Font; 7 8 import java.awt.GridBagLayout; … … 11 12 import java.util.ArrayList; 12 13 import java.util.Collection; 14 import java.util.HashMap; 13 15 import java.util.Iterator; 14 16 import java.util.LinkedList; 15 17 import java.util.List; 18 import java.util.Map; 16 19 17 20 import javax.swing.BorderFactory; … … 52 55 } 53 56 57 // all created tabs 58 private final Map<String,Component> tabs = new HashMap<String,Component>(); 54 59 private final static Collection<PreferenceSettingFactory> settingsFactory = new LinkedList<PreferenceSettingFactory>(); 55 60 private final List<PreferenceSetting> settings = new ArrayList<PreferenceSetting>(); … … 115 120 tab = sp; 116 121 } 122 tabs.put(icon,tab); 117 123 addTab(null, ImageProvider.get("preferences", icon), tab); 118 124 setToolTipTextAt(getTabCount()-1, "<html>"+desc+"</html>"); 119 125 return p; 126 } 127 128 public void selectTabByName(String name) { 129 Component c = tabs.get(name); 130 if (c!=null) setSelectedComponent(c); 120 131 } 121 132 -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r4306 r4586 27 27 import java.util.Map; 28 28 29 import javax.swing.AbstractAction;30 29 import javax.swing.Action; 31 30 import javax.swing.DefaultListCellRenderer; … … 63 62 import org.openstreetmap.josm.actions.ParameterizedActionDecorator; 64 63 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 64 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 65 65 import org.openstreetmap.josm.tools.GBC; 66 66 import org.openstreetmap.josm.tools.ImageProvider; … … 365 365 } 366 366 367 } 368 369 private static class ToolbarPopupMenu extends JPopupMenu { 370 public ToolbarPopupMenu(final ActionDefinition action) { 371 372 add(tr("Remove from toolbar",action.getDisplayName())) 373 .addActionListener(new ActionListener() { 374 public void actionPerformed(ActionEvent e) { 375 Collection<String> t = new LinkedList<String>(getToolString()); 376 ActionParser parser = new ActionParser(null); 377 // get text definition of current action 378 String res = parser.saveAction(action); 379 // remove the button from toolbar preferences 380 t.remove( res ); 381 Main.pref.putCollection("toolbar", t); 382 Main.toolbar.refreshToolbarControl(); 383 } 384 }); 385 386 add(tr("Configure toolbar")).addActionListener(new ActionListener() { 387 public void actionPerformed(ActionEvent e) { 388 final PreferenceDialog p =new PreferenceDialog(Main.parent); 389 p.selectPreferencesTabByName("toolbar"); 390 p.setVisible(true); 391 } 392 }); 393 394 } 367 395 } 368 396 … … 921 949 if (i != null) 922 950 b.setIcon(i); 951 b.addMouseListener(new PopupMenuLauncher( new ToolbarPopupMenu(action))); 923 952 } 924 953 }
Note:
See TracChangeset
for help on using the changeset viewer.