Changeset 30862 in osm for applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap
- Timestamp:
- 2014-12-19T17:42:28+01:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
r30459 r30862 47 47 48 48 public class UtilsPlugin2 extends Plugin { 49 50 private static UtilsPlugin2 instance; 51 49 52 JMenuItem unglueRelation; 50 53 JMenuItem symmetry; … … 65 68 JMenuItem latlon; 66 69 JMenuItem multiTag; 67 70 68 71 JMenuItem replaceGeometry; 69 72 JMenuItem tagBuffer; … … 76 79 JMenuItem selectHighway; 77 80 JMenuItem selectAreaBoundary; 78 81 79 82 JMenuItem selectURL; 80 83 81 84 JMenuItem drawArc; 82 85 83 86 public UtilsPlugin2(PluginInformation info) { 84 87 super(info); 88 instance = this; 89 85 90 JMenu toolsMenu = Main.main.menu.moreToolsMenu; 86 91 JMenu dataMenu = Main.main.menu.dataMenu; 87 92 JMenu selectionMenu = Main.main.menu.selectionMenu; 88 93 89 94 addIntersections = MainMenu.add(toolsMenu, new AddIntersectionsAction()); 90 95 splitObject = MainMenu.add(toolsMenu, new SplitObjectAction()); … … 104 109 105 110 selectionMenu.addSeparator(); 106 111 107 112 selectWayNodes = MainMenu.add(selectionMenu, new SelectWayNodesAction()); 108 113 adjNodes = MainMenu.add(selectionMenu, new AdjacentNodesAction()); … … 119 124 selectHighway = MainMenu.add(selectionMenu, new SelectHighwayAction()); 120 125 selectAreaBoundary = MainMenu.add(selectionMenu, new SelectBoundaryAction()); 121 126 122 127 selectURL = MainMenu.add(dataMenu, new ChooseURLAction()); 123 128 multiTag = MainMenu.add(dataMenu, new MultiTagAction()); 124 129 125 130 // register search operators 126 131 SearchCompiler.addMatchFactory(new UtilsUnaryMatchFactory()); … … 161 166 multiTag.setEnabled(enabled); 162 167 } 163 168 164 169 @Override 165 170 public PreferenceSetting getPreferenceSetting() { 166 171 return new UtilsPluginPreferences(); 167 172 } 168 169 170 173 174 public static final UtilsPlugin2 getInstance() { 175 return instance; 176 } 171 177 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java
r30737 r30862 10 10 import java.util.logging.Level; 11 11 import java.util.logging.Logger; 12 12 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2; 13 15 14 16 public class URLList { … … 21 23 public static void select(String url) { 22 24 Main.pref.put("utilsplugin2.customurl",url); 23 } 25 } 24 26 public static List<String> resetURLList() { 25 27 List<String> items=new ArrayList<>(); … … 40 42 return items; 41 43 } 42 44 43 45 public static List<String> getURLList() { 44 46 List<String> items = (List<String>) Main.pref.getCollection("utilsplugin2.urlHistory"); … … 49 51 return items; 50 52 } 51 53 52 54 public static void updateURLList(List<String> lst) { 53 55 Main.pref.putCollection("utilsplugin2.urlHistory",lst); … … 58 60 } 59 61 } 60 61 public static 62 63 public static List<String> loadURLList() { 62 64 ArrayList<String> items=new ArrayList<>(); 63 65 BufferedReader fr=null; 64 66 try { 65 File f = new File (Main.pref.getPreferencesDir(),"customurl.txt");66 fr = new BufferedReader(new FileReader(f));67 String s;68 while ((s = fr.readLine()) !=null ) items.add(s);67 File f = new File(UtilsPlugin2.getInstance().getPluginDir(), "customurl.txt"); 68 fr = new BufferedReader(new FileReader(f)); 69 String s; 70 while ((s = fr.readLine()) !=null ) items.add(s); 69 71 } catch (IOException e) { 70 72 e.printStackTrace(); … … 73 75 } 74 76 return items; 75 76 77 } 77 78 public static 79 File f = new File (Main.pref.getPreferencesDir(),"customurl.txt");78 79 public static void saveURLList(List<String> items) { 80 File f = new File(UtilsPlugin2.getInstance().getPluginDir(), "customurl.txt"); 80 81 PrintWriter fw=null; 81 82 try { 82 fw=new PrintWriter(f);83 for (String s : items) {84 fw.println(s);85 }83 fw=new PrintWriter(f); 84 for (String s : items) { 85 fw.println(s); 86 } 86 87 } catch (IOException e) { 87 88 e.printStackTrace(); … … 90 91 } 91 92 } 92 93 94 93 } 95
Note:
See TracChangeset
for help on using the changeset viewer.