|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Put a Flag in elements of the BPMN [message #1057945 is a reply to message #1057938] |
Thu, 09 May 2013 21:17   |
reg bas Messages: 16 Registered: May 2013 |
Junior Member |
|
|
This is for a university research 
That is why I wanted to know an opinion on whether it is possible to create a plug-in for this
I was thinking that the plug-in should be targeted to the different elements right?
Do not create one for all elements, but one for tasks, one for datas, one for messages and so on.
I say this because in the first instance had thought about making one for the whole set of items, but I think it will be more complex and there are actually some differences between what extra data must carry each.
Now you understand a little more the idea of plug-in I want to generate?
Greetings and thank you very much!!!
[Updated on: Thu, 09 May 2013 21:27] Report message to a moderator
|
|
|
| Re: Put a Flag in elements of the BPMN [message #1058008 is a reply to message #1057945] |
Fri, 10 May 2013 09:24   |
|
It's possible...anything is possible but it's going to take some work.
The first thing you'll have to do in your extension plugin is create an extension model; this model does not necessarily have to define all of the model features (classes, attributes and references) that your plugin will create - extension model objects can be defined on-the-fly. That said, it is a good idea to define these features anyway because your model will probably be used by other systems outside of the editor and this is a good place to define this metadata.
Next you must provide a the <featureContainer> extension and create your own FeatureContainer classes for each of the BPMN2 elements that need this new "flag" capability. Note that this could be the same FeatureContainer class for all of the elements. Your FeatureContainer will need to provide its own AddFeature, and override decorateShape() to add the flag icon to the Shape. Your FeatureContainer will also want to override getCustomFeatures() so that you can provide graphiti Features to handle adding and removing of the flag icons using the button pad (this is the pop-up button grouping that appears when you mouse over a Shape).
Next you will have to provide your own <propertyTab> extensions for all of the BPMN2 elements, and add editing widgets for all of the element extension attributes. The BPMN2 Modeler code base already has several styles of editing widgets for different attribute types - see the ObjectEditor abstract base class and its subclasses for examples.
I think a lot of what you want to do is already being done in the example plugins. See the SampleCustomTaskFeatureContainer class for an example of how to implement decorateShape() in an AddFeature. Don't be fooled by the fact that this is a CustomTaskFeatureContainer - it simply provides a level of indirection for FeatureContainer so that it can be used generically.
Depending on how you want to extend the BPMN2 elements (either with attributes defined in your own namespace, or as elements in a <bpmn2:extensionElements> container) you can add and remove model extensions using the ModelUtil utility class methods addAnyAttribute() and addExtensionAttributeValue().
I have created a screencast that demonstrates the entire process, here:
http://eclipse.org/bpmn2-modeler/videos/CustomTask-Example-part1.htm
Have fun!
Bob
|
|
|
|
| Re: Put a Flag in elements of the BPMN [message #1058995 is a reply to message #1053858] |
Thu, 16 May 2013 03:31   |
reg bas Messages: 16 Registered: May 2013 |
Junior Member |
|
|
Hi Bob!
As I said before, try again with the screencast you recommended. I did, but I had problems, mainly I can not see the business that I created, that if the diagram recognizes that there is a task that has been added (I know the numbers that follow when dragging elements) but not shown. It's not the first time that happens to me, in fact I could never make it look the work of the many times I've tried from scratch. I think they'll at least seven attempts. The only difference between the screencast and I will not use the repositories that open at first because throw errors. Influences that???
Here you can see that the project starts
Here I create the diagram
The task is displayed in the palette
And dragging a CustomTask and after that, two Task happens
And again with one of each
I've done sooooo many times the project, I reinstalled BPMN2 and EMF and complements and no change.
Another thing that happens is that when I try to relaunch the project after closing it I get:
DocumentRoot id = "unknown": Feature 'definitions' not found. (Platform :/ resource/test-custom-task/tes/process_1.bpmn, 2, 394)
And on the screen shows me the following:
Failed to create the part's controls
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1081)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:362)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:138)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:96)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:313)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:861)
at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:841)
at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:113)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:321)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:242)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:894)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:629)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:731)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:702)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:696)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:681)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$1.handleEvent(PartServiceImpl.java:92)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:187)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:80)
at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:58)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:422)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:389)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:606)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:332)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1029)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3047)
at org.eclipse.ui.internal.WorkbenchPage.access$22(WorkbenchPage.java:2969)
at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2951)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2947)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2911)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2902)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:655)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:614)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$4.open(PackageExplorerPart.java:538)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Bpmn file generated is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI-XMI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC-XMI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI-XMI" id="Definitions_1" targetNamespace="http://org.eclipse.bpmn2.modeler.examples.customtask">
<bpmn2:process id="process_1" name="Default Process">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" sourceRef="StartEvent_1" targetRef="EndEvent_1"/>
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:task id="Task_2" name="Task 2"/>
<bpmn2:task id="Task_3" name="Task 3"/>
<bpmn2:task id="Task_5" name="Task 5"/>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process_1">
<bpmndi:BPMNShape id="BPMNShape_1" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="100.0" y="100.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_2" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="500.0" y="100.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_1" targetElement="BPMNShape_2">
<di:waypoint xsi:type="dc:Point" x="136.0" y="118.0"/>
<di:waypoint xsi:type="dc:Point" x="500.0" y="118.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BPMNShape_Task_1" bpmnElement="Task_2">
<dc:Bounds height="50.0" width="110.0" x="225.0" y="175.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Task_2" bpmnElement="Task_3">
<dc:Bounds height="50.0" width="110.0" x="255.0" y="275.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Task_3" bpmnElement="Task_5">
<dc:Bounds height="50.0" width="110.0" x="355.0" y="435.0"/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
I hope the enclosed text is not garbage and serve only to get a response to guide me a bit in identifying what I'm doing wrong. I could not move because of this ...
Sorry Bob ... take away so long
and thanks in advance!
PS: I mention again that translate through Google Translator: S
|
|
|
| Re: Put a Flag in elements of the BPMN [message #1059050 is a reply to message #1058995] |
Thu, 16 May 2013 08:34   |
|
In order for the "Custom Task" extension to work, the code needs to be able to differentiate between it and a regular bpmn2 element of the same type, otherwise there is no reason for having a "custom task". This is accomplished by having some kind of extension attribute on the element. That's what the "type" attribute is used for in the example.
I don't see any extension attributes on the <task> elements in your generated bpmn file, so there's something missing there.
Also, you need to define your own EMF model because extension features are created dynamically by the editor within this model. They can NOT be created on the BPMN2 model because it is cached and the additional features would interfere with other editors that use the BPMN2 model.
I know this stuff is not easy! There are a lot of moving parts and it is difficult for me to figure out exactly where the problem is just from a description of the symptoms. If possible, can you push your project to a github repository so I can have a closer look?
Bob
P.S. What is your native language that you are translating with Google Translator? If I know the grammar rules for the origin language, reading these posts would make a lot more sense. For example, I'm sure the phrase "take away so long" makes a lot more sense in your language than it does in English
|
|
|
|
|
|
|
| Re: Put a Flag in elements of the BPMN [message #1060296 is a reply to message #1059400] |
Thu, 23 May 2013 21:37   |
reg bas Messages: 16 Registered: May 2013 |
Junior Member |
|
|
Bob! I have news!!!
I downloaded from github the source code of BPMN2. In the files I found the source code of the CustomTask example. I imported and run the code in eclipse... and guess?
The example work perfectly!
So... I suppose the problem is not from versions of eclipse I used.
Could be lack a step at the screencast? (I don't sure if this question is understood, GTranslate ¬¬)
Now I can help to find the error comparing the codes! And I can continue with my work... making a little bit more!
I await!
Thanks!
[Updated on: Thu, 23 May 2013 21:37] Report message to a moderator
|
|
|