summaryrefslogtreecommitdiff
path: root/java/management/eclipse-plugin
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2009-02-27 18:03:47 +0000
committerRobert Gemmell <robbie@apache.org>2009-02-27 18:03:47 +0000
commitbdf674be05b7a205ad3802e14df4d686746d657b (patch)
treec11ce56e4a283fa8622278190e00cec4ae229943 /java/management/eclipse-plugin
parent65888b790e8bc11c441baadfbf75e872633c2da8 (diff)
downloadqpid-python-bdf674be05b7a205ad3802e14df4d686746d657b.tar.gz
QPID-1590: make add server and reconnect dialogues centre within the app window to fix multimonitor issues
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@748620 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin')
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java18
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java18
2 files changed, 22 insertions, 14 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
index ce7d8816ba..80f01b1d8c 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
@@ -103,6 +103,8 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
*/
private void createAddServerPopup()
{
+ final Shell appShell = _window.getShell();
+
Display display = Display.getCurrent();
final Shell shell = new Shell(display, SWT.BORDER | SWT.CLOSE);
shell.setText(ACTION_ADDSERVER);
@@ -112,9 +114,11 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
createWidgets(shell);
shell.pack();
- //get current size dialog, and screen size
- int displayWidth = display.getBounds().width;
- int displayHeight = display.getBounds().height;
+ //get current size dialog, and application window size and location
+ int appWidth = appShell.getBounds().width;
+ int appHeight = appShell.getBounds().height;
+ int appLocX = appShell.getBounds().x;
+ int appLocY = appShell.getBounds().y;
int currentShellWidth = shell.getSize().x;
int currentShellHeight = shell.getSize().y;
@@ -125,8 +129,8 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
int newShellWidth = currentShellWidth > minShellWidth ? currentShellWidth : minShellWidth;
int newShellHeight = currentShellHeight > minShellHeight ? currentShellHeight : minShellHeight;
- //set the final size and centre the dialog
- shell.setBounds((displayWidth - newShellWidth)/2 , (displayHeight - newShellHeight)/2, newShellWidth, newShellHeight);
+ //set the final size and centre the dialog within the app window
+ shell.setBounds((appWidth - newShellWidth)/2 + appLocX, (appHeight - newShellHeight)/2 + appLocY, newShellWidth, newShellHeight);
shell.open();
_window.getShell().setEnabled(false);
@@ -228,7 +232,7 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
if (event.character == SWT.ESC)
{
//Escape key acts as cancel on all widgets
- shell.close();
+ shell.dispose();
}
}
});
@@ -314,7 +318,7 @@ public class AddServer extends AbstractAction implements IWorkbenchWindowActionD
if (event.character == SWT.ESC)
{
//Escape key acts as cancel on all widgets
- shell.close();
+ shell.dispose();
}
}
});
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
index ce9d80d49b..5eb9d9a168 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
@@ -99,6 +99,8 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
// Create the login popup fot th user to enter usernaem and password
private void createLoginPopup()
{
+ final Shell appShell = _window.getShell();
+
Display display = Display.getCurrent();
final Shell shell = new Shell(display, SWT.BORDER | SWT.CLOSE);
shell.setText(_title);
@@ -108,9 +110,11 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
createWidgets(shell);
shell.pack();
- //get current size dialog, and screen size
- int displayWidth = display.getBounds().width;
- int displayHeight = display.getBounds().height;
+ //get current size dialog, and application window size and location
+ int appWidth = appShell.getBounds().width;
+ int appHeight = appShell.getBounds().height;
+ int appLocX = appShell.getBounds().x;
+ int appLocY = appShell.getBounds().y;
int currentShellWidth = shell.getSize().x;
int currentShellHeight = shell.getSize().y;
@@ -121,8 +125,8 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
int newShellWidth = currentShellWidth > minShellWidth ? currentShellWidth : minShellWidth;
int newShellHeight = currentShellHeight > minShellHeight ? currentShellHeight : minShellHeight;
- //set the final size and centre the dialog
- shell.setBounds((displayWidth - newShellWidth)/2 , (displayHeight - newShellHeight)/2, newShellWidth, newShellHeight);
+ //set the final size and centre the dialog within the app window
+ shell.setBounds((appWidth - newShellWidth)/2 + appLocX, (appHeight - newShellHeight)/2 + appLocY, newShellWidth, newShellHeight);
shell.open();
_window.getShell().setEnabled(false);
@@ -182,7 +186,7 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
if (event.character == SWT.ESC)
{
//Escape key acts as cancel on all widgets
- shell.close();
+ shell.dispose();
}
}
});
@@ -248,7 +252,7 @@ public class ReconnectServer extends AbstractAction implements IWorkbenchWindowA
if (event.character == SWT.ESC)
{
//Escape key acts as cancel on all widgets
- shell.close();
+ shell.dispose();
}
}
});