Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Accessing CommonNavigator for CDT projects

There is no single UI Tree shared by all views. Each view instance creates its own Tree control.
The Project Explorer is not a class, it is an Eclipse View based on the Common Navigator Framework. Opening the Project Explorer instantiates the CommonNavigator class. Therefore, if you want to access the Tree control through the Common Navigator Framework, you must create the view first.
 
Anyway, I still don't understand the need for all that.
The Tree control is usually not publicly accessible for good reasons!
 
Toni


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of bala.torati@xxxxxxxxxxx
Sent: Thursday, April 05, 2007 12:50 PM
To: CDT General developers list.
Subject: RE: [cdt-dev] Accessing CommonNavigator for CDT projects


Thanks Toni for the quick reply.

I want to access the UI Tree control of the projects. How to make sure the Project Explorer is the active view part. I couldn't find Project Explorer class anywhere. Do I need to create one (Though I am not interested in creating any UI elements to acees the projects UI Tree).

Regards,
-Bala



"Leherbauer, Anton" <Anton.Leherbauer@xxxxxxxxxxxxx>
Sent by: cdt-dev-bounces@xxxxxxxxxxx

05/04/2007 11:30

Please respond to
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

To
"CDT General developers list." <cdt-dev@xxxxxxxxxxx>
cc
Subject
RE: [cdt-dev] Accessing CommonNavigator for CDT projects





Hi Bala,
 
the question is, what you want to achieve.
Do you really need the UI Tree of the projects, or rather the ICProject objects of the CModel?
The main entry point for this would be CoreModel.getDefault().getCModel().
 
If you indeed want to access the UI Tree control through the Common Navigator in the way you described, then you must make sure that the Project Explorer (an instance of CommonNavigator) is the active view part.
 
HTH,
Toni


From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of bala.torati@xxxxxxxxxxx
Sent:
Thursday, April 05, 2007 11:34 AM
To:
cdt-dev@xxxxxxxxxxx
Subject:
[cdt-dev] Accessing CommonNavigator for CDT projects



Hi,


I would like to get all the CDT Projects (Tree) from workspace. I could access this through CView using the following code.


               IWorkbenchPage page = CUIPlugin.getActivePage();

               if (page != null) {

                       IWorkbenchPart part = page.showView(CUIPlugin.CVIEW_ID);

                       
                       if (part instanceof CView) {

                               CView cview = (CView) part;

                               TreeItem[] items = cview.getViewer.getTree().getItems();

                               for (int i = 0; i < items.length; i++) {

                                       //Do something

                               }

                       }

               }


However CView is part of CDT UI internal classes. So I am thinking of accessing the projects tree thrugh public API. I understood that
Bug 140337 implements the CDT content extensions for the Project Explorer based on the Common Navigator Framework.
I think I can use the common navigator API to access the projects tree. So can somebody help me in accessing the CDT project explorer or common navigator through public API.


I have tried the following piece of code to access Common Navigator instead of the above code. But the partView always returning an instance of CView instead of CommonNavigator. So again I am having same problem of accessing internal CDT classes.


                       IWorkbenchWindow ww= PlatformUI.getWorkbench().getActiveWorkbenchWindow();

                       if (ww != null) {

                               IWorkbenchPage activePage = ww.getActivePage();

                               if (activePage != null) {

                                       IWorkbenchPartReference partRef = activePage.getActivePartReference();

                                       if (partRef != null) {

                                               IWorkbenchPart part= partRef.getPart(false);

                                               if (part instanceof CommonNavigator) {  
<==== part always returns an instance of CView in the above case
                                                       //use CN to access the projects tree.

                                               }

                                       }

                               }

                       }



Please let me know, if there is another way of accessing CommonNavigator(CN) for CDT extensions. Or a better of getting the project tree (not through CN).


Thanks for your help.


Regards,
-Bala


********************************************************************** Symbian Software Ltd is a company registered in England and Wales with registered number 4190020 and registered office at 2-6 Boundary Row, Southwark, London, SE1 8HP, UK. This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@xxxxxxxxxxx and delete the message and any attachments accompanying it immediately. Neither Symbian nor any of its Affiliates accepts liability for any corruption, interception, amendment, tampering or viruses occurring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy. ********************************************************************** _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


********************************************************************** Symbian Software Ltd is a company registered in England and Wales with registered number 4190020 and registered office at 2-6 Boundary Row, Southwark, London, SE1 8HP, UK. This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@xxxxxxxxxxx and delete the message and any attachments accompanying it immediately. Neither Symbian nor any of its Affiliates accepts liability for any corruption, interception, amendment, tampering or viruses occurring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy. **********************************************************************


Back to the top