use of org.obeonetwork.dsl.cinematic.view.ViewContainer in project InformationSystem by ObeoNetwork.
the class CinematicFlowServices method getViewContainerAssociateAndAncestors.
/**
* Retrieve the view container associate to flow and the hierarchy of
* viewContainer associate to flow (view Container's parents).
*
* @param context
* the context
* @return the list of viewContainer associate to flow
*/
public List<ViewContainer> getViewContainerAssociateAndAncestors(EObject context) {
List<ViewContainer> viewContainersAncestors = new ArrayList<ViewContainer>();
if (context instanceof Flow) {
// Retrieve the viewContainer associate directly to flow
List<ViewContainer> viewContainers = getViewContainerAssociate(context);
viewContainersAncestors.addAll(viewContainers);
for (ViewContainer viewContainer : viewContainers) {
EObject objectContainer = viewContainer.eContainer();
while (objectContainer.eContainer() != null) {
if (objectContainer instanceof ViewContainer) {
viewContainersAncestors.add((ViewContainer) objectContainer);
}
objectContainer = objectContainer.eContainer();
}
}
}
return viewContainersAncestors;
}
use of org.obeonetwork.dsl.cinematic.view.ViewContainer in project InformationSystem by ObeoNetwork.
the class FlowsUtil method getViewContainersPossible.
public List<EObject> getViewContainersPossible(EObject context, List<ViewContainer> viewContainers) {
List<EObject> viewContainersAncestors = new ArrayList<EObject>();
// on the list.
for (ViewContainer viewContainer : viewContainers) {
viewContainersAncestors.add(viewContainer);
EObject objectContainer = viewContainer.eContainer();
while (objectContainer != null) {
if (!viewContainersAncestors.contains(objectContainer)) {
viewContainersAncestors.add(objectContainer);
}
objectContainer = objectContainer.eContainer();
}
}
// Removing duplicates, if duplicates are present
Set<EObject> set = new HashSet<EObject>();
set.addAll(viewContainersAncestors);
return new ArrayList<EObject>(set);
}
use of org.obeonetwork.dsl.cinematic.view.ViewContainer in project InformationSystem by ObeoNetwork.
the class ViewContainerReferenceViewContainerReferencePropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final ViewContainerReference viewContainerReference = (ViewContainerReference) elt;
final ViewContainerReferencePropertiesEditionPart viewContainerReferencePart = (ViewContainerReferencePropertiesEditionPart) editingPart;
// init values
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.description))
viewContainerReferencePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainerReference.getDescription()));
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.name))
viewContainerReferencePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainerReference.getName()));
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.widget)) {
// init part
widgetSettings = new EObjectFlatComboSettings(viewContainerReference, ViewPackage.eINSTANCE.getAbstractViewElement_Widget());
viewContainerReferencePart.initWidget(widgetSettings);
// set the button mode
viewContainerReferencePart.setWidgetButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.actions)) {
actionsSettings = new ReferencesTableSettings(viewContainerReference, ViewPackage.eINSTANCE.getAbstractViewElement_Actions());
viewContainerReferencePart.initActions(actionsSettings);
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.events)) {
eventsSettings = new ReferencesTableSettings(viewContainerReference, ViewPackage.eINSTANCE.getAbstractViewElement_Events());
viewContainerReferencePart.initEvents(eventsSettings);
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.label))
viewContainerReferencePart.setLabel(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainerReference.getLabel()));
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.viewContainer)) {
// init part
viewContainerSettings = new EObjectFlatComboSettings(viewContainerReference, ViewPackage.eINSTANCE.getViewContainerReference_ViewContainer());
viewContainerReferencePart.initViewContainer(viewContainerSettings);
// set the button mode
viewContainerReferencePart.setViewContainerButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.widget)) {
viewContainerReferencePart.addFilterToWidget(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof Widget);
}
});
// Start of user code for additional businessfilters for widget
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.actions)) {
viewContainerReferencePart.addFilterToActions(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof ViewAction);
}
});
// Start of user code for additional businessfilters for actions
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.events)) {
viewContainerReferencePart.addFilterToEvents(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof ViewEvent);
}
});
// Start of user code for additional businessfilters for events
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainerReference.Properties.viewContainer)) {
viewContainerReferencePart.addFilterToViewContainer(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
return (element instanceof ViewContainer);
}
});
// Start of user code for additional businessfilters for viewContainer
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.dsl.cinematic.view.ViewContainer in project InformationSystem by ObeoNetwork.
the class ViewContainerViewContainerPropertiesEditionComponent method updateSemanticModel.
/**
* {@inheritDoc}
* @see org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updateSemanticModel(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*/
public void updateSemanticModel(final IPropertiesEditionEvent event) {
ViewContainer viewContainer = (ViewContainer) semanticObject;
if (ViewViewsRepository.ViewContainer.Properties.description == event.getAffectedEditor()) {
viewContainer.setDescription((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (ViewViewsRepository.ViewContainer.Properties.name == event.getAffectedEditor()) {
viewContainer.setName((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (ViewViewsRepository.ViewContainer.Properties.widget == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.SET) {
widgetSettings.setToReference((Widget) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.ADD) {
Widget eObject = ToolkitsFactory.eINSTANCE.createWidget();
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, eObject, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(eObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy != null) {
policy.execute();
}
}
widgetSettings.setToReference(eObject);
}
}
if (ViewViewsRepository.ViewContainer.Properties.actions == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, actionsSettings, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy instanceof CreateEditingPolicy) {
policy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.EDIT) {
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
if (editionPolicy != null) {
editionPolicy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
actionsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
actionsSettings.move(event.getNewIndex(), (ViewAction) event.getNewValue());
}
}
if (ViewViewsRepository.ViewContainer.Properties.events == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, eventsSettings, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy instanceof CreateEditingPolicy) {
policy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.EDIT) {
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
if (editionPolicy != null) {
editionPolicy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
eventsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
eventsSettings.move(event.getNewIndex(), (ViewEvent) event.getNewValue());
}
}
if (ViewViewsRepository.ViewContainer.Properties.label == event.getAffectedEditor()) {
viewContainer.setLabel((java.lang.String) EEFConverterUtil.createFromString(EcorePackage.Literals.ESTRING, (String) event.getNewValue()));
}
if (ViewViewsRepository.ViewContainer.Properties.ownedElements == event.getAffectedEditor()) {
if (event.getKind() == PropertiesEditionEvent.ADD) {
EReferencePropertiesEditionContext context = new EReferencePropertiesEditionContext(editingContext, this, ownedElementsSettings, editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt(semanticObject, PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy policy = provider.getPolicy(context);
if (policy instanceof CreateEditingPolicy) {
policy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.EDIT) {
EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(editingContext, this, (EObject) event.getNewValue(), editingContext.getAdapterFactory());
PropertiesEditingProvider provider = (PropertiesEditingProvider) editingContext.getAdapterFactory().adapt((EObject) event.getNewValue(), PropertiesEditingProvider.class);
if (provider != null) {
PropertiesEditingPolicy editionPolicy = provider.getPolicy(context);
if (editionPolicy != null) {
editionPolicy.execute();
}
}
} else if (event.getKind() == PropertiesEditionEvent.REMOVE) {
ownedElementsSettings.removeFromReference((EObject) event.getNewValue());
} else if (event.getKind() == PropertiesEditionEvent.MOVE) {
ownedElementsSettings.move(event.getNewIndex(), (AbstractViewElement) event.getNewValue());
}
}
}
use of org.obeonetwork.dsl.cinematic.view.ViewContainer in project InformationSystem by ObeoNetwork.
the class ViewContainerViewContainerPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final ViewContainer viewContainer = (ViewContainer) elt;
final ViewContainerPropertiesEditionPart viewContainerPart = (ViewContainerPropertiesEditionPart) editingPart;
// init values
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.description))
viewContainerPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainer.getDescription()));
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.name))
viewContainerPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainer.getName()));
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.widget)) {
// init part
widgetSettings = new EObjectFlatComboSettings(viewContainer, ViewPackage.eINSTANCE.getAbstractViewElement_Widget());
viewContainerPart.initWidget(widgetSettings);
// set the button mode
viewContainerPart.setWidgetButtonMode(ButtonsModeEnum.BROWSE);
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.actions)) {
actionsSettings = new ReferencesTableSettings(viewContainer, ViewPackage.eINSTANCE.getAbstractViewElement_Actions());
viewContainerPart.initActions(actionsSettings);
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.events)) {
eventsSettings = new ReferencesTableSettings(viewContainer, ViewPackage.eINSTANCE.getAbstractViewElement_Events());
viewContainerPart.initEvents(eventsSettings);
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.label))
viewContainerPart.setLabel(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, viewContainer.getLabel()));
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.ownedElements)) {
ownedElementsSettings = new ReferencesTableSettings(viewContainer, ViewPackage.eINSTANCE.getViewContainer_OwnedElements());
viewContainerPart.initOwnedElements(ownedElementsSettings);
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.widget)) {
viewContainerPart.addFilterToWidget(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof Widget);
}
});
// Start of user code for additional businessfilters for widget
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.actions)) {
viewContainerPart.addFilterToActions(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof ViewAction);
}
});
// Start of user code for additional businessfilters for actions
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.events)) {
viewContainerPart.addFilterToEvents(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof ViewEvent);
}
});
// Start of user code for additional businessfilters for events
// End of user code
}
if (isAccessible(ViewViewsRepository.ViewContainer.Properties.ownedElements)) {
viewContainerPart.addFilterToOwnedElements(new ViewerFilter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
// $NON-NLS-1$
return (element instanceof String && element.equals("")) || (element instanceof AbstractViewElement);
}
});
// Start of user code for additional businessfilters for ownedElements
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations