use of org.obeonetwork.tools.requirement.wizard.util.RequirementCreationPropertiesEditingContext in project InformationSystem by ObeoNetwork.
the class CreateRequirementAction method run.
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
EditingDomain editingDomain = TransactionUtil.getEditingDomain(linksView.getInput());
RequirementCreationPropertiesEditingContext propertiesEditionContext = new RequirementCreationPropertiesEditingContext(null, null, editingDomain, linksView.getAdapterFactory(), linksView.getInput());
RequirementCreationOperation operation = new RequirementCreationOperation(propertiesEditionContext);
try {
operation.execute(new NullProgressMonitor(), null);
linksView.refresh();
} catch (ExecutionException e) {
// $NON-NLS-1$
EEFRuntimePlugin.getDefault().logError("An error occured during wizard editing.", e);
}
}
use of org.obeonetwork.tools.requirement.wizard.util.RequirementCreationPropertiesEditingContext in project InformationSystem by ObeoNetwork.
the class RequirementCreationOperation method doExecute.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.workspace.AbstractEMFOperation#doExecute(org.eclipse.core.runtime.IProgressMonitor,
* org.eclipse.core.runtime.IAdaptable)
*/
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
((RequirementCreationPropertiesEditingContext) this.editingContext).preProcess();
RequirementEditingWizard wizard = new RequirementEditingWizard(editingContext, editingContext.getAdapterFactory(), editingContext.getEObject());
WizardDialog wDialog = new WizardDialog(EditingUtils.getShell(), wizard) {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.dialogs.TitleAreaDialog#getInitialSize()
*/
@Override
protected Point getInitialSize() {
Point initialSize = super.getInitialSize();
return new Point(Math.min(UIConstants.INITIAL_WIZARD_SIZE.x, initialSize.x), Math.min(UIConstants.INITIAL_WIZARD_SIZE.y, initialSize.y));
}
};
int open = wDialog.open();
ChangeDescription description = editingContext.getChangeRecorder().endRecording();
if (open == Window.OK) {
Requirement requirement = (Requirement) editingContext.getEObject();
requirement.eResource().getContents().remove(requirement);
wizard.getOwningCategory().getRequirements().add(requirement);
return Status.OK_STATUS;
} else {
description.applyAndReverse();
return Status.CANCEL_STATUS;
}
}
Aggregations