In this topic, we will see how to change the default icons generated by EMF / GMF.
When the EMF editor is generated, severals icons are created in the plugin icons
folders.
Changing our diagram default icons is mainly to replace these images.
Full code is availabale through :
This tutorial has been built with :
This tutorial is based on the model built in the first tutorial.
The model files can be downloaded from this location.
The icon files are available at this location.
/Filesystem.diagram/icons/obj16/FilesystemDiagramFile.gif
by FilesystemDiagram16x16.gif
(which means that you have to delete the existing FilesystemDiagramFile.gif
file, copy/paste the FilesystemDiagramFile16x16.gif
file and rename it with the deleted file name (ie. FilesystemDiagramFile.gif
)/Filesystem.edit/icons/full/obj16/File.gif
by File16x16.gif
(the same way as above)/Filesystem.edit/icons/full/obj16/Filesystem.gif
by Filesystem16x16.gif
(the same way as above)/Filesystem.edit/icons/full/obj16/Folder.gif
by Folder16x16.gif
(the same way as above)You should get this result :
If you don't modify the tools palette icons, GMF will select the default EMF icons (the icons that are located in /Filesystem.edit/icons
).
In the previous example, we can see that edges tools icons are not very representative.
It is possible to override this :
Filesystem.edit/icons/full/obj16
, copy Edge16x16.gif
and rename it to Edge.gif
Filesystem.edit
, create a folder icons/full/obj32
File32x32.gif
, Folder32x32.gif
and Edge32x32.gif
File.gif
, Folder.gif
and Edge.gif
filesystem.gmftool
fileCreation Tool File
:Default image
nodesBundle
: Filesystem.edit
(plugin name in wich the icons are located)Path
: icons/full/obj16/File.gif
(plugin relative path of the icon)Bundle
: Filesystem.edit
(plugin name in wich the icons are located)Path
: icons/full/obj32/File.gif
(plugin relative path of the icon)Creation Tool Folder
: icons/full/obj16/Folder.gif
icons/full/obj32/Folder.gif
Creation Tool FolderFolders
: icons/full/obj16/Edge.gif
icons/full/obj32/Edge.gif
Creation Tool FolderFiles
: icons/full/obj16/Edge.gif
icons/full/obj32/Edge.gif
Transform
label of the dashboardThe gmftool file should loook like this :
And the result should look like this (small tools palette icon size on the left, large on the right):
You can get the filesystem model files described in this tutorial following this link : gmf-tutorial3-filesystem-model.zip
I hope that this material will be helpful for you. If you want to support it, your help is welcome :
Discussion
It took me a while to figure it out this part of the tutorial:
By “Replace X by Y” is meant “Delete X and put Y in its place, and rename Y to X's name”.
OK, I've added a few explanations to make it clearer. I agree to say that it wasn't easy to understand… Thank you for the feedback.
How to add tool tip for each icon. I mean what is the way to show our own description for each each icon when we bring arrow on the icon. Thanks
hello there,
I would like to know, how can i visualize the large icons, i did exactly all the steps, but i have only the small tools palette icon size , and not the large one.
thanks :)
it's ok, i have just to choose “use large icons”. i didn't see it :p see you.
hi djamel, Pls where did you get the “use large icons” option? Thanks in advance