use of org.eclipse.e4.core.contexts.IEclipseContext in project whole by wholeplatform.
the class ContentAssistVisibleWhen method isVisible.
@Override
public boolean isVisible(IBindingManager bm) {
if (!HandlersBehavior.isValidFocusEntityPart(bm))
return false;
IEclipseContext context = (IEclipseContext) bm.wGetValue("eclipse#eclipseContext");
ContentAssistRunnable runnable = new ContentAssistRunnable(context, bm);
IEntity result = runnable.syncExec(3000).getResult();
IEntity[] values = (IEntity[]) result.wGetValue();
if (values == null)
return false;
else if (values.length == 1 && !EntityUtils.isData(values[0])) {
IEntity value = Matcher.find(new IsConcreteAction(Action), values[0], false);
return value != null;
} else
return values.length > 0;
}
use of org.eclipse.e4.core.contexts.IEclipseContext in project whole by wholeplatform.
the class EntityLocationHyperlink method linkActivated.
public void linkActivated() {
try {
IEclipseContext context = (IEclipseContext) PlatformUI.getWorkbench().getService(IEclipseContext.class);
EPartService partService = context.get(EPartService.class);
Collection<MPart> parts = partService.getParts();
for (MPart part : parts) {
IEclipseContext partContext = part.getContext();
if (partContext == null)
continue;
IModelInput modelInput = partContext.get(IModelInput.class);
if (modelInput != null && ((IFilePersistenceProvider) modelInput.getPersistenceProvider()).getStore().equals(file)) {
partService.activate(part, true);
IEntityPartViewer viewer = partContext.get(IEntityPartViewer.class);
IEntity entityContents = viewer.getEntityContents();
final IEntity entity = EntityUtils.getEntity(entityContents, location);
viewer.selectAndReveal(entity);
}
}
} catch (Exception e) {
E4CompatibilityPlugin.log(e);
}
}
use of org.eclipse.e4.core.contexts.IEclipseContext in project whole by wholeplatform.
the class AssignmentsDialogFactory method createDialog.
public Dialog createDialog(Shell shell, String title, String message, Assignments assignments, IBindingManager bindings) {
IEclipseContext params = EclipseContextFactory.create();
params.set("dialogTitle", title);
params.set("dialogMessage", message);
params.set("dialogAssignments", assignments);
IEclipseContext context = (IEclipseContext) bindings.wGetValue("eclipse#eclipseContext");
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(DisabledImportAsModelDialogFactory.class, context);
params.set(IImportAsModelDialogFactory.class, factory);
return ContextInjectionFactory.make(AssignmentsDialog.class, context, params);
}
use of org.eclipse.e4.core.contexts.IEclipseContext in project whole by wholeplatform.
the class ChooseModelsDialogFactory method createDialog.
public Dialog createDialog(Shell shell, String title, String message, Assignments assignments, IBindingManager bindings) {
IEclipseContext params = EclipseContextFactory.create();
params.set("dialogTitle", title);
params.set("dialogMessage", message);
params.set("dialogAssignments", assignments);
IEclipseContext context = (IEclipseContext) bindings.wGetValue("eclipse#eclipseContext");
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(DisabledImportAsModelDialogFactory.class, context);
params.set(IImportAsModelDialogFactory.class, factory);
return ContextInjectionFactory.make(ChooseModelsDialog.class, context, params);
}
use of org.eclipse.e4.core.contexts.IEclipseContext in project whole by wholeplatform.
the class TestsUIInterpreterVisitor method reportError.
@Override
protected void reportError(String name, RuntimeException e) {
super.reportError(name, e);
IBindingManager debugEnv = getBindings();
IEclipseContext context = (IEclipseContext) debugEnv.wGetValue("eclipse#eclipseContext");
if ((debugEnv.wIsSet("debug#reportModeEnabled") && !debugEnv.wBooleanValue("debug#reportModeEnabled")) || (debugEnv.wIsSet("debug#debugModeEnabled") && !debugEnv.wBooleanValue("debug#debugModeEnabled")) || (debugEnv.wIsSet("debug#breakpointsEnabled") && !debugEnv.wBooleanValue("debug#breakpointsEnabled")))
return;
else
E4Utils.suspendOrReportException(context, SuspensionKind.RECOVERABLE_ERROR, "Model test error", "Error while executing " + name + " test", e, debugEnv);
}
Aggregations