use of org.whole.lang.actions.factories.ActionsEntityFactory in project whole by wholeplatform.
the class SemanticsInterpreterVisitor method visit.
@Override
public void visit(StructuredVariable entity) {
ActionsEntityFactory aef = ActionsEntityFactory.instance;
QueriesEntityFactory qef = QueriesEntityFactory.instance;
ActionCall actionCall = aef.createActionCall(aef.createLabel("whole:org.whole.lang.semantics:SemanticsActions:1.0.0#toVariableFlatName"), qef.createVariableRefStep("variable").wGetAdapter(ActionsEntityDescriptorEnum.SelectedEntities));
getBindings().wDef("variable", entity);
IEntity varNameEntity = BehaviorUtils.evaluate(actionCall, 0, getOperation());
if (isSelectedFeature(SemanticsUtils.USE_IDENTIFIER_SEMANTICS))
setResult(varNameEntity);
else {
IEntity varValue = BindingUtils.wGet(getBindings(), varNameEntity.wStringValue());
if (varValue == null)
throw new MissingVariableException(entity.toString()).withSourceEntity(entity).withBindings(getBindings());
setResult(varValue);
}
}
use of org.whole.lang.actions.factories.ActionsEntityFactory in project whole by wholeplatform.
the class ActionsUIContentAssistVisitor method createReplaceTemplateAction.
protected TemplateAction createReplaceTemplateAction(IEntity prototype, String label, ImageDescriptor icon) {
ActionsEntityFactory aef = ActionsEntityFactory.instance;
TemplateAction action = aef.createTemplateAction();
action.getKind().setValue(ActionKindEnum.REPLACE);
action.getText().setValue(label);
if (icon != null)
action.getIcon().setValue(icon);
action.setEnablerPredicate(createStageUpFragment(Predicate, createNotEqualsQuery(prototype)));
action.setTransformation(createStageUpFragment(Transformation, EntityUtils.clone(prototype)));
return action;
}
use of org.whole.lang.actions.factories.ActionsEntityFactory in project whole by wholeplatform.
the class ActionsUIEntityFactory method createTemplateAction.
public TemplateAction createTemplateAction(ActionKindEnum.Value kind, IEntity prototype, String label, ImageDescriptor icon, boolean differentPredicate) {
ActionsEntityFactory aef = ActionsEntityFactory.instance;
TemplateAction action = aef.createTemplateAction();
action.getKind().setValue(kind);
action.getText().setValue(label);
if (icon != null)
action.getIcon().setValue(icon);
if (differentPredicate && kind == ActionKindEnum.REPLACE)
action.setEnablerPredicate(createStageUpFragment(Predicate, createNotEqualsPredicate(prototype)));
action.setTransformation(createStageUpFragment(Transformation, EntityUtils.cloneIfParented(prototype)));
return action;
}
use of org.whole.lang.actions.factories.ActionsEntityFactory in project whole by wholeplatform.
the class ActionsUIContentAssistVisitor method allLanguages.
protected boolean allLanguages(IEntity entity) {
if (!Matcher.match(ActionsEntityDescriptorEnum.URI, entity))
return false;
ActionsEntityFactory aef = ActionsEntityFactory.instance;
GroupAction languagesGroup = aef.createGroupAction();
Actions actions = aef.createActions(0);
String actualLanguageURI = DataTypeUtils.getAsPersistenceString(entity);
IResourceRegistry<ILanguageKit> registry = ReflectionFactory.getLanguageKitRegistry();
for (ILanguageKit languageKit : registry.getResources(false, ResourceUtils.SIMPLE_COMPARATOR)) {
String uri = languageKit.getURI();
if (uri.equals(actualLanguageURI))
continue;
URI prototype = aef.createURI(uri);
actions.wAdd(createReplaceTemplateAction(prototype, ResourceUtils.SIMPLE_NAME_PROVIDER.toString(registry, languageKit), IActionConstants.SELECT_LANGUAGE_ICON));
}
languagesGroup.setActions(actions);
return mergeResult(languagesGroup);
}
use of org.whole.lang.actions.factories.ActionsEntityFactory in project whole by wholeplatform.
the class WorkflowsIDEContentAssistVisitor method chooseClass.
protected boolean chooseClass(IEntity entity) {
if (!WorkflowsUtils.isClassNameInJavaActivity(entity))
return false;
ReplaceWithClassNameAction action = new ReplaceWithClassNameAction((IEclipseContext) getBindings().wGetValue("eclipse#eclipseContext"), WorkflowsEntityDescriptorEnum.StringLiteral, entity.wStringValue(), "Select class...");
ActionsEntityFactory aef = ActionsEntityFactory.instance;
GroupAction customGroup = aef.createGroupAction();
customGroup.setFillStrategy(aef.createFlat());
customGroup.getText().setValue("workflows.custom");
customGroup.setActions(aef.createActions(aef.createCustomAction(action)));
return EntityUtils.isResolver(entity) ? mergeResult(StringLiteral, customGroup) : mergeResult(customGroup);
}
Aggregations