protected void setDialogPosition(Shell shell) { String position = this.getConfiguration().getProperty(CFG_POSITION, "left-top"); if (DisplayManager.getDefaultDisplay() == null) { this.m_logger.severe("Could not get monitor device object for dialog."); return; } Monitor primaryMonitor = DisplayManager.getDefaultDisplay().getPrimaryMonitor(); int offset = m_instance_count * 15; int x = 0, y = 0; // added 2008/04/07: set minimal width and height shell.setBounds( x, y, Math.max(shell.getBounds().width, 165), Math.max(shell.getBounds().height, 115)); if (position.equalsIgnoreCase("left-top")) { x = 5 + offset; y = 5 + offset; } if (position.equalsIgnoreCase("right-top") || position.length() == 0) { y = 5 + offset; x = primaryMonitor.getClientArea().width - shell.getBounds().width - 30 - offset; } if (position.equalsIgnoreCase("left-bottom")) { x = 5; y = primaryMonitor.getClientArea().height - shell.getBounds().height - 35 - offset; } if (position.equalsIgnoreCase("right-bottom")) { x = primaryMonitor.getClientArea().width - shell.getBounds().width - 30 - offset; y = primaryMonitor.getClientArea().height - shell.getBounds().height - 35 - offset; } if (position.equalsIgnoreCase("center")) { x = (primaryMonitor.getClientArea().width / 2) - (shell.getBounds().width / 2) - 1 - offset; y = (primaryMonitor.getClientArea().height / 2) - (shell.getBounds().height / 2) - 35 - offset; } // dialog has free defined position if (this.isFreePositioning()) { x = this.getFreePosX(); y = this.getFreePosY(); } shell.setBounds(x, y, shell.getBounds().width, shell.getBounds().height); }