Changeset 7026 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-04-29T09:26:29+02:00 (10 years ago)
Author:
stoecker
Message:

fix #3142 - drop applet code finally

Location:
trunk/src/org/openstreetmap/josm
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r7005 r7026  
    5656import org.openstreetmap.josm.data.Bounds;
    5757import org.openstreetmap.josm.data.Preferences;
    58 import org.openstreetmap.josm.data.ServerSidePreferences;
    5958import org.openstreetmap.josm.data.UndoRedoHandler;
    6059import org.openstreetmap.josm.data.ViewportData;
     
    175174
    176175    /**
    177      * Set to <code>true</code>, when in applet mode
    178      */
    179     public static boolean applet = false;
    180 
    181     /**
    182176     * The toolbar preference control to register new actions.
    183177     */
     
    421415     */
    422416    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 6471
    428      */
    429     public static void initAppletPreferences(URL serverURL) {
    430         Main.pref = new ServerSidePreferences(serverURL);
    431     }
    432417
    433418    /**
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r7005 r7026  
    7777    @Override
    7878    protected void updateEnabledState() {
    79         setEnabled(! Main.applet);
     79        setEnabled(true);
    8080    }
    8181
  • trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java

    r6380 r7026  
    4848        panel.add(name);
    4949        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);
    5752        if (filerename.isEnabled()) {
    5853            filerename.setSelected(Main.pref.getBoolean("layer.rename-file", true));
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r7005 r7026  
    105105    @Override
    106106    protected void updateEnabledState() {
    107         if (Main.applet) {
    108             setEnabled(false);
    109             return;
    110         }
    111107        boolean check = Main.isDisplayingMapView()
    112108        && Main.map.mapView.getActiveLayer() != null;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r7012 r7026  
    689689
    690690        updateSystemProperties();
    691         if(Main.applet)
    692             return;
    693691
    694692        File prefFile = getPreferenceFile();
     
    724722    public void load() throws Exception {
    725723        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);
    737733        }
    738734        updateSystemProperties();
     
    741737
    742738    public void init(boolean reset){
    743         if(Main.applet)
    744             return;
    745739        // get the preferences.
    746740        File prefDir = getPreferencesDirFile();
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r7005 r7026  
    671671        viewportFollowToggleAction.addButtonModel(vft.getModel());
    672672
    673         if(!Main.applet && Main.platform.canFullscreen()) {
     673        if(Main.platform.canFullscreen()) {
    674674            // -- fullscreen toggle action
    675675            fullscreenToggleAction = new FullscreenToggleAction();
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java

    r7005 r7026  
    181181            }
    182182        }
    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_MESSAGE
    233                 );
    234             }
    235         }
    236183    }
    237184
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r7005 r7026  
    261261    @Override
    262262    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         }
    277263        return new Action[] {
    278264                LayerListDialog.getInstance().createShowHideLayerAction(),
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r7013 r7026  
    490490
    491491    @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)};
    504492        List<Action> actions = new ArrayList<>();
    505493        actions.addAll(Arrays.asList(new Action[]{
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r7005 r7026  
    300300     */
    301301    public void savePreferences() {
    302         if(Main.applet)
    303             return;
    304302        // create a task for downloading plugins if the user has activated, yet not downloaded,
    305303        // new plugins
     
    507505        settingsFactory.add(new TaggingPresetPreference.Factory());
    508506        settingsFactory.add(new BackupPreference.Factory());
    509         if(!Main.applet) {
    510             settingsFactory.add(new PluginPreference.Factory());
    511         }
     507        settingsFactory.add(new PluginPreference.Factory());
    512508        settingsFactory.add(Main.toolbar);
    513509        settingsFactory.add(new AudioPreference.Factory());
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java

    r7005 r7026  
    55import static org.openstreetmap.josm.tools.I18n.tr;
    66
    7 import java.applet.Applet;
    87import java.awt.Component;
    98import java.awt.Container;
     
    634633                    // focus remains on one of the associated components
    635634                    return;
    636                 else if ((c instanceof Window) ||
    637                         (c instanceof Applet && c.getParent() == null)) {
     635                else if (c instanceof Window) {
    638636                    if (c == SwingUtilities.getRoot(TagTable.this)) {
    639637                        if (!getCellEditor().stopCellEditing()) {
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r6889 r7026  
    145145     */
    146146    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) {
    148153            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);
    160156        }
    161157    }
     
    165161     */
    166162    private void saveToDisk() {
    167         if (Main.applet)
    168             return;
    169163        BufferedOutputStream output = null;
    170164        try {
  • trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java

    r7012 r7026  
    137137                }
    138138            } 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);
    145140            }
    146141        } catch (java.net.MalformedURLException e) {
  • trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java

    r6682 r7026  
    88import java.net.MalformedURLException;
    99import java.net.URI;
    10 
    11 import javax.swing.JApplet;
    1210
    1311import org.openstreetmap.josm.Main;
     
    4240    public static String displayUrl(URI uri) {
    4341        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
    5443        Main.info(tr("Opening URL: {0}", uri));
    5544
Note: See TracChangeset for help on using the changeset viewer.