Omaha #3848 Fix cancelling geotiff import.

Change-Id: I1af55a1ba866fc08814fbb8362334a430b0f7463

Former-commit-id: e1af24d84e [formerly 4c64044de959e709cd00da40826b916a579c44fe]
Former-commit-id: 3e7a1993e3
This commit is contained in:
Nathan Bowler 2014-12-04 13:24:04 -05:00
parent e7b3f59131
commit a5bc553461

View file

@ -1,27 +1,25 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.geotiff.ui;
import java.io.File;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Status;
@ -44,15 +42,16 @@ import com.raytheon.viz.ui.EditorUtil;
/**
* Open an GeoTIFF image
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation.
*
* Dec 04, 2014 3848 nabowle Fix file dialog being cancelled.
*
* </pre>
*
*
* @author chammack
* @version 1
*/
@ -70,43 +69,44 @@ public class OpenImageAction extends AbstractMapHandler {
FileDialog fd = new FileDialog(shell, SWT.OPEN);
fd.setFilterExtensions(new String[] { "*.tif;*.tiff" });
fd.open();
final String fileName = fd.getFilterPath() + File.separator
+ fd.getFileName();
final String fileName = fd.open();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
try {
IDescriptor mapDesc = container.getActiveDisplayPane()
.getRenderableDisplay().getDescriptor();
if (fileName != null) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
try {
IDescriptor mapDesc = container.getActiveDisplayPane()
.getRenderableDisplay().getDescriptor();
if (mapDesc == null) {
Activator
.getDefault()
.getLog()
.log(new Status(Status.ERROR,
Activator.PLUGIN_ID,
"Map does not support GeoTIFFs", null));
if (mapDesc == null) {
Activator
.getDefault()
.getLog()
.log(new Status(Status.ERROR,
Activator.PLUGIN_ID,
"Map does not support GeoTIFFs",
null));
}
GeoTiffResourceData data = new GeoTiffResourceData(
fileName);
LoadProperties lProps = new LoadProperties();
GeoTiffResource gtiff = data.construct(lProps, mapDesc);
ResourceProperties rProps = new ResourceProperties();
rProps.setMapLayer(true);
rProps.setVisible(true);
rProps.setPdProps(new ProgressiveDisclosureProperties());
mapDesc.getResourceList().add(gtiff);
} catch (Exception e) {
e.printStackTrace();
}
GeoTiffResourceData data = new GeoTiffResourceData(fileName);
LoadProperties lProps = new LoadProperties();
GeoTiffResource gtiff = data.construct(lProps, mapDesc);
ResourceProperties rProps = new ResourceProperties();
rProps.setMapLayer(true);
rProps.setVisible(true);
rProps.setPdProps(new ProgressiveDisclosureProperties());
mapDesc.getResourceList().add(gtiff);
} catch (Exception e) {
e.printStackTrace();
}
}
});
});
}
return null;
}
}