Issue #1229 Changes for non-blocking BackgroundColorDialog.

Change-Id: Ie3d72e33a33ebdd12fe0b66047fd211e049474d9

Former-commit-id: 23c93af437fa662cc7df98e69a8bd383aabbab41
This commit is contained in:
Roger Ferrel 2012-10-16 17:00:11 -05:00
parent d51ba247d1
commit d60b4ca396
3 changed files with 15 additions and 5 deletions

View file

@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
import com.raytheon.viz.ui.color.IBackgroundColorChangedListener.BGColorMode;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog;
/**
@ -38,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 1, 2009 mschenke Initial creation
* Oct 16, 2012 1229 rferrel Changes for non-blocking BackgroundColorDialog.
*
* </pre>
*
@ -67,12 +69,18 @@ public class SetBackgroundColorAction extends AbstractRightClickAction {
@Override
public void run() {
BackgroundColorDialog dialog = dialogMap.get(container);
if (dialog == null) {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
dialog = new BackgroundColorDialog(Display.getCurrent()
.getActiveShell(), container, mode);
dialogMap.put(container, dialog);
dialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
dialogMap.remove(container);
}
});
dialog.open();
dialogMap.remove(container);
} else {
dialog.bringToTop();
}

View file

@ -38,6 +38,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 7,2008 Dan Fitch Initial Creation
* Oct 16, 2012 1229 rferrel Changed for non-blocking BackgroundColorDialog.
*
* </pre>
*
@ -50,11 +51,10 @@ public class SetBackgroundColor extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (dialog == null) {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
dialog = new BackgroundColorDialog(
HandlerUtil.getActiveShell(event), null, BGColorMode.GLOBAL);
dialog.open();
dialog = null;
} else {
dialog.bringToTop();
}

View file

@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 1/8/2008 706 Dan Fitch Initial Creation.
* 10/16/2012 1229 rferrel Make dialog non-blocking.
*
* </pre>
*
@ -108,7 +109,8 @@ public class BackgroundColorDialog extends CaveSWTDialog implements
*/
public BackgroundColorDialog(Shell parent, IDisplayPaneContainer container,
BGColorMode mode) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN, CAVE.PERSPECTIVE_INDEPENDENT);
super(parent, SWT.DIALOG_TRIM | SWT.MIN, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
setText("Set Background Color");
this.container = container;
this.mode = mode;