A subtype of ScriptTask [message #1236564] |
Mon, 27 January 2014 09:50  |
Eclipse User |
|
|
|
Hi.
I need to have a new subtype of ScriptTask - called for instance. MyScriptTask.
The difference is that the script task is persisted with an additional attribute:
<bpmn2:scriptTask mynamespace:type="mine">
I see what I have to do to persist it the way I want, but I don't know how to create a new element in the Pallete that will also correspond to a Script task.
How do I manage to do this?
I believe I must to implement a new feature container for script task where the script icon or "my" icon is choosen accordingly with the existence of mynamespace:type="mine" property. I also believe I shold not in this case to implement a custom Task. Am I wrong?
But how should I proceed in what concerns to palette??
Thanks
rui
|
|
|
|
|
|
|
|
Re: A subtype of ScriptTask [message #1236908 is a reply to message #1236746] |
Tue, 28 January 2014 06:09   |
Eclipse User |
|
|
|
Thanks.
The second problem occurs because in org.eclipse.bpmn2.modeler.ui.features.activity.task.CustomShapeFeatureContainer
the icon is added only if addFeatureDelegate hasn't added one yet.
@Override
public PictogramElement add(IAddContext context) {
PictogramElement pe = addFeatureDelegate.add(context);
// make sure everyone knows that this PE is a custom task
if (pe!=null)
Graphiti.getPeService().setPropertyValue(pe,CUSTOM_ELEMENT_ID,getId());
// add an icon to the top-left corner if applicable, and if the implementing
// addFeatureDelegate hasn't already done so.
String icon = customTaskDescriptor.getIcon();
if (icon!=null && pe instanceof ContainerShape) {
boolean addImage = true;
ContainerShape containerShape = (ContainerShape)pe;
GraphicsAlgorithm ga =
GraphicsAlgorithm)AbstractBpmn2AddFeature.getGraphicsAlgorithm(containerShape);
for (PictogramElement child : containerShape.getChildren()) {
if (child.getGraphicsAlgorithm() instanceof Image) {
addImage = false;
break;
}
}
if (ga!=null) {
for (GraphicsAlgorithm g : ga.getGraphicsAlgorithmChildren()) {
if (g instanceof Image) {
addImage = false;
break;
}
}
}
else
addImage = false;
if (addImage) {
Image img = CustomTaskImageProvider.createImage(customTaskDescriptor, ga, icon, 24, 24);
Graphiti.getGaService().setLocationAndSize(img, 2, 2, 24, 24);
}
}
return pe;
}
Thanks again
|
|
|
|
Re: A subtype of ScriptTask [message #1237097 is a reply to message #1237093] |
Tue, 28 January 2014 16:25  |
Eclipse User |
|
|
|
1.Yes, I noticed that the description was the one shown in the Tab. And not the one used to instantiate create feature.
2.Yes I can code around that somehow. For now I've just hacked the plugin code. I'll try later to work around that in feature container if it is possible.
Thanks Bob
|
|
|
Powered by
FUDForum. Page generated in 0.10773 seconds