use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ActivateToolAction method run.
@Override
public void run() {
ESelectionService selectionService = getContext().get(ESelectionService.class);
IBindingManager bm = (IBindingManager) selectionService.getSelection();
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
boolean clearCaret = Tools.TEXTUAL != tool && Tools.TEXTUAL.isActive(viewer);
if (tool.ensureActive(viewer) && clearCaret) {
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart focusPart = viewer.getEditPartRegistry().get(focusEntity);
if (focusPart instanceof ITextualEntityPart) {
ITextualEntityPart textualPart = (ITextualEntityPart) focusPart;
textualPart.setCaretVisible(false);
viewer.setSelection(new StructuredSelection(textualPart));
}
}
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class WholePluginProjectWizard method performFinish.
public boolean performFinish() {
// outside WorkspaceModifyOperation.execute() due to a concurrency bug of OSGI
final IBindingManager params = BindingManagerFactory.instance.createArguments();
params.wDefValue("projectName", newProjectCreationPage.getProjectName());
params.wDefValue("pluginId", newProjectCreationPage.getPluginId());
params.wDefValue("pluginVersion", newProjectCreationPage.getPluginVersion());
params.wDefValue("pluginName", newProjectCreationPage.getPluginName());
params.wDefValue("pluginProvider", newProjectCreationPage.getPluginProvider());
if (!newProjectCreationPage.useDefaults())
params.wDefValue("locationURI", newProjectCreationPage.getLocationURI());
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor progressMonitor) {
try {
progressMonitor.beginTask("Generating...", IOperationProgressMonitor.TOTAL_WORK);
params.wDefValue("progressMonitor", new OperationProgressMonitorAdapter(progressMonitor));
IEntity projectTemplate = ProjectsArtifactsTemplateManager.instance().create("WholePluginProject");
projectTemplate = BehaviorUtils.evaluate(projectTemplate, 1, params);
Matcher.removeVars(projectTemplate, false);
ArtifactsGeneratorOperation.generate(projectTemplate, params);
} catch (Exception exception) {
E4CompatibilityPlugin.log(exception);
} finally {
progressMonitor.done();
}
}
};
try {
getContainer().run(false, false, operation);
} catch (Exception exception) {
E4CompatibilityPlugin.log(exception);
return false;
}
if (project != null) {
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
final IWorkbenchPart activePart = page.getActivePart();
if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new StructuredSelection(project);
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
((ISetSelectionTarget) activePart).selectReveal(targetSelection);
}
});
}
}
return true;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class WholeProjectWizard method performFinish.
public boolean performFinish() {
// outside WorkspaceModifyOperation.execute() due to a concurrency bug of OSGI
final IBindingManager params = BindingManagerFactory.instance.createArguments();
params.wDefValue("projectName", projectName);
if (!newProjectCreationPage.useDefaults())
params.wDefValue("locationURI", newProjectCreationPage.getLocationURI());
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor progressMonitor) {
try {
progressMonitor.beginTask("Generating...", IOperationProgressMonitor.TOTAL_WORK);
params.wDefValue("progressMonitor", new OperationProgressMonitorAdapter(progressMonitor));
IEntity projectTemplate = ProjectsArtifactsTemplateManager.instance().create("WholeProject");
projectTemplate = BehaviorUtils.evaluate(projectTemplate, 1, params);
Matcher.removeVars(projectTemplate, false);
ArtifactsGeneratorOperation.generate(projectTemplate, params);
} catch (Exception exception) {
E4CompatibilityPlugin.log(exception);
} finally {
progressMonitor.done();
}
}
};
try {
getContainer().run(false, false, operation);
} catch (Exception exception) {
E4CompatibilityPlugin.log(exception);
return false;
}
if (project != null) {
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
final IWorkbenchPart activePart = page.getActivePart();
if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new StructuredSelection(project);
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
((ISetSelectionTarget) activePart).selectReveal(targetSelection);
}
});
}
}
return true;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class WorkflowsIDEInterpreterVisitor method createArtifactsBindings.
@Override
protected IBindingManager createArtifactsBindings(String resource, ResourceKind resourceKind) {
if (!ResourceKindEnum.WORKSPACE.equals(resourceKind.getValue()))
return super.createArtifactsBindings(resource, resourceKind);
try {
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
IResource rootResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resource);
if (rootResource == null)
throw new IllegalArgumentException("root resource does not exist");
bindings.wDefValue("artifactsOperations", new WorkspaceResourceOperations());
bindings.wDefValue("rootResource", rootResource);
IContainer container = rootResource.getParent();
if (container != null) {
int type = container.getType();
switch(type) {
case IResource.PROJECT:
bindings.wDefValue("project", container);
break;
case IResource.FOLDER:
bindings.wDefValue("folder", container);
break;
default:
break;
}
}
return bindings;
} catch (Exception e) {
throw new IllegalArgumentException("Cannot find the specified resource", e);
}
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class WorkflowsInterpreterVisitor method getPersistenceProvider.
protected IPersistenceProvider getPersistenceProvider(PersistenceActivity entity) {
IBindingManager bm = BindingManagerFactory.instance.createBindingManager();
getBindings().wEnterScope(bm, true);
entity.getBindings().accept(this);
getBindings().wExitScope();
String resource = getResourceString(entity);
ResourceKind resourceKind = getResourceKind(entity);
switch(resourceKind.getValue().getOrdinal()) {
case ResourceKindEnum.FILE_SYSTEM_ord:
return getFileSystemProvider(bm, resource);
case ResourceKindEnum.WORKSPACE_ord:
return getWorkspaceProvider(bm, resource);
case ResourceKindEnum.CLASSPATH_ord:
ReflectionFactory.setClassLoader(bm, ReflectionFactory.getClassLoader(getBindings()));
return getClasspathProvider(bm, resource);
case ResourceKindEnum.URL_ord:
return getURLProvider(bm, resource);
case ResourceKindEnum.VARIABLE_ord:
return getStringProvider(bm, resource);
default:
throw new IllegalArgumentException("Unsupported resource kind");
}
}
Aggregations