use of org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder in project yamcs-studio by yamcs.
the class OPIView method findMementoFromPlaceholder.
/**
* Retrieve memento persisted in MPlaceholder if present.
*
* @return memento persisted in the placeholder.
*/
private IMemento findMementoFromPlaceholder() {
IMemento memento = null;
MPlaceholder placeholder = findPlaceholder();
if (placeholder != null) {
if (placeholder.getPersistedState().containsKey(TAG_MEMENTO)) {
String mementoString = placeholder.getPersistedState().get(TAG_MEMENTO);
memento = loadMemento(mementoString);
}
}
return memento;
}
use of org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder in project yamcs-studio by yamcs.
the class OPIView method findPlaceholder.
/**
* Find the MPlaceholder corresponding to this MPart in the MPerspective. This may have persisted information
* relevant to loading this OPIView.
*
* @return corresponding placeholder
*/
private MPlaceholder findPlaceholder() {
// do not remove casting - RAP 3.0 still needs it
final IEclipseContext localContext = (IEclipseContext) getViewSite().getService(IEclipseContext.class);
final MPart part = localContext.get(MPart.class);
final EModelService service = (EModelService) PlatformUI.getWorkbench().getService(EModelService.class);
final IEclipseContext globalContext = (IEclipseContext) PlatformUI.getWorkbench().getService(IEclipseContext.class);
final MApplication app = globalContext.get(MApplication.class);
final List<MPlaceholder> phs = service.findElements(app, null, MPlaceholder.class, null);
for (MPlaceholder ph : phs) {
if (ph.getRef() == part) {
return ph;
}
}
return null;
}
Aggregations