Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Change IModelElement icons (in outline, explorer, completion)
| |
Re: Change IModelElement icons (in outline, explorer, completion) [message #501667 is a reply to message #501101] |
Thu, 03 December 2009 11:13 |
David Largeteau Messages: 35 Registered: July 2009 Location: Bordeaux - France |
Member |
|
|
Andrei Sobolev a écrit :
> Hi David,
>
> Please look into org.eclipse.dltk.ui.modelLabelProvider extension point.
> It's allow any customization of outline, etc by providing custom label
> provider.
>
> You could check example implementation in TCL in class
> TclModelLabelProvider.
>
> If you need to add some additional elements you also could use following
> extension points ( for customization of outline, script explorer content
> and element ordering)
> org.eclipse.dltk.ui.modelCompareProvider
> org.eclipse.dltk.ui.modelContentProvider
>
> Best regards,
> Andrei.
Hi Andrei,
Thank you for your answer.
I’ve tried to use org.eclipse.dltk.ui.modelLabelProvider extension
point, as in Tcl project. It works very well for all explorer part, but
I still have problems with icons size in Outline view : they are
displayed bigger than they are in explorer part.
In Tcl project, the only custom objects that are displayed are Tcl
Packages (tcl_packagefolder_obj.gif), and this kind of object is not
displayed in the Outline, so I can’t compare the behavior.
I also noticed that IModelElement objects displayed in completion
proposals do not react the same way : I mean that modelLabelProvider is
not used in this case (I need to override
CompletionProposalLabelProvider to do what I want). I think
modelLabelProvider extension point should also be used by completion.
Thanks in advance for your help,
David
|
|
| | | | | | |
Re: Change IModelElement icons (in outline, explorer, completion) [message #520129 is a reply to message #519986] |
Thu, 11 March 2010 04:28 |
David Largeteau Messages: 35 Registered: July 2009 Location: Bordeaux - France |
Member |
|
|
Hi Kevin,
What I do is :
- extend LabelProvider class
- override "public Image getImage(Object element)" method in my
xxxLabelProvider class. In this class, check for element flags like
example below (you'll have to adapt it to your case).
@Override
public Image getImage(Object element)
{
IMember member = getMember(element);
if (member == null)
return null;
try
{
if (member.exists())
{
int flags = member.getFlags();
// Special icon for private type
if (member instanceof IType
&& (flags & Modifiers.AccPrivate) != 0)
return getPrivateMethodIcon(); // return your special icon
}
}
catch (ModelException e)
{
}
return null; // will enter default DLTK behavior
}
Hope this helps you
David
[Updated on: Thu, 11 March 2010 12:21] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Tue Sep 17 15:41:55 GMT 2024
Powered by FUDForum. Page generated in 0.04498 seconds
|