Changeset 2170 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2009-09-20T13:01:42+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r2128 r2170 44 44 import org.openstreetmap.josm.gui.ExtendedDialog; 45 45 import org.openstreetmap.josm.gui.QuadStateCheckBox; 46 import org.openstreetmap.josm.gui.layer.Layer; 46 47 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 48 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; 47 49 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionCache; 48 50 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionItemPritority; … … 62 64 * It is also able to construct dialogs out of preset definitions. 63 65 */ 64 public class TaggingPreset extends AbstractAction {66 public class TaggingPreset extends AbstractAction implements LayerChangeListener { 65 67 66 68 public TaggingPresetMenu group = null; … … 480 482 * Use this as default item for "do not select anything". 481 483 */ 482 public TaggingPreset() {} 484 public TaggingPreset() { 485 Layer.listeners.add(this); 486 updateEnabledState(); 487 } 483 488 484 489 /** … … 674 679 675 680 public void actionPerformed(ActionEvent e) { 681 if (Main.main == null) return; 682 if (Main.main.getCurrentDataSet() == null) return; 676 683 Collection<OsmPrimitive> sel = createSelection(Main.main.getCurrentDataSet().getSelected()); 677 684 PresetPanel p = createPanel(sel); … … 771 778 return new SequenceCommand(tr("Change Properties"), cmds); 772 779 } 780 781 protected void updateEnabledState() { 782 setEnabled(Main.main != null && Main.main.getCurrentDataSet() != null); 783 } 784 785 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 786 updateEnabledState(); 787 } 788 789 public void layerAdded(Layer newLayer) { 790 updateEnabledState(); 791 } 792 793 public void layerRemoved(Layer oldLayer) { 794 updateEnabledState(); 795 } 773 796 }
Note:
See TracChangeset
for help on using the changeset viewer.