简体   繁体   中英

Eclipse, own TreeViewer with file attributes in Project Explorer View

I'm writing Eclipse plugin. One of many features is create Tree with File Attributes like .java files have (if you click on .java File in Eclipse you can see whole list with what classes or methods this file have).

I can create this tree with separate view, it isn't problem (I have data,using TreeViewer and everything works great), but now I must create this tree in Project Explorer View and I don't know how.
Maybe should I write because it isn't obviously. This tree won't be display with .java file but with .txt file.

So read about this. What I know for now:

  1. I should have org.eclipse.ui.decorators extension point. I already have it
  2. My class should extends LabelProvider implements ILightweightLabelDecorator . It already has it

Also I can get access to already selection File , Project , Folder (by using decorate() method). I can add prefix/suffix to already select file ,add icons into File but...

I'm not seeing any methods what give me possibility add any attributes to file .

You should be using the extension points to provide content , not labels , just as your existing trees (hopefully) use content providers for those details. Start at http://help.eclipse.org/luna/topic/org.eclipse.platform.doc.isv/guide/cnf.htm .

nitind has right , if someone wants implement outline with Project Explorer,use Common Navigator Framework.

Here is simply examples,wrote by creator this framework,how to do this :

  1. http://scribbledideas.blogspot.com/2006/05/building-common-navigator-based-viewer.html // create view

  2. http://scribbledideas.blogspot.com/2006/05/building-common-navigator-based-viewer_22.html // create outline

Just try copy this example into your project.

Thx nitind for advice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM