Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » How to use a custom icons?
How to use a custom icons? [message #1734135] Sat, 04 June 2016 17:48 Go to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
I need some help to load a custom image in my CustomShapeFeatureContainer.
I did not found out how to register custom icons located in the /icons/large/ folder.
I guessed the CustomTaskImageProvider.registerAvailableImages(); automatically registers all images in this folder. But it seems not to be the case.

What is necessary to be able to load a icon with something like this:

img = CustomTaskImageProvider.createImage(customTaskDescriptor, ga,
								"inbox.png", 24, 24);


All my attempts resulted in a red-box-icon which seems to indicate that I have not registered my image to Eclipse.


===
Ralph
Re: How to use a custom icons? [message #1735014 is a reply to message #1734135] Tue, 14 June 2016 16:19 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Ralph, try this:

	String imageId = customTaskDescriptor.getImageId("inbox.png", CustomTaskImageProvider.IconSize.LARGE);
	if (!registered) {
		String filename = "/icons/large/inbox.png";
		URL url = getClass().getClassLoader().getResource(filename);
		ImageDescriptor descriptor =  ImageDescriptor.createFromURL(url);
		CustomTaskImageProvider.registerImage(imageId, descriptor);
		registered = true;
	}
	Image img = Graphiti.getGaService().createImage(ga, imageId);
	img.setProportional(false);
	img.setWidth(24);
	img.setHeight(24);
	img.setStretchH(true);
	img.setStretchV(true);
	Graphiti.getGaService().setLocation(img, 50, 25);
Re: How to use a custom icons? [message #1735423 is a reply to message #1735014] Sun, 19 June 2016 07:55 Go to previous message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
Thanks, this works fine.
Previous Topic:How to open bpmn files properly
Next Topic:How to place a second icon into a CustomShapeFeatureContainer
Goto Forum:
  


Current Time: Thu Apr 25 04:13:44 GMT 2024

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

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

Back to the top