Ignore:
Timestamp:
2013-04-06T14:56:43+02:00 (11 years ago)
Author:
Don-vip
Message:

fix javadoc + minor refactorization/code cleanup

File:
1 edited

Legend:

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

    r5696 r5829  
    9595import org.openstreetmap.josm.tools.WindowGeometry;
    9696
     97/**
     98 * Abstract class holding various static global variables and methods used in large parts of JOSM application.
     99 * @since 98
     100 */
    97101abstract public class Main {
    98102
     
    108112        return true;
    109113    }
     114   
    110115    /**
    111116     * Global parent component for all dialogs and message boxes
    112117     */
    113118    public static Component parent;
     119   
    114120    /**
    115121     * Global application.
    116122     */
    117123    public static Main main;
     124   
    118125    /**
    119126     * The worker thread slave. This is for executing all long and intensive
     
    122129     */
    123130    public final static ExecutorService worker = new ProgressMonitorExecutor();
     131   
    124132    /**
    125133     * Global application preferences
     
    131139     */
    132140    public static final PrimitiveDeepCopy pasteBuffer = new PrimitiveDeepCopy();
     141   
     142    /**
     143     * The layer source from which {@link Main#pasteBuffer} data comes from.
     144     */
    133145    public static Layer pasteSource;
    134146
    135147    /**
    136      * The MapFrame. Use setMapFrame to set or clear it.
     148     * The MapFrame. Use {@link Main#setMapFrame} to set or clear it.
    137149     */
    138150    public static MapFrame map;
     151   
    139152    /**
    140153     * Set to <code>true</code>, when in applet mode
     
    147160    public static ToolbarPreferences toolbar;
    148161
     162    /**
     163     * The commands undo/redo handler.
     164     */
    149165    public UndoRedoHandler undoRedo = new UndoRedoHandler();
    150166
     
    240256    /**
    241257     * Set or clear (if passed <code>null</code>) the map.
     258     * @param map The map to set {@link Main#map} to. Can be null.
    242259     */
    243260    public final void setMapFrame(final MapFrame map) {
     
    532549    ///////////////////////////////////////////////////////////////////////////
    533550
     551    /**
     552     * Global panel.
     553     */
    534554    public static final JPanel panel = new JPanel(new BorderLayout());
    535555
     
    592612    }
    593613
    594     public void postConstructorProcessCmdLine(Map<Option, Collection<String>> args) {
     614    protected static void postConstructorProcessCmdLine(Map<Option, Collection<String>> args) {
    595615        if (args.containsKey(Option.DOWNLOAD)) {
    596616            List<File> fileList = new ArrayList<File>();
     
    705725    }
    706726
     727    /**
     728     * Closes JOSM and optionally terminates the Java Virtual Machine (JVM). If there are some unsaved data layers, asks first for user confirmation.
     729     * @param exit If {@code true}, the JVM is terminated by running {@link System#exit} with a return code of 0.
     730     * @return {@code true} if JOSM has been closed, {@code false} if the user has cancelled the operation.
     731     * @since 3378
     732     */
    707733    public static boolean exitJosm(boolean exit) {
    708734        if (Main.saveUnsavedModifications()) {
    709735            geometry.remember("gui.geometry");
    710             if (map  != null) {
     736            if (map != null) {
    711737                map.rememberToggleDialogWidth();
    712738            }
     
    721747            if (exit) {
    722748                System.exit(0);
    723                 return true;
    724             } else
    725                 return true;
    726         } else
    727             return false;
     749            }
     750            return true;
     751        }
     752        return false;
    728753    }
    729754
     
    739764     * @return The guessed parameter type
    740765     */
    741     private DownloadParamType paramType(String s) {
     766    private static DownloadParamType paramType(String s) {
    742767        if(s.startsWith("http:")) return DownloadParamType.httpUrl;
    743768        if(s.startsWith("file:")) return DownloadParamType.fileUrl;
     
    798823    }
    799824
     825    /**
     826     * Identifies the current operating system family and initializes the platform hook accordingly.
     827     * @since 1849
     828     */
    800829    public static void determinePlatformHook() {
    801830        String os = System.getProperty("os.name");
     
    853882        }
    854883    }
    855     public static void addListener() {
     884   
     885    protected static void addListener() {
    856886        parent.addComponentListener(new WindowPositionSizeListener());
    857887        ((JFrame)parent).addWindowStateListener(new WindowPositionSizeListener());
    858888    }
    859889
     890    /**
     891     * Checks that JOSM is at least running with Java 6.
     892     * @since 3815
     893     */
    860894    public static void checkJava6() {
    861895        String version = System.getProperty("java.version");
    862896        if (version != null) {
    863897            if (version.startsWith("1.6") || version.startsWith("6") ||
    864                     version.startsWith("1.7") || version.startsWith("7"))
     898                    version.startsWith("1.7") || version.startsWith("7") ||
     899                    version.startsWith("1.8") || version.startsWith("8"))
    865900                return;
    866901            if (version.startsWith("1.5") || version.startsWith("5")) {
Note: See TracChangeset for help on using the changeset viewer.