Merge "Issue #1298 Changes for non-blocking BrightnessDialog." into development

Former-commit-id: 276ce2ad08 [formerly 8d14e957dc2152a31c813a9278646904e2a3c777]
Former-commit-id: e47d1beb09
This commit is contained in:
Lee Venable 2012-10-30 16:45:35 -05:00 committed by Gerrit Code Review
commit cebd35bb47
2 changed files with 21 additions and 13 deletions

View file

@ -27,7 +27,7 @@ import com.raytheon.viz.gfe.dialogs.BrightnessDialog;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* TODO Add Description
* Action class for dispalying the Change Brightness dialog.
*
* <pre>
*
@ -35,6 +35,7 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 18, 2010 wldougher Initial creation
* Oct 30, 2012 1298 rferrel Changes for non-blocking BrightnessDialog.
*
* </pre>
*
@ -43,6 +44,7 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
*/
public class ChangeBrightnessAction extends AbstractRightClickAction {
private BrightnessDialog dialog;
protected Parm parm;
@ -53,10 +55,15 @@ public class ChangeBrightnessAction extends AbstractRightClickAction {
@Override
public void run() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
BrightnessDialog dialog = new BrightnessDialog(shell, parm);
dialog.open();
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dialog = new BrightnessDialog(shell, parm);
dialog.setBlockOnOpen(false);
dialog.open();
} else {
dialog.bringToTop();
}
}
}

View file

@ -54,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 18, 2010 wldougher Initial creation
* Oct 30, 2012 1298 rferrel Code cleanup for non-blocking dialog.
*
* </pre>
*
@ -64,38 +65,38 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
public class BrightnessDialog extends CaveJFACEDialog {
// A width hint that keeps part of the title from being cut off
private static final int WIDTH_HINT = 235;
private final int WIDTH_HINT = 235;
/**
* A label for displaying the scale's value, that moves with the scale thumb
*/
protected Label driftingLabel;
private Label driftingLabel;
/**
* A scale for adjusting brightness.
*/
protected Scale scale;
private Scale scale;
/**
* A text field; an alternate way of changing the brightness.
*/
protected Text field;
private Text field;
/**
* The brightness for the weather element (0-1).
*/
protected float brightness;
private float brightness;
/**
* The brightness value when the dialog is first opened. Used by field
* validation code.
*/
protected float originalBrightness;
private float originalBrightness;
/**
* The composite for the main dialog area.
*/
protected Composite comp;
private Composite comp;
private Parm parm;
@ -104,7 +105,7 @@ public class BrightnessDialog extends CaveJFACEDialog {
/**
* Multiplier to keep driftingLabel from very ends of the dialog.
*/
protected static final float FUDGE_FACTOR = 0.8f;
private final float FUDGE_FACTOR = 0.8f;
/**
* Constructor.