Merge "Issue #1298 Changes for GFEConfigDialog. Must be used as a blocking dialog." into development

Former-commit-id: 0b9b82f99d [formerly 51c60c1876] [formerly 868fe53216] [formerly 2c86fdb2d0 [formerly 868fe53216 [formerly 08784a33471cc96472370081f31d7d7edb2a61f7]]]
Former-commit-id: 2c86fdb2d0
Former-commit-id: f0a60833c7d918fac07817906b853f6e6861dcc3 [formerly 881a8e726b]
Former-commit-id: 7b0e8774db
This commit is contained in:
Lee Venable 2012-10-30 16:46:30 -05:00 committed by Gerrit Code Review
commit 5226755f8b
2 changed files with 38 additions and 19 deletions

View file

@ -34,6 +34,20 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolJob;
/**
* The activator class controls the plug-in life cycle
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Oct 30, 2012 1298 rferrel Must be a blocking dialog.
*
* </pre>
*
* @author unknown
* @version 1.0
*/
public class Activator extends AbstractUIPlugin implements BundleActivator {
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -101,17 +115,22 @@ public class Activator extends AbstractUIPlugin implements BundleActivator {
public PythonPreferenceStore getPreferenceStore() {
synchronized (this) {
if (pythonPrefs == null) {
if (cfgDlg == null) {
if (cfgDlg == null || cfgDlg.getShell() == null
|| cfgDlg.isDisposed()) {
cfgDlg = new GFEConfigDialog(
new Shell(Display.getDefault()));
// Must keep as a blocking dialog for eclipse plugins to
// work properly.
cfgDlg.setBlockOnOpen(true);
cfgDlg.open();
} else {
cfgDlg.bringToTop();
}
cfgDlg.setBlockOnOpen(true);
cfgDlg.open();
String config = cfgDlg.getConfig();
// this is necessary because we sometimes get in here
// recursively and only want to do this once
if (pythonPrefs == null) {
String config = cfgDlg.getConfig();
pythonPrefs = new PythonPreferenceStore(config);
statusHandler.handle(Priority.EVENTA,
"GFE started with configuration: " + config);

View file

@ -83,6 +83,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Date Ticket// Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 30, 2009 randerso Initial creation
* Oct 30, 2012 1298 rferrel Code cleanup for non-blocking dialog.
*
* </pre>
*
@ -91,34 +92,33 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
*/
public class GFEConfigDialog extends CaveJFACEDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GFEConfigDialog.class);
private static final String DEFAULT_CONFIG = "gfeConfig";
private final String DEFAULT_CONFIG = "gfeConfig";
private static final String LAST_CONFIG = FileUtil.join("gfe",
"lastConfig.txt");
private final String LAST_CONFIG = FileUtil.join("gfe", "lastConfig.txt");
// Number of votes for Extra Photos
private static final int[][] splashVotes = new int[][] { { 14, 10 },
{ 15, 8 }, { 16, 7 }, { 17, 5 }, { 18, 5 }, { 19, 8 }, { 20, 5 },
{ 21, 7 }, { 22, 7 }, { 23, 5 }, { 24, 6 }, { 25, 9 }, { 26, 6 },
{ 27, 9 }, { 28, 8 } };
private final int[][] splashVotes = new int[][] { { 14, 10 }, { 15, 8 },
{ 16, 7 }, { 17, 5 }, { 18, 5 }, { 19, 8 }, { 20, 5 }, { 21, 7 },
{ 22, 7 }, { 23, 5 }, { 24, 6 }, { 25, 9 }, { 26, 6 }, { 27, 9 },
{ 28, 8 } };
private static final int[][] splashDist = new int[splashVotes.length][2];
private final int[][] splashDist = new int[splashVotes.length][2];
// Percentage of time to show a winner
private static final double winnerThreshold = .65;
private final double winnerThreshold = .65;
// Percentage of time to show an extra photo
private static final double extrasThreshold = .30;
private final double extrasThreshold = .30;
// The remainder will be developer's choice photos
private static final int totalPics = 45;
private final int totalPics = 45;
private static final int totalVotes;
private final int totalVotes;
static {
{
int val = 0;
for (int i = 0; i < splashVotes.length; i++) {
val += splashVotes[i][1];
@ -128,7 +128,7 @@ public class GFEConfigDialog extends CaveJFACEDialog {
totalVotes = val;
}
private static Set<Integer> usedImages = new HashSet<Integer>(totalPics);
private Set<Integer> usedImages = new HashSet<Integer>(totalPics);
private Image image;