use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ArtifactsGeneratorTest method testGenerateArtifacts.
@Test
public void testGenerateArtifacts() {
IBindingManager env = BindingManagerFactory.instance.createArguments();
IEntity artifact = getMetadataPattern();
IBindingScope args = BindingManagerFactory.instance.createSimpleScope();
args.wDefValue("packageName", "artifact.test");
Matcher.substitute(artifact, args, false);
args.wClear();
args.wDefValue("templateManagerName", "MyTM");
Matcher.substitute(artifact, args, false);
ArtifactsGeneratorOperation.generate(artifact, env);
// String pn = env.wStringValue("packageName");
// String fn = env.wStringValue("fileName");
// String l = env.wStringValue("location");
// String n = env.wStringValue("name");
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class AbstractLinkableSelectionListener method isRelevant.
protected boolean isRelevant(Object selection) {
if (!(selection instanceof IBindingManager))
return false;
IBindingManager actualSelection = (IBindingManager) selection;
IEntityPartViewer selectedViewer = (IEntityPartViewer) actualSelection.wGetValue("viewer");
if (viewer == selectedViewer)
return false;
lastSelection = actualSelection.clone();
return linkType.isLinkedToActivePart() || (linkType.isLinkedToFixedPart() && selectedViewer == linkedViewer);
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ModelInputFunction method compute.
@Override
public Object compute(IEclipseContext context) {
final IBindingManager bm = BindingManagerFactory.instance.createBindingManager();
bm.wDefValue("eclipse#eclipseContext", context);
final IEditorPart editorPart = context.get(IEditorPart.class);
final IEditorInput input = context.get(IEditorInput.class);
if (input instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) input).getFile();
IFilePersistenceProvider pp = new IFilePersistenceProvider(file, bm);
ModelInput modelInput = new ModelInput(context, pp, calculateBasePersistenceKitId(file));
if (editorPart != null) {
String editorId = editorPart.getSite().getId();
String overridePersistenceKitId = ReflectionFactory.getPersistenceKitFromEditorId(editorId).getId();
modelInput.setOverridePersistenceKitId(overridePersistenceKitId);
}
return modelInput;
} else if (input instanceof IURIEditorInput) {
File file = new File(((IURIEditorInput) input).getURI());
FilePersistenceProvider pp = new FilePersistenceProvider(file, bm);
ModelInput modelInput = new ModelInput(context, pp, ReflectionFactory.getDefaultPersistenceKit().getId());
if (editorPart != null) {
String editorId = editorPart.getSite().getId();
String overridePersistenceKitId = ReflectionFactory.getPersistenceKitFromEditorId(editorId).getId();
modelInput.setOverridePersistenceKitId(overridePersistenceKitId);
}
return modelInput;
} else
return null;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class AbstractSelectionConstrainedVisibleWhen method evaluate.
@Override
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
ESelectionService selectionService = (ESelectionService) context.getVariable(ESelectionService.class.getName());
Object selection = selectionService.getSelection();
if (selection instanceof IBindingManager) {
if (isVisible((IBindingManager) selection))
return EvaluationResult.TRUE;
}
return EvaluationResult.FALSE;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ActivateToolAction method update.
@Override
public void update() {
setEnabled(false);
ESelectionService selectionService = getContext().get(ESelectionService.class);
if (selectionService.getSelection() instanceof IBindingManager) {
IBindingManager bm = (IBindingManager) selectionService.getSelection();
if (bm.wIsSet("viewer"))
setEnabled(!tool.isActive((IEntityPartViewer) bm.wGetValue("viewer")));
}
}
Aggregations