Search in sources :

Example 1 with TaskReference

use of org.obeonetwork.graal.TaskReference in project InformationSystem by ObeoNetwork.

the class TaskReferenceItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public String getText(Object object) {
    String label = null;
    TaskReference taskRef = (TaskReference) object;
    if (taskRef.getTask() != null) {
        label = ((Task) taskRef.getTask()).getName();
    } else {
        label = crop(((TaskReference) object).getDescription());
    }
    return label == null || label.length() == 0 ? getString("_UI_TaskReference_type") : getString("_UI_TaskReference_type") + " " + label;
}
Also used : TaskReference(org.obeonetwork.graal.TaskReference)

Example 2 with TaskReference

use of org.obeonetwork.graal.TaskReference in project InformationSystem by ObeoNetwork.

the class TaskReferenceTaskReferencePropertiesEditionComponent 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 TaskReference taskReference = (TaskReference) elt;
        final TaskReferencePropertiesEditionPart taskReferencePart = (TaskReferencePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.description))
            taskReferencePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, taskReference.getDescription()));
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.outgoingTransitions)) {
            outgoingTransitionsSettings = new ReferencesTableSettings(taskReference, GraalPackage.eINSTANCE.getNode_OutgoingTransitions());
            taskReferencePart.initOutgoingTransitions(outgoingTransitionsSettings);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.incomingTransitions)) {
            incomingTransitionsSettings = new ReferencesTableSettings(taskReference, GraalPackage.eINSTANCE.getNode_IncomingTransitions());
            taskReferencePart.initIncomingTransitions(incomingTransitionsSettings);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.task)) {
            // init part
            taskSettings = new EObjectFlatComboSettings(taskReference, GraalPackage.eINSTANCE.getTaskReference_Task());
            taskReferencePart.initTask(taskSettings);
            // set the button mode
            taskReferencePart.setTaskButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.outgoingTransitions)) {
            taskReferencePart.addFilterToOutgoingTransitions(new EObjectFilter(GraalPackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for outgoingTransitions
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.incomingTransitions)) {
            taskReferencePart.addFilterToIncomingTransitions(new EObjectFilter(GraalPackage.Literals.TRANSITION));
        // Start of user code for additional businessfilters for incomingTransitions
        // End of user code
        }
        if (isAccessible(GraalViewsRepository.TaskReference.Properties.task)) {
            taskReferencePart.addFilterToTask(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 Task);
                }
            });
        // Start of user code for additional businessfilters for task
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : 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) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) TaskReferencePropertiesEditionPart(org.obeonetwork.graal.parts.TaskReferencePropertiesEditionPart) TaskReference(org.obeonetwork.graal.TaskReference)

Example 3 with TaskReference

use of org.obeonetwork.graal.TaskReference in project InformationSystem by ObeoNetwork.

the class TaskUtils method deleteUseRelationship.

/**
 * Deletes an "use" relationship between two tasks Deletes also
 * TaskReferences instances when needed
 *
 * @param usingTask
 *            Source task of the "use" relationship
 * @param usedTask
 *            Target task of the "use" relationship
 */
private void deleteUseRelationship(Task usingTask, Task usedTask, Session session, ModelAccessor modelAccessor) {
    // Delete "use" relationship
    usingTask.getUses().remove(usedTask);
    // Retrieve the TaskReference pointing to usedTask
    TaskReference taskRef = getReferenceOn(usingTask, usedTask);
    // plan
    if (taskRef != null) {
        deleteTaskReference(taskRef, session, modelAccessor);
    }
}
Also used : TaskReference(org.obeonetwork.graal.TaskReference)

Example 4 with TaskReference

use of org.obeonetwork.graal.TaskReference in project InformationSystem by ObeoNetwork.

the class TaskUtils method createTaskUseTaskEdge.

/**
 * Creates a "use" relationship between two Task instances
 *
 * @param usingTask
 *            Source Task instance of the relationship
 * @param usedTask
 *            Target Task instance of the relationship
 */
public void createTaskUseTaskEdge(Task usingTask, Task usedTask) {
    // We check if the edge doesn't already exist
    if (!usingTask.getUses().contains(usedTask)) {
        // Add the "use" reference between the two tasks
        usingTask.getUses().add(usedTask);
        // Create a task reference towards usedTask on usingTask's actions
        // plan
        TaskReference taskRef = GraalFactory.eINSTANCE.createTaskReference();
        taskRef.setTask(usedTask);
        usingTask.getNodes().add(taskRef);
    }
}
Also used : TaskReference(org.obeonetwork.graal.TaskReference)

Example 5 with TaskReference

use of org.obeonetwork.graal.TaskReference in project InformationSystem by ObeoNetwork.

the class TaskImpl method getReferencedBy.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
public EList<TaskReference> getReferencedBy() {
    Collection<Setting> referencingTasksReferences = new GraalUsageCrossReferencer() {

        @Override
        protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
            return eReference == GraalPackage.Literals.TASK_REFERENCE__TASK;
        }

        @Override
        protected boolean containment(EObject eObject) {
            // (We use Resource instead of CDOResource to avoid dependency on CDO)
            return (eObject instanceof Resource) || (eObject instanceof System) || (eObject instanceof TasksGroup) || (eObject instanceof Task) || (eObject instanceof Loop) || (eObject instanceof TaskReference);
        }
    }.findUsage(this);
    List<TaskReference> foundTasksReferences = new ArrayList<TaskReference>();
    for (Setting setting : referencingTasksReferences) {
        foundTasksReferences.add((TaskReference) setting.getEObject());
    }
    return ECollections.unmodifiableEList(new BasicEList<TaskReference>(foundTasksReferences));
}
Also used : Loop(org.obeonetwork.graal.Loop) AbstractTask(org.obeonetwork.graal.AbstractTask) Task(org.obeonetwork.graal.Task) Setting(org.eclipse.emf.ecore.EStructuralFeature.Setting) GraalUsageCrossReferencer(org.obeonetwork.graal.util.GraalUsageCrossReferencer) Resource(org.eclipse.emf.ecore.resource.Resource) ArrayList(java.util.ArrayList) System(org.obeonetwork.graal.System) TaskReference(org.obeonetwork.graal.TaskReference) TasksGroup(org.obeonetwork.graal.TasksGroup) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

TaskReference (org.obeonetwork.graal.TaskReference)5 EObject (org.eclipse.emf.ecore.EObject)2 Task (org.obeonetwork.graal.Task)2 ArrayList (java.util.ArrayList)1 EReference (org.eclipse.emf.ecore.EReference)1 Setting (org.eclipse.emf.ecore.EStructuralFeature.Setting)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)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 AbstractTask (org.obeonetwork.graal.AbstractTask)1 Loop (org.obeonetwork.graal.Loop)1 System (org.obeonetwork.graal.System)1 TasksGroup (org.obeonetwork.graal.TasksGroup)1 TaskReferencePropertiesEditionPart (org.obeonetwork.graal.parts.TaskReferencePropertiesEditionPart)1 GraalUsageCrossReferencer (org.obeonetwork.graal.util.GraalUsageCrossReferencer)1