Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsListen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616136/#msg_616136
I'm using the stp.bpmn modeler and I want to be notified about any
change in the diagram itself. If something is added, removed, changed, etc.
But where do I have to register my listener and what listener do I have
to implement?
Thanks
Till]]>Till Essers2008-05-19T13:15:56-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616141/#msg_616141
Originally posted by: atoulme.intalio.com
Look for the EMF EContentAdapter class. That should give you a gread
head start.
Thanks,
Antoine
Till Essers wrote:
> Hi
>
> I'm using the stp.bpmn modeler and I want to be notified about any
> change in the diagram itself. If something is added, removed, changed, etc.
> But where do I have to register my listener and what listener do I have
> to implement?
>
> Thanks
> Till]]>2008-05-19T13:21:46-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616145/#msg_616145
Writing my own EContentAdapter and adding it to the Diagram object would
be the way it should work. My only left problem is... where to get the
Diagram object for the active editor?
Antoine Toulme schrieb:
> Look for the EMF EContentAdapter class. That should give you a gread
> head start.
>
> Thanks,
>
> Antoine
>
> Till Essers wrote:
>> Hi
>>
>> I'm using the stp.bpmn modeler and I want to be notified about any
>> change in the diagram itself. If something is added, removed, changed,
>> etc.
>> But where do I have to register my listener and what listener do I
>> have to implement?
>>
>> Thanks
>> Till]]>Till Essers2008-05-19T15:01:25-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616149/#msg_616149
Till Essers schrieb:
> Sorry for bugging you again...
>
> Writing my own EContentAdapter and adding it to the Diagram object would
> be the way it should work. My only left problem is... where to get the
> Diagram object for the active editor?
>
> Thanks
> Till
>
> PS: I wrote a small tutorial on hiding the advanced tab, you might
> review it and then link it to your component, Antoine.
> http://wiki.eclipse.org/STP/BPMN_Component/Hiding_property_t abs
>
> Antoine Toulme schrieb:
>> Look for the EMF EContentAdapter class. That should give you a gread
>> head start.
>>
>> Thanks,
>>
>> Antoine
>>
>> Till Essers wrote:
>>> Hi
>>>
>>> I'm using the stp.bpmn modeler and I want to be notified about any
>>> change in the diagram itself. If something is added, removed,
>>> changed, etc.
>>> But where do I have to register my listener and what listener do I
>>> have to implement?
>>>
>>> Thanks
>>> Till]]>Till Essers2008-05-19T15:18:09-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616152/#msg_616152
Originally posted by: atoulme.intalio.com
Hey, just for the next folk reading this to feel smarter, would you mind
giving away the secret ? ;)
Till Essers wrote:
> Nevermind, I found it and feel stupid :D
> Till Essers schrieb:
>> Sorry for bugging you again...
>>
>> Writing my own EContentAdapter and adding it to the Diagram object
>> would be the way it should work. My only left problem is... where to
>> get the Diagram object for the active editor?
>>
>> Thanks
>> Till
>>
>> PS: I wrote a small tutorial on hiding the advanced tab, you might
>> review it and then link it to your component, Antoine.
>> http://wiki.eclipse.org/STP/BPMN_Component/Hiding_property_t abs
>>
>> Antoine Toulme schrieb:
>>> Look for the EMF EContentAdapter class. That should give you a gread
>>> head start.
>>>
>>> Thanks,
>>>
>>> Antoine
>>>
>>> Till Essers wrote:
>>>> Hi
>>>>
>>>> I'm using the stp.bpmn modeler and I want to be notified about any
>>>> change in the diagram itself. If something is added, removed,
>>>> changed, etc.
>>>> But where do I have to register my listener and what listener do I
>>>> have to implement?
>>>>
>>>> Thanks
>>>> Till]]>2008-05-19T15:48:39-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616154/#msg_616154
Originally posted by: atoulme.intalio.com
That is very nice! I added the categories [[Category:BPMN]] and
[[Category:STP]] to have it referenced properly.
I will add the item to our latest news, and our home page.
Thanks for the contribution !
Antoine]]>2008-05-19T15:50:00-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616156/#msg_616156
After opening the editor call the getDiagram() method and add your
EContentAdapter to the eAdapters list.
An Action for opening the editor will look like this:
IEditorPart editorpart =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(new
FileEditorInput(file), MyBpmnDiagramEditor.ID);
Diagram
((EexBpmnDiagramEditor)editorpart).getDiagram().eAdapters(). add(new
MyContentAdapter());
Thats it ;)
Next step is to understand the Notification passed around ;)
Antoine Toulme schrieb:
> Hey, just for the next folk reading this to feel smarter, would you mind
> giving away the secret ? ;)
>
> Till Essers wrote:
>> Nevermind, I found it and feel stupid :D
>> Till Essers schrieb:
>>> Sorry for bugging you again...
>>>
>>> Writing my own EContentAdapter and adding it to the Diagram object
>>> would be the way it should work. My only left problem is... where to
>>> get the Diagram object for the active editor?
>>>
>>> Thanks
>>> Till
>>>
>>> PS: I wrote a small tutorial on hiding the advanced tab, you might
>>> review it and then link it to your component, Antoine.
>>> http://wiki.eclipse.org/STP/BPMN_Component/Hiding_property_t abs
>>>
>>> Antoine Toulme schrieb:
>>>> Look for the EMF EContentAdapter class. That should give you a gread
>>>> head start.
>>>>
>>>> Thanks,
>>>>
>>>> Antoine
>>>>
>>>> Till Essers wrote:
>>>>> Hi
>>>>>
>>>>> I'm using the stp.bpmn modeler and I want to be notified about any
>>>>> change in the diagram itself. If something is added, removed,
>>>>> changed, etc.
>>>>> But where do I have to register my listener and what listener do I
>>>>> have to implement?
>>>>>
>>>>> Thanks
>>>>> Till]]>Till Essers2008-05-19T15:53:24-00:00Re: Listen to any modyfication of the diagram
https://www.eclipse.org/forums/index.php/mv/msg/193761/616159/#msg_616159
few month' ago ;)
You may add it to your Wiki if you want to:
=== Showing the property tab only when a task is selected ===
Until now we just disabled the input fields in our property tab when no
task is selected, but hiding the whole property tab is a nicer solution.
The first step we have to take is adding a filter to our propertySection:
<source lang="xml">
<extension point="org.eclipse.ui.views.properties.tabbed.propertySections ">
<propertySections
contributorId="org.eclipse.gmf.runtime.diagram.ui.properties ">
<propertySection
The second step is to implement the filter:
<source lang="java">
public class PropertySectionFilter implements IFilter {
public boolean select(Object toTest) {
if(toTest instanceof ActivityEditPart) {
Object obj = ((IGraphicalEditPart) toTest).resolveSemanticElement();
if(obj instanceof Activity){
Activity task = (Activity)obj;
if(task.getActivityType() == ActivityType.get(ActivityType.TASK)) {
return true;
}
}
}
return false;
}
}
</source>
All the filter does is testing if the given Object is a task and return
true to show the tab if this is the case.
We have to do this with a filter, because we can't declare the Activity
as input for the section. (even though the tutorial says you should...
remove the <input type="java.lang.Object" /> and the tab will never show
up) What is passed is always an EditPart, so we have to filter for an
ActivityEditPart first, then get the element this EditPart wraps through
resolveSemanticElement(). Then we have to take a look on the type of the
Activity because we just want our tab to be shown when the selected
Activity is of type TASK.
Now the participant tab will only show up when you click on a task.
Antoine Toulme schrieb:
>
>> PS: I wrote a small tutorial on hiding the advanced tab, you might
>> review it and then link it to your component, Antoine.
>> http://wiki.eclipse.org/STP/BPMN_Component/Hiding_property_t abs
>
> That is very nice! I added the categories [[Category:BPMN]] and
> [[Category:STP]] to have it referenced properly.
>
> I will add the item to our latest news, and our home page.
>
> Thanks for the contribution !
>
> Antoine]]>Till Essers2008-05-19T16:07:26-00:00