Search in sources :

Example 56 with IVisitor

use of org.whole.lang.visitors.IVisitor 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 57 with IVisitor

use of org.whole.lang.visitors.IVisitor 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 58 with IVisitor

use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.

the class JavaStoreBuilder method addSubtree.

public Expression addSubtree(IVisitor visitor, StageDownFragment fragment, String type) {
    int parentNestingSize = initNestingSize();
    IVisitor v = ((AbstractOperation) visitor.getOperation()).getVisitor(fragment.wGetRoot(), 0);
    v.visit(fragment.wGetRoot());
    MethodInvocation callExp2 = newFactoryInvocation(v, "makeRootEntity");
    callExp2.arguments().add(getExpression());
    MethodInvocation callExp = newFactoryInvocation(visitor, "create" + type);
    callExp.arguments().add(callExp2);
    return addSubtree(parentNestingSize, type, callExp);
}
Also used : AbstractOperation(org.whole.lang.operations.AbstractOperation) IVisitor(org.whole.lang.visitors.IVisitor) MethodInvocation(org.eclipse.jdt.core.dom.MethodInvocation)

Example 59 with IVisitor

use of org.whole.lang.visitors.IVisitor 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)

Example 60 with IVisitor

use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.

the class TestsUIDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addEditorKit(TestsEditorKit.ID);
    platform.addOperationFactory(TestsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

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

Aggregations

IVisitor (org.whole.lang.visitors.IVisitor)63 IOperation (org.whole.lang.operations.IOperation)34 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)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 IEntity (org.whole.lang.model.IEntity)9 ILanguageKit (org.whole.lang.reflect.ILanguageKit)4 MethodInvocation (org.eclipse.jdt.core.dom.MethodInvocation)3 IBindingManager (org.whole.lang.bindings.IBindingManager)3 Test (org.junit.Test)2 ITransactionScope (org.whole.lang.bindings.ITransactionScope)2 GenericMatcherFactory (org.whole.lang.matchers.GenericMatcherFactory)2 AbstractOperation (org.whole.lang.operations.AbstractOperation)2 PrettyPrinterOperation.toPrettyPrintString (org.whole.lang.operations.PrettyPrinterOperation.toPrettyPrintString)2 VisitException (org.whole.lang.visitors.VisitException)2 PrintWriter (java.io.PrintWriter)1 Writer (java.io.Writer)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1