use of org.whole.lang.ui.input.IModelInput 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.whole.lang.ui.input.IModelInput in project whole by wholeplatform.
the class E4GraphicalViewer method setContents.
public void setContents(IModelInput modelInput, IEntity defaultContents) {
if (modelInput != null) {
IModelInput oldModelInput = this.modelInput;
this.modelInput = modelInput;
try {
setEntityContents(this.modelInput.readModel());
fireModelInputChanged(oldModelInput, this.modelInput);
} catch (Exception e) {
String errorMessage = String.format("Unable to open \"%s\" using \"%s\" persistence kit", modelInput.getName(), modelInput.getPersistenceKit().getDescription());
setEntityContents(E4Utils.createErrorStatusContents(errorMessage, e.getLocalizedMessage()));
}
} else
setEntityContents(defaultContents);
}
use of org.whole.lang.ui.input.IModelInput in project whole by wholeplatform.
the class E4TreeViewer method setContents.
public void setContents(IModelInput modelInput, IEntity defaultContents) {
if (modelInput != null) {
IModelInput oldModelInput = this.modelInput;
this.modelInput = modelInput;
try {
setEntityContents(this.modelInput.readModel());
fireModelInputChanged(oldModelInput, this.modelInput);
} catch (Exception e) {
String errorMessage = String.format("Unable to open \"%s\" using \"%s\" persistence kit", modelInput.getName(), modelInput.getPersistenceKit().getDescription());
setEntityContents(E4Utils.createErrorStatusContents(errorMessage, e.getLocalizedMessage()));
}
} else
setEntityContents(defaultContents);
}
use of org.whole.lang.ui.input.IModelInput in project whole by wholeplatform.
the class AbstractE4Part method restoreState.
protected void restoreState() {
if (part.getPersistedState().containsKey("basePersistenceKitId")) {
String basePersistenceKitId = part.getPersistedState().get("basePersistenceKitId");
IModelInput modelInput = new ModelInput(context, part.getPersistedState().get("filePath"), basePersistenceKitId);
modelInput.setOverridePersistenceKitId(part.getPersistedState().get("overridePersistenceKitId"));
updateModelInput(modelInput);
}
}
Aggregations