Fix for Bug 345764 - DND moves tab to the end even though it seems like a no-op
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java index 9ea16ab..181c56e 100644 --- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java +++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java
@@ -221,9 +221,23 @@ } } + // 'dropIndex' is now the index of the CTabItem to put ourselves before + // we need to adjust this to be a model index + if (dropIndex < dropCTF.getItemCount()) { + CTabItem item = dropCTF.getItem(dropIndex); + MUIElement itemModel = (MUIElement) item.getData(AbstractPartRenderer.OWNING_ME); + + // if we're going before ourselves its a NO-OP + if (itemModel == dragElement) + return; + + dropIndex = itemModel.getParent().getChildren().indexOf(itemModel); + } + if (dragElement instanceof MStackElement) { if (dragElement.getParent() != null) dragElement.getParent().getChildren().remove(dragElement); + if (dropIndex >= 0 && dropIndex < dropStack.getChildren().size()) dropStack.getChildren().add(dropIndex, (MStackElement) dragElement); else