use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class EntityActionBarContributor 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 statecharts by Yakindu.
the class ActiveEditorTracker method getLastActiveEditorResourceSet.
/**
* @return The EMF resource set of the last active editor (if it is still
* open).
*/
public static ResourceSet getLastActiveEditorResourceSet() {
final IEditorPart editor = getLastActiveEditor();
if (editor == null)
return null;
EditingDomain domain = null;
if (editor instanceof IEditingDomainProvider) {
domain = ((IEditingDomainProvider) editor).getEditingDomain();
} else if (editor.getAdapter(IEditingDomainProvider.class) != null) {
domain = ((IEditingDomainProvider) editor.getAdapter(IEditingDomainProvider.class)).getEditingDomain();
} else if (editor.getAdapter(EditingDomain.class) != null) {
domain = (EditingDomain) editor.getAdapter(EditingDomain.class);
}
if (domain == null) {
return null;
}
return domain.getResourceSet();
}
use of org.eclipse.emf.edit.domain.EditingDomain in project InformationSystem by ObeoNetwork.
the class RequirementActionBarContributor 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 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 GraalActionBarContributor 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);
}
}
Aggregations