Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » BPMN2 validator for custom file extensions
BPMN2 validator for custom file extensions [message #1625541] Fri, 20 February 2015 13:06 Go to next message
Stefan Henke is currently offline Stefan HenkeFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

I want the BPMN2 validator run for BPMN2 files with my custom file extension. For some reason this is not working. I successfully associated an editor that extends the BPMN2 editor with my file extension.
I also registered an extension for the extension point "org.eclipse.core.contenttype.contentTypes" for my file extension.

However, the BPMN2 builder/project validator is either not called at all or doesn´t recognize my file extension as valid BPMN2 file.

BPMN2 builder not called at all:
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type base-type="org.eclipse.core.runtime.xml"
id="org.eclipse.bpmn2.content-type.xml"
name="%content-type.name"
file-extensions="myextension"
priority="normal">
<describer class="org.eclipse.bpmn2.modeler.ui.BPMN2ContentDescriber">
</describer>
</content-type>
</extension>

Not recognized as BPMN2 file in BPMN2 builder:
<extension point="org.eclipse.core.contenttype.contentTypes">
<content-type base-type="org.eclipse.bpmn2.content-type.xml"
id="myid"
name="%content-type.name"
file-extensions="myextension"
priority="normal">
<describer class="org.eclipse.bpmn2.modeler.ui.BPMN2ContentDescriber">
</describer>
</content-type>
</extension>

I figured out that method BPMN2ProjectValidator.isBPMN2File is only checking for the content type id, but does not take the base type id into account which might help here.

Is there any other suggestion how I can make the validator run for custom extensions of BPMN2 files?
Best regards,
Stefan
Re: BPMN2 validator for custom file extensions [message #1625579 is a reply to message #1625541] Fri, 20 February 2015 13:41 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Stefan,

It would be helpful to know which version of the editor you are building on. The validation framework has changed a bit since 1.1.0 and there may be an easier way to do what you're trying to do...

Bob
Re: BPMN2 validator for custom file extensions [message #1625844 is a reply to message #1625579] Fri, 20 February 2015 17:29 Go to previous messageGo to next message
Stefan Henke is currently offline Stefan HenkeFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Bob,
we are not yet on 1.1.0, but 1.0.2.
I´m not sure about our exact plans to adopt 1.1.0. So, if possible you could give an advise for both releases.
Regards,
Stefan
Re: BPMN2 validator for custom file extensions [message #1634783 is a reply to message #1625844] Wed, 25 February 2015 12:58 Go to previous messageGo to next message
Stefan Henke is currently offline Stefan HenkeFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Bob,
any hint on this? Ana advise would be highly appreciated.
Best regards,
Stefan
Re: BPMN2 validator for custom file extensions [message #1634952 is a reply to message #1634783] Wed, 25 February 2015 14:45 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Stefan,

The reason the validator is not being called is because the BPMN2 project builder (which does the validation) has not been added to your .project file. Your .project file should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>org.my.bpmn2.project</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.bpmn2.modeler.core.bpmn2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.bpmn2.modeler.core.bpmn2Nature</nature>
	</natures>
</projectDescription>


You can have the editor automatically configure the .project by setting a Project property User Preference: right-click on the project, then Properties->BPMN2 and enable "Check if project is configured for BPMN2 Project Nature".

BTW, any chance you could migrate to version 1.0.4.Final? This is the latest version of the editor for Kepler and includes many bug fixes.

Cheers,
Bob
Re: BPMN2 validator for custom file extensions [message #1635016 is a reply to message #1634952] Wed, 25 February 2015 15:20 Go to previous messageGo to next message
Stefan Henke is currently offline Stefan HenkeFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Bob,
actually the .project file contains both settings. When I debug the coding, I can see that the debugger properly stops in the class BPMN2Builder. it also passes on to the method validate() in class BPMN2ProjectValidator. However, this method calls an internal one called isBPMN2File. This is causing the issue. Looking at my original post where I list two different ways how we register our extensions, we can see two different behaviors.

The first snippet registers the extension with id "org.eclipse.bpmn2.content-type.xml" which is already used by plug-in org.eclipse.bpmn2.modeler.ui. So, we end up with two extensions with same id which randomly picks one of the available extensions. In some cases the isBPMN2File method successfully identifies our extension as bpmn2. In other cases it does not as the call to resource.getContentDesciption() returns null.

The second snippet registers the extension with a new id which identifies the extension uniquely. With that resource.getContentDescription() always returns the proper result. However, the next check on equality of the content type id returns false which rejects our file extension from being validated.

I quickly looked at the coding in master and I cannot see any difference to 1.0.2.
Any further idea on this?
Best regards,
Stefan
Re: BPMN2 validator for custom file extensions [message #1684159 is a reply to message #1625541] Wed, 18 March 2015 10:01 Go to previous messageGo to next message
Stefan Henke is currently offline Stefan HenkeFriend
Messages: 12
Registered: July 2009
Junior Member
Meanwhile I was able to solve this issue. For others running into a similar issue, I´m posting my solution.

Rather than contributing a whole new content type for our file extension, I´m now contributing only a new file extension to the existing content type:

<extension point="org.eclipse.core.contenttype.contentTypes">
<file-association
content-type="org.eclipse.bpmn2.content-type.xml"
file-extensions="myextension">
</file-association>
</extension>
Re: BPMN2 validator for custom file extensions [message #1689530 is a reply to message #1684159] Mon, 23 March 2015 20:08 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Thanks for the tip Stefan Smile
Previous Topic:is it possible toexport bpmn as xpdl?
Next Topic:Who can help me to extend the BPMN2 Plugin?
Goto Forum:
  


Current Time: Sat Apr 20 06:04:21 GMT 2024

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

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

Back to the top