Changeset 1234


Ignore:
Timestamp:
01/24/12 21:24:44 (13 years ago)
Author:
masberg
Message:

Fix loading of the Modelica standard library. Bonus: Fixed a few spelling errors and some minor formatting tweaks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt.omc/src/org/modelica/mdt/omc/OMCProxy.java

    r1175 r1234  
    128128    private boolean systemLibraryLoaded = false;
    129129
    130     private ArrayList<String> standardLibraryPackages = null;
     130    private java.util.List<String> standardLibraryPackages = null;
    131131
    132132    /* should we trace the calls to sendExpression? */
    133     private  boolean traceOMCCalls = false;
    134     private  boolean traceOMCStatus = true;
    135 
    136     private  boolean traceStatusPreferences = false;
    137     private  boolean traceCommandsPreferences = false;
    138     private  boolean traceErrorPreferences = false;
    139     private  boolean traceReplyPrefereces = false; 
     133    private boolean traceOMCCalls = false;
     134    private boolean traceOMCStatus = true;
     135
     136    private boolean traceStatusPreferences = false;
     137    private boolean traceCommandsPreferences = false;
     138    private boolean traceErrorPreferences = false; 
     139    private boolean traceReplyPrefereces = false;   
    140140
    141141    {
     
    638638
    639639    /**
    640      * outputs the message about a call error that occured
     640     * outputs the message about a call error that occurred
    641641     * when communicating with omc
    642642     * @param message the message to log
     
    962962            endLine = Integer.parseInt(tokens.elementAt(4).toString());
    963963            endColumn = Integer.parseInt(tokens.elementAt(5).toString());
    964            
     964
    965965            if (startColumn == 0) {
    966966                assert(startLine == 1);
     
    10501050                else
    10511051                {
    1052                     /* OMC returned someting wierd, panic mode ! */
     1052                    /* OMC returned something weird, panic mode ! */
    10531053                    break;
    10541054                }
     
    11221122     * the server
    11231123     */
    1124     public String[] getStandardLibrary() throws ConnectException
    1125     {
    1126         String openModelicaLibrary = System.getenv("OPENMODELICALIBRARY");
    1127         if (openModelicaLibrary != null)
    1128         {
    1129             File path = new File(openModelicaLibrary);
    1130             ArrayList<String> libs = new ArrayList<String>();
    1131             for (File f: path.listFiles()) if (f.isDirectory()) libs.add(f.getName());
    1132             standardLibraryPackages = libs;
    1133         }
    1134 
    1135         if (!systemLibraryLoaded)
    1136         {
    1137             if (standardLibraryPackages == null)
    1138             {
    1139                 ArrayList<String> libs = new ArrayList<String>();
    1140                 libs.add("Modelica");
    1141                 standardLibraryPackages = libs;
    1142             }
    1143             for (Object lib : standardLibraryPackages)
    1144             {
    1145                 sendExpression("loadModel("+(String)lib+")", true);
    1146 
    1147             }
     1124    public String[] getStandardLibrary() throws ConnectException {
     1125        if (!systemLibraryLoaded) {
     1126            if (standardLibraryPackages == null) {
     1127                standardLibraryPackages = new ArrayList<String>();
     1128                standardLibraryPackages.add("Modelica");
     1129            }
     1130
     1131            sendExpression("loadModel(Modelica)", true);
    11481132
    11491133            systemLibraryLoaded = true;
    11501134        }
    11511135
    1152         return (String[]) standardLibraryPackages.toArray(new String[standardLibraryPackages.size()]);
     1136        String[] arr = standardLibraryPackages.toArray(new String[0]);
     1137
     1138        return arr;
    11531139    }
    11541140
Note: See TracChangeset for help on using the changeset viewer.