Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Adding icons to the palette
Adding icons to the palette [message #884175] Sun, 10 June 2012 10:04 Go to next message
David cousinsa is currently offline David cousinsaFriend
Messages: 1
Registered: June 2012
Junior Member
Hello,

I've done the graphiti tutorial (not every part, but almost), i registered an ImageProvider, i modified the palette with a MuseeToolBehaviorProvider.

When i add a ObjectCreationEntry to a PaletteCompartmentEntry, we use a "getCreateImageId()" as parameter. I guess it represents the small icon in the palette to show a small picture of what we are going to add. However, i can't find where we define this imageid (in the createFeature ?), i already searched, but i only find a setImageId for a contextButton, not for a CreateFeature.

So, my question is, how can i add this small picture in my Palette ?

Thank you for your time
Re: Adding icons to the palette [message #884508 is a reply to message #884175] Mon, 11 June 2012 08:08 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Usually, you would simply define your CreateFeature and override
getCreateImageId(). The create features are automatically added to the
editor's palette along with the icon, there's no need to modify editor code
for that.

Does that help?
Michael
Re: Adding icons to the palette [message #1413293 is a reply to message #884508] Thu, 28 August 2014 08:25 Go to previous messageGo to next message
John Cole is currently offline John ColeFriend
Messages: 38
Registered: June 2013
Member
Hello Michael,

I've got a similar problem, so I post my question here.
I've created a DiagramImageProvider, registered it in the plugin.xml and in my CreateFeature I am trying to add an icon to the palette. So I override getCreateImageId(), which looks like this:
	@Override
	public String getCreateImageId() {
		if (DiagramImageProvider.isAvailable(IMG_ID)) {
			System.out.println(IMG_ID);
			return IMG_ID;
		}
		return null;
	}


The ID is availible in the ImageProvider but the problem is, that the method addAvailableImages() is never called (I tried to set a debug point inside).
So the icon of my CreateFeature in the palette is a simple red point:

index.php/fa/18984/0/

The image path and name seems to be correct.

What could be the problem? Is there a solution for this?

Thank you very much in advance!
  • Attachment: palette.png
    (Size: 4.70KB, Downloaded 84 times)

[Updated on: Thu, 28 August 2014 08:26]

Report message to a moderator

Re: Adding icons to the palette [message #1413436 is a reply to message #1413293] Thu, 28 August 2014 14:00 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Have you registered your image provider with your diagram type provider?

Here's the example for the tutorial:
<extension
point="org.eclipse.graphiti.ui.diagramTypeProviders">
<diagramTypeProvider
class="org.eclipse.graphiti.examples.tutorial.diagram.TutorialDiagramTypeProvider"
description="This is the editor for the Graphiti tutorial"
id="org.eclipse.graphiti.examples.tutorial.diagram.TutorialDiagramTypeProvider"
name="Graphiti Tutorial Editor">
<diagramType
id="org.eclipse.graphiti.examples.tutorial.diagram.TutorialDiagramType">
</diagramType>
<imageProvider
id="org.eclipse.graphiti.examples.tutorial.TutorialImageProvider">
<-------
</imageProvider>
<imageProvider
id="org.eclipse.graphiti.examples.common.ExampleImageProvider">
</imageProvider>
</diagramTypeProvider>
</extension>

Michael
Previous Topic:Multiple create features
Next Topic:Drawing shapes using SWT/Draw2D
Goto Forum:
  


Current Time: Fri Dec 19 06:41:13 GMT 2014

Powered by FUDForum. Page generated in 0.09440 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software