Hi everyone! I’m pretty new to the Eclipse environment. Nonetheless, I am trying to load a capella model in Eclipse.
I had the same difficulties as the OP in this post: How to load a Capella model in Ecore? but the solution has not yet worked for me.
I have tried importing the package of SessionHelper as a plug-in. After this, Eclipse complained about not being able to resolve some plugins defined in the dependencies of SessionHelper. Then, after I imported those, Eclipse complained about missing dependencies in those plugins, etc. etc… This went on for a long time and, eventually, I could not even load the Capella model.
My goal is to load the model from a pop-up menu and resolve the project with the SessionHelper class so I can pass it to XTend for code generation.
What am I doing wrong?
Thanks!
To add some more information:
The code I use is as follows:
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getSelection();
IFile file = null;
if (selection instanceof ITreeSelection) {
ITreeSelection treeSelection = (ITreeSelection) selection;
Object firstElement = treeSelection.getFirstElement();
if (firstElement instanceof IAdaptable) {
file = (IFile) ((IAdaptable) firstElement).getAdapter(IFile.class);
}
}
ResourceSet resSet = new ResourceSetImpl();
Resource res = resSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
Session ses = SessionHelper.getSession(file);
Project capellaProject = SessionHelper.getCapellaProject(ses);
getCapellaProject gives me the following error: “The method getCapellaProject(Session) from the type SessionHelper refers to the missing type Project”
This is (I think) because Eclipse is unable to resolve “org.polarsys.capella.core.data.capellamodeller.Project;”
The target platform is Eclipse. If I set it to Capella, I will not be able to use XTend anymore.