Changeset 28648 in osm


Ignore:
Timestamp:
2012-08-28T11:37:15+02:00 (12 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed2
Files:
6 added
2 edited
2 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/build.xml

    r28633 r28648  
    9595            <manifest>
    9696                <attribute name="Author" value="Malcolm Herring"/>
    97                 <attribute name="Plugin-Class" value="smed.Smed"/>
     97                <attribute name="Plugin-Class" value="smed2.Smed2"/>
    9898                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    99                 <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap"/>
     99                <attribute name="Plugin-Description" value="Edit features for OpenSeaMap"/>
    100100                <attribute name="Plugin-Icon" value="images/Smed.png"/>
    101101                <attribute name="Plugin-Link" value="http://openseamap.org/"/>
  • applications/editors/josm/plugins/smed2/src/smed2/Smed2.java

    r28640 r28648  
    1 package smed;
     1package smed2;
    22
    33import org.openstreetmap.josm.Main;
     
    77
    88public class Smed2 extends Plugin {
    9     public Smed2(PluginInformation info) {
     9
     10        public Smed2(PluginInformation info) {
    1011        super(info);
    11         MainMenu.add(Main.main.menu.toolsMenu, new SmedAction());
     12        MainMenu.add(Main.main.menu.toolsMenu, new Smed2Action());
    1213    }
    1314}
  • applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.java

    r28640 r28648  
    1 package smed;
     1package smed2;
    22
     3import java.awt.Dimension;
    34import java.awt.event.ActionEvent;
    45
     6import javax.swing.JFrame;
     7import javax.swing.SwingUtilities;
     8import javax.swing.WindowConstants;
     9
     10import static org.openstreetmap.josm.tools.I18n.tr;
    511import org.openstreetmap.josm.actions.JosmAction;
    612
    7 public class SmedAction extends JosmAction {
     13import panels.PanelMain;
     14
     15public class Smed2Action extends JosmAction {
    816
    917        private static final long serialVersionUID = 1L;
     18        private static String editor = tr("SeaMap Editor");
     19        private JFrame frame = null;
     20        private boolean isOpen = false;
     21        public PanelMain panelMain = null;
    1022
    11         public SmedAction() {
    12                
     23        public Smed2Action() {
     24                super(editor, "Smed2", editor, null, true);
    1325        }
    1426
    15 @Override
     27        @Override
    1628        public void actionPerformed(ActionEvent arg0) {
    17         // TODO Auto-generated method stub
     29                SwingUtilities.invokeLater(new Runnable() {
     30                        public void run() {
     31                                if (!isOpen) createFrame();
     32                                else frame.toFront();
     33                        isOpen = true;
     34                        }
     35                });
    1836        }
    19  
     37
     38        protected void createFrame() {
     39                frame = new JFrame(editor);
     40                frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     41                frame.setResizable(true);
     42                frame.setAlwaysOnTop(false);
     43
     44                frame.addWindowListener(new java.awt.event.WindowAdapter() {
     45                        public void windowClosing(java.awt.event.WindowEvent e) {
     46                                closeDialog();
     47                        }
     48                });
     49                frame.setSize(new Dimension(480, 480));
     50                frame.setVisible(true);
     51                panelMain = new PanelMain();
     52                frame.add(panelMain);
     53        }
     54
     55        public void closeDialog() {
     56                if (isOpen) {
     57                        frame.setVisible(false);
     58                        frame.dispose();
     59                }
     60                isOpen = false;
     61        }
     62
    2063}
    21                                                    
Note: See TracChangeset for help on using the changeset viewer.