Changeset 3077 in osm
- Timestamp:
- 2007-06-01T10:39:16+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/SurveyorPlugin.java
r2945 r3077 4 4 package at.dallermassl.josm.plugin.surveyor; 5 5 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 8 import java.util.Iterator; 9 6 10 import javax.swing.AbstractAction; 7 11 import javax.swing.JCheckBoxMenuItem; 8 12 import javax.swing.JFrame; 9 13 import javax.swing.JMenuItem; 14 import javax.swing.JOptionPane; 10 15 import javax.swing.KeyStroke; 16 17 import org.openstreetmap.josm.Main; 18 import org.openstreetmap.josm.plugins.PluginProxy; 11 19 12 20 import livegps.LiveGpsPlugin; … … 21 29 * 22 30 */ 23 public class SurveyorPlugin extends LiveGpsPlugin{31 public class SurveyorPlugin { 24 32 25 33 private static JFrame surveyorFrame; 34 public static final String PREF_KEY_STREET_NAME_FONT_SIZE = "surveyor.way.fontsize"; 26 35 27 36 /** … … 30 39 public SurveyorPlugin() { 31 40 super(); 32 SurveyorShowAction surveyorAction = new SurveyorShowAction("Surveyor", this); 41 42 // try to determine if the livegps plugin was already loaded: 43 try { 44 Class.forName("livegps.LiveGpsPlugin"); 45 } catch(ClassNotFoundException cnfe) { 46 String message = 47 tr("SurveyorPlugin depends on LiveGpsPlugin!") + "\n" + 48 tr("LiveGpsPlugin not found, please install and activate.") + "\n" + 49 tr("SurveyorPlugin is disabled for the moment"); 50 JOptionPane.showMessageDialog(Main.parent, message, tr("SurveyorPlugin"), JOptionPane.ERROR_MESSAGE); 51 return; 52 } 53 54 55 LiveGpsPlugin gpsPlugin = null; 56 Iterator<PluginProxy> proxyIter = Main.plugins.iterator(); 57 while(proxyIter.hasNext()) { 58 Object plugin = proxyIter.next().plugin; 59 if(plugin instanceof LiveGpsPlugin) { 60 gpsPlugin = (LiveGpsPlugin) plugin; 61 break; 62 } 63 } 64 if(gpsPlugin == null) { 65 throw new IllegalStateException("SurveyorPlugin needs LiveGpsPlugin, but could not find it!"); 66 } 67 SurveyorShowAction surveyorAction = new SurveyorShowAction("Surveyor", gpsPlugin); 33 68 JMenuItem surveyorMenuItem = new JMenuItem(surveyorAction); 34 69 surveyorAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt S")); 35 70 // surveyorMenuItem.addActionListener(new ActionListener() { 36 g etLgpsMenu().addSeparator();37 g etLgpsMenu().add(surveyorMenuItem);71 gpsPlugin.getLgpsMenu().addSeparator(); 72 gpsPlugin.getLgpsMenu().add(surveyorMenuItem); 38 73 39 74 AutoSaveAction autoSaveAction = new AutoSaveAction("AutoSave LiveData"); 40 75 JCheckBoxMenuItem autoSaveMenu = new JCheckBoxMenuItem(autoSaveAction); 41 g etLgpsMenu().add(autoSaveMenu);76 gpsPlugin.getLgpsMenu().add(autoSaveMenu); 42 77 43 78 }
Note:
See TracChangeset
for help on using the changeset viewer.