Changeset 379 for trunk


Ignore:
Timestamp:
02/27/06 09:26:12 (19 years ago)
Author:
remar
Message:
  • start OMC from the correct working directory (OPENMODELICAHOME)
  • OMC binary moved to OPENMODELICAHOME/build/bin/omc
  • updated documentation
File:
1 edited

Legend:

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

    r376 r379  
    191191    {
    192192        String pathToOmc = null;
     193        File workingDirectory;
    193194
    194195        /*
     
    213214            pathToOmc = omHome + "\\omc.exe";
    214215        }
     216       
     217        /* We should start OMC from the OPENMODELICAHOME directory */
     218        workingDirectory = new File(omHome);
    215219
    216220        /*
     
    230234        {
    231235            logOMCStatus("Running command " + command[0] + " " + command[1]);
    232             Runtime.getRuntime().exec(command);
     236            Runtime.getRuntime().exec(command, null, workingDirectory);
    233237            logOMCStatus("Command run successfully.");
    234238        }
     
    247251                if(os.equals("Unix"))
    248252                {
    249                     secondaryPathToOmc = omHome + "/Compiler/omc";
     253                    secondaryPathToOmc = omHome + "/build/bin/omc";
    250254                }
    251255                else if(os.equals("Windows"))
    252256                {
    253                     secondaryPathToOmc = omHome + "\\Compiler\\omc.exe";
     257                    secondaryPathToOmc = omHome + "\\build\\bin\\omc.exe";
    254258                }
    255259
     
    258262                logOMCStatus("Running command "
    259263                        + command[0] + " " + command[1]);
    260                 Runtime.getRuntime().exec(command);
     264                Runtime.getRuntime().exec(command, null, workingDirectory);
    261265                logOMCStatus("Command run successfully.");
    262266            }
     
    533537     *
    534538     * @param className full class name where to look for packages
    535      * @return an array of subclasses defined (and loaded into OMC)
    536      *  inside the class named className, but don't return packages in this
    537      *  class. The results is returned as Vector of objects but objects
    538      *  are actually String's.
    539      * 
     539     * @return a <code>List</code> of subclasses defined (and loaded into OMC)
     540     * inside the class named className.
     541     *
    540542     * @throws ConnectException
    541543     * @throws UnexpectedReplyException
     
    559561     * @return the restriction type of the class or Type.CLASS if
    560562     *         type can't be determined
    561      * @throws ConnectException
     563     * @throws ConnectException
     564     * @throws UnexpectedReplyException
    562565     */
    563566    public IModelicaClass.Type getRestrictionType(String className)
     
    597600    /**
    598601     * Fetches the error string from OMC. This should be called after an "Error"
    599      * is received.
    600      * @return
     602     * is received. (Or whenever the queue of errors should be emptied.)
     603     * @return the <code>String</code> of errors
    601604     * @throws ConnectException
    602605     */
     
    605608    {
    606609        String res = sendExpression("getErrorString()");
    607         if(res != null)
     610       
     611        /* Make sure the error string isn't empty */
     612        if(res != null && res.length() > 2)
    608613        {
    609614            res = res.trim();
     
    619624     * checked.
    620625     * @param file the file we want to load
    621      * @return either returns the classes (and packages) found in the file or
    622      * the error messages from OMC
     626     * @return a <code>ParseResult</code> containing the classes found in the
     627     * file and the error messages from OMC
    623628     * @throws ConnectException
    624629     * @throws UnexpectedReplyException
     
    645650        {           
    646651            res.setClassNames(new List());
    647             res.setCompileErrors(OMCParser.parseErrorString(errorString));
     652            if(errorString.equals("") == false)
     653            {
     654                res.setCompileErrors(OMCParser.parseErrorString(errorString));
     655            }
    648656        }
    649657        /*
     
    668676
    669677    /**
    670      * Gets the location (file, line number and column number) of a Modelica
    671      * element.
     678     * Gets the location (file, starting and ending line number and column
     679     * number) of a Modelica element.
    672680     * @param className the element we want to get location of
    673      * @return an IElementLocation containing the file, line number and column
    674      * number of the given class
     681     * @return an <code>ElementLocation</code> containing the file, starting and
     682     * ending line number and column number of the given class
    675683     * @throws ConnectException
    676684     * @throws UnexpectedReplyException
     
    688696        {
    689697            throw new
    690                 InvocationError("fetching file position of " + className,
     698                InvocationError("Fetching file position of " + className,
    691699                        "getCrefInfo(" + className + ")");
    692700        }
     
    694702       
    695703        /*
    696          * The getCrefInfo reply have the following format:
     704         * The getCrefInfo reply has the following format:
    697705         *
    698706         * <file path>,<something>,<start line>,<start column>,<end line>,<end column>
     
    736744     *
    737745     * @param className fully qualified name of the class/package
    738      * @return true if className is a package false otherwise
     746     * @return true if className is a package, false otherwise
    739747     * @throws ConnectException
    740748     */
     
    750758    }
    751759   
     760    /**
     761     * Uses the OMC API call getElementsInfo to fetch lots of information
     762     * about a class definition. See interactive_api.txt in the OMC
     763     * source tree.
     764     * @param className the fully qualified name of a class
     765     * @return a <code>Collection</code> (of <code>ElementsInfo</code>)
     766     * containing the information about className
     767     */
    752768    public Collection<ElementsInfo> getElementsInfo(String className)
    753769        throws ConnectException, InvocationError, UnexpectedReplyException
     
    807823    }
    808824
    809    
     825    /**
     826     * @return the name of the compiler that this plugin tries to communicate
     827     * with (at least it tries...)
     828     */
    810829    public String getCompilerName()
    811830    {
Note: See TracChangeset for help on using the changeset viewer.