DataFlavor[] flavors = e.getCurrentDataFlavors();
if (flavors != null && flavors.length == 1) {
try {
TreePath targetPath = ((PluginTree) ((DropTarget) e.getSource())
.getComponent()).getPathForLocation(e.getLocation().x, e
.getLocation().y);
if (targetPath != null) {
Node target = (Node)targetPath.getLastPathComponent();
if(target.getProgramReceiveTarget() == null && targetPath.getPathCount() <= 2) {
target = (Node) targetPath.getPathComponent(1);
}
if (flavors[0].getHumanPresentableName().equals("NodeExport")) {
TreePath sourcePath = ((PluginTree) ((DropTarget) e.getSource())
.getComponent()).getSelectionPath();
Node plugin = (Node) sourcePath.getPathComponent(1);
if (!target.equals(plugin) && !targetPath.isDescendant(sourcePath) &&
!sourcePath.isDescendant(targetPath)) {
if (target.equals(ReminderPlugin.getRootNode()
.getMutableTreeNode())) {
e.acceptDrag(e.getDropAction());
reject = false;
temp = ReminderPlugin.getInstance();
rejected = false;
} else if(target.getProgramReceiveTarget() == null) {
PluginProxy[] pluginAccessArray = PluginProxyManager.getInstance().getActivatedPlugins();
for (PluginProxy pluginAccess : pluginAccessArray) {
if (pluginAccess.getRootNode() != null) {
if (pluginAccess.getRootNode().getMutableTreeNode().equals(target)) {
if (pluginAccess.canReceiveProgramsWithTarget()) {
e.acceptDrag(e.getDropAction());
reject = false;
temp = pluginAccess;
rejected = false;
} else {
mPlugin = null;
break;
}
}
}
}
}
else if(!target.equals(sourcePath.getLastPathComponent())){
e.acceptDrag(e.getDropAction());
reject = rejected = false;
temp = target.getProgramReceiveTarget();
}
else {