|
|
Re: Loss of my shape decoration [message #1786161 is a reply to message #1786148] |
Thu, 26 April 2018 09:45 |
Xabier Garat Messages: 30 Registered: November 2017 |
Member |
|
|
Hi Ralph,
Sorry for not giving more information.
I extended a DataObject and, a TextAnnotation and an Association.
The only one for which the decoration is not lost is the Association. Maybe because I didn't not put him in my extension model ?
Here is the code of the feature container of my DataObject extension :
public class DataIoBarrierFeatureContainer extends CustomShapeFeatureContainer {
@Override
protected IShapeFeatureContainer createFeatureContainer(IFeatureProvider fp) {
return new DataObjectFeatureContainer() {
@Override
public IAddFeature getAddFeature(IFeatureProvider fp) {
return new AddDataObjectFeature(fp) {
@Override
protected void decorateShape(IAddContext context, ContainerShape containerShape, DataObject businessObject) {
super.decorateShape(context, containerShape, businessObject);
}
};
}
@Override
public ICreateFeature getCreateFeature(IFeatureProvider fp) {
return new CreateDataObjectFeature(fp) {
@Override
public DataObject createBusinessObject(ICreateContext context) {
DataObject businessObject = (DataObject) super.createBusinessObject(context);
return businessObject;
}
@Override
public String getCreateImageId() {
return SampleImageProvider.getImageId(customTaskDescriptor, IconSize.SMALL);
}
@Override
public String getCreateLargeImageId() {
return SampleImageProvider.getImageId(customTaskDescriptor, IconSize.LARGE);
}
@Override
public String getCreateDescription() {
return "Create "+customTaskDescriptor.getName();
}
};
}
@Override
public IDirectEditingFeature getDirectEditingFeature(IFeatureProvider fp) {
return null;
}
@Override
public IResizeShapeFeature getResizeFeature(IFeatureProvider fp) {
return null;
}
};
}
public String getId(EObject arg0) {
EStructuralFeature f = ModelDecorator.getAnyAttribute(arg0, "type");
if (f!=null) {
Object id = arg0.eGet(f);
if (TYPE_VALUE.equals(id))
return CUSTOM_TASK_ID;
}
return null;
}
}
And the customTask definition :
<customTask
category="Interoperability"
description="Data Interoperability Barrier"
featureContainer="com.hedadura16.DataIoBarrierFeatureContainer"
icon="InteroperabilityBarrier.png"
id="com.hedadura16.dataIoBarrierId"
name="Data Interoperability Barrier"
runtimeId="com.hedadura16.runtimeId"
type="DataObject">
<property name="type" value="DataIoBarrier">
</property>
</customTask>
It is very simple, but I loose it...
[Updated on: Thu, 26 April 2018 09:55] Report message to a moderator
|
|
|
Re: Loss of my shape decoration [message #1786203 is a reply to message #1786161] |
Thu, 26 April 2018 19:44 |
Ralph Soika Messages: 193 Registered: July 2009 |
Senior Member |
|
|
Ok, the custom task definition looks fine for me. But I think the method createFeatureContainer is the problem. Can you try to add to the DataObjectFeatureContainer the method:
/**
* this MUST be overridden if you intend to add extension attributes to your
* business object (bpmn2 element) - see the code example. You will also
* want to provide your own images for the tool palette by overriding
* getCreateImageId() and getCreateLargeImageId() in your Create Feature.
*/
@Override
public ICreateFeature getCreateFeature(IFeatureProvider fp) {
return new CreateDataObjectFeature(fp) {
};
}
The comment is the original comment from the core examples.
I am not the expert in this area but in my own plugin it was always necessary to overwrite this method.
===
Ralph
[Updated on: Thu, 26 April 2018 19:46] Report message to a moderator
|
|
|
|
|
|
Re: Loss of my shape decoration [message #1792701 is a reply to message #1786814] |
Sun, 22 July 2018 16:06 |
Xabier Garat Messages: 30 Registered: November 2017 |
Member |
|
|
Hi,
I'm trying and trying again, but without success...
I'm trying now to make an extension of a TextAnnotation without model (like in the dynamic example), but I still loose the shape when I reopen my diagram.
I don't understand why...
The property tab is ok. I can change the values of my parameters, but I can't keep the shape, and then I have a classic TextAnnotation which doesn't display the parameters.
The only extension keeping his shape is the Association, which is a modelExtension.
What could be the problem ?
[Updated on: Sun, 22 July 2018 16:15] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04227 seconds