Issue #2353 - fixed cursor memory leaks
Former-commit-id: 0481bd1eaf467d1be6b8cc2f558f2de0301969ad
This commit is contained in:
parent
dcab61ba26
commit
e70475bb7b
8 changed files with 70 additions and 80 deletions
|
@ -23,7 +23,6 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
@ -38,6 +37,7 @@ import com.raytheon.viz.mpe.ui.dialogs.gagetable.GageTableDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 28, 2009 mpduff Initial creation
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leaks.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,40 +46,16 @@ import com.raytheon.viz.mpe.ui.dialogs.gagetable.GageTableDlg;
|
|||
*/
|
||||
|
||||
public class GageTableAction extends AbstractHandler {
|
||||
private Cursor waitCursor = null;
|
||||
|
||||
private Cursor arrowCursor = null;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
waitCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
|
||||
arrowCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_ARROW);
|
||||
|
||||
shell.setCursor(waitCursor);
|
||||
shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
GageTableDlg gageTable = new GageTableDlg();
|
||||
gageTable.open();
|
||||
// try {
|
||||
// gageTable.showGageTable();
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
// | SWT.OK);
|
||||
// mb.setText("Error");
|
||||
// mb
|
||||
// .setMessage("Unable to open Gage Table Dialog.");
|
||||
// mb.open();
|
||||
// } catch (IOException e) {
|
||||
// MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
// | SWT.OK);
|
||||
// mb.setText("Error");
|
||||
// mb
|
||||
// .setMessage("Unable to open Gage Table Dialog.");
|
||||
// mb.open();
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
shell.setCursor(arrowCursor);
|
||||
shell.setCursor(null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.ArrayList;
|
|||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
@ -51,6 +50,7 @@ import com.raytheon.viz.mpe.util.ReadTemperatureStationList;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 1, 2009 snaples Initial creation
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leaks.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,9 +77,7 @@ public class ScreeningOptions {
|
|||
ArrayList<Station> temp_stations = DailyQcUtils.temperature_stations;
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
final Cursor prevCursor = shell.getCursor();
|
||||
final Cursor waitCursor = new Cursor(Display.getDefault(),
|
||||
SWT.CURSOR_WAIT);
|
||||
Cursor prevCursor = shell.getCursor();
|
||||
|
||||
if (client_data == 0) {
|
||||
pdata[pcpn_day].stddev = 5.0f;
|
||||
|
@ -97,7 +95,7 @@ public class ScreeningOptions {
|
|||
tdata[pcpn_day].stddev = 5.0f;
|
||||
}
|
||||
|
||||
shell.setCursor(waitCursor);
|
||||
shell.setCursor(shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
|
||||
/*
|
||||
* do not estimate daily and partial point precipitation from each other
|
||||
|
|
|
@ -66,6 +66,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul, 7 2009 snaples Initial creation
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -382,7 +383,7 @@ public class QcFreezeOptionsDialog extends AbstractMPEDialog {
|
|||
dataOptionsGroup.setLayoutData(gd);
|
||||
final Shell shell = this.getParent();
|
||||
final Cursor prevCursor = shell.getCursor();
|
||||
final Cursor waitCursor = new Cursor(Display.getDefault(),
|
||||
final Cursor waitCursor = Display.getDefault().getSystemCursor(
|
||||
SWT.CURSOR_WAIT);
|
||||
|
||||
// Create a container to hold the label and the combo box.
|
||||
|
|
|
@ -66,7 +66,7 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Ts;
|
|||
* Nov 12, 2008 snaples Initial creation
|
||||
* Mar 7, 2013 15657 lbousaidi fixed DQC slider and added listener to the Keys
|
||||
* when pressed.
|
||||
*
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -381,7 +381,7 @@ public class QcPrecipOptionsDialog extends AbstractMPEDialog {
|
|||
dataOptionsGroup.setLayoutData(gd);
|
||||
final Shell shell = this.getParent();
|
||||
final Cursor prevCursor = shell.getCursor();
|
||||
final Cursor waitCursor = new Cursor(Display.getDefault(),
|
||||
final Cursor waitCursor = Display.getDefault().getSystemCursor(
|
||||
SWT.CURSOR_WAIT);
|
||||
|
||||
if (MPEDisplayManager.pcpn_time_step != 1) {
|
||||
|
@ -910,9 +910,8 @@ public class QcPrecipOptionsDialog extends AbstractMPEDialog {
|
|||
});
|
||||
|
||||
/**
|
||||
* Add a key listener for up and down arrows
|
||||
* to move up and down through the filter
|
||||
* scale
|
||||
* Add a key listener for up and down arrows to move up and down through
|
||||
* the filter scale
|
||||
*/
|
||||
|
||||
pntFilter.addKeyListener(new KeyAdapter() {
|
||||
|
@ -966,9 +965,8 @@ public class QcPrecipOptionsDialog extends AbstractMPEDialog {
|
|||
|
||||
});
|
||||
/**
|
||||
* Add a key listener for up and down arrows
|
||||
* to move up and down through the reverse filter
|
||||
* scale
|
||||
* Add a key listener for up and down arrows to move up and down through
|
||||
* the reverse filter scale
|
||||
*/
|
||||
pntRevFilter.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Ts;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 12, 2008 snaples Initial creation
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -375,7 +376,7 @@ public class QcTempOptionsDialog extends AbstractMPEDialog {
|
|||
dataOptionsGroup.setLayoutData(gd);
|
||||
final Shell shell = this.getParent();
|
||||
final Cursor prevCursor = shell.getCursor();
|
||||
final Cursor waitCursor = new Cursor(Display.getDefault(),
|
||||
final Cursor waitCursor = Display.getDefault().getSystemCursor(
|
||||
SWT.CURSOR_WAIT);
|
||||
|
||||
// Create a container to hold the label and the combo box.
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Jan 26, 2011 7761 bkowal The value associated with polygons
|
||||
* with the "scale" action will no
|
||||
* longer be divided by 100.
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -120,7 +121,7 @@ public class DrawPolygonDlg extends CaveSWTDialog {
|
|||
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Edit Precipitation");
|
||||
this.resource = resource;
|
||||
waitCursor = new Cursor(parentShell.getDisplay(), SWT.CURSOR_WAIT);
|
||||
waitCursor = parentShell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.viz.ui.input.InputAdapter;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 8, 2011 mschenke Initial creation
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leak.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,7 +72,7 @@ public abstract class AbstractMPEInputResource extends
|
|||
map.put(PROPERTY, false);
|
||||
}
|
||||
|
||||
private static final Cursor CURSOR_HAND = new Cursor(Display.getDefault(),
|
||||
private final Cursor CURSOR_HAND = Display.getDefault().getSystemCursor(
|
||||
SWT.CURSOR_HAND);
|
||||
|
||||
/** Input handler for polygon creation and dialog opening */
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2009 snaples Initial creation
|
||||
* Dec 04, 2012 15544 wkwock fix missing 12z-18z after 12
|
||||
* Sep 11, 2013 #2353 lvenable Fixed cursor memory leaks and Scanner resource leak.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -877,13 +878,12 @@ public class DailyQcUtils {
|
|||
qcDays = MPEDataManager.getInstance().getDQCDays();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
Cursor prev = shell.getCursor();
|
||||
Cursor wait = new Cursor(Display.getDefault(), SWT.CURSOR_WAIT);
|
||||
shell.setCursor(wait);
|
||||
Cursor prevCursor = shell.getCursor();
|
||||
shell.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
new_area_flag = 1;
|
||||
int retval = loadDataSet();
|
||||
lastQcArea = currentQcArea;
|
||||
shell.setCursor(prev);
|
||||
shell.setCursor(prevCursor);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -930,15 +930,15 @@ public class DailyQcUtils {
|
|||
|| newarea == true) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
Cursor prev = shell.getCursor();
|
||||
Cursor wait = new Cursor(Display.getDefault(), SWT.CURSOR_WAIT);
|
||||
shell.setCursor(wait);
|
||||
Cursor prevCursor = shell.getCursor();
|
||||
shell.setCursor(Display.getDefault().getSystemCursor(
|
||||
SWT.CURSOR_WAIT));
|
||||
int retval = loadDataSet();
|
||||
if (retval == 2) {
|
||||
load_gage_data_once = 1;
|
||||
}
|
||||
lastQcArea = currentQcArea;
|
||||
shell.setCursor(prev);
|
||||
shell.setCursor(prevCursor);
|
||||
return retval;
|
||||
} else {
|
||||
new_area_flag = 1;
|
||||
|
@ -1022,10 +1022,14 @@ public class DailyQcUtils {
|
|||
btime.set(Calendar.SECOND, 0);
|
||||
hrgt12z = 0;
|
||||
}
|
||||
/* In order to allow user access the 12~18Z point data for the most recent day,
|
||||
advance one more day from current day if the later than 18Z */
|
||||
Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
if (currentTime.get(Calendar.HOUR_OF_DAY)>=18) {
|
||||
/*
|
||||
* In order to allow user access the 12~18Z point data for the most
|
||||
* recent day, advance one more day from current day if the later than
|
||||
* 18Z
|
||||
*/
|
||||
Calendar currentTime = Calendar
|
||||
.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
if (currentTime.get(Calendar.HOUR_OF_DAY) >= 18) {
|
||||
btime.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
|
||||
|
@ -1651,12 +1655,13 @@ public class DailyQcUtils {
|
|||
// open and read file containing std dev of point precip data
|
||||
// --------------------------------------------------------------
|
||||
BufferedReader in = null;
|
||||
Scanner s = null;
|
||||
|
||||
try {
|
||||
in = new BufferedReader(new FileReader(precc));
|
||||
String ibuf = "";
|
||||
ibuf = in.readLine();
|
||||
Scanner s = new Scanner(ibuf);
|
||||
s = new Scanner(ibuf);
|
||||
|
||||
pdata[m].stddev = s.nextFloat();
|
||||
|
||||
|
@ -1665,7 +1670,7 @@ public class DailyQcUtils {
|
|||
|
||||
pdata[m].stddev = 3.0f;
|
||||
}
|
||||
in.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("File not found " + precc);
|
||||
} catch (IOException e) {
|
||||
|
@ -1674,6 +1679,12 @@ public class DailyQcUtils {
|
|||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
in = null;
|
||||
}
|
||||
|
||||
if (s != null) {
|
||||
s.close();
|
||||
s = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -1686,7 +1697,7 @@ public class DailyQcUtils {
|
|||
in = new BufferedReader(new FileReader(tpointc));
|
||||
String ibuf = "";
|
||||
ibuf = in.readLine();
|
||||
Scanner s = new Scanner(ibuf);
|
||||
s = new Scanner(ibuf);
|
||||
|
||||
tdata[m].stddev = s.nextFloat();
|
||||
|
||||
|
@ -1695,7 +1706,6 @@ public class DailyQcUtils {
|
|||
tdata[m].stddev = 10.0f;
|
||||
}
|
||||
|
||||
in.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("File not found " + tpointc);
|
||||
} catch (IOException e) {
|
||||
|
@ -1705,6 +1715,10 @@ public class DailyQcUtils {
|
|||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (s != null) {
|
||||
s.close();
|
||||
s = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue