aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2012-09-20 13:40:44 (EDT)
committerMarkus Keller2012-09-20 13:40:44 (EDT)
commit334390383c858261dc51d9501c21aa01d2756795 (patch)
treeec4c56c444c0d394ed45cd6cfd47be47066885b3
parent94e5f7d9199692b2b3719f7dcbe0aec3ced79f3c (diff)
downloadegit-334390383c858261dc51d9501c21aa01d2756795.zip
egit-334390383c858261dc51d9501c21aa01d2756795.tar.gz
egit-334390383c858261dc51d9501c21aa01d2756795.tar.bz2
Fix dialog activation order with multiple detail dialogsrefs/changes/34/7834/3
Multiple detail dialogs are stacked, and the user expects that when he closes the topmost dialog, then the next in the stack comes to front. The old implementation didn't work reliably due to bug 388667. Bug: 389914 Change-Id: I92b02705e00c2f8890dcf788977c6e94b6ebaee3 Signed-off-by: Markus Keller <markus_keller@ch.ibm.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java34
1 files changed, 26 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
index 0b95cd7..7d95f5c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
@@ -14,6 +14,7 @@
package org.eclipse.egit.ui.internal.pull;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -40,6 +41,7 @@ import org.eclipse.jgit.api.RebaseResult;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@@ -185,9 +187,8 @@ public class MultiPullResultDialog extends Dialog {
.getSelection();
boolean enabled = false;
for (Entry<Repository, Object> entry : (List<Entry<Repository, Object>>) sel
- .toList()) {
+ .toList())
enabled |= entry.getValue() instanceof PullResult;
- }
getButton(DETAIL_BUTTON).setEnabled(enabled);
}
});
@@ -241,6 +242,7 @@ public class MultiPullResultDialog extends Dialog {
int yOffset = 0;
int yDelta = -trim.y - 3;
+ final LinkedList<PullResultDialog> dialogs= new LinkedList<PullResultDialog>();
IStructuredSelection sel = (IStructuredSelection) tv.getSelection();
for (Entry<Repository, Object> item : (List<Entry<Repository, Object>>) sel
.toList()) {
@@ -251,7 +253,7 @@ public class MultiPullResultDialog extends Dialog {
xOffset += xDelta;
yOffset += yDelta;
- PullResultDialog dialog = new PullResultDialog(shell,
+ final PullResultDialog dialog = new PullResultDialog(shell,
item.getKey(), (PullResult) item.getValue()) {
private Point initialLocation;
@@ -271,20 +273,36 @@ public class MultiPullResultDialog extends Dialog {
if (resultShell != null
&& !resultShell.isDisposed()) {
Point location = resultShell.getLocation();
- if (location.equals(initialLocation))
+ if (location.equals(initialLocation)) {
+ resultShell.setVisible(false);
resultShell.setLocation(location.x - x,
location.y - y);
+ }
}
boolean result = super.close();
// activate next result dialog (not the multi-result dialog):
- Shell[] subShells = shell.getShells();
- if (subShells.length > 0) {
- subShells[subShells.length - 1].setActive();
- }
+
+ // TODO: This doesn't work due to https://bugs.eclipse.org/388667 :
+// Shell[] subShells = shell.getShells();
+// if (subShells.length > 0) {
+// subShells[subShells.length - 1].setActive();
+// }
+
+ dialogs.remove(this);
+ if (dialogs.size() > 0)
+ dialogs.getLast().getShell().setActive();
+
return result;
}
};
+ dialog.create();
+ dialog.getShell().addShellListener(new ShellAdapter() {
+ public void shellActivated(org.eclipse.swt.events.ShellEvent e) {
+ dialogs.remove(dialog);
+ dialogs.add(dialog);
+ }
+ });
dialog.open();
}
}