Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Problems with ImageProvider
Problems with ImageProvider [message #910535] Sun, 09 September 2012 23:47 Go to next message
Dominik Thalmann is currently offline Dominik ThalmannFriend
Messages: 11
Registered: May 2012
Junior Member
Hey everyone,

I have three concerns. First thing is that I cant load images with my own ImageProvider. Below is the code for my ImageProvider and a link to a picture where you can see what the result looks like. I just see a red square on the editor. If I use the ImageProvider from the bpmn modeler the picture loads just fine and everything works... It seems as if my picture isnt found although it is there in the folder icons.

The second question: Is it possible to add a picture on the elements in the palette? SO that I have a small picture for all my new elements... It would be the same as on the diagram but just a bit smaller.

The third question is: Can I somehow change the name of the CustomTask Container on the palette without having to edit the BPMN Modeler code? I would like to have a Container thats called "ROSI Elements" or something instead of "Custom Task".


Here is the code for my ImageProvider:

package org.eclipse.bpmn2.modeler.runtime.rosi.extension;

import org.eclipse.graphiti.ui.platform.AbstractImageProvider;

public class RosiImageProvider extends AbstractImageProvider {

	public static final String RISK = "Risk";

	public RosiImageProvider() {
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void addAvailableImages() {
		// TODO Auto-generated method stub

		addImageFilePath(RISK, "icons/risk.png");

		System.out.println("Images added.");
	}

}



And here is the code where I want to use the image with the RISK-ID in my addFeature:

	@Override
	public IAddFeature getAddFeature(IFeatureProvider fp) {

			return new AddCustomTaskFeature(fp) {
				@Override
				protected void decorateActivityRectangle(RoundedRectangle rect) {
					
					IGaService service = Graphiti.getGaService();
					Image img = service.createImage(rect, RosiImageProvider.RISK);
					service.setLocationAndSize(img, 2, 2,
							GraphicsUtil.TASK_IMAGE_SIZE,
							GraphicsUtil.TASK_IMAGE_SIZE);
				}
			};
		
	}



The link for the result (the red square in the left-top corner of the task should be my picture):

www7.pic-upload.de/10.09.12/7zfrz6qnusz.png

[Updated on: Sun, 09 September 2012 23:48]

Report message to a moderator

Re: Problems with ImageProvider [message #910842 is a reply to message #910535] Mon, 10 September 2012 13:31 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Dominik,

This is an area of Graphiti that I don't have a lot of familiarity with, so you may want to experiment with a few things... first, did you add the imageprovider extension to your plugin.xml? (see the jbpm5 plugin for example) Make sure your ImageProvider's addAvailableImages() is getting called! If that doesn't work, try adding your images to the Graphiti image registry directly, like so:

 ImageDescriptor image = ImageDescriptor.createFromURL(url);
 ImageRegistry imageRegistry = GraphitiUIPlugin.getDefault().getImageRegistry();
 if (imageRegistry.get(iconPath) == null)
   imageRegistry.put(iconPath, image);


As far as your third question, I'm afraid the answer is no - there is no editor extension point to add new palette drawers, or change the draw titles at this time but you can always request this as a new feature in bugzilla Wink

HTH,
Bob
Previous Topic:Duplicated Property-menus
Next Topic:Problems with targetNamespace
Goto Forum:
  


Current Time: Sat Apr 20 01:11:22 GMT 2024

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

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

Back to the top