Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Loss of my shape decoration
Loss of my shape decoration [message #1786115] Wed, 25 April 2018 18:05 Go to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 30
Registered: November 2017
Member
Hi,
All is in the title : when I close my diagram and open it again, I loose the decoration of my custom shape (but not the properties).
What I am doing wrong ?
Re: Loss of my shape decoration [message #1786148 is a reply to message #1786115] Thu, 26 April 2018 07:40 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
Hi,
very few information to help.
I guess you have overwritten the CustomShapeFeatureContainer class? Did you overwrite the method getCreateFeature?
Take a look into the examples on the wiki pages: https://wiki.eclipse.org/BPMN2-Modeler/DeveloperTutorials/CreateCustomShape

Tell me if it works if you add the following method:

	@Override
	public ICreateFeature getCreateFeature(IFeatureProvider fp) {
		return new CreateTaskFeature(fp) {
		};
	}


inside the method call:

  protected TaskFeatureContainer createFeatureContainer(IFeatureProvider fp) 


Re: Loss of my shape decoration [message #1786161 is a reply to message #1786148] Thu, 26 April 2018 09:45 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
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 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
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 #1786219 is a reply to message #1786203] Fri, 27 April 2018 06:13 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 30
Registered: November 2017
Member
This method is yet in the DataObjectFeatureContainer.
Re: Loss of my shape decoration [message #1786457 is a reply to message #1786219] Thu, 03 May 2018 15:47 Go to previous messageGo to next message
Xabier Garat is currently offline Xabier GaratFriend
Messages: 30
Registered: November 2017
Member
Hi,
Do you think a bad definition of the model could cause this loss ?
Re: Loss of my shape decoration [message #1786814 is a reply to message #1786457] Sat, 12 May 2018 23:02 Go to previous messageGo to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
What did you mean with "This method is yet in the DataObjectFeatureContainer."?

To get more clear about the problem: is your data stored in the EMF model? So if you save and close your changes and then reopen the model, did you than see your changes displayed correctly? If not, you have a problem with the EMF objects I think.

===
Ralph
Re: Loss of my shape decoration [message #1792701 is a reply to message #1786814] Sun, 22 July 2018 16:06 Go to previous message
Xabier Garat is currently offline Xabier GaratFriend
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

Previous Topic:Key 'namespace' ignored when generating genmodel
Next Topic:java.lang.ClassCastException: org.eclipse.bpmn2.impl.ExpressionImpl incompatible with org.eclipse.bp
Goto Forum:
  


Current Time: Tue Apr 16 15:31:47 GMT 2024

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

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

Back to the top