Issue #1353 Changes for non-blocking FFMPSplash and LoadSaveConfigDlg dialogs.
Change-Id: Ie8589daa43e45a83835d119bdecc1674c7104ed0 Former-commit-id:8d386b762a
[formerly991c64f0a9
] [formerly0c83b2a277
] [formerly3cb0385a93
[formerly0c83b2a277
[formerly c243a7bdb065db53dee2a01b251e5fbc5f1ec23e]]] Former-commit-id:3cb0385a93
Former-commit-id: 38dca43e15ed38d02c589e769eeda53a1ff21ddc [formerlyb6ae15b04e
] Former-commit-id:351e3711fb
This commit is contained in:
parent
f3fa72b26b
commit
fd2e92a9b9
5 changed files with 185 additions and 135 deletions
|
@ -87,6 +87,7 @@ import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 04/03/10 4494 D. Hladky Initial release
|
||||
* 12/07/12 1353 rferrel Changes for non-blocking FFMPSplash.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -150,6 +151,11 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPMonitor.class);
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ResourceMonitor#nullifyMonitor()
|
||||
*/
|
||||
@Override
|
||||
public void nullifyMonitor() {
|
||||
|
||||
|
@ -182,7 +188,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ffmpData = null;
|
||||
ffmpAvailableUriQueryDates = null;
|
||||
ffmpAvailableUris = null;
|
||||
|
@ -193,11 +199,25 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
System.gc();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ResourceMonitor#thresholdUpdate(com.raytheon
|
||||
* .uf.viz.monitor.events.IMonitorThresholdEvent)
|
||||
*/
|
||||
@Override
|
||||
public void thresholdUpdate(IMonitorThresholdEvent me) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ResourceMonitor#configUpdate(com.raytheon
|
||||
* .uf.viz.monitor.events.IMonitorConfigurationEvent)
|
||||
*/
|
||||
@Override
|
||||
public void configUpdate(IMonitorConfigurationEvent me) {
|
||||
// updates the config
|
||||
|
@ -388,9 +408,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
|
||||
if (source != null) {
|
||||
|
||||
|
||||
boolean dupOverride = false;
|
||||
if (getSourceConfig().getSource(source).getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
if (getSourceConfig().getSource(source).getSourceType()
|
||||
.equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
dupOverride = true;
|
||||
}
|
||||
|
||||
|
@ -525,7 +546,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
SourceXML sourceXML = fscm.getSource(fsource);
|
||||
FFMPCacheRecord ffmpRec = populateFFMPRecord(true,
|
||||
fdataUri, fsiteKey, fsource, fhuc);
|
||||
//FFMPRecord ffmpRec = loadRecordFromDatabase(fdataUri);
|
||||
// FFMPRecord ffmpRec =
|
||||
// loadRecordFromDatabase(fdataUri);
|
||||
File loc = HDF5Util.findHDF5Location(ffmpRec);
|
||||
IDataStore dataStore = DataStoreFactory
|
||||
.getDataStore(loc);
|
||||
|
@ -545,9 +567,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
ffmpRec.getSourceName(), fbasin);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"FFMP Can't retrieve FFMP URI, "
|
||||
+ fdataUri, e);
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"FFMP Can't retrieve FFMP URI, "
|
||||
+ fdataUri, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +628,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
statusHandler.handle(Priority.WARN,
|
||||
"FFMP Can't find availble URI list for, " + sourceName, e);
|
||||
}
|
||||
|
||||
|
||||
return uris;
|
||||
}
|
||||
|
||||
|
@ -647,12 +670,12 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
Date previousQueryTime = ffmpAvailableUriQueryDates.get(siteKey).get(
|
||||
sourceName);
|
||||
SourceXML source = getSourceConfig().getSource(sourceName);
|
||||
|
||||
if (source.getSourceType().equals(
|
||||
SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
// Always look back for guidance types because of long expiration times,
|
||||
// prevents mosaic brittleness from occurring.
|
||||
retrieveNew = true;
|
||||
|
||||
if (source.getSourceType().equals(SOURCE_TYPE.GUIDANCE.getSourceType())) {
|
||||
// Always look back for guidance types because of long expiration
|
||||
// times,
|
||||
// prevents mosaic brittleness from occurring.
|
||||
retrieveNew = true;
|
||||
}
|
||||
|
||||
if (retrieveNew
|
||||
|
@ -945,14 +968,16 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
FFMPResourceData frd = resource.getResourceData();
|
||||
|
||||
if (loadType == LOADER_TYPE.SECONDARY) {
|
||||
//hucsToLoad.remove("ALL");
|
||||
//hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
|
||||
timeBack = new Date(resource.getMostRecentTime().getTime() - (6 * 1000 * 24));
|
||||
// hucsToLoad.remove("ALL");
|
||||
// hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
|
||||
timeBack = new Date(resource.getMostRecentTime().getTime()
|
||||
- (6 * 1000 * 24));
|
||||
frd.timeBack = timeBack;
|
||||
} else if (loadType == LOADER_TYPE.TERTIARY) {
|
||||
hucsToLoad.clear();
|
||||
hucsToLoad.add("ALL");
|
||||
timeBack = new Date(resource.getMostRecentTime().getTime() - (3600 * 1000 * 24));
|
||||
timeBack = new Date(resource.getMostRecentTime().getTime()
|
||||
- (3600 * 1000 * 24));
|
||||
}
|
||||
|
||||
frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType,
|
||||
|
@ -974,6 +999,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
|
||||
if (ffmpSplash == null) {
|
||||
ffmpSplash = new FFMPSplash(fshell);
|
||||
ffmpSplash.open();
|
||||
// latch
|
||||
int count = 0;
|
||||
while (!getTemplates(fsiteKey).done) {
|
||||
|
@ -981,14 +1007,14 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
try {
|
||||
count++;
|
||||
if (count == 50) {
|
||||
ffmpSplash.disposeDialog();
|
||||
ffmpSplash.close();
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
if (ffmpSplash != null) {
|
||||
ffmpSplash.disposeDialog();
|
||||
ffmpSplash.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1042,7 +1068,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
resource.basinTableDlg.getShell().setActive();
|
||||
resource.basinTableDlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1086,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
|
||||
public synchronized void splashDisposeAndDataLoad(FFMPResource resource) {
|
||||
if (ffmpSplash != null) {
|
||||
ffmpSplash.disposeDialog();
|
||||
ffmpSplash.close();
|
||||
ffmpSplash = null;
|
||||
|
||||
if (resource.isFirst) {
|
||||
|
@ -1080,7 +1106,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
|
||||
public void forceKillFFMPSplash() {
|
||||
if (ffmpSplash != null) {
|
||||
ffmpSplash.disposeDialog();
|
||||
ffmpSplash.close();
|
||||
ffmpSplash = null;
|
||||
}
|
||||
}
|
||||
|
@ -1122,9 +1148,10 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
res.getResourceData().floader = null;
|
||||
int val = siteCount.get(res.getSiteKey());
|
||||
|
||||
|
||||
// clear out the cache
|
||||
for (Entry<String, FFMPCacheRecord> entry: ffmpData.get(res.getSiteKey()).entrySet()){
|
||||
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(
|
||||
res.getSiteKey()).entrySet()) {
|
||||
entry.getValue().closeCache();
|
||||
}
|
||||
|
||||
|
@ -2121,15 +2148,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
// based on "duration". A horizontal line (composed of two
|
||||
// points) will be drawn to represent the precip during
|
||||
// each "duration" period.
|
||||
if ((secondsL < 0) || (secondsR > t1.getTime() / 1000)) { // gage
|
||||
// data
|
||||
// ahead
|
||||
// of
|
||||
// or
|
||||
// beyond
|
||||
// radar
|
||||
// time
|
||||
// range
|
||||
if ((secondsL < 0) || (secondsR > t1.getTime() / 1000)) {
|
||||
// gage data ahead of or beyond radar time range
|
||||
continue;
|
||||
} else {
|
||||
gageAccu += (Float) data1Dur.get(i)[5];
|
||||
|
@ -2347,7 +2367,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
|
||||
public void load() {
|
||||
|
||||
|
||||
if (fffmpRec != null) {
|
||||
|
||||
ConcurrentMap<String, String> uris = getUriMap(fsiteKey,
|
||||
|
@ -2378,7 +2398,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
curRecord = ffmpData.get(fsiteKey).get(mySource);
|
||||
if (curRecord == null) {
|
||||
curRecord = new FFMPCacheRecord(fffmpRec,
|
||||
mySource, getRunConfig().getRunner(wfo).getCacheDir());
|
||||
mySource, getRunConfig().getRunner(wfo)
|
||||
.getCacheDir());
|
||||
ffmpData.get(fsiteKey).put(mySource, curRecord);
|
||||
}
|
||||
}
|
||||
|
@ -2409,7 +2430,8 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
"Retrieving and Populating URI: , "
|
||||
+ dataUri);
|
||||
curRecord.retrieveMapFromDataStore(dataStore,
|
||||
dataUri, getTemplates(fffmpRec.getSiteKey()), fhuc,
|
||||
dataUri,
|
||||
getTemplates(fffmpRec.getSiteKey()), fhuc,
|
||||
fffmpRec.getDataTime().getRefTime(),
|
||||
fffmpRec.getSourceName());
|
||||
} catch (Exception e) {
|
||||
|
@ -2492,7 +2514,7 @@ public class FFMPMonitor extends ResourceMonitor {
|
|||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
|
||||
SourceXML source = getSourceConfig().getSource(fsourceName);
|
||||
|
||||
if (furiMap != null) {
|
||||
|
|
|
@ -31,20 +31,32 @@ import org.eclipse.swt.graphics.Rectangle;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Canvas;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Monitor;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
public class FFMPSplash extends Dialog {
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* Display FFMP Basin Table's splash page dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Initial creation
|
||||
* Dec 7, 2012 1353 rferrel Covert to CaveSWTDialog and make non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FFMPSplash extends CaveSWTDialog {
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
|
@ -70,20 +82,19 @@ public class FFMPSplash extends Dialog {
|
|||
private Image loadImage = null;
|
||||
|
||||
public FFMPSplash(Shell parent) {
|
||||
super(parent, 0);
|
||||
|
||||
open();
|
||||
super(parent, SWT.NO_TRIM | SWT.ON_TOP, CAVE.DO_NOT_BLOCK);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method to show the dialog.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @return Null.
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP);
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
display = shell.getDisplay();
|
||||
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
|
@ -93,14 +104,17 @@ public class FFMPSplash extends Dialog {
|
|||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
}
|
||||
|
||||
shell.pack();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||
*/
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
centerOnScreen();
|
||||
|
||||
shell.setVisible(true);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initializeComponents() {
|
||||
|
@ -185,11 +199,15 @@ public class FFMPSplash extends Dialog {
|
|||
return path;
|
||||
}
|
||||
|
||||
public void disposeDialog() {
|
||||
if (shell != null) {
|
||||
textFont.dispose();
|
||||
loadImage.dispose();
|
||||
shell.dispose();
|
||||
}
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
textFont.dispose();
|
||||
loadImage.dispose();
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
|
|||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Main FFMP dialog.
|
||||
|
@ -102,6 +103,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ColorCell is true.
|
||||
* Dec 06, 2012 1353 rferrel Code clean up.
|
||||
* Changes for non-blocking AttributesDlg.
|
||||
* Changes for non-blocking AttributeThresholdDlg.
|
||||
* Changes for non-blocking LoadSaveConfigDlg.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,6 +118,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FfmpBasinTableDlg.class);
|
||||
|
||||
private LoadSaveConfigDlg loadDlg;
|
||||
|
||||
private LoadSaveConfigDlg saveDlg;
|
||||
|
||||
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
||||
|
||||
private MenuItem linkToFrameMI;
|
||||
|
@ -1714,36 +1721,47 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private void retrieveConfiguration() {
|
||||
if (loadDlg == null) {
|
||||
|
||||
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell,
|
||||
DialogType.OPEN);
|
||||
LocalizationFile fileName = (LocalizationFile) loadDlg.open();
|
||||
loadDlg = new LoadSaveConfigDlg(shell, DialogType.OPEN);
|
||||
loadDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
if (fileName == null) {
|
||||
return;
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
ffmpConfig.loadNewConfig(fileName);
|
||||
|
||||
refreshDisplay(false);
|
||||
} else {
|
||||
shell.setCursor(null);
|
||||
}
|
||||
loadDlg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ffmpConfig.loadNewConfig(fileName);
|
||||
|
||||
refreshDisplay(false);
|
||||
loadDlg.open();
|
||||
}
|
||||
|
||||
private void saveConfiguration() {
|
||||
|
||||
LoadSaveConfigDlg saveDlg = new LoadSaveConfigDlg(shell,
|
||||
DialogType.SAVE_AS);
|
||||
LocalizationFile fileName = (LocalizationFile) saveDlg.open();
|
||||
if (saveDlg == null) {
|
||||
|
||||
if (fileName == null) {
|
||||
return;
|
||||
saveDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS);
|
||||
saveDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
fileName.getFile().getParentFile().mkdirs();
|
||||
ffmpConfig.saveFFMPBasinConfig(fileName);
|
||||
}
|
||||
saveDlg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (fileName.getFile().getParentFile().mkdirs() == false) {
|
||||
System.out.println("Did not not create directory(ies): "
|
||||
+ fileName.toString());
|
||||
}
|
||||
|
||||
ffmpConfig.saveFFMPBasinConfig(fileName);
|
||||
saveDlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,10 +47,37 @@ import com.raytheon.uf.common.localization.LocalizationFile;
|
|||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Display FFMP Basin Table's Load/Save dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Initial creation
|
||||
* Dec 6, 2012 1353 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
public class LoadSaveConfigDlg extends CaveSWTDialog {
|
||||
|
||||
public static enum DialogType {
|
||||
OPEN, SAVE_AS
|
||||
OPEN("Load Configuration"), SAVE_AS("Save Configuration");
|
||||
|
||||
private final String title;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
DialogType(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
};
|
||||
|
||||
private final DialogType dialogType;
|
||||
|
@ -59,8 +86,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
|
||||
private List cfgFileList;
|
||||
|
||||
private LocalizationFile selectedFile;
|
||||
|
||||
private LocalizationFile[] locFiles;
|
||||
|
||||
private TreeMap<String, LocalizationFile> locFileMap;
|
||||
|
@ -73,16 +98,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
|
||||
private Button userBtn;
|
||||
|
||||
// private String selectedFileName = null;
|
||||
|
||||
public LoadSaveConfigDlg(Shell parent, DialogType type) {
|
||||
super(parent, SWT.TITLE);
|
||||
if (type == DialogType.OPEN) {
|
||||
setText("Load Configuration");
|
||||
} else {
|
||||
setText("Save Configuration");
|
||||
}
|
||||
|
||||
super(parent, SWT.TITLE, CAVE.DO_NOT_BLOCK);
|
||||
setText(type.getTitle());
|
||||
dialogType = type;
|
||||
}
|
||||
|
||||
|
@ -99,7 +117,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
setReturnValue(selectedFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,8 +254,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
selectedFile = null;
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -246,8 +262,8 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
private void openAction() {
|
||||
int selectedIndex = cfgFileList.getSelectionIndex();
|
||||
String str = cfgFileList.getItem(selectedIndex);
|
||||
selectedFile = locFileMap.get(str);
|
||||
shell.dispose();
|
||||
setReturnValue(locFileMap.get(str));
|
||||
close();
|
||||
}
|
||||
|
||||
private void saveAction() {
|
||||
|
@ -261,10 +277,12 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, level);
|
||||
String newFileName = "ffmp/guiConfig/" + fileName;
|
||||
selectedFile = pm.getLocalizationFile(context, newFileName);
|
||||
LocalizationFile selectedFile = pm.getLocalizationFile(context,
|
||||
newFileName);
|
||||
|
||||
FFMPConfig.getInstance().saveFFMPBasinConfig(selectedFile);
|
||||
shell.dispose();
|
||||
setReturnValue(selectedFile);
|
||||
close();
|
||||
}
|
||||
|
||||
private boolean validateFileName() {
|
||||
|
@ -287,27 +305,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
return false;
|
||||
}
|
||||
|
||||
// String[] listItems = cfgFileList.getItems();
|
||||
//
|
||||
// for (String listItem : listItems) {
|
||||
// int idx = listItem.lastIndexOf("/");
|
||||
// String fn = listItem.substring(idx + 1);
|
||||
//
|
||||
// if (fn.compareTo(strBuf.toString()) == 0) {
|
||||
// if (listItem.compareTo(strBuf.toString()) == 0) {
|
||||
// MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.YES
|
||||
// | SWT.NO);
|
||||
// mb.setText("Warning");
|
||||
// mb.setMessage("File name already exists. Do you wish to overwrite\n"
|
||||
// + "the existing file?.");
|
||||
// int result = mb.open();
|
||||
//
|
||||
// if (result == SWT.NO) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (strBuf.toString().endsWith(".xml") == false) {
|
||||
strBuf.append(".xml");
|
||||
newFileNameTF.setText(strBuf.toString().trim());
|
||||
|
@ -330,8 +327,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
locFiles = pm.listFiles(contextList
|
||||
.toArray(new LocalizationContext[contextList.size()]),
|
||||
"ffmp/guiConfig", extensions, false, true);
|
||||
// locFiles = PathManagerFactory.getPathManager().listStaticFiles(
|
||||
// "ffmp/guiConfig", extensions, true, true);
|
||||
|
||||
if (locFiles == null) {
|
||||
return;
|
||||
|
@ -350,8 +345,4 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
|
|||
cfgFileList.setSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
public LocalizationFile getSelectedFile() {
|
||||
return selectedFile;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
|
||||
* 31 July 2012 14517 mpduff Fix for blanking map on update.
|
||||
* 14 Sep 2012 1048 njensen Code cleanup
|
||||
* 07 Dec 2012 1353 rferrel Changes for non-blocking FFMPSplash dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1225,7 +1226,7 @@ public class FFMPResource extends
|
|||
}
|
||||
} else {
|
||||
if (getResourceData().getMonitor().ffmpSplash != null) {
|
||||
getResourceData().getMonitor().ffmpSplash.disposeDialog();
|
||||
getResourceData().getMonitor().ffmpSplash.close();
|
||||
getResourceData().getMonitor().ffmpSplash = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue