Search in sources :

Example 1 with EEFWizardDialog

use of org.eclipse.emf.eef.runtime.ui.wizards.EEFWizardDialog in project InformationSystem by ObeoNetwork.

the class RequirementEditingOperation method doExecute.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.impl.operation.WizardEditingOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor,
 *      org.eclipse.core.runtime.IAdaptable)
 */
@Override
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
    editingContext.initializeRecorder();
    RequirementEditingWizard wizard = new RequirementEditingWizard(editingContext, editingContext.getAdapterFactory(), editingContext.getEObject());
    EEFWizardDialog wDialog = new EEFWizardDialog(EditingUtils.getShell(), wizard);
    int open = wDialog.open();
    ChangeDescription description = editingContext.getChangeRecorder().endRecording();
    if (open == Window.OK) {
        if (wizard.getOwningCategory() != null) {
            Category category = wizard.getOwningCategory();
            if (editingContext.getEObject().eContainer() != category) {
                category.getRequirements().add((Requirement) editingContext.getEObject());
            }
        }
        return Status.OK_STATUS;
    } else {
        description.applyAndReverse();
        return Status.CANCEL_STATUS;
    }
}
Also used : Category(org.obeonetwork.dsl.requirement.Category) EEFWizardDialog(org.eclipse.emf.eef.runtime.ui.wizards.EEFWizardDialog) ChangeDescription(org.eclipse.emf.ecore.change.ChangeDescription) RequirementEditingWizard(org.obeonetwork.tools.requirement.wizard.RequirementEditingWizard)

Aggregations

ChangeDescription (org.eclipse.emf.ecore.change.ChangeDescription)1 EEFWizardDialog (org.eclipse.emf.eef.runtime.ui.wizards.EEFWizardDialog)1 Category (org.obeonetwork.dsl.requirement.Category)1 RequirementEditingWizard (org.obeonetwork.tools.requirement.wizard.RequirementEditingWizard)1