Hello,
We have a requirement to select model element from external Windows application.
So, here is the scenario:
- We have an external Windows application where I can import/capture model elements from Capella
- Now, when I double click on that model element in my application, it should select the same model element inside Capella Project Explorer tree view
We have written a Capella plugin which:
- Starts socket server when it is loaded
- Listens request from our external Windows application. This is where we want to send element select request from our application.
It would be good to select the element using either its ID or some kind of URI.
Could you please help with this?
I am trying below code:
EObject elementToSelect = null;
public IWorkbenchPart getActivePart() {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
if (activeWindow != null) {
final IWorkbenchPage activePage = activeWindow.getActivePage();
if (activePage != null) {
return activePage.getActivePart();
}
}
return null;
}
IWorkbenchPart activePart = getActivePart();
if (activePart != null && activePart instanceof IPackagesViewPart) {
((IPackagesViewPart) activePart).selectAndReveal(elementToSelect);
}
What I am missing here is elementToSelect .
As a input, I have only string ID of an element like in the form: “61c2baab-5479-440b-9e3b-887ab22bddf9” [as mentioned in .capella file]
From this, I need to form elementToSelect so that it can be revealed in the tree [along with tree expansion]
Could you please help me to get elementToSelect of type EObject from mere ID of an element? Is it even possible?
If not possible, is there any other way I can use to get this EObject?
Thank you in advance for your feedback.