Changeset 365 in tmcsimulator for trunk/src


Ignore:
Timestamp:
04/11/2019 07:01:03 PM (7 years ago)
Author:
jdalbey
Message:

RevisionNumber?.java, SimulationManagerView?.java : Fix defect #119

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/spikes/ShowUserDir.java

    r360 r365  
    22package spikes; 
    33 
     4import java.io.File; 
    45import java.io.FileInputStream; 
     6import java.net.URL; 
     7import java.net.URLClassLoader; 
    58import java.util.Properties; 
    69import java.util.logging.Level; 
     
    1720    public ShowUserDir() 
    1821    { 
     22        // This shows the path to where the Jar is located 
     23        String currpath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); 
     24        JOptionPane.showMessageDialog(new JWindow(),  
     25                currpath, 
     26                "Show Jar Path", JOptionPane.INFORMATION_MESSAGE);  
     27        // This shows the current working directory, which is different 
     28        // if you double-click launch in Nautilus from command line launch. 
    1929        JOptionPane.showMessageDialog(new JWindow(),  
    2030                "\nUser.Dir=" + System.getProperty("user.dir"), 
    21                 "Show User Dir", JOptionPane.INFORMATION_MESSAGE);                         
     31                "Show User Dir", JOptionPane.INFORMATION_MESSAGE);  
     32         
    2233    }    
    2334    public static void main(String[] args) 
  • trunk/src/tmcsim/application.properties

    r361 r365  
    1 #Thu, 11 Apr 2019 09:48:15 -0700 
     1#Thu, 11 Apr 2019 20:30:13 -0700 
    22 
    3 Application.revision=360 
     3Application.revision=364 
    44 
    5 Application.buildnumber=121 
     5Application.buildnumber=130 
  • trunk/src/tmcsim/cadsimulator/viewer/CADServerViewer.java

    r230 r365  
    2323import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 
    2424import tmcsim.interfaces.CADViewer; 
     25import tmcsim.common.RevisionNumber; 
    2526 
    2627/** 
     
    6465    { 
    6566        super(); 
    66         setTitle("CAD Server " + getAppVersion()); 
     67        setTitle("CAD Server " + RevisionNumber.getAppVersion()); 
    6768 
    6869        initComponents(); 
    6970    } 
    7071 
    71     /** 
    72      * Read the version number from the application properties. The file 
    73      * 'application.properties' is generated by build.xml. 
    74      * 
    75      * @return a version string obtained from application.properties file, or 
    76      * "Version: unknown" if an IOerror prevents us from reading the file. 
    77      */ 
    78     private String getAppVersion() 
    79     { 
    80         String propfilename = "/tmcsim/application.properties"; 
    81         String propKey = "Application.revision"; 
    82         String version = "unknown"; 
    83         try 
    84         { 
    85             Properties props = new Properties(); 
    86             props.load(this.getClass().getResourceAsStream(propfilename)); 
    87             version = (String) props.get(propKey); 
    88         } catch (IOException ex) 
    89         { 
    90             Logger.getLogger("tmcsim/cadsimulator").log(Level.SEVERE, 
    91                     "CADSimulatorView.getAppVersion()." 
    92                     + " IOError reading " + propfilename); 
    93         } catch (NullPointerException npe) 
    94         { 
    95             Logger.getLogger("tmcsim/cadsimulator").log(Level.SEVERE, 
    96                     "CADSimulatorView.getAppVersion().load." 
    97                     + " Missing file: " + propfilename); 
    98         } 
    99         return "revision: " + version; 
    100     } 
     72 
    10173 
    10274    /** 
  • trunk/src/tmcsim/common/RevisionNumber.java

    r6 r365  
    22 
    33import java.io.File; 
     4import java.io.IOException; 
     5import java.util.Properties; 
    46import java.util.Scanner; 
    57import java.util.logging.Level; 
     
    1517 * @author jdalbey 
    1618 */ 
    17 public class RevisionNumber 
     19public final class RevisionNumber 
    1820{ 
    1921 
    2022    private static Logger logger = Logger.getLogger("tmcsim.common"); 
    2123    // Read the subversion revision info and return it 
    22  
     24    /** 
     25     * Read the version number from the application properties. The file 
     26     * 'application.properties' is generated by build.xml. 
     27     * 
     28     * @return a version string obtained from application.properties file, or 
     29     * "Version: unknown" if an IOerror prevents us from reading the file. 
     30     */ 
     31    public static String getAppVersion() 
     32    { 
     33        String propfilename = "/tmcsim/application.properties"; 
     34        String propKey = "Application.revision"; 
     35        String version = "unknown"; 
     36        try 
     37        { 
     38            Properties props = new Properties(); 
     39            props.load(RevisionNumber.class.getResourceAsStream(propfilename)); 
     40            version = (String) props.get(propKey); 
     41        } catch (IOException ex) 
     42        { 
     43            Logger.getLogger("tmcsim/common").log(Level.SEVERE, 
     44                    "getAppVersion(): IOError reading " + propfilename); 
     45        } catch (NullPointerException npe) 
     46        { 
     47            Logger.getLogger("tmcsim/common").log(Level.SEVERE, 
     48                    "getAppVersion().load:  Missing file: " + propfilename); 
     49        } 
     50        return "revision: " + version; 
     51    } 
     52     
    2353    /** 
    2454     * Return the version number as a string. The revision number is generated 
  • trunk/src/tmcsim/simulationmanager/SimulationManagerView.java

    r349 r365  
    702702            public void actionPerformed(java.awt.event.ActionEvent evt) 
    703703            { 
    704                 String ver = RevisionNumber.getString(); 
     704                String ver = RevisionNumber.getAppVersion(); 
    705705                JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE); 
    706706            } 
Note: See TracChangeset for help on using the changeset viewer.