[jboss-jira] [JBoss JIRA] Updated: (GPD-143) Load the icon of a paletteContribution entry from the plugin directory where it is defined
Matthew Sandoz (JIRA)
jira-events at lists.jboss.org
Tue Oct 16 15:30:06 EDT 2007
[ http://jira.jboss.com/jira/browse/GPD-143?page=all ]
Matthew Sandoz updated GPD-143:
-------------------------------
Attachment: PaletteRoot.java
I just ended up needing to do this as well - if you havent already fixed it this seems to work. I am also attaching this file to the issue
### Eclipse Workspace Patch 1.0
#P org.jbpm.gd.jpdl
Index: src/org/jbpm/gd/common/editor/PaletteRoot.java
===================================================================
RCS file: /cvsroot/jbpm/jbpm.3/designer/jpdl/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/editor/PaletteRoot.java,v
retrieving revision 1.2
diff -u -r1.2 PaletteRoot.java
--- src/org/jbpm/gd/common/editor/PaletteRoot.java 7 Aug 2007 11:38:49 -0000 1.2
+++ src/org/jbpm/gd/common/editor/PaletteRoot.java 16 Oct 2007 19:25:06 -0000
@@ -21,6 +21,7 @@
*/
package org.jbpm.gd.common.editor;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -37,6 +38,7 @@
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jbpm.gd.jpdl.Plugin;
+import org.osgi.framework.Bundle;
public class PaletteRoot extends org.eclipse.gef.palette.PaletteRoot {
@@ -78,9 +80,9 @@
PaletteEntry entry;
CreationFactory factory = new CreationFactory(object, editor.getSemanticElementFactory(), editor.getNotationElementFactory());
if (isNode) {
- entry = new CreationToolEntry(label, tooltip, factory, getIconDescriptor(icon), null);
+ entry = new CreationToolEntry(label, tooltip, factory, getIconDescriptor(entryElement), null);
} else {
- entry = new ConnectionCreationToolEntry(label, tooltip, factory, getIconDescriptor(icon), null);
+ entry = new ConnectionCreationToolEntry(label, tooltip, factory, getIconDescriptor(entryElement), null);
}
entry.setId(entryName);
paletteGroup.add(entry);
@@ -90,8 +92,10 @@
}
}
- private ImageDescriptor getIconDescriptor(String icon) {
- return ImageDescriptor.createFromURL(Plugin.getDefault().getBundle().getEntry("/" + icon));
+ private ImageDescriptor getIconDescriptor(IConfigurationElement element) {
+ Bundle bundle = Platform.getBundle(element.getDeclaringExtension().getNamespace());
+ URL location = bundle.getEntry("/" + element.getAttribute("icon"));
+ return ImageDescriptor.createFromURL(location);
}
private void processPaletteContribution(IConfigurationElement configurationElement) {
> Load the icon of a paletteContribution entry from the plugin directory where it is defined
> ------------------------------------------------------------------------------------------
>
> Key: GPD-143
> URL: http://jira.jboss.com/jira/browse/GPD-143
> Project: JBoss jBPM GPD
> Issue Type: Feature Request
> Components: jpdl
> Reporter: Matthias Hanisch
> Assigned To: Koen Aers
> Fix For: jBPM jPDL Designer 3.2.0.alpha1
>
> Attachments: PaletteRoot.java
>
>
> In PaletteRoot class, the icon of a palette entry is always loaded from org.jbpm.gd.jpdl plugin, even if the paletteContribution entry is defined in a dependent plugin.
> The information, where the palette entry element (entryElement in PaletteRoot.addControls) is defined, can be found in entryElement.getContributor().getName().
> So also the corresponding image can be loaded from the correct bundle.
> [ Sorry to only give a verbal description of the implementation. I would sign a corporate contributor's agreement, but I have problems with the procedure, e.g.
> - do we need a corporate jboss account for my boss to sign
> - if we sign with the "corporate" account, with which account I need to contribute then
> etc.
> So I would need some assistance here. Then you would get a real diff also.
> ]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list