Search in sources :

Example 41 with IVisitor

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

the class CommonsUIDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addEditorKit(CommonsEditorKit.ID);
    platform.addOperationFactory(CommonsLanguageKit.URI, ContentAssistOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new CommonsUIContentAssistVisitor();
        }
    });
}
Also used : IOperation(org.whole.lang.operations.IOperation) IVisitor(org.whole.lang.visitors.IVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) CommonsUIContentAssistVisitor(org.whole.lang.commons.ui.visitors.CommonsUIContentAssistVisitor)

Example 42 with IVisitor

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

the class XmlLanguageDeployer method deploy.

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

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new XmlGenericBuilderAdapter((IXmlBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new XmlSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new XmlPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(XmlLanguageKit.URI, NormalizerOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new XmlNormalizerVisitor();
        }
    });
    platform.addPersistenceKit("org.whole.lang.xml.XmlBuilderEditor", XmlBuilderPersistenceKit.instance());
    platform.addPersistenceKit("org.whole.lang.xml.XmlSourceEditor", XmlSourcePersistenceKit.instance());
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) XmlNormalizerVisitor(org.whole.lang.xml.visitors.XmlNormalizerVisitor) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) XmlGenericBuilderAdapter(org.whole.lang.xml.builders.XmlGenericBuilderAdapter) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) XmlPrettyPrinterVisitor(org.whole.lang.xml.visitors.XmlPrettyPrinterVisitor) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) XmlSpecificBuilderAdapter(org.whole.lang.xml.builders.XmlSpecificBuilderAdapter) IXmlBuilder(org.whole.lang.xml.builders.IXmlBuilder)

Example 43 with IVisitor

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

the class ScriptsLanguageDeployer method deploy.

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

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ScriptsGenericBuilderAdapter((IScriptsBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ScriptsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ScriptsSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ScriptsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ScriptsInterpreterVisitor();
            else
                return null;
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) ScriptsGenericBuilderAdapter(org.whole.lang.scripts.builders.ScriptsGenericBuilderAdapter) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) IScriptsBuilder(org.whole.lang.scripts.builders.IScriptsBuilder) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ScriptsInterpreterVisitor(org.whole.lang.scripts.visitors.ScriptsInterpreterVisitor) ScriptsSpecificBuilderAdapter(org.whole.lang.scripts.builders.ScriptsSpecificBuilderAdapter)

Example 44 with IVisitor

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

the class Matcher method findAncestor.

@SuppressWarnings("unchecked")
public static <E extends IEntity> E findAncestor(E pattern, IEntity model, IBindingManager bindings) {
    IVisitor mv = GenericMatcherFactory.instance.matchInScope(pattern);
    mv.setBindings(bindings);
    return (E) findAncestor(mv, model);
}
Also used : IVisitor(org.whole.lang.visitors.IVisitor)

Example 45 with IVisitor

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

the class Matcher method findAncestorOrSelf.

@SuppressWarnings("unchecked")
public static <E extends IEntity> E findAncestorOrSelf(E pattern, IEntity model, IBindingManager bindings) {
    IVisitor mv = GenericMatcherFactory.instance.matchInScope(pattern);
    mv.setBindings(bindings);
    return (E) findAncestorOrSelf(mv, model);
}
Also used : IVisitor(org.whole.lang.visitors.IVisitor)

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