use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4GraphicalViewer method selectAndReveal.
// End Block Shared With E4TreeViewer
public void selectAndReveal(IEntity entity, boolean propagate) {
IEntityPart entityPart = ModelObserver.getObserver(entity, getEditPartRegistry());
if (entityPart != null) {
getControl().getDisplay().syncExec(() -> reveal(entityPart));
select(entityPart, propagate);
}
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4TreeViewer 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);
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4TreeViewer 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();
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class AbstractE4Part method createPartControl.
@PostConstruct
public void createPartControl(Composite parent) {
restoreState();
registerHandlers();
parent.setLayout(new FillLayout());
viewer = createEntityViewer(parent);
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateSelection(E4Utils.createSelectionBindings(event, context));
}
});
viewer.getControl().addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
}
@Override
@SuppressWarnings("unchecked")
public void focusGained(FocusEvent event) {
context.set(IEntityPartViewer.class, viewer);
context.set(ActionRegistry.class, actionRegistry);
updateSelection(E4Utils.createSelectionBindings(viewer.getSelectedEditParts(), viewer, context));
}
});
viewer.addPartFocusListener(new IPartFocusListener() {
@SuppressWarnings("unchecked")
public void focusChanged(IEntityPart oldPart, IEntityPart newPart) {
updateSelection(E4Utils.createSelectionBindings(viewer.getSelectedEditParts(), viewer, context));
}
});
E4KeyHandler keyHandler = new E4KeyHandler(context);
keyHandler.setParent(new E4NavigationKeyHandler(context));
context.set(IEntityPartViewer.class, viewer);
viewer.setKeyHandler(keyHandler);
viewer.setContents(modelInput, createDefaultContents());
actionRegistry = ContextInjectionFactory.make(ActionRegistry.class, context);
actionRegistry.registerKeyActions(viewer.getKeyHandler());
context.set(ActionRegistry.class, actionRegistry);
configureContextMenu();
if (!E4Utils.isLegacyApplication())
viewer.getCommandStack().addCommandStackEventListener(new CommandStackEventListener() {
@Override
public void stackChanged(CommandStackEvent event) {
if ((event.getDetail() & CommandStack.POST_MASK) != 0)
part.setDirty(viewer.isDirty());
}
});
reloader = new LazyConfirmationDialogReloader(viewer.getControl(), new Runnable() {
@Override
public void run() {
viewer.setContents(modelInput, null);
}
});
}
use of org.whole.lang.ui.editparts.IEntityPart in project whole by wholeplatform.
the class E4DebugGraphicalPart method updateUI.
protected void updateUI() {
updateActions();
IEventBroker eventBroker = context.get(IEventBroker.class);
ExecutionState execution = executions.peek();
if (execution != null) {
final IEntity sourceEntity = execution.getSourceEntity();
IEntity contents = EntityUtils.getCompoundRoot(sourceEntity);
getViewer().setContents(contents);
getViewer().setInteractive(contents, false, true, false);
context.get(UISynchronize.class).asyncExec(new Runnable() {
@Override
public void run() {
IEntity adaptee = sourceEntity.wGetAdaptee(false);
IEntityPart sourceEntityPart = getViewer().getEditPartRegistry().get(adaptee);
sourceEntityPart.installEditPolicy(SuspensionFeedbackEditPolicy.SUSPENSION_FEEDBACK_ROLE, new SuspensionFeedbackEditPolicy(getSuspensionKind(), execution.getThrowable()));
getViewer().reveal(sourceEntity);
}
});
eventBroker.post(IE4UIConstants.TOPIC_UPDATE_VARIABLES, execution.getVariablesModel());
} else {
getViewer().setEntityContents(createDefaultContents());
eventBroker.post(IE4UIConstants.TOPIC_UPDATE_VARIABLES, null);
}
}
Aggregations