Search in sources :

Example 1 with RedoAction

use of org.whole.lang.e4.ui.actions.RedoAction 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());
    }
}
Also used : MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) IFileEditorInput(org.eclipse.ui.IFileEditorInput) RedoAction(org.whole.lang.e4.ui.actions.RedoAction) IWorkspace(org.eclipse.core.resources.IWorkspace) IImportAsModelDialogFactory(org.whole.lang.ui.dialogs.IImportAsModelDialogFactory) IResourceChangeListener(org.eclipse.core.resources.IResourceChangeListener) CommandStackEventListener(org.eclipse.gef.commands.CommandStackEventListener) CommandStackEvent(org.eclipse.gef.commands.CommandStackEvent) UndoAction(org.whole.lang.e4.ui.actions.UndoAction) IEntityPartViewer(org.whole.lang.ui.viewers.IEntityPartViewer)

Example 2 with RedoAction

use of org.whole.lang.e4.ui.actions.RedoAction 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();
}
Also used : MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) RedoAction(org.whole.lang.e4.ui.actions.RedoAction) IImportAsModelDialogFactory(org.whole.lang.ui.dialogs.IImportAsModelDialogFactory) UndoAction(org.whole.lang.e4.ui.actions.UndoAction)

Aggregations

MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)2 RedoAction (org.whole.lang.e4.ui.actions.RedoAction)2 UndoAction (org.whole.lang.e4.ui.actions.UndoAction)2 IImportAsModelDialogFactory (org.whole.lang.ui.dialogs.IImportAsModelDialogFactory)2 IResourceChangeListener (org.eclipse.core.resources.IResourceChangeListener)1 IWorkspace (org.eclipse.core.resources.IWorkspace)1 CommandStackEvent (org.eclipse.gef.commands.CommandStackEvent)1 CommandStackEventListener (org.eclipse.gef.commands.CommandStackEventListener)1 IFileEditorInput (org.eclipse.ui.IFileEditorInput)1 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)1