Search in sources :

Example 1 with TaskPropertiesEditionPart

use of org.obeonetwork.graal.parts.TaskPropertiesEditionPart in project InformationSystem by ObeoNetwork.

the class TaskTaskPropertiesEditionComponent 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 Task task = (Task) elt;
        final TaskPropertiesEditionPart taskPart = (TaskPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.Task.Properties.description))
            taskPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getDescription()));
        if (isAccessible(GraalViewsRepository.Task.Properties.subActivities)) {
            subActivitiesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getActivity_SubActivities());
            taskPart.initSubActivities(subActivitiesSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.actors)) {
            actorsSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Actors());
            taskPart.initActors(actorsSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.id))
            taskPart.setId(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getId()));
        if (isAccessible(GraalViewsRepository.Task.Properties.name))
            taskPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, task.getName()));
        if (isAccessible(GraalViewsRepository.Task.Properties.uses)) {
            usesSettings = new ReferencesTableSettings(task, GraalPackage.eINSTANCE.getTask_Uses());
            taskPart.initUses(usesSettings);
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.preconditions))
            taskPart.setPreconditions(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPreconditions()));
        if (isAccessible(GraalViewsRepository.Task.Properties.postconditions))
            taskPart.setPostconditions(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, task.getPostconditions()));
        if (isAccessible(GraalViewsRepository.Task.Properties.subActivities)) {
            taskPart.addFilterToSubActivities(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 Loop);
                }
            });
        // Start of user code for additional businessfilters for subActivities
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.actors)) {
            taskPart.addFilterToActors(new EObjectFilter(GraalPackage.Literals.ACTOR));
        // Start of user code for additional businessfilters for actors
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.Task.Properties.uses)) {
            taskPart.addFilterToUses(new EObjectFilter(GraalPackage.Literals.TASK));
        // Start of user code for additional businessfilters for uses
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : Loop(org.obeonetwork.graal.Loop) EObjectFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter) Task(org.obeonetwork.graal.Task) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Viewer(org.eclipse.jface.viewers.Viewer) EObject(org.eclipse.emf.ecore.EObject) TaskPropertiesEditionPart(org.obeonetwork.graal.parts.TaskPropertiesEditionPart)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)1 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)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 Loop (org.obeonetwork.graal.Loop)1 Task (org.obeonetwork.graal.Task)1 TaskPropertiesEditionPart (org.obeonetwork.graal.parts.TaskPropertiesEditionPart)1