| Hook custom tree outline to package explorer [message #252439] | 
Fri, 04 April 2008 08:28   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello, I'd like to make a custom tree outline for XML files appear in the  
package explorer for each file, just like the Java outline does for Java  
files. 
 
So far, I've used the "org.eclipse.ui.navigator.navigatorContent"  
extension point, providing an ITreeContentProvider and an ILabelProvider.  
The tree appears, but it doesn't reflect any changes in the file, not even  
when I refresh the view. 
 
 
I have the feeling that these providers are not enough, and am searching  
for the minimal set of classes that implement the desired functionality in  
JDT. However, as the project is rather big, I'm somewhat lost. Can someone  
give me a good starting point? 
 
 
Generally, I'd guess that the concept of reusing a TreeViewer based  
ContentOutlinePage in the package explorer (and have these explorer views  
interact with each respective file as outlines would) might be a huge  
value-add for many projects. Is there a standard way to achieve this, or  
maybe a detailed tutorial? 
 
 
Thanks in advance! 
Gerrit
 |  
 |  
  | 
| Re: Hook custom tree outline to package explorer [message #252450 is a reply to message #252439] | 
Mon, 07 April 2008 04:02    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Gerrit wrote: 
> Hello, I'd like to make a custom tree outline for XML files appear in  
> the package explorer for each file, just like the Java outline does  
> for Java files. 
I assume you are talking about the Project Explorer (aka Common  
Navigator) and not the Package Explorer which can't be extended like this. 
 
Dani 
> 
> So far, I've used the "org.eclipse.ui.navigator.navigatorContent"  
> extension point, providing an ITreeContentProvider and an  
> ILabelProvider. The tree appears, but it doesn't reflect any changes  
> in the file, not even when I refresh the view. 
> 
> 
> I have the feeling that these providers are not enough, and am  
> searching for the minimal set of classes that implement the desired  
> functionality in JDT. However, as the project is rather big, I'm  
> somewhat lost. Can someone give me a good starting point? 
> 
> 
> Generally, I'd guess that the concept of reusing a TreeViewer based  
> ContentOutlinePage in the package explorer (and have these explorer  
> views interact with each respective file as outlines would) might be a  
> huge value-add for many projects. Is there a standard way to achieve  
> this, or maybe a detailed tutorial? 
> 
> 
> Thanks in advance! 
> Gerrit 
> 
>
 |  
 |  
  | 
| Re: Hook custom tree outline to package explorer [message #252460 is a reply to message #252450] | 
Mon, 07 April 2008 04:40    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
>> Hello, I'd like to make a custom tree outline for XML files appear in  
>> the package explorer for each file, just like the Java outline does  
>> for Java files. 
> I assume you are talking about the Project Explorer (aka Common  
> Navigator) and not the Package Explorer which can't be extended like this. 
 
Yes, sorry. It's probably the Project Explorer, I was confusing the two.  
Can I extend the Project Explorer / Common Navigator in the described  
fashion? 
 
 
>> So far, I've used the "org.eclipse.ui.navigator.navigatorContent"  
>> extension point, providing an ITreeContentProvider and an  
>> ILabelProvider. The tree appears, but it doesn't reflect any changes  
>> in the file, not even when I refresh the view. 
 
Even in the Project Explorer, Java elements are updated in the tree, as  
soon as they are changed in a Java editor, and on saving the file even  
from a normal text editor. How is this done, i.e. which extension points  
have to be used? 
 
 
Thanks for your help! 
Gerrit
 |  
 |  
  | 
| Re: Hook custom tree outline to package explorer [message #252464 is a reply to message #252460] | 
Mon, 07 April 2008 10:08   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
>> I assume you are talking about the Project Explorer (aka Common  
>> Navigator) and not the Package Explorer which can't be extended like this. 
 
Thanks to your introduction to the name "Common Navigator", I was now able  
to find these blog postings to the org.eclipse.ui.examples.navigator  
example, which is pretty much the minimal setup I was looking for: 
 
 http://richclientplatform.blogspot.com/2007/06/common-naviga tor-framework.html 
 
 
> So far, I've used the "org.eclipse.ui.navigator.navigatorContent"  
> extension point, providing an ITreeContentProvider and an  
> ILabelProvider. The tree appears, but it doesn't reflect any changes  
> in the file, not even when I refresh the view. 
 
The solution found in the sample code is to add an IResourceChangeListener  
to the Workspace in the constructor of the ITreeContentProvider. No  
extension point mechanisms are used for this. 
 
Many thanks! 
Gerrit
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04598 seconds