Omaha #5483 - Fix hi-dpi issues in hydro Data Sources dialog.

Change-Id: If2e1d1279b09ce97b1ec8b7804c1a2e3c968efa0

Former-commit-id: 5ebba7665c39ca689aec696b01f5de3d69073dcf
This commit is contained in:
David Gillingham 2016-04-22 14:42:45 -05:00
parent b501c05d55
commit 810f7888e7
3 changed files with 503 additions and 537 deletions

View file

@ -27,7 +27,7 @@ import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.datasources.DataSourcesDlg;
@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 12/16/2008 1782 grichard Refreshed Data Sources.
* 1/11/2008 1802 askripsk HydroBase implementation.
* 07/15/2013 2088 rferrel Changes for non-blocking DataSourceDlg.
* 04/22/2016 5483 dgilling Code cleanup.
*
* </pre>
*
@ -54,19 +55,18 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*
*/
public class DataSourcesAction extends AbstractHandler {
private final Map<String, DataSourcesDlg> dataSourcesDlgMap = new HashMap<String, DataSourcesDlg>();
private final Map<String, DataSourcesDlg> dataSourcesDlgMap = new HashMap<>();
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
Shell shell = HandlerUtil.getActiveShellChecked(arg0);
HydroDisplayManager manager = HydroDisplayManager.getInstance();
if (manager.isCurrentLidSelected(shell)) {
String lid = manager.getCurrentLid();
final String lid = manager.getCurrentLid();
DataSourcesDlg dataSourcesDlg = dataSourcesDlgMap.get(lid);
if (dataSourcesDlg == null || dataSourcesDlg.isDisposed()) {
if ((dataSourcesDlg == null) || (dataSourcesDlg.isDisposed())) {
String name = manager.getCurrentData().getName();
StringBuilder displayString = new StringBuilder(" - ");
@ -77,14 +77,11 @@ public class DataSourcesAction extends AbstractHandler {
dataSourcesDlg = new DataSourcesDlg(shell,
displayString.toString(), lid, false);
dataSourcesDlg.setCloseCallback(new ICloseCallback() {
dataSourcesDlg.addCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
String lid = returnValue.toString();
dataSourcesDlgMap.remove(lid);
}
dataSourcesDlgMap.remove(lid);
}
});
dataSourcesDlg.open();

View file

@ -166,6 +166,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Changes for non-blocking RatingCurveDlg.
* Changes for non-blocking TextReportDlg.
* 04/11/2016 5483 dgilling Fix hard-coded layouts in HBPasswordDlg.
* 04/22/2016 5483 dgilling Code cleanup.
*
* </pre>
*
@ -341,7 +342,7 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
/**
* Allow one instance per station.
*/
private final Map<String, DataSourcesDlg> dataSourcesDlgMap = new HashMap<String, DataSourcesDlg>();
private final Map<String, DataSourcesDlg> dataSourcesDlgMap = new HashMap<>();
/**
* Allow one instance per station.
@ -779,19 +780,16 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
* Display data source dialog for selected station.
*/
private void handleDataSouceDlg() {
String lid = getSelectedLocation().getStation();
final String lid = getSelectedLocation().getStation();
DataSourcesDlg dataSourcesDlg = dataSourcesDlgMap.get(lid);
if (dataSourcesDlg == null || dataSourcesDlg.isDisposed()) {
dataSourcesDlg = new DataSourcesDlg(shell, getStationAndName(),
lid, true);
dataSourcesDlg.setCloseCallback(new ICloseCallback() {
dataSourcesDlg.addCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
String lid = returnValue.toString();
dataSourcesDlgMap.remove(lid);
}
dataSourcesDlgMap.remove(lid);
}
});
dataSourcesDlg.open();