Invoke my plugin by a draw action?


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 = ... {
	public void diagramElementAdded(IDiagramUIModel aDiagram, IDiagramElement aDiagramElement) {
		// do somethings

IDiagramUIModel lDiagram = ...

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 :pray::pray: