use of org.eclipse.sirius.business.api.session.Session in project Palladio-Editors-Sirius by PalladioSimulator.
the class LoadResources method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
EObject element = selections.iterator().next();
Session session = SessionManager.INSTANCE.getSession(element);
for (Object p : parameters.values()) {
URI uri = URI.createURI(p.toString());
if (!SiriusCustomUtil.uriAlreadyLoaded(uri, session))
session.addSemanticResource(uri, new NullProgressMonitor());
}
}
use of org.eclipse.sirius.business.api.session.Session in project Palladio-Editors-Sirius by PalladioSimulator.
the class AllocationCreationWizard method finish.
@Override
protected void finish() {
Allocation allocation = (Allocation) modelObject;
Session session = SessionManager.INSTANCE.getSession(modelObject);
TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
String fileString = modelURI.toPlatformString(true);
IPath path = new Path(fileString);
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
List<IFile> list = new ArrayList<IFile>();
list.add(file);
AbstractTransactionalCommand command = new AbstractTransactionalCommand(domain, "Save Allocation model.", list) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
allocation.setTargetResourceEnvironment_Allocation(resourceEnvironmentSelectorpage.getSelectedResourceEnvironment(session));
allocation.setSystem_Allocation(systemSelectorPage.getSelectedSystem(session));
return CommandResult.newOKCommandResult();
}
};
try {
OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
System.out.println("Unable to save allocation model.");
e.printStackTrace();
}
}
Aggregations