Selection of an object from an external application

Is there a way to select an object in the Capella Project Explorer from an external application ?
It could be using a dedicated Capella URL or using the Command Line Interface or using an socket client.

Hi,
There is currently no mechanism provided in Capella allowing to achieve that.
And, if I correctly understand your need, the command line application will not help you.
For your use case to work, you would need to embed a small server in Capella.
This would probably not be very complicated and if you are interested in contributing this development, we could provide a bit of technical guidance.
Regards,
Jean

Hello JBarata,

We have a same requirement in our Windows application.
So, here is the scenario:

  1. We have an external Windows application where I can import/capture model elements from Capella
  2. 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:

  1. Starts socket server when it is loaded
  2. Listens request from our external Windows application. This is where we want to send element select request from our application.

The original question has been asked in March 2018. After that, is there any update in Capella API infrastructure to select/highlight the model element in the Tree View? It would be good to select the element using either its ID or some kind of URI.

Could you please help with this?

Thank you in advance for your feedback.

Hi,

Anyone can answer this, please?

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.

I suggest you to post this is in the Capella Studio forum room: Latest Capella Studio & Kitalpha topics - Eclipse Capella Forum (mbse-capella.org)

OK, Thanks. :slightly_smiling_face: