Math2mat

/home/ythoma/docs/math2mat/svn/wp1/framework/m2mGUI/src/m2m/backend/project/ExternalToolsProperties.java

Go to the documentation of this file.
00001 
00020 package m2m.backend.project;
00021 
00022 import java.util.prefs.*;
00023 
00024 public class ExternalToolsProperties {
00025         
00026         private String octavePath;
00027         private String vsimPath;
00028         private String isePath;
00029         private String dotPath;
00030         private int simulationFiles;
00031         private int simulator;
00032         
00033         private String ubiduleIP;
00034         private String xilinxLicense;
00035         
00036         private String libPath;
00037         
00038         enum SimulationFilesType {OVM,M2MOVM};
00039         public final static int SIMULATIONFILES_OVM=0;
00040         public final static int SIMULATIONFILES_M2MOVM=1;
00041         public final static int SIMULATIONFILES_UVM=2;
00042         
00043         public final static String simulatorTypes[]={"Questa_older","Questa_v6.5","Questa_v6.6","Questa_younger"};
00044         
00045         static private ExternalToolsProperties externalToolsProperties;
00046         
00047         static public ExternalToolsProperties getReference() {
00048                 if (externalToolsProperties==null)
00049                         externalToolsProperties=new ExternalToolsProperties();
00050                 return externalToolsProperties;
00051         }
00052         //constructors
00056         private ExternalToolsProperties() {
00057                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00058 
00059                 vsimPath=prefs.get("VsimPath","vsim");
00060                 octavePath=prefs.get("OctavePath","octave");
00061                 isePath=prefs.get("IsePath","ise");
00062                 dotPath=prefs.get("DotPath","dot");
00063                 simulationFiles=prefs.getInt("SimulationFiles",0);
00064                 simulator=prefs.getInt("Simulator", 0);
00065                 ubiduleIP=prefs.get("UbiduleIP","10.192.51.40");
00066                 xilinxLicense=prefs.get("XilinxLicense","");
00067                 libPath=prefs.get("LibPath","");
00068         }
00069         
00070 /*      private static String applicationPath=null;
00071 
00072 
00073         public String getApplicationPath() {
00074                 if (applicationPath==null) {
00075                         applicationPath=this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
00076                 }
00077                 System.out.println("Application path: "+applicationPath);
00078                 return applicationPath;
00079         }
00080 */
00081         
00082         protected void finalize() {
00083                 
00084         }
00085         
00086         public String getLibPath() {
00087                 return libPath;
00088         }
00089         
00090         public String getXilinxLicense() {
00091                 return xilinxLicense;
00092         }
00093         
00094         public String getUbiduleIP() {
00095                 return ubiduleIP;
00096         }
00097 
00098         public int getSimulationFiles() {
00099                 return simulationFiles;
00100         }
00101         
00102         public int getSimulator() {
00103                 return simulator;
00104         }
00105 
00111         public void setSimulationFiles(int type) {
00112                 simulationFiles=type;
00113                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00114                 prefs.put("SimulationFiles",String.valueOf(simulationFiles));
00115         }
00116         
00122         public String getOctavePath() {
00123                 if ((octavePath==null) || (octavePath.isEmpty()))
00124                         return "octave";
00125                 else
00126                         return octavePath;
00127         }
00128 
00129         
00135         public String getVsimPath() {
00136                 if ((vsimPath==null) || (vsimPath.isEmpty()))
00137                         return "vsim";
00138                 else
00139                         return vsimPath;
00140         }
00141         
00142 
00148         public String getIsePath() {
00149                 if ((isePath==null) || (isePath.isEmpty()))
00150                         return "ise";
00151                 else
00152                         return isePath;
00153         }
00154 
00160         public String getDotPath() {
00161                 if ((dotPath==null) || (dotPath.isEmpty()))
00162                         return "dot";
00163                 else
00164                         return dotPath;
00165         }
00166 
00167 
00168         public void setSimulator(int sim) {
00169                 simulator=sim;
00170                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00171                 prefs.put("Simulator",String.valueOf(simulator));
00172         }
00173         
00174 
00175         
00181         public void setLibPath(String path) {
00182                 libPath = path;
00183                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00184                 prefs.put("LibPath",libPath);
00185         }
00186         
00187 
00193         public void setOctavePath(String path) {
00194                 octavePath = path;
00195                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00196                 prefs.put("OctavePath",octavePath);
00197         }
00198         
00204         public void setVsimPath(String path) {
00205                 vsimPath = path;
00206                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00207                 prefs.put("VsimPath",vsimPath);
00208         }
00209         
00210 
00216         public void setIsePath(String path) {
00217                 isePath = path;
00218                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00219                 prefs.put("IsePath",isePath);
00220         }
00221 
00227         public void setDotPath(String path) {
00228                 dotPath = path;
00229                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00230                 prefs.put("DotPath",dotPath);
00231         }
00232         
00233         public void setXilinxLicense(String license) {
00234                 xilinxLicense = license;
00235                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00236                 prefs.put("XilinxLicense",xilinxLicense);
00237         }
00238         
00239         public void setUbiduleIP(String ip) {
00240                 ubiduleIP = ip;
00241                 final Preferences prefs = Preferences.userNodeForPackage(ExternalToolsProperties.class);
00242                 prefs.put("UbiduleIP",ubiduleIP);
00243         }
00244 }
 All Classes Namespaces Files Functions Variables Enumerations