use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class XsiSimpleElementPart method addChildVisual.
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
super.addChildVisual(childEditPart, index);
IEntity child = ((IEntityPart) childEditPart).getModelEntity();
if (EntityUtils.isComposite(child))
child.wAddChangeEventHandler(getRefreshChangeEventHandler());
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4Utils method defineSelectionBindings.
@SuppressWarnings("unchecked")
public static void defineSelectionBindings(IBindingManager bm, SelectionChangedEvent event) {
ISelection selection = event.getSelection();
List<IEntityPart> selectedEntityParts = selection instanceof IStructuredSelection ? ((IStructuredSelection) selection).toList() : Collections.emptyList();
defineSelectionBindings(bm, selectedEntityParts, (IEntityPartViewer) event.getSelectionProvider());
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4Utils method defineSelectionBindings.
public static void defineSelectionBindings(IBindingManager bm, List<IEntityPart> selectedEntityParts, IEntityPartViewer viewer) {
IEntity selectedEntities = BindingManagerFactory.instance.createTuple();
for (IEntityPart selectedEntityPart : selectedEntityParts) selectedEntities.wAdd(selectedEntityPart.getModelEntity());
if (viewer != null) {
bm.wDef("self", EntityUtils.getCompoundRoot(viewer.getEntityContents()));
bm.wDefValue("viewer", viewer);
IEntityPart focusEntityPart = viewer.getFocusEntityPart();
bm.wDef("focusEntity", focusEntityPart.getModelEntity());
}
bm.wDef("selectedEntities", selectedEntities);
IEntityIterator<IEntity> iterator = IteratorFactory.childIterator();
iterator.reset(selectedEntities);
if (iterator.hasNext()) {
IEntity focusEntity = iterator.next();
bm.wDef("primarySelectedEntity", focusEntity);
if (!bm.wIsSet("focusEntity"))
bm.wDef("focusEntity", focusEntity);
IEntityPart primarySelectedEntityPart = selectedEntityParts.get(0);
if (primarySelectedEntityPart instanceof IHilightable) {
final IHilightable hilightable = (IHilightable) primarySelectedEntityPart;
bm.wDefValue("hilightPosition", -1);
bm.wGet("hilightPosition").wAddRequestEventHandler(new IdentityRequestEventHandler() {
public int notifyRequested(IEntity source, FeatureDescriptor feature, int value) {
return hilightable.getHilightPosition();
}
});
}
if (primarySelectedEntityPart instanceof ITextualEntityPart) {
final ITextualEntityPart textualEntityPart = (ITextualEntityPart) primarySelectedEntityPart;
bm.wDefValue("selectedText", "");
bm.wGet("selectedText").wAddRequestEventHandler(new IdentityRequestEventHandler() {
public String notifyRequested(IEntity source, FeatureDescriptor feature, String value) {
return textualEntityPart.hasSelectionRange() ? DataTypeUtils.getAsPresentationString(textualEntityPart.getModelEntity()).substring(textualEntityPart.getSelectionStart(), textualEntityPart.getSelectionEnd()) : "";
}
});
}
}
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method setFocus.
@Override
public void setFocus(EditPart part) {
IEntityPart oldPart = getFocusEntityPart();
super.setFocus(part);
if (oldPart != part)
firePartFocusChanged(oldPart, (IEntityPart) part);
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method rebuildNotation.
public void rebuildNotation(IEntity entity) {
IEntityPart entityPart = ModelObserver.getObserver(entity, getEditPartRegistry());
if (entityPart == null) {
if (EntityUtils.isAncestorOrSelf(entity, getEntityContents()))
entityPart = ModelObserver.getObserver(getEntityContents(), getEditPartRegistry());
else
return;
}
entityPart.rebuild();
invalidateTree();
}
Aggregations