use of org.whole.lang.queries.factories.QueriesEntityFactory in project whole by wholeplatform.
the class QueriesContentAssistVisitor method visit.
@Override
public void visit(LanguageTest entity) {
String actualLanguageURI = entity.getValue();
ActionsUIEntityFactory aef = ActionsUIEntityFactory.instance;
GroupAction languagesGroup = aef.createGroupAction();
languagesGroup.setFillStrategy(aef.createHierarchical(aef.createDistinctPrefix(), aef.createSize(10)));
languagesGroup.getText().setValue("queries.languages");
Actions actions = aef.createActions(0);
QueriesEntityFactory qef = QueriesEntityFactory.instance;
IResourceRegistry<ILanguageKit> registry = ReflectionFactory.getLanguageKitRegistry();
for (ILanguageKit languageKit : registry.getResources(false, ResourceUtils.SIMPLE_COMPARATOR)) {
String languageURI = languageKit.getURI();
if (languageURI.equals(actualLanguageURI))
continue;
actions.wAdd(aef.createReplaceDifferentTemplateAction(qef.create(LanguageTest, languageURI), ResourceUtils.SIMPLE_NAME_PROVIDER.toString(registry, languageKit), IActionConstants.SELECT_LANGUAGE_ICON));
}
languagesGroup.setActions(actions);
mergeResult(languagesGroup);
}
use of org.whole.lang.queries.factories.QueriesEntityFactory in project whole by wholeplatform.
the class QueriesContentAssistVisitor method allFeatureNames.
private boolean allFeatureNames(SortedSet<String> fNames, String actualFName) {
ActionsUIEntityFactory aef = ActionsUIEntityFactory.instance;
QueriesEntityFactory qef = QueriesEntityFactory.instance;
GroupAction featurenamesGroup = aef.createGroupAction();
featurenamesGroup.setFillStrategy(aef.createHierarchical(aef.createDistinctPrefix(), aef.createSize(10)));
featurenamesGroup.getText().setValue("queries.featurenames");
Actions actions = aef.createActions(0);
for (String fName : fNames) {
if (fName.equals(actualFName))
continue;
Name prototype = qef.createName(fName);
actions.wAdd(aef.createReplaceDifferentTemplateAction(prototype, fName));
}
featurenamesGroup.setActions(actions);
return mergeResult(featurenamesGroup);
}
use of org.whole.lang.queries.factories.QueriesEntityFactory in project whole by wholeplatform.
the class QueriesUtils method createRootPath.
public static Path createRootPath(IEntity entity) {
QueriesEntityFactory qef = QueriesEntityFactory.instance;
Path path = qef.createPath(0);
IEntity parent = null;
IEntityIterator<IEntity> iterator = IteratorFactory.ancestorOrSelfReverseIterator();
iterator.reset(entity);
if (CommonsEntityDescriptorEnum.RootFragment.equals(iterator.lookahead().wGetEntityDescriptor()))
iterator.next();
for (IEntity child : iterator) {
if (parent != null)
path.wAdd(EntityUtils.isSimple(parent) ? qef.createFeatureStep(CommonsDataTypePersistenceParser.unparseFeatureDescriptor(parent.wGetFeatureDescriptor(child))) : qef.createFilter(qef.createChildStep(), qef.createIndexTest(qef.createIntLiteral(parent.wIndexOf(child)))));
parent = child;
}
return path;
}
use of org.whole.lang.queries.factories.QueriesEntityFactory in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testPathOfChildSteps.
@Test
public void testPathOfChildSteps() {
Model model = new XmlModel().create();
IEntity decl3 = model.getDeclarations().wGet(3);
QueriesEntityFactory ef = QueriesEntityFactory.instance;
PathExpression pe = ef.createPath(ef.createFeatureStep("declarations"), ef.createFilter(ef.createChildStep(), ef.createIndexTest(ef.createIntLiteral(3))));
IEntity result = BehaviorUtils.evaluateFirstResult(pe, model);
Assert.assertSame(decl3, result);
}
use of org.whole.lang.queries.factories.QueriesEntityFactory in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testChildStepByName.
@Test
public void testChildStepByName() {
Model model = new XmlModel().create();
SimpleName name = model.getName();
QueriesEntityFactory ef = QueriesEntityFactory.instance;
IEntity result = BehaviorUtils.evaluateFirstResult(ef.createFeatureStep("name"), model);
Assert.assertSame(name, result);
}
Aggregations