Okay, so I had some free time today, and this will be a nice to have for my application so I dug in a little bit more.
Turns out that if you have the Tag Browse Tree mode configured as a Readtime Tag Tree then you get a different Transferable type.
If your mode is set to ‘Realtime Tag Tree’ then the transferable that is used is a ListOfNodeBrowseInfo
If your mode is set to ‘Historical Tag Tree’ the the transferable that is used is a ListOfQualifiedPath
I am sure there are reasons for that in the background.
That means your code needs to change slightly to use the correct Transferable Flavor
NOTE: If you have added the listener in the InternalFramActivated event you will need to close the window in the designer and re-open it once the change has been made.
from java.awt.dnd import DropTargetAdapter, DropTarget
from com.inductiveautomation.ignition.client.tags.dnd import ListOfNodeBrowseInfo
_comp = None
self._comp = comp
paths = [[node.getFullPath()] for node in e.getTransferable().getTransferData(ListOfNodeBrowseInfo.FLAVOR) if not node.hasChildren() and node.getObjectType().toString() != 'Provider']
self._comp.data = system.dataset.addRows(self._comp.data,paths) if self._comp.data.columnCount > 0 else system.dataset.toDataSet(['Selected Tags'],paths)
ddl = customDragDropListener(self)
Note that his will not accept a Folder or Provider, I didn’t take the time to handle that.
To properly handle these you will need to write a function which utilizes a recursive browse to gather the paths on a thread other than the GUI thread, should you want to handle a folder or provider in any way other than doing nothing. I have chosen to ‘ignore’ those items with this code.