Changeset 26624 in osm
- Timestamp:
- 2011-09-04T08:59:08+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/build.xml
r26621 r26624 30 30 <project name="utilsplugin2" default="dist" basedir="."> 31 31 <!-- enter the SVN commit message --> 32 <property name="commit.message" value="Utilsplugin2: Open custom URL in browser by Shift-\"/>32 <property name="commit.message" value="Utilsplugin2: added setting tab"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 34 <property name="plugin.main.version" value="4395"/> -
applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/OpenPageAction.java
r26603 r26624 55 55 p=sel.iterator().next(); 56 56 } else { 57 showConfigDialog(); 57 JOptionPane.showMessageDialog( 58 Main.parent, 59 tr("Please select one element to open custom URL for it. You can choose the URL in Preferences, Utils tab."), 60 tr("Information"), 61 JOptionPane.INFORMATION_MESSAGE 62 ); 58 63 return; 59 64 } … … 67 72 try { 68 73 while (m.find()) { 69 System.out.println(m.group());70 74 key=m.group(1); 71 75 if (key.equals("#id")) { … … 91 95 return; 92 96 } 93 System.out.println(i);94 97 for (int j=0;j<i;j++){ 95 98 addr = addr.replace(keys[j],vals[j]); 96 99 } 97 System.out.println(addr);98 100 try { 99 101 OpenBrowser.displayUrl(addr); … … 120 122 setEnabled(selection != null ); 121 123 } 122 123 private void showConfigDialog() {124 JPanel all = new JPanel();125 GridBagLayout layout = new GridBagLayout();126 all.setLayout(layout);127 128 HistoryComboBox combo1=new HistoryComboBox();129 130 // FIXME: get rid of hardcoded URLS131 ArrayList<String> items=new ArrayList<String>();132 items.add(defaultURL);133 items.add("http://latlon.org/buildings?zoom=17&lat={#lat}&lon={#lon}&layers=B");134 items.add("http://addresses.amdmi3.ru/?zoom=11&lat={#lat}&lon={#lon}&layers=B00");135 items.add("http://www.openstreetmap.org/browse/{#type}/{#id}/history");136 items.add("http://www.openstreetmap.org/browse/{#type}/{#id}");137 String addr = Main.pref.get("utilsplugin2.customurl", defaultURL);138 System.out.println("pref:"+addr);139 combo1.setPossibleItems(items);140 141 HtmlPanel help = new HtmlPanel(tr("You can open custom URL for <b>one</b> selected object<br/>"142 + " <b>{key}</b> is replaced with the tag walue<br/>"143 + " <b>{#id}</b> is replaced with the element ID<br/>"144 + " <b>{#type}</b> is replaced with \"node\",\"way\" or \"relation\" <br/>"145 + " <b>{#lat} , {#lon}</b> is replaced with element latitude/longitude"));146 help.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));147 all.add(help,GBC.eop().insets(5,10,0,0));148 all.add(combo1,GBC.eop().insets(5,10,0,0));149 150 ExtendedDialog dialog = new ExtendedDialog(Main.parent,151 tr("Configure custom URL"),152 new String[] {tr("OK"),tr("Cancel"),}153 );154 dialog.setContent(all, false);155 dialog.setButtonIcons(new String[] {"ok.png","cancel.png",});156 dialog.setDefaultButton(1);157 dialog.showDialog();158 159 addr=combo1.getText();160 if (dialog.getValue() ==1 && addr.length()>6) Main.pref.put("utilsplugin2.customurl",addr);161 }162 124 } -
applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/UtilsPlugin2.java
r26603 r26624 2 2 package utilsplugin2; 3 3 4 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 4 5 import java.awt.event.KeyEvent; 5 6 import javax.swing.JMenu; … … 102 103 undoSelection.setEnabled(enabled); 103 104 } 105 @Override 106 public PreferenceSetting getPreferenceSetting() { 107 return new UtilsPluginPreferences(); 108 } 109 104 110 }
Note:
See TracChangeset
for help on using the changeset viewer.