Hi every body,
Is there any way to invoke your plugin when you drop a shape on a diagram ?
Hi every body,
Is there any way to invoke your plugin when you drop a shape on a diagram ?
Any idea ???
My guess is as good as yours but I don’t think you can. According to the manual you can only activate a plugin through means of an ActionController class and that has two main options which it can use: the toolbar or the pop-up menu.
But solely basing myself on going over the API documentation I don’t think it allows for registering any custom (event) handlers and all that.
assume drop a shape on a diagram means a shape is added into the diagram.
You can add a listener to the diagram, your listener will receive the event when a shape is added into the diagram.
// implements your listener
com.vp.plugin.diagram.IDiagramListener lMyDiagramListener = ... {
@Override
public void diagramElementAdded(IDiagramUIModel aDiagram, IDiagramElement aDiagramElement) {
// do somethings
}
...
}
IDiagramUIModel lDiagram = ...
lDiagram.addDiagramListener(lMyDiagramListener);
PS: the diagramElementAdded(…) event will be triggered when a shape is added (no matter the shape is added by Drag&Drop, or Duplicate a Shape, etc…)
OK,Thank you
Hello again
I have another question related to this topic
Is it possible to add a listener to each shape(like a unit at an organization chart diagram ) to receive an event every time i update that shape ( for example when i change the name or position of that shape)