use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class CustomEditingPolicy method execute.
/**
* (non-Javadoc)
*
* @see org.eclipse.emf.eef.runtime.policies.PropertiesEditingPolicy#execute()
*/
@Override
public void execute() {
EditingDomain editingDomain = EEFUtils.getEditingDomain(editionContext);
if (editingDomain != null) {
DomainPropertiesEditionContext domainPropertiesEditionContext = new DomainPropertiesEditionContext(null, null, editingDomain, editionContext.getAdapterFactory(), editionContext.getEObject());
WizardEditingOperation operation = new WizardEditingOperation(domainPropertiesEditionContext);
try {
operation.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
EEFRuntimePlugin.getDefault().logError("An error occured during wizard editing.", e);
}
} else {
super.execute();
}
}
use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class GenerateVsmHandler method execute.
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
Configuration configuration = getConfiguration(activeEditor);
EditingDomain editingDomain = getEditingDomainFromEditor(activeEditor);
ClassDiagramGenerator generator = new ClassDiagramGenerator(configuration, editingDomain);
Collection<RepresentationDescription> newDescriptions = generator.generate();
if (!newDescriptions.isEmpty() && activeEditor instanceof ISelectionProvider) {
((ISelectionProvider) activeEditor).setSelection(new StructuredSelection(newDescriptions));
}
return null;
}
use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class FlowActionBarContributor method selectionChanged.
/**
* This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
* handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
* that can be added to the selected object and updating the menus accordingly.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void selectionChanged(SelectionChangedEvent event) {
//
if (createChildMenuManager != null) {
depopulateManager(createChildMenuManager, createChildActions);
}
if (createSiblingMenuManager != null) {
depopulateManager(createSiblingMenuManager, createSiblingActions);
}
// Query the new selection for appropriate new child/sibling descriptors
//
Collection<?> newChildDescriptors = null;
Collection<?> newSiblingDescriptors = null;
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) {
Object object = ((IStructuredSelection) selection).getFirstElement();
EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain();
newChildDescriptors = domain.getNewChildDescriptors(object, null);
newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
}
// Generate actions for selection; populate and redraw the menus.
//
createChildActions = generateCreateChildActions(newChildDescriptors, selection);
createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
if (createChildMenuManager != null) {
populateManager(createChildMenuManager, createChildActions, null);
createChildMenuManager.update(true);
}
if (createSiblingMenuManager != null) {
populateManager(createSiblingMenuManager, createSiblingActions, null);
createSiblingMenuManager.update(true);
}
}
use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class AddUserStoryHandler method execute.
/**
* {@inheritDoc}
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
if (activePart instanceof UserStoriesView) {
UserStoriesView view = (UserStoriesView) activePart;
EditingDomain editingDomain = view.getEditingDomain();
if (editingDomain != null) {
UserStoryDialog dialog = new UserStoryDialog(HandlerUtil.getActiveShell(event));
int open = dialog.open();
if (open == Window.OK) {
UserStory story = GraalFactory.eINSTANCE.createUserStory();
story.setName(dialog.getName());
story.setDescription(dialog.getDescription());
Date createdOn = new Date();
story.setCreatedOn(createdOn);
story.setModifiedOn(createdOn);
EObject eObject = EcoreUtil.getRootContainer(view.getInput().get(0));
if (eObject instanceof org.obeonetwork.graal.System) {
editingDomain.getCommandStack().execute(AddCommand.create(editingDomain, eObject, GraalPackage.eINSTANCE.getSystem_UserStories(), story));
view.refresh();
}
}
}
}
return null;
}
use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class CustomEEFEditorSettings method getOrCreateSignificantObject.
public EObject getOrCreateSignificantObject() {
EObject object = getSignificantObject();
if (object == null) {
if (getSource() instanceof ObeoDSMObject) {
ObeoDSMObject source = (ObeoDSMObject) getSource();
EditingDomain domain = context.getEditingDomain();
if (source.getMetadatas() == null) {
// Create MetaDataContainer
MetaDataContainer mdContainer = EnvironmentFactory.eINSTANCE.createMetaDataContainer();
domain.getCommandStack().execute(SetCommand.create(domain, source, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Metadatas(), mdContainer));
}
// Create Risk
Risk risk = GraalExtensionsFactory.eINSTANCE.createRisk();
domain.getCommandStack().execute(AddCommand.create(domain, source.getMetadatas(), EnvironmentPackage.eINSTANCE.getMetaDataContainer_Metadatas(), risk));
significantObject = getSignificantObject();
return significantObject;
}
}
return object;
}
Aggregations