Search in sources :

Example 31 with IOperation

use of org.whole.lang.operations.IOperation in project whole by wholeplatform.

the class CommonsLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new CommonsLanguageKit());
    platform.addOperationFactory(CommonsLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new CommonsGenericBuilderAdapter((ICommonsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new CommonsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new CommonsContentAssistVisitor();
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new CommonsInterpreterVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, DynamicCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new CommonsDynamicCompilerVisitor();
            else
                return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new CommonsPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, FindDeclarationOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, FindDeclarationsOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return null;
        }
    });
    platform.addOperationFactory(CommonsLanguageKit.URI, IOperation.ANY_ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new CommonsInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) CommonsContentAssistVisitor(org.whole.lang.commons.visitors.CommonsContentAssistVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) CommonsGenericBuilderAdapter(org.whole.lang.commons.builders.CommonsGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ICommonsBuilder(org.whole.lang.commons.builders.ICommonsBuilder) CommonsPrettyPrinterVisitor(org.whole.lang.commons.visitors.CommonsPrettyPrinterVisitor) CommonsDynamicCompilerVisitor(org.whole.lang.commons.visitors.CommonsDynamicCompilerVisitor) CommonsInterpreterVisitor(org.whole.lang.commons.visitors.CommonsInterpreterVisitor) CommonsSpecificBuilderAdapter(org.whole.lang.commons.builders.CommonsSpecificBuilderAdapter)

Example 32 with IOperation

use of org.whole.lang.operations.IOperation in project whole by wholeplatform.

the class ReusablesUIDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addEditorKit(ReusablesEditorKit.ID);
    platform.addOperationFactory(ReusablesLanguageKit.URI, DynamicCompilerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ReusablesUIDynamicCompilerVisitor();
            else
                return null;
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) ReusablesUIDynamicCompilerVisitor(org.whole.lang.reusables.visitors.ReusablesUIDynamicCompilerVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory)

Example 33 with IOperation

use of org.whole.lang.operations.IOperation in project whole by wholeplatform.

the class LegacyContributionExtensionsDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    try {
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/html/HTML5Semantics.xwl")));
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/html/HTML5Actions.xwl")));
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/javascript/JavaScriptSemantics.xwl")));
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/javascript/JavaScriptActions.xwl")));
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/mediawiki/MediaWikiActions.xwl")));
        InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(new ClasspathPersistenceProvider("org/whole/lang/ui/CaretActionsSemantics.xwl")));
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
    platform.addPersistenceKit("org.whole.lang.html.Html5Editor", HtmlPersistenceKit.instance());
    platform.addOperationFactory(LegacyMetaModelsDeployer.HTML5_URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new HtmlPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(JavaScriptLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new JavaScriptInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) IVisitor(org.whole.lang.visitors.IVisitor) ClasspathPersistenceProvider(org.whole.lang.codebase.ClasspathPersistenceProvider) JavaScriptInterpreterVisitor(org.whole.lang.javascript.visitors.JavaScriptInterpreterVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) HtmlPrettyPrinterVisitor(org.whole.lang.html.visitors.HtmlPrettyPrinterVisitor)

Example 34 with IOperation

use of org.whole.lang.operations.IOperation in project whole by wholeplatform.

the class SchemaHelpers method deploySchemaOperations.

public static void deploySchemaOperations(final String languageUri) {
    ILanguageKit lk = ReflectionFactory.getLanguageKit(languageUri, false, null);
    if (!lk.isDynamic())
        return;
    // configure data-type parsers
    IMappingStrategy mappingStrategy = MappingStrategyRegistry.instance().getMappingStrategy(languageUri);
    IDataTypeParser parser = new XsiDataTypeParser(mappingStrategy.getDataTypeParsers());
    DynamicLanguageKit languageKit = (DynamicLanguageKit) lk;
    languageKit.setDataTypeParser(DataTypeParsers.PERSISTENCE, parser);
    languageKit.setDataTypeParser(DataTypeParsers.PRESENTATION, parser);
    // deploy a generic pretty print
    ReflectionFactory.deploy(new AbstractLanguageExtensionDeployer() {

        public void deploy(ReflectionFactory platform) {
            platform.addOperationFactory(languageUri, PrettyPrinterOperation.ID, new IVisitorFactory() {

                public IVisitor create(IOperation operation, int stage) {
                    return new XsiPrettyPrinterVisitor();
                }
            });
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) IMappingStrategy(org.whole.lang.xsd.codebase.IMappingStrategy) DynamicLanguageKit(org.whole.lang.reflect.DynamicLanguageKit) ReflectionFactory(org.whole.lang.reflect.ReflectionFactory) XsiDataTypeParser(org.whole.lang.xsd.parsers.XsiDataTypeParser) AbstractLanguageExtensionDeployer(org.whole.lang.reflect.AbstractLanguageExtensionDeployer) XsiPrettyPrinterVisitor(org.whole.lang.xsd.visitors.XsiPrettyPrinterVisitor) IDataTypeParser(org.whole.lang.parsers.IDataTypeParser) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ILanguageKit(org.whole.lang.reflect.ILanguageKit)

Example 35 with IOperation

use of org.whole.lang.operations.IOperation in project whole by wholeplatform.

the class JSONPersistenceDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addOperationFactory(JSONLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new JSONPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addPersistenceKit("org.whole.lang.json.JSONSourceEditor", JSONSourcePersistenceKit.instance());
    platform.addPersistenceKit("org.whole.lang.json.JSONLDEditor", JSONLDPersistenceKit.instance());
}
Also used : IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) IVisitor(org.whole.lang.visitors.IVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) JSONPrettyPrinterVisitor(org.whole.lang.json.visitors.JSONPrettyPrinterVisitor)

Aggregations

IOperation (org.whole.lang.operations.IOperation)36 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)36 IVisitor (org.whole.lang.visitors.IVisitor)34 IBuilder (org.whole.lang.builders.IBuilder)20 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)20 IEntityContext (org.whole.lang.contexts.IEntityContext)20 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)13 ResourceArtifactsGeneratorVisitor (org.whole.lang.artifacts.visitors.ResourceArtifactsGeneratorVisitor)2 IBindingManager (org.whole.lang.bindings.IBindingManager)2 IImpBuilder (org.whole.examples.lang.imp.builders.IImpBuilder)1 ImpGenericBuilderAdapter (org.whole.examples.lang.imp.builders.ImpGenericBuilderAdapter)1 ImpSpecificBuilderAdapter (org.whole.examples.lang.imp.builders.ImpSpecificBuilderAdapter)1 BytecodeGeneratorOperation (org.whole.examples.lang.imp.visitors.BytecodeGeneratorOperation)1 ImpBytecodeGeneratorVisitor (org.whole.examples.lang.imp.visitors.ImpBytecodeGeneratorVisitor)1 ImpDefUseValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpDefUseValidatorVisitor)1 ImpInterpreterVisitor (org.whole.examples.lang.imp.visitors.ImpInterpreterVisitor)1 ImpPrettyPrinterVisitor (org.whole.examples.lang.imp.visitors.ImpPrettyPrinterVisitor)1 ImpResolverValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpResolverValidatorVisitor)1 ReflectLibraryDeployer (org.whole.lang.ReflectLibraryDeployer)1 ViewDerivationLibraryDeployer (org.whole.lang.ViewDerivationLibraryDeployer)1