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;
}
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);
}
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);
}
}
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);
}
}
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));
}
Aggregations