use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class DirectEditAction 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")) {
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart entityPart = viewer.getEditPartRegistry().get(focusEntity);
setEnabled(entityPart.understandsRequest(request));
}
}
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class DirectEditAction method run.
@Override
public void run() {
ESelectionService selectionService = getContext().get(ESelectionService.class);
IBindingManager bm = (IBindingManager) selectionService.getSelection();
IEntityPartViewer viewer = (IEntityPartViewer) bm.wGetValue("viewer");
IEntity focusEntity = bm.wGet("focusEntity");
IEntityPart entityPart = viewer.getEditPartRegistry().get(focusEntity);
try {
entityPart.performRequest(request);
} catch (Exception e) {
e.getCause();
}
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method refreshNotation.
public void refreshNotation(IEntity entity) {
IEntityPart entityPart = ModelObserver.getObserver(entity, getEditPartRegistry());
if (entityPart == null) {
if (EntityUtils.isAncestorOrSelf(entity, getEntityContents()))
entityPart = ModelObserver.getObserver(getEntityContents(), getEditPartRegistry());
else
return;
}
refreshNotation(((IGraphicalEntityPart) entityPart).getFigure());
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method reveal.
public void reveal(IEntity entity) {
IEntityPart entityPart = ModelObserver.getObserver(entity, getEditPartRegistry());
reveal(entityPart);
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method select.
@Override
public void select(List<? extends IEntity> entities, boolean propagate) {
List<IEntityPart> entityParts = new ArrayList<>();
for (int i = entities.size() - 1; i >= 0; i--) {
IEntityPart entityPart = ModelObserver.getObserver(entities.get(i), getEditPartRegistry());
if (entityPart != null && entityPart.isSelectable())
entityParts.add(entityPart);
}
setSelection(new StructuredSelection(entityParts), propagate);
}
Aggregations