Search in sources :

Example 1 with ViewContainerPropertiesEditionPart

use of org.obeonetwork.dsl.cinematic.view.parts.ViewContainerPropertiesEditionPart 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);
}
Also used : ViewContainerPropertiesEditionPart(org.obeonetwork.dsl.cinematic.view.parts.ViewContainerPropertiesEditionPart) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) AbstractViewElement(org.obeonetwork.dsl.cinematic.view.AbstractViewElement) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ViewAction(org.obeonetwork.dsl.cinematic.view.ViewAction) ViewEvent(org.obeonetwork.dsl.cinematic.view.ViewEvent) Widget(org.obeonetwork.dsl.cinematic.toolkits.Widget) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) ViewContainer(org.obeonetwork.dsl.cinematic.view.ViewContainer)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)1 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 Widget (org.obeonetwork.dsl.cinematic.toolkits.Widget)1 AbstractViewElement (org.obeonetwork.dsl.cinematic.view.AbstractViewElement)1 ViewAction (org.obeonetwork.dsl.cinematic.view.ViewAction)1 ViewContainer (org.obeonetwork.dsl.cinematic.view.ViewContainer)1 ViewEvent (org.obeonetwork.dsl.cinematic.view.ViewEvent)1 ViewContainerPropertiesEditionPart (org.obeonetwork.dsl.cinematic.view.parts.ViewContainerPropertiesEditionPart)1