aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
}
}