Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Change IModelElement icons (in outline, explorer, completion)
| Change IModelElement icons (in outline, explorer, completion) [message #500932] |
Mon, 30 November 2009 05:43  |
David Largeteau Messages: 35 Registered: July 2009 Location: Bordeaux - France |
Member |
|
|
Hi,
I would like to change IModelElement icons displayed in outline,
explorer and completion, but with no success :-(
I've tried to look around ModelElementLabelProvider class, but I still
have problems with icons size (those I changed are not displayed with
the right size), and I'm not sure to go the right way...
If someone could help ... (thanks in advance)
David
|
|
| |
| Re: Change IModelElement icons (in outline, explorer, completion) [message #501667 is a reply to message #501101] |
Thu, 03 December 2009 06: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] |
Wed, 10 March 2010 23: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 07:21] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Thu May 23 09:37:51 EDT 2013
Powered by FUDForum. Page generated in 0.02156 seconds
|