[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 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
  
  
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. 
  **********************************************************************