use of org.whole.lang.ui.dialogs.LazyConfirmationDialogReloader 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);
}
});
}
Aggregations