Changeset 7026 in josm
- Timestamp:
- 2014-04-29T09:26:29+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7005 r7026 56 56 import org.openstreetmap.josm.data.Bounds; 57 57 import org.openstreetmap.josm.data.Preferences; 58 import org.openstreetmap.josm.data.ServerSidePreferences;59 58 import org.openstreetmap.josm.data.UndoRedoHandler; 60 59 import org.openstreetmap.josm.data.ViewportData; … … 175 174 176 175 /** 177 * Set to <code>true</code>, when in applet mode178 */179 public static boolean applet = false;180 181 /**182 176 * The toolbar preference control to register new actions. 183 177 */ … … 421 415 */ 422 416 public static boolean isOpenjdk; 423 424 /**425 * Initializes {@code Main.pref} in applet context.426 * @param serverURL The server URL hosting the user preferences.427 * @since 6471428 */429 public static void initAppletPreferences(URL serverURL) {430 Main.pref = new ServerSidePreferences(serverURL);431 }432 417 433 418 /** -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r7005 r7026 77 77 @Override 78 78 protected void updateEnabledState() { 79 setEnabled( ! Main.applet);79 setEnabled(true); 80 80 } 81 81 -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r6380 r7026 48 48 panel.add(name); 49 49 JCheckBox filerename = new JCheckBox(tr("Also rename the file")); 50 if (Main.applet) { 51 filerename.setEnabled(false); 52 filerename.setSelected(false); 53 } else { 54 panel.add(filerename); 55 filerename.setEnabled(file != null); 56 } 50 panel.add(filerename); 51 filerename.setEnabled(file != null); 57 52 if (filerename.isEnabled()) { 58 53 filerename.setSelected(Main.pref.getBoolean("layer.rename-file", true)); -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r7005 r7026 105 105 @Override 106 106 protected void updateEnabledState() { 107 if (Main.applet) {108 setEnabled(false);109 return;110 }111 107 boolean check = Main.isDisplayingMapView() 112 108 && Main.map.mapView.getActiveLayer() != null; -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r7012 r7026 689 689 690 690 updateSystemProperties(); 691 if(Main.applet)692 return;693 691 694 692 File prefFile = getPreferenceFile(); … … 724 722 public void load() throws Exception { 725 723 settingsMap.clear(); 726 if (!Main.applet) { 727 File pref = getPreferenceFile(); 728 BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8)); 729 try { 730 validateXML(in); 731 Utils.close(in); 732 in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8)); 733 fromXML(in); 734 } finally { 735 Utils.close(in); 736 } 724 File pref = getPreferenceFile(); 725 BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8)); 726 try { 727 validateXML(in); 728 Utils.close(in); 729 in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8)); 730 fromXML(in); 731 } finally { 732 Utils.close(in); 737 733 } 738 734 updateSystemProperties(); … … 741 737 742 738 public void init(boolean reset){ 743 if(Main.applet)744 return;745 739 // get the preferences. 746 740 File prefDir = getPreferencesDirFile(); -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r7005 r7026 671 671 viewportFollowToggleAction.addButtonModel(vft.getModel()); 672 672 673 if( !Main.applet &&Main.platform.canFullscreen()) {673 if(Main.platform.canFullscreen()) { 674 674 // -- fullscreen toggle action 675 675 fullscreenToggleAction = new FullscreenToggleAction(); -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r7005 r7026 181 181 } 182 182 } 183 else if(!Main.applet) { /* FIXME: remove else clause after spring 2011, but fix windows installer before */184 File bookmarkFile = new File(Main.pref.getPreferencesDir(),"bookmarks");185 try {186 LinkedList<Bookmark> bookmarks = new LinkedList<>();187 if (bookmarkFile.exists()) {188 Main.info("Try loading obsolete bookmarks file");189 BufferedReader in = new BufferedReader(new InputStreamReader(190 new FileInputStream(bookmarkFile), Utils.UTF_8));191 192 for (String line = in.readLine(); line != null; line = in.readLine()) {193 Matcher m = Pattern.compile("^(.+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)[,\u001e](-?\\d+.\\d+)$").matcher(line);194 if (!m.matches() || m.groupCount() != 5) {195 Main.error(tr("Unexpected line ''{0}'' in bookmark file ''{1}''",line, bookmarkFile.toString()));196 continue;197 }198 Bookmark b = new Bookmark();199 b.setName(m.group(1));200 double[] values= new double[4];201 for (int i = 0; i < 4; ++i) {202 try {203 values[i] = Double.parseDouble(m.group(i+2));204 } catch (NumberFormatException e) {205 Main.error(tr("Illegal double value ''{0}'' on line ''{1}'' in bookmark file ''{2}''",m.group(i+2),line, bookmarkFile.toString()));206 continue;207 }208 }209 b.setArea(new Bounds(values));210 bookmarks.add(b);211 }212 Utils.close(in);213 Collections.sort(bookmarks);214 for (Bookmark b : bookmarks) {215 model.addElement(b);216 }217 save();218 Main.info("Removing obsolete bookmarks file");219 if (!bookmarkFile.delete()) {220 bookmarkFile.deleteOnExit();221 }222 }223 } catch (IOException e) {224 Main.error(e);225 JOptionPane.showMessageDialog(226 Main.parent,227 tr("<html>Could not read bookmarks from<br>''{0}''<br>Error was: {1}</html>",228 bookmarkFile.toString(),229 e.getMessage()230 ),231 tr("Error"),232 JOptionPane.ERROR_MESSAGE233 );234 }235 }236 183 } 237 184 -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r7005 r7026 261 261 @Override 262 262 public Action[] getMenuEntries() { 263 if (Main.applet) {264 return new Action[] {265 LayerListDialog.getInstance().createShowHideLayerAction(),266 LayerListDialog.getInstance().createDeleteLayerAction(),267 SeparatorLayerAction.INSTANCE,268 new CustomizeColor(this),269 new CustomizeDrawingAction(this),270 new ConvertToDataLayerAction(this),271 SeparatorLayerAction.INSTANCE,272 new ChooseTrackVisibilityAction(this),273 new RenameLayerAction(getAssociatedFile(), this),274 SeparatorLayerAction.INSTANCE,275 new LayerListPopup.InfoAction(this) };276 }277 263 return new Action[] { 278 264 LayerListDialog.getInstance().createShowHideLayerAction(), -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r7013 r7026 490 490 491 491 @Override public Action[] getMenuEntries() { 492 if (Main.applet)493 return new Action[]{494 LayerListDialog.getInstance().createActivateLayerAction(this),495 LayerListDialog.getInstance().createShowHideLayerAction(),496 LayerListDialog.getInstance().createDeleteLayerAction(),497 SeparatorLayerAction.INSTANCE,498 LayerListDialog.getInstance().createMergeLayerAction(this),499 SeparatorLayerAction.INSTANCE,500 new RenameLayerAction(getAssociatedFile(), this),501 new ConsistencyTestAction(),502 SeparatorLayerAction.INSTANCE,503 new LayerListPopup.InfoAction(this)};504 492 List<Action> actions = new ArrayList<>(); 505 493 actions.addAll(Arrays.asList(new Action[]{ -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r7005 r7026 300 300 */ 301 301 public void savePreferences() { 302 if(Main.applet)303 return;304 302 // create a task for downloading plugins if the user has activated, yet not downloaded, 305 303 // new plugins … … 507 505 settingsFactory.add(new TaggingPresetPreference.Factory()); 508 506 settingsFactory.add(new BackupPreference.Factory()); 509 if(!Main.applet) { 510 settingsFactory.add(new PluginPreference.Factory()); 511 } 507 settingsFactory.add(new PluginPreference.Factory()); 512 508 settingsFactory.add(Main.toolbar); 513 509 settingsFactory.add(new AudioPreference.Factory()); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r7005 r7026 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 6 7 import java.applet.Applet;8 7 import java.awt.Component; 9 8 import java.awt.Container; … … 634 633 // focus remains on one of the associated components 635 634 return; 636 else if ((c instanceof Window) || 637 (c instanceof Applet && c.getParent() == null)) { 635 else if (c instanceof Window) { 638 636 if (c == SwingUtilities.getRoot(TagTable.this)) { 639 637 if (!getCellEditor().stopCellEditing()) { -
trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java
r6889 r7026 145 145 */ 146 146 private void loadFromDisk() throws T { 147 if (Main.applet) 147 BufferedInputStream input = null; 148 try { 149 input = new BufferedInputStream(new FileInputStream(path)); 150 this.data = new byte[input.available()]; 151 input.read(this.data); 152 } catch (IOException e) { 148 153 this.data = updateForce(); 149 else { 150 BufferedInputStream input = null; 151 try { 152 input = new BufferedInputStream(new FileInputStream(path)); 153 this.data = new byte[input.available()]; 154 input.read(this.data); 155 } catch (IOException e) { 156 this.data = updateForce(); 157 } finally { 158 Utils.close(input); 159 } 154 } finally { 155 Utils.close(input); 160 156 } 161 157 } … … 165 161 */ 166 162 private void saveToDisk() { 167 if (Main.applet)168 return;169 163 BufferedOutputStream output = null; 170 164 try { -
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r7012 r7026 137 137 } 138 138 } else { 139 if (Main.applet) { 140 fs = new BufferedInputStream(Utils.openURL(url)); 141 file = new File(url.getFile()); 142 } else { 143 file = checkLocal(url, destDir, maxTime, httpAccept); 144 } 139 file = checkLocal(url, destDir, maxTime, httpAccept); 145 140 } 146 141 } catch (java.net.MalformedURLException e) { -
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r6682 r7026 8 8 import java.net.MalformedURLException; 9 9 import java.net.URI; 10 11 import javax.swing.JApplet;12 10 13 11 import org.openstreetmap.josm.Main; … … 42 40 public static String displayUrl(URI uri) { 43 41 CheckParameterUtil.ensureParameterNotNull(uri, "uri"); 44 if (Main.applet) { 45 try { 46 JApplet applet = (JApplet) Main.parent; 47 applet.getAppletContext().showDocument(uri.toURL()); 48 return null; 49 } catch (MalformedURLException mue) { 50 return mue.getMessage(); 51 } 52 } 53 42 54 43 Main.info(tr("Opening URL: {0}", uri)); 55 44
Note:
See TracChangeset
for help on using the changeset viewer.