use of org.obeonetwork.graal.UseCase in project InformationSystem by ObeoNetwork.
the class AbstractTaskImpl method getUseCase.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public UseCase getUseCase() {
Collection<Setting> useCaseReferences = new GraalUsageCrossReferencer() {
@Override
protected boolean crossReference(EObject eObject, EReference eReference, EObject crossReferencedEObject) {
return eReference == GraalPackage.Literals.USE_CASE__TASKS;
}
@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 UseCase);
}
}.findUsage(this);
UseCase useCase = null;
for (Setting setting : useCaseReferences) {
useCase = (UseCase) setting.getEObject();
break;
}
return useCase;
}
use of org.obeonetwork.graal.UseCase in project InformationSystem by ObeoNetwork.
the class UseCaseUseCasePropertiesEditionComponent 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 UseCase useCase = (UseCase) elt;
final UseCasePropertiesEditionPart useCasePart = (UseCasePropertiesEditionPart) editingPart;
// init values
if (isAccessible(GraalViewsRepository.UseCase.Properties.description))
useCasePart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, useCase.getDescription()));
if (isAccessible(GraalViewsRepository.UseCase.Properties.tasks)) {
tasksSettings = new ReferencesTableSettings(useCase, GraalPackage.eINSTANCE.getUseCase_Tasks());
useCasePart.initTasks(tasksSettings);
}
if (isAccessible(GraalViewsRepository.UseCase.Properties.name))
useCasePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, useCase.getName()));
if (isAccessible(GraalViewsRepository.UseCase.Properties.namespaces)) {
namespacesSettings = new ReferencesTableSettings(useCase, GraalPackage.eINSTANCE.getDomainModelRegistry_Namespaces());
useCasePart.initNamespaces(namespacesSettings);
}
if (isAccessible(GraalViewsRepository.UseCase.Properties.domainClasses)) {
domainClassesSettings = new ReferencesTableSettings(useCase, GraalPackage.eINSTANCE.getUseCase_DomainClasses());
useCasePart.initDomainClasses(domainClassesSettings);
}
if (isAccessible(GraalViewsRepository.UseCase.Properties.tasks)) {
useCasePart.addFilterToTasks(new EObjectFilter(GraalPackage.Literals.ABSTRACT_TASK));
// Start of user code for additional businessfilters for tasks
// End of user code
}
if (isAccessible(GraalViewsRepository.UseCase.Properties.namespaces)) {
useCasePart.addFilterToNamespaces(new EObjectFilter(EnvironmentPackage.Literals.NAMESPACE));
// Start of user code for additional businessfilters for namespaces
// End of user code
}
if (isAccessible(GraalViewsRepository.UseCase.Properties.domainClasses)) {
useCasePart.addFilterToDomainClasses(new EObjectFilter(GraalPackage.Literals.DOMAIN_CLASS));
// Start of user code for additional businessfilters for domainClasses
// End of user code
}
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
use of org.obeonetwork.graal.UseCase in project InformationSystem by ObeoNetwork.
the class UngroupAction method executeUngroupAction.
/**
* Executes the ungrouping action
* @param context Object needed so the method can be called by Acceleo. It is returned unchanged
* @param selections Graphical elements selected by the user before launching the action
* @return The first parameter without any change
*/
public EObject executeUngroupAction(EObject context, Collection<? extends EObject> selections) {
TasksGroup group = extractTasksGroup(selections);
// Keep attachment to use case
UseCase useCase = group.getUseCase();
if (useCase != null) {
for (AbstractTask abstractTask : group.getTasks()) {
useCase.getTasks().add(abstractTask);
}
}
TasksContainer container = (TasksContainer) group.eContainer();
container.getTasks().addAll(group.getTasks());
// Delete without EcoreUtil.delete()
DeleteUtils.delete(group);
return context;
}
use of org.obeonetwork.graal.UseCase in project InformationSystem by ObeoNetwork.
the class CreateUseCaseAction method executeCreateUseCaseAction.
/**
* creates a new use case from selected Task and TasksGroup instances
* @param context EObject needed so the method can be called by Acceleo
* @param selections Graphical elements selected by the user before invoking the action
* @return unmodified "context" parameter
*/
public EObject executeCreateUseCaseAction(EObject context, Collection<? extends EObject> selections) {
// Filter the selections to retrieve only the Tasks
List<AbstractTask> tasks = extractTasks(selections);
String suggestedName = "UC - " + TaskUtils.instance.computeNameFromTasks(tasks);
InputDialog enterNameDialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Creating an use case", "Enter a name for the Use Case", suggestedName, null);
enterNameDialog.open();
int returnCode = enterNameDialog.getReturnCode();
if (returnCode == InputDialog.OK && tasks.size() > 0) {
// Get the containing System
System system = tasks.get(0).getContainingSystem();
// Create a new Use Case
UseCase useCase = GraalFactory.eINSTANCE.createUseCase();
Date createdOn = new Date();
useCase.setCreatedOn(createdOn);
useCase.setModifiedOn(createdOn);
useCase.getTasks().addAll(tasks);
useCase.setName(enterNameDialog.getValue());
system.getUseCases().add(useCase);
return useCase;
}
return null;
}
use of org.obeonetwork.graal.UseCase in project InformationSystem by ObeoNetwork.
the class UseCaseServicesTest method testSortIgnoringAccents.
@Test
public void testSortIgnoringAccents() {
System system = loadRoot("SortIgnoringAccents.graal", System.class);
UseCase useCase = query(() -> {
return (UseCase) system.getUseCases().get(0);
});
verifyAllDomainClasses(useCase, new String[] { "ns1.BaShouldBe1", "ns1.bbShouldBe2", "ns1.éaShouldBe3", "ns1.EBShouldBe4" });
}
Aggregations