Bug 210056 - [api] Make HierarchicalDecorationContext API
Summary: [api] Make HierarchicalDecorationContext API
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 210076
Blocks:
  Show dependency tree
 
Reported: 2007-11-15 22:56 EST by Pavel Krupets CLA
Modified: 2008-07-02 13:05 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Krupets CLA 2007-11-15 22:56:07 EST
I need this in my plugin (decorators) because:

For instance there are 2 classes:

p1.p2.c1
p1.p2.p3.c2

class c2 has TODO tag.

in hierarchical mode packages p1, p2, and class c1 should be decorated.
in flat mode we have 2 lines (exactly as shown in 'For instance there are 2 classes') but packages p1 and p2 will be decorated in both lines which isn't what I want. I need to decorate only line 2 as it is the only one which has TODO tag.

Thank you.
Comment 1 Martin Aeschlimann CLA 2007-11-16 05:16:56 EST
If we would expose the 'is in hierarchical mode' on the IPackagesViewPart that wouldn't help you as decorators are not aware in which viewer they are decorating.
We also have a second viewer that supports hiearchical packages in the browsing perspective.

The solution for this would be, in my opinion, the new API suggested in bug 210076. There, the decorator will get access to a 'viewer 'resource mapping of the correct element.

If you have a different suggestion, please let me know.
Comment 2 Pavel Krupets CLA 2007-11-16 18:41:59 EST
Yep. But this property is still need to me made public. All what's related to it is in internal package.
Thank you!
Comment 3 Martin Aeschlimann CLA 2007-11-19 04:32:00 EST
Can you give more information how and why you need it? I just need some examples to see if this API really would be useful.
Comment 4 Pavel Krupets CLA 2007-11-19 22:41:08 EST
Not sure what kind of additional information you need. My decorator should behave differently in different presentation modes (flat or hierarchical) as described in my 1st post, so I need access to current view mode where I am decorating stuff.
Comment 5 Martin Aeschlimann CLA 2007-11-20 03:49:17 EST
Does your decorator know in which view it is decorating? Normally decorators are contributed as light weight decorators and the only thing they get is the element to decorate.
Comment 6 Pavel Krupets CLA 2007-12-20 14:25:38 EST
Now I couldn't tell which view I am decorating. I think decorators are only supported by package explorer.

More information on plugin: http://www.krupets.com/fun/twiki/bin/view/TODODecorator
Comment 7 Pavel Krupets CLA 2007-12-20 14:46:25 EST
I found a way to check whether it's flat or not. But it is a hack (if you say decoration can take place in different views).

HierarchicalDecorationContext is used when view is hierarchical otherwise DecorationContext.DEFAULT_CONTEXT is used.

Another problem is that HierarchicalDecorationContext is in internal package.
Comment 8 Martin Aeschlimann CLA 2007-12-21 03:56:00 EST
As you are a lightweight label decorator contributor, your plug-in decorates Java elements in all views. Have a look for example at the browsing perspective.
There can also be several instances of package explorers (in multiple windows).

The 'HierarchicalDecorationContext' is the right way to go. And my request to platform UI in bug 210076 would make that functionality available through API.
Comment 9 Pavel Krupets CLA 2008-07-02 13:05:02 EDT
Ok. In 3.4 even HierarchicalDecorationContext isn't working any more. Now flat/hierarchical state is totally private. Thanks.