Ignore:
Timestamp:
2013-04-02T00:59:43+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] Update xml-imagery-bounds and tag2link plugins to JOSM 5821

Location:
applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/ImageryXmlBoundsPlugin.java

    r27015 r29461  
    1818import org.openstreetmap.josm.Main;
    1919import org.openstreetmap.josm.actions.ExtensionFileFilter;
    20 import org.openstreetmap.josm.data.Version;
    2120import org.openstreetmap.josm.data.osm.DataSet;
    2221import org.openstreetmap.josm.gui.MapFrame;
     
    2423import org.openstreetmap.josm.plugins.Plugin;
    2524import org.openstreetmap.josm.plugins.PluginInformation;
    26 import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.ShowBoundsListAction;
    27 import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.ShowBoundsPropertiesAction;
     25import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.ShowBoundsAction;
    2826import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.ShowBoundsSelectionAction;
    2927import org.openstreetmap.josm.plugins.imageryxmlbounds.actions.downloadtask.DownloadXmlBoundsTask;
     
    4644     * Action showing bounds of the selected closed ways in Selection dialog
    4745     */
    48         private final ShowBoundsListAction selectionListAction = new ShowBoundsListAction();
     46        private final ShowBoundsAction selectionListAction = new ShowBoundsAction();
    4947
    5048    /**
    5149     * Action showing bounds of the selected multipolygons in Properties dialog
    5250     */
    53     private final ShowBoundsPropertiesAction propertiesListAction = new ShowBoundsPropertiesAction();
     51    private final ShowBoundsAction propertiesListAction = new ShowBoundsAction();
    5452   
    5553        /**
    5654     * Action showing bounds of the selected multipolygons in Relations dialog
    5755     */
    58         private final ShowBoundsListAction relationListAction = new ShowBoundsListAction();
     56        private final ShowBoundsAction relationListAction = new ShowBoundsAction();
    5957
    6058    /**
     
    8280                Main.toolbar.register(selectionAction);
    8381                // Allow JOSM to download *.imagery.xml files
    84                 if (Version.getInstance().getVersion() >= 4523) {
    85                     Main.main.menu.openLocation.addDownloadTaskClass(DownloadXmlBoundsTask.class);
    86                 }
     82                Main.main.menu.openLocation.addDownloadTaskClass(DownloadXmlBoundsTask.class);
    8783        }
    8884       
     
    10298                if (newFrame != null) {
    10399                    // Initialize dialogs actions only after the main frame is created
    104             newFrame.selectionListDialog.addPopupMenuSeparator();
    105             newFrame.selectionListDialog.addPopupMenuAction(selectionListAction);
    106             newFrame.propertiesDialog.addMembershipPopupMenuSeparator();
    107             newFrame.propertiesDialog.addMembershipPopupMenuAction(propertiesListAction);
    108                         newFrame.relationListDialog.addPopupMenuSeparator();
    109                         newFrame.relationListDialog.addPopupMenuAction(relationListAction);
     100            newFrame.selectionListDialog.getPopupMenuHandler().addSeparator();
     101            newFrame.selectionListDialog.getPopupMenuHandler().addAction(selectionListAction);
     102            newFrame.propertiesDialog.getMembershipPopupMenuHandler().addSeparator();
     103            newFrame.propertiesDialog.getMembershipPopupMenuHandler().addAction(propertiesListAction);
     104                        newFrame.relationListDialog.getPopupMenuHandler().addSeparator();
     105                        newFrame.relationListDialog.getPopupMenuHandler().addAction(relationListAction);
     106                } else if (oldFrame != null) {
     107            // Remove listeners from previous frame to avoid memory leaks
     108                    if (oldFrame.relationListDialog != null) {
     109                        oldFrame.relationListDialog.getPopupMenuHandler().removeAction(relationListAction);
     110                    }
     111                    if (oldFrame.propertiesDialog != null) {
     112                        oldFrame.propertiesDialog.getMembershipPopupMenuHandler().removeAction(propertiesListAction);
     113                    }
     114                    if (oldFrame.selectionListDialog != null) {
     115                        oldFrame.selectionListDialog.getPopupMenuHandler().removeAction(selectionListAction);
     116                    }
    110117                }
    111118        }
  • applications/editors/josm/plugins/imagery-xml-bounds/src/org/openstreetmap/josm/plugins/imageryxmlbounds/actions/ShowBoundsAction.java

    r27014 r29461  
    1919import java.awt.Font;
    2020import java.awt.event.ActionEvent;
     21import java.util.Collection;
    2122
    2223import javax.swing.Box;
     
    2728
    2829import org.openstreetmap.josm.Main;
     30import org.openstreetmap.josm.actions.OsmPrimitiveAction;
     31import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2932import org.openstreetmap.josm.plugins.imageryxmlbounds.XmlBoundsLayer;
    3033
     
    3437 */
    3538@SuppressWarnings("serial")
    36 public class ShowBoundsAction extends ComputeBoundsAction {
     39public class ShowBoundsAction extends ComputeBoundsAction implements OsmPrimitiveAction {
    3740
    3841        public ShowBoundsAction() {
     
    5861        JOptionPane.showMessageDialog(Main.parent, box, ACTION_NAME, JOptionPane.PLAIN_MESSAGE);
    5962        }
     63
     64    @Override
     65    public void setPrimitives(Collection<? extends OsmPrimitive> primitives) {
     66        updateOsmPrimitives(primitives);
     67    }
    6068}
Note: See TracChangeset for help on using the changeset viewer.