aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Aniola2013-01-10 15:46:12 (EST)
committerEric Moffatt2013-01-10 15:46:12 (EST)
commita0c375018d74ecb34887eafb9cc7195863e39dbf (patch)
tree126191211ac004d5226e177094f91507e8eff8f2
parent923c49b5ab2b7e78504051413500bd8ac83393d9 (diff)
downloadeclipse.platform.ui-a0c375018d74ecb34887eafb9cc7195863e39dbf.zip
eclipse.platform.ui-a0c375018d74ecb34887eafb9cc7195863e39dbf.tar.gz
eclipse.platform.ui-a0c375018d74ecb34887eafb9cc7195863e39dbf.tar.bz2
Bug 387678 - [DND] Drag and Drop of view tabs behaves unpredictablyv20130110-204612
(drop feedback and drop behavior)
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/StackDropAgent.java8
1 files changed, 7 insertions, 1 deletions
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 12e99b5..9f756c4 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
@@ -223,7 +223,8 @@ public class StackDropAgent extends DropAgent {
// '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()) {
+ int ctfItemCount = dropCTF.getItemCount();
+ if (dropIndex < ctfItemCount) {
CTabItem item = dropCTF.getItem(dropIndex);
MUIElement itemModel = (MUIElement) item.getData(AbstractPartRenderer.OWNING_ME);
@@ -232,6 +233,11 @@ public class StackDropAgent extends DropAgent {
return;
dropIndex = itemModel.getParent().getChildren().indexOf(itemModel);
+ // if the item is dropped at the last position, there is
+ // no existing item to put ourselves before
+ // so we'll just go to the end.
+ } else if (dropIndex == ctfItemCount) {
+ dropIndex = dropStack.getChildren().size();
}
if (dragElement instanceof MStackElement) {