CapellaCommonNavigator object value is null

I am trying to select model element in Capella Project Explorere using CapellaCommonNavigator Class with below code:

                	CapellaCommonNavigator naviagtor = null;
                	    IWorkbench workbench = PlatformUI.getWorkbench();
                	    IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
            		    if (activeWindow != null) {
            		        final IWorkbenchPage activePage = activeWindow.getActivePage();
            		        if (activePage != null) {
            		        	naviagtor =  (CapellaCommonNavigator) activePage.findView("capella.project.explorer");		        	  
                		if (naviagtor != null) {
                		    naviagtor.selectReveal(new StructuredSelection(elementToSelectInTree));

I am getting NULL value for “navigator”.
I have seen strange behavior with this navigator. On another machine, the value is not null.
For your information, my Capella details are as below:
Version: 5.0.0
Build id: 202012021234
OS: Windows10
And the configuration is the same for another machine.

Could you please tell me why this strange behavior happens?


It seems to look like what we do here…

Is it when you deploy the addon or when you run in debug?

Now it works fine thank you.

The “navigator” value gets null because the project explorer is different from a different perspective.

for my case, the explorer we search for is not open in my perspective thats why we get a null value.