- Timestamp:
- 04/11/2019 07:01:03 PM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
-
spikes/ShowUserDir.java (modified) (2 diffs)
-
tmcsim/application.properties (modified) (1 diff)
-
tmcsim/cadsimulator/viewer/CADServerViewer.java (modified) (2 diffs)
-
tmcsim/common/RevisionNumber.java (modified) (2 diffs)
-
tmcsim/simulationmanager/SimulationManagerView.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/spikes/ShowUserDir.java
r360 r365 2 2 package spikes; 3 3 4 import java.io.File; 4 5 import java.io.FileInputStream; 6 import java.net.URL; 7 import java.net.URLClassLoader; 5 8 import java.util.Properties; 6 9 import java.util.logging.Level; … … 17 20 public ShowUserDir() 18 21 { 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. 19 29 JOptionPane.showMessageDialog(new JWindow(), 20 30 "\nUser.Dir=" + System.getProperty("user.dir"), 21 "Show User Dir", JOptionPane.INFORMATION_MESSAGE); 31 "Show User Dir", JOptionPane.INFORMATION_MESSAGE); 32 22 33 } 23 34 public static void main(String[] args) -
trunk/src/tmcsim/application.properties
r361 r365 1 #Thu, 11 Apr 2019 09:48:15-07001 #Thu, 11 Apr 2019 20:30:13 -0700 2 2 3 Application.revision=36 03 Application.revision=364 4 4 5 Application.buildnumber=1 215 Application.buildnumber=130 -
trunk/src/tmcsim/cadsimulator/viewer/CADServerViewer.java
r230 r365 23 23 import tmcsim.cadsimulator.viewer.model.CADSimulatorStatus; 24 24 import tmcsim.interfaces.CADViewer; 25 import tmcsim.common.RevisionNumber; 25 26 26 27 /** … … 64 65 { 65 66 super(); 66 setTitle("CAD Server " + getAppVersion());67 setTitle("CAD Server " + RevisionNumber.getAppVersion()); 67 68 68 69 initComponents(); 69 70 } 70 71 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 101 73 102 74 /** -
trunk/src/tmcsim/common/RevisionNumber.java
r6 r365 2 2 3 3 import java.io.File; 4 import java.io.IOException; 5 import java.util.Properties; 4 6 import java.util.Scanner; 5 7 import java.util.logging.Level; … … 15 17 * @author jdalbey 16 18 */ 17 public class RevisionNumber19 public final class RevisionNumber 18 20 { 19 21 20 22 private static Logger logger = Logger.getLogger("tmcsim.common"); 21 23 // 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 23 53 /** 24 54 * Return the version number as a string. The revision number is generated -
trunk/src/tmcsim/simulationmanager/SimulationManagerView.java
r349 r365 702 702 public void actionPerformed(java.awt.event.ActionEvent evt) 703 703 { 704 String ver = RevisionNumber.get String();704 String ver = RevisionNumber.getAppVersion(); 705 705 JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE); 706 706 }
Note: See TracChangeset
for help on using the changeset viewer.
