Package ptolemy.moml

Examples of ptolemy.moml.ParserAttribute


            URL url = modelURL.asURL();
            if (url != null) {
                MoMLParser parser = new MoMLParser();
                try {
                    _entity = parser.parse(null, url);
                    ParserAttribute parserAttribute = new ParserAttribute(
                            _entity, "_parser");
                    parserAttribute.setParser(parser);
                } catch (Exception ex) {
                    throw new IllegalActionException(this, ex,
                            "Failed to read model from: " + url);
                }
            } else {
View Full Code Here


    private void _createBlankEntity() {
        String moml = "<entity name=\"top\" class=\"ptolemy.kernel.CompositeEntity\"/>";
        MoMLParser parser = new MoMLParser();
        try {
            _entity = parser.parse(null, moml);
            ParserAttribute parserAttribute = new ParserAttribute(_entity,
                    "_parser");
            parserAttribute.setParser(parser);
        } catch (Exception ex) {
            throw new InternalErrorException(ex);
        }
    }
View Full Code Here

                // The model should have a parser associated with it
                // so that undo works.
                // Checking to see if there already is a _parser attribute
                // might be overkill, but it is safer.
                ParserAttribute parserAttribute = (ParserAttribute) newModel
                        .getAttribute("_parser", ParserAttribute.class);

                if (parserAttribute == null) {
                    parserAttribute = new ParserAttribute(newModel, "_parser");

                    MoMLParser parser = new MoMLParser();

                    // Make sure that the MoMLParser._modified flag is reset
                    // If we don't call reset here, then the second time
                    // the code generator is run, we will be prompted to
                    // save the model because the first time we ran
                    // the code generator the model was marked as modified.
                    parser.reset();

                    parserAttribute.setParser(parser);
                }

                // The name might be "blank" which is confusing.
                // Set it to an empty string.  On Save As, this will
                // be changed to match the file name.
View Full Code Here

TOP

Related Classes of ptolemy.moml.ParserAttribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.