((ToolWindowBarDropTarget) dtde.getDropTargetContext().getDropTarget()).hidePosition(true);
try {
String toolId = (String) transferable.getTransferData(MyDoggyTransferable.TOOL_WINDOW_ID_DF);
ToolWindow toolWindow = manager.getToolWindow(toolId);
if (toolWindow == null)
return;
dtde.acceptDrop(DnDConstants.ACTION_MOVE);
// Chech if it was a tab
if (transferable.isDataFlavorSupported(MyDoggyTransferable.TOOL_WINDOW_TAB_ID_DF)) {
// Remove from tab
ToolWindowTab tab = (ToolWindowTab) manager.getDockable(
transferable.getTransferData(MyDoggyTransferable.TOOL_WINDOW_TAB_ID_DF)
);
tab.getOwner().removeToolWindowTab(tab);
toolWindow = (ToolWindow) tab.getDockableDelegator();
toolWindow.setAnchor(anchor, index);
toolWindow.setActive(true);
} else {
boolean oldAggregateMode = toolWindow.isAggregateMode();
toolWindow.setAggregateMode(true);
try {
toolWindow.setAnchor(anchor, index);
} finally {
toolWindow.setAggregateMode(oldAggregateMode);
}
}
dtde.dropComplete(true);
} catch (Exception e) {
e.printStackTrace();
dtde.rejectDrop();
}
} else if (transferable.isDataFlavorSupported(MyDoggyTransferable.CONTENT_ID_DF)) {
((ToolWindowBarDropTarget) dtde.getDropTargetContext().getDropTarget()).hidePosition(true);
try {
String contentId = (String) transferable.getTransferData(MyDoggyTransferable.CONTENT_ID_DF);
Content content = manager.getContentManager().getContent(contentId);
if (content == null)
return;
dtde.acceptDrop(DnDConstants.ACTION_MOVE);
// Chech if it was a tab
if (content.getDockableDelegator() != null) {
if (content.getDockableDelegator() instanceof ToolWindow) {
ToolWindow toolWindow = (ToolWindow) content.getDockableDelegator();
manager.getContentManager().removeContent(content);
toolWindow.setAnchor(anchor, index);
toolWindow.setActive(true);
}
}
dtde.dropComplete(true);
} catch (Exception e) {