Merge "Issue #1229 Changes to make GenScriptsDlg non-blocking." into development

Former-commit-id: 14dc84e644 [formerly a2ff5015a0] [formerly 14dc84e644 [formerly a2ff5015a0] [formerly f8009f760e [formerly 9aa405fe7917790d2dc3989443d57746de9a2106]]]
Former-commit-id: f8009f760e
Former-commit-id: 2da8b89c9f [formerly 01b53a994c]
Former-commit-id: e7adde2f1a
This commit is contained in:
Lee Venable 2012-10-08 09:14:30 -05:00 committed by Gerrit Code Review
commit fc69bfd82e
3 changed files with 55 additions and 26 deletions

View file

@ -73,6 +73,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.HelpUsageDlg;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* This class displays the main Climate Data dialog.
@ -92,7 +93,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* May 24, 2011 #9075 rferrel Changed getObsHistoryFromInv() to scan
* ish-inventory.txt only one time.
* Oct 04, 2012 #1229 rferrel Made non-blocking.
* Oct 04, 2012 #1229 rfrreel Changes of non-blocking ClimateHistoryDlg.
* Oct 04, 2012 #1229 rferrel Changes for non-blocking ClimateHistoryDlg.
* Oct 08, 2012 #1229 rferrel Changes for non-blocking GenScriptsDlg.
*
* </pre>
*
@ -869,12 +871,20 @@ public class ClimateDataMenuDlg extends CaveSWTDialog {
* Display the generate scripts dialog.
*/
private void displayGenerateScriptDialog() {
if (generateScriptsDlg == null) {
if (generateScriptsDlg == null || generateScriptsDlg.getShell() == null
|| generateScriptsDlg.isDisposed()) {
ClimateDataManager.getInstance().assessStationsMap(this);
generateScriptsDlg = new GenScriptsDlg(shell);
Boolean bool = (Boolean) generateScriptsDlg.open("data");
generateScriptsDlg = null;
genScriptsBtn.setEnabled(bool);
generateScriptsDlg = new GenScriptsDlg(shell, "data");
generateScriptsDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
genScriptsBtn.setEnabled((Boolean) returnValue);
}
});
generateScriptsDlg.open();
} else {
generateScriptsDlg.bringToTop();
}
}

View file

@ -70,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* to the correct directory.
* May 10, 2011 #8844 rferrel Display error message when unable
* to save a script.
* Oct 08, 2012 #1229 rferrel Made non-blocking.
*
* </pre>
*
@ -132,23 +133,16 @@ public class GenScriptsDlg extends CaveSWTDialog {
/**
* Constructor.
*
* @param style
* @param parentShell
* Parent shell.
*/
public GenScriptsDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT);
public GenScriptsDlg(Shell parentShell, String style) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
setText("Generate Scripts");
initFtpArgs();
}
/**
* Open the dialog.
*
* @return null.
*/
public Object open(String style) {
this.style = style;
return open();
initFtpArgs();
}
public void preOpened() {

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* This class displays the NCDC Inventory/History dialog.
@ -53,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 16, 2009 #3438 lvenable Initial creation
* Oct 08, 2012 #1229 rferrel Changes for non-blocking GenScriptsDlg.
*
* </pre>
*
@ -225,10 +227,22 @@ public class NCDCInvHistDlg extends CaveSWTDialog {
invScriptBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (generateScriptsDlg == null) {
generateScriptsDlg = new GenScriptsDlg(shell);
generateScriptsDlg.open("inv");
generateScriptsDlg = null;
if (generateScriptsDlg == null
|| generateScriptsDlg.getShell() == null
|| generateScriptsDlg.isDisposed()) {
histScriptBtn.setEnabled(false);
generateScriptsDlg = new GenScriptsDlg(shell, "inv");
generateScriptsDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
histScriptBtn.setEnabled(true);
}
});
generateScriptsDlg.open();
} else {
generateScriptsDlg.bringToTop();
}
}
});
@ -300,10 +314,21 @@ public class NCDCInvHistDlg extends CaveSWTDialog {
histScriptBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (generateScriptsDlg == null) {
generateScriptsDlg = new GenScriptsDlg(shell);
generateScriptsDlg.open("his");
generateScriptsDlg = null;
if (generateScriptsDlg == null
|| generateScriptsDlg.getShell() == null
|| generateScriptsDlg.isDisposed()) {
invScriptBtn.setEnabled(false);
generateScriptsDlg = new GenScriptsDlg(shell, "his");
generateScriptsDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
invScriptBtn.setEnabled(true);
}
});
generateScriptsDlg.open();
} else {
generateScriptsDlg.bringToTop();
}
}
});