use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.
the class DeleteServices method deleteExecution.
public void deleteExecution(Execution execution) {
if (execution == null) {
return;
}
Session session = SessionManager.INSTANCE.getSession(execution);
ModelAccessor modelAccessor = session.getModelAccessor();
deleteExecutionEnd(execution.getStartingEnd(), session, modelAccessor);
deleteExecutionEnd(execution.getFinishingEnd(), session, modelAccessor);
delete(execution, session, modelAccessor);
}
use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.
the class TaskUtils method deleteTaskUseTaskEdge.
/**
* This service is used to remove the "use" relationship between 2 abstract
* tasks and remove the corresponding elements on the using task's Actions
* Plan when needed
*
* @param usingTask
* Source AbstractTask instance of the relationship
* @param usedTask
* Target AbstractTask instance of the relationship
*/
public void deleteTaskUseTaskEdge(AbstractTask usingTask, AbstractTask usedTask) {
Session session = SessionManager.INSTANCE.getSession(usingTask);
ModelAccessor modelAccessor = session.getModelAccessor();
// Get all potentially concerned used Tasks
List<Task> usedTasks = new ArrayList<Task>();
if (usedTask instanceof Task) {
usedTasks.add((Task) usedTask);
} else {
usedTasks.addAll(getAllUsedTasks((TasksGroup) usedTask));
}
// Check if the using "task" is a Task or a Group
if (usingTask instanceof Task) {
for (Task realUsedTask : usedTasks) {
deleteUseRelationship((Task) usingTask, realUsedTask, session, modelAccessor);
}
} else {
for (Task realUsedTask : usedTasks) {
for (Task realUsingTask : getTasksFromGroupUsingTask((TasksGroup) usingTask, realUsedTask)) {
deleteUseRelationship(realUsingTask, realUsedTask, session, modelAccessor);
}
}
}
}
use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.
the class DeleteInteractionHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final Interaction interaction = extractInteraction(event);
if (interaction == null) {
return null;
}
boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Delete interaction", "Delete the selected interaction ?");
if (confirm) {
final Session session = SessionManager.INSTANCE.getSession(interaction);
final ModelAccessor modelAccessor = session.getModelAccessor();
final ECrossReferenceAdapter semanticCrossReferencer = session.getSemanticCrossReferencer();
TransactionalEditingDomain transactionalEditingDomain = session.getTransactionalEditingDomain();
transactionalEditingDomain.getCommandStack().execute(new RecordingCommand(transactionalEditingDomain) {
@Override
protected void doExecute() {
// Retrieve associated representations
Collection<DRepresentationDescriptor> representationDescriptors = DialectManager.INSTANCE.getRepresentationDescriptors(interaction, session);
// Delete representations
for (DRepresentationDescriptor representationDescriptor : representationDescriptors) {
closeEditor(session, representationDescriptor.getRepresentation());
DialectManager.INSTANCE.deleteRepresentation(representationDescriptor, session);
}
// Delete interaction
modelAccessor.eDelete(interaction, semanticCrossReferencer);
}
});
}
return null;
}
use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.
the class DeleteStateMachineHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
final StateMachine stateMachine = extractStateMachine(event);
if (stateMachine == null) {
return null;
}
boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Delete State Machine", "Delete the selected state machine ?");
if (confirm) {
final Session session = SessionManager.INSTANCE.getSession(stateMachine);
final ModelAccessor modelAccessor = session.getModelAccessor();
final ECrossReferenceAdapter semanticCrossReferencer = session.getSemanticCrossReferencer();
TransactionalEditingDomain transactionalEditingDomain = session.getTransactionalEditingDomain();
transactionalEditingDomain.getCommandStack().execute(new RecordingCommand(transactionalEditingDomain) {
@Override
protected void doExecute() {
// Retrieve associated representations
Collection<DRepresentationDescriptor> representationDescriptors = DialectManager.INSTANCE.getRepresentationDescriptors(stateMachine, session);
// Delete representations
for (DRepresentationDescriptor representationDescriptor : representationDescriptors) {
closeEditor(session, representationDescriptor.getRepresentation());
DialectManager.INSTANCE.deleteRepresentation(representationDescriptor, session);
}
// Delete StateMachine
modelAccessor.eDelete(stateMachine, semanticCrossReferencer);
}
});
}
return null;
}
use of org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor in project InformationSystem by ObeoNetwork.
the class DocumentationLinkImpl method delete.
/**
* {@inheritDoc}
* @see org.obeonetwork.tools.doc.core.DocumentationLink#delete()
*/
public void delete() {
Session session = SessionManager.INSTANCE.getSession(annotation);
if (session != null) {
ModelAccessor vpModelAccessor = session.getModelAccessor();
vpModelAccessor.eDelete(annotation, session.getSemanticCrossReferencer(), new EReferencePredicate() {
public boolean apply(EReference reference) {
return DSemanticDecorator.class.isAssignableFrom(reference.getContainerClass());
}
});
} else {
EcoreUtil.delete(annotation);
}
// $NON-NLS-1$
name = "";
// $NON-NLS-1$
value = "";
annotation = null;
}
Aggregations