use of org.whole.lang.ui.dialogs.IImportAsModelDialogFactory in project whole by wholeplatform.
the class EditorPart method createPartControl.
@Override
public void createPartControl(Composite parent) {
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(ImportAsModelDialogFactory.class, getContext());
getContext().set(IImportAsModelDialogFactory.class, factory);
super.createPartControl(parent);
getContext().get(MPart.class).setElementId("org.eclipse.e4.ui.compatibility.editor");
setPartName(getEditorInput().getName());
final IEntityPartViewer viewer = getComponent().getViewer();
viewer.getCommandStack().addCommandStackEventListener(listener = new CommandStackEventListener() {
@Override
public void stackChanged(CommandStackEvent event) {
if ((event.getDetail() & CommandStack.POST_MASK) != 0)
setDirtyState(viewer.isDirty());
}
});
undoAction = new UndoAction(getContext(), UNDO_LABEL);
undoAction.update();
redoAction = new RedoAction(getContext(), REDO_LABEL);
redoAction.update();
if (getEditorInput() instanceof IFileEditorInput) {
IWorkspace workspace = ((IFileEditorInput) getEditorInput()).getFile().getWorkspace();
workspace.addResourceChangeListener(resourceListener = new ResourceChangeListener());
}
}
use of org.whole.lang.ui.dialogs.IImportAsModelDialogFactory in project whole by wholeplatform.
the class ModelMergeViewer method createMergeArea.
protected Control createMergeArea(Composite parent) {
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(ImportAsModelDialogFactory.class, getContext());
IEclipseContext params = EclipseContextFactory.create();
params.set("parent", parent);
params.set(IImportAsModelDialogFactory.class, factory);
viewer = ContextInjectionFactory.make(E4GraphicalViewer.class, getContext(), params);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateSelection(E4Utils.createSelectionBindings(event, getContext()));
}
});
viewer.getControl().addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
}
@SuppressWarnings("unchecked")
@Override
public void focusGained(FocusEvent event) {
getContext().set(IEntityPartViewer.class, viewer);
getContext().set(ActionRegistry.class, actionRegistry);
updateSelection(E4Utils.createSelectionBindings(viewer.getSelectedEditParts(), viewer, getContext()));
}
});
viewer.addPartFocusListener(new IPartFocusListener() {
@SuppressWarnings("unchecked")
public void focusChanged(IEntityPart oldPart, IEntityPart newPart) {
updateSelection(E4Utils.createSelectionBindings(viewer.getSelectedEditParts(), viewer, getContext()));
}
});
E4KeyHandler keyHandler = new E4KeyHandler(getContext());
keyHandler.setParent(new E4NavigationKeyHandler(getContext()));
viewer.setKeyHandler(keyHandler);
viewer.setEntityContents(createDefaultContents());
getContext().set(IEntityPartViewer.class, viewer);
actionRegistry = ContextInjectionFactory.make(ActionRegistry.class, getContext());
actionRegistry.registerWorkbenchActions();
getContext().set(ActionRegistry.class, actionRegistry);
JFaceMenuBuilder uiBuilder = ContextInjectionFactory.make(JFaceMenuBuilder.class, getContext());
contextMenuProvider = new PopupMenuProvider<IContributionItem, IMenuManager>(uiBuilder);
viewer.setContextMenu(new ContextMenuProvider(viewer) {
@Override
public void buildContextMenu(IMenuManager menuManager) {
contextMenuProvider.populate(menuManager);
}
});
return parent;
}
use of org.whole.lang.ui.dialogs.IImportAsModelDialogFactory in project whole by wholeplatform.
the class ViewPart method createPartControl.
@Override
public void createPartControl(Composite parent) {
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(ImportAsModelDialogFactory.class, getContext());
getContext().set(IImportAsModelDialogFactory.class, factory);
super.createPartControl(parent);
getContext().get(MPart.class).setElementId(partId);
undoAction = new UndoAction(getContext(), UNDO_LABEL);
undoAction.update();
redoAction = new RedoAction(getContext(), REDO_LABEL);
redoAction.update();
}
use of org.whole.lang.ui.dialogs.IImportAsModelDialogFactory in project whole by wholeplatform.
the class AssignmentsDialogFactory method createDialog.
public Dialog createDialog(Shell shell, String title, String message, Assignments assignments, IBindingManager bindings) {
IEclipseContext params = EclipseContextFactory.create();
params.set("dialogTitle", title);
params.set("dialogMessage", message);
params.set("dialogAssignments", assignments);
IEclipseContext context = (IEclipseContext) bindings.wGetValue("eclipse#eclipseContext");
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(DisabledImportAsModelDialogFactory.class, context);
params.set(IImportAsModelDialogFactory.class, factory);
return ContextInjectionFactory.make(AssignmentsDialog.class, context, params);
}
use of org.whole.lang.ui.dialogs.IImportAsModelDialogFactory in project whole by wholeplatform.
the class ChooseModelsDialogFactory method createDialog.
public Dialog createDialog(Shell shell, String title, String message, Assignments assignments, IBindingManager bindings) {
IEclipseContext params = EclipseContextFactory.create();
params.set("dialogTitle", title);
params.set("dialogMessage", message);
params.set("dialogAssignments", assignments);
IEclipseContext context = (IEclipseContext) bindings.wGetValue("eclipse#eclipseContext");
IImportAsModelDialogFactory factory = ContextInjectionFactory.make(DisabledImportAsModelDialogFactory.class, context);
params.set(IImportAsModelDialogFactory.class, factory);
return ContextInjectionFactory.make(ChooseModelsDialog.class, context, params);
}
Aggregations