Merge "Omaha #1664 Fixed invalid thread access in several GFE dialogs" into omaha_14.4.1
Former-commit-id: e59e5c327a8ba0488092d8774ecf65fd6b298a5b
This commit is contained in:
commit
72ce7a78b2
6 changed files with 150 additions and 87 deletions
|
@ -55,6 +55,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.GFEException;
|
||||
|
@ -87,6 +88,7 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
|
|||
* 10/15/2013 #2445 randerso Removed expansion of publish time to span of
|
||||
* overlapping grids since this is now done on
|
||||
* the server side
|
||||
* 08/20/2014 #1664 randerso Fixed invalid thread access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -602,12 +604,16 @@ public class ParmOp {
|
|||
parm.getParmState().setCombineMode(editMode);
|
||||
}
|
||||
|
||||
// WeatherCombineModeChangedMsg::send(_msgHand, editMode);
|
||||
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
|
||||
.getService(ICommandService.class);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ICommandService service = (ICommandService) PlatformUI
|
||||
.getWorkbench().getService(ICommandService.class);
|
||||
|
||||
service.refreshElements("com.raytheon.viz.gfe.actions.setCombineMode",
|
||||
null);
|
||||
service.refreshElements(
|
||||
"com.raytheon.viz.gfe.actions.setCombineMode", null);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.common.dataplugin.gfe.DiscreteTerm;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteDefinition;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKeyDef;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.core.msgs.ICombineModeChangedListener;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
import com.raytheon.viz.gfe.core.parm.ParmState.CombineMode;
|
||||
|
@ -52,6 +53,7 @@ import com.raytheon.viz.gfe.core.wxvalue.DiscreteWxValue;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 22, 2009 #1318 randerso Initial creation
|
||||
* Aug 20, 2014 #1664 randerso Fixed invalid thread access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -224,10 +226,16 @@ public class DiscreteSetValue extends AbstractSetValue implements
|
|||
* com.raytheon.viz.gfe.core.parm.ParmState.CombineMode)
|
||||
*/
|
||||
@Override
|
||||
public void combineModeChanged(Parm parm, CombineMode mode) {
|
||||
public void combineModeChanged(Parm parm, final CombineMode mode) {
|
||||
// Parm Client notification
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
combineButton.setSelection(mode.equals(CombineMode.COMBINE));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void addToSession() {
|
||||
// LogStream.logUse("Add to session")
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Scale;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.msgs.IActivatedParmChangedListener;
|
||||
import com.raytheon.viz.gfe.core.msgs.IDisplayedParmListChangedListener;
|
||||
|
@ -62,6 +63,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2008 Eric Babin Initial Creation
|
||||
* Nov 10, 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
* Aug 20, 2014 #1664 randerso Fixed invalid thread access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -95,7 +97,8 @@ public class FuzzValueDialog extends CaveJFACEDialog implements
|
|||
private static FuzzValueDialog dialog;
|
||||
|
||||
public static void openDialog(DataManager dataManager) {
|
||||
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||
if ((dialog == null) || (dialog.getShell() == null)
|
||||
|| dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
|
@ -113,8 +116,6 @@ public class FuzzValueDialog extends CaveJFACEDialog implements
|
|||
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
|
||||
this.dataManager = dataManager;
|
||||
this.parm = dataManager.getSpatialDisplayManager().getActivatedParm();
|
||||
this.minimum = parm.getGridInfo().getMinValue();
|
||||
this.maximum = parm.getGridInfo().getMaxValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,40 +135,34 @@ public class FuzzValueDialog extends CaveJFACEDialog implements
|
|||
}
|
||||
|
||||
private void initializeComponents() {
|
||||
GridData data = new GridData(GridData.FILL_HORIZONTAL);
|
||||
GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
data.horizontalSpan = 2;
|
||||
data.horizontalAlignment = SWT.CENTER;
|
||||
lab = new Label(top, SWT.BORDER);
|
||||
lab.setText(this.parm.getParmID().getParmName() + " Fuzz");
|
||||
lab = new Label(top, SWT.CENTER);
|
||||
lab.setLayoutData(data);
|
||||
|
||||
data = new GridData(200, SWT.DEFAULT);
|
||||
data.horizontalAlignment = SWT.CENTER;
|
||||
fuzzSlider = new Scale(top, SWT.HORIZONTAL);
|
||||
fuzzSlider.setLayoutData(data);
|
||||
|
||||
int precision = parm.getGridInfo().getPrecision();
|
||||
resolution = Math.pow(10, precision);
|
||||
fuzzSlider.setMinimum(0);
|
||||
|
||||
scaleSlider = new Label(top, SWT.NONE);
|
||||
data = new GridData(40, SWT.DEFAULT);
|
||||
data.horizontalAlignment = SWT.CENTER;
|
||||
scaleSlider.setLayoutData(data);
|
||||
|
||||
fuzzSlider.setMinimum(0);
|
||||
fuzzSlider.setMaximum((int) (maximum - minimum) / 5 * (int) resolution);
|
||||
fuzzSlider.setSelection((int) (resolution * this.parm.getParmState()
|
||||
.getFuzzValue()));
|
||||
updateDialog();
|
||||
|
||||
fuzzSlider.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0) {
|
||||
setValues();
|
||||
}
|
||||
});
|
||||
setValues();
|
||||
}
|
||||
|
||||
private void setValues() {
|
||||
|
@ -225,19 +220,33 @@ public class FuzzValueDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
public void activatedParmChanged(Parm newParm) {
|
||||
parm = newParm;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void updateDialog() {
|
||||
if (parm != null) {
|
||||
lab.setText(parm.getParmID().getParmName() + " Delta");
|
||||
lab.setText(parm.getParmID().getParmName() + " Fuzz");
|
||||
minimum = parm.getGridInfo().getMinValue();
|
||||
maximum = parm.getGridInfo().getMaxValue();
|
||||
int precision = parm.getGridInfo().getPrecision();
|
||||
resolution = Math.pow(10, precision);
|
||||
fuzzSlider.setMaximum((int) (maximum - minimum) / 5
|
||||
fuzzSlider.setMaximum(((int) (maximum - minimum) / 5)
|
||||
* (int) resolution);
|
||||
fuzzSlider.setSelection((int) (resolution * this.parm
|
||||
.getParmState().getDeltaValue()));
|
||||
fuzzSlider.setEnabled(true);
|
||||
setValues();
|
||||
} else {
|
||||
lab.setText("No active weather element");
|
||||
fuzzSlider.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,6 +264,12 @@ public class FuzzValueDialog extends CaveJFACEDialog implements
|
|||
if (parm != null) {
|
||||
if (Arrays.asList(deletions).contains(parm)) {
|
||||
parm = null;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -33,6 +35,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.Activator;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
|
@ -55,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* Sep 16, 2011 dgilling Initial creation
|
||||
* Nov 13, 2012 1298 rferrel Code clean up for non-blocking dialog.
|
||||
* Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs.
|
||||
* Aug 20, 2014 #1664 randerso Fixed invalid thread access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -194,6 +198,20 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
newShell.setText("Delta Value");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createContents(org.eclipse
|
||||
* .swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createContents(Composite parent) {
|
||||
Control contents = super.createContents(parent);
|
||||
setUpDialog();
|
||||
return contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
dialogFrame = (Composite) super.createDialogArea(parent);
|
||||
|
@ -201,11 +219,10 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
dialogFrame.setLayout(layout);
|
||||
dialogFrame.setLayoutData(data);
|
||||
setUpDialog(dialogFrame);
|
||||
return dialogFrame;
|
||||
}
|
||||
|
||||
private void setUpDialog(Composite master) {
|
||||
private void setUpDialog() {
|
||||
// remove any existing ones first
|
||||
if (label != null) {
|
||||
label.dispose();
|
||||
|
@ -229,7 +246,7 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
// Set up the display for setting delta value
|
||||
GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
data.horizontalSpan = 2;
|
||||
label = new Label(master, SWT.CENTER);
|
||||
label = new Label(dialogFrame, SWT.CENTER);
|
||||
label.setText("No active weather element");
|
||||
label.setLayoutData(data);
|
||||
|
||||
|
@ -251,7 +268,7 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
.getGridInfo().getMinValue()) / 5;
|
||||
}
|
||||
|
||||
scale = new Scale(master, SWT.HORIZONTAL);
|
||||
scale = new Scale(dialogFrame, SWT.HORIZONTAL);
|
||||
scale.setMinimum(0);
|
||||
scale.setMaximum((int) (maxLimit / res));
|
||||
scale.setIncrement((int) (1 / res));
|
||||
|
@ -262,20 +279,23 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
scale.setLayoutData(data);
|
||||
scale.addSelectionListener(scaleListener);
|
||||
|
||||
entryLabel = new Label(master, SWT.NONE);
|
||||
entryLabel = new Label(dialogFrame, SWT.NONE);
|
||||
data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
|
||||
entryLabel.setText("Enter Value:");
|
||||
entryLabel.setLayoutData(data);
|
||||
|
||||
data = new GridData(80, SWT.DEFAULT);
|
||||
entryField = new Text(master, SWT.BORDER);
|
||||
entryField = new Text(dialogFrame, SWT.BORDER);
|
||||
entryField.setText(String.format("%-6." + (prec + 1) + "f",
|
||||
origValue).trim());
|
||||
entryField.setLayoutData(data);
|
||||
entryField.addSelectionListener(entryListener);
|
||||
}
|
||||
|
||||
master.layout();
|
||||
}
|
||||
getButton(ADJUST_UP).setEnabled(parm != null);
|
||||
getButton(ADJUST_DOWN).setEnabled(parm != null);
|
||||
|
||||
dialogFrame.layout();
|
||||
getShell().pack(true);
|
||||
}
|
||||
|
||||
|
@ -298,7 +318,12 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
public void activatedParmChanged(Parm newParm) {
|
||||
parm = newParm;
|
||||
setUpDialog(dialogFrame);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setUpDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -313,11 +338,14 @@ public class SetDeltaDialog extends CaveJFACEDialog implements
|
|||
public void displayedParmListChanged(Parm[] parms, Parm[] deletions,
|
||||
Parm[] additions) {
|
||||
if (parm != null) {
|
||||
for (Parm deleted : deletions) {
|
||||
if (parm.equals(deleted)) {
|
||||
if (Arrays.asList(deletions).contains(parm)) {
|
||||
parm = null;
|
||||
setUpDialog(dialogFrame);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setUpDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.core.msgs.IActivatedParmChangedListener;
|
||||
|
@ -56,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* Jun 18, 2009 #1318 randerso Ported AWIPS I pickup value dialogs
|
||||
* Nov 13, 2012 #1298 rferrel Changes for non-blocking dialog.
|
||||
* Mar 29, 2013 #1790 rferrel Bug fix for non-blocking dialogs.
|
||||
* Aug 20, 2014 #1664 randerso Fixed invalid thread access
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -167,7 +169,6 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
valueFrame.setLayoutData(layoutData);
|
||||
|
||||
setValue = null;
|
||||
setSetValueOrder();
|
||||
|
||||
dataManager.getParmManager().addDisplayedParmListChangedListener(this);
|
||||
dataManager.getSpatialDisplayManager().addActivatedParmChangedListener(
|
||||
|
@ -187,9 +188,7 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
protected Control createContents(Composite parent) {
|
||||
Control contents = super.createContents(parent);
|
||||
|
||||
Point size = getInitialSize();
|
||||
getShell().setSize(size);
|
||||
getShell().setLocation(getInitialLocation(size));
|
||||
setSetValueOrder();
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
@ -240,9 +239,8 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
origin = Geometry.getLocation(monitorBounds);
|
||||
}
|
||||
|
||||
return new Point(origin.x + 50, Math.max(
|
||||
monitorBounds.y,
|
||||
Math.min(origin.y + 550, monitorBounds.y + monitorBounds.height
|
||||
return new Point(origin.x + 50, Math.max(monitorBounds.y, Math.min(
|
||||
origin.y + 550, (monitorBounds.y + monitorBounds.height)
|
||||
- initialSize.y)));
|
||||
}
|
||||
|
||||
|
@ -260,8 +258,13 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
if (activeParm != null) {
|
||||
if (Arrays.asList(deletions).contains(activeParm)) {
|
||||
activeParm = null;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setSetValueOrder();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,11 +277,17 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
public void activatedParmChanged(Parm newParm) {
|
||||
activeParm = newParm;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setSetValueOrder();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setSetValueOrder() {
|
||||
// no active parm case
|
||||
getButton(ASSIGN_ID).setEnabled(activeParm != null);
|
||||
if (activeParm == null) {
|
||||
pnLabel.setText("No active weather element");
|
||||
if (setValue != null) {
|
||||
|
@ -286,20 +295,15 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
setValue.dispose();
|
||||
setValue = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
// no change in parm
|
||||
if (setValue != null && setValue.getParm() == activeParm) {
|
||||
if ((setValue != null) && (setValue.getParm() == activeParm)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// change in parm
|
||||
if (setValue != null) {
|
||||
// delete the old one
|
||||
// setValue.pack_forget();
|
||||
// setValue.unregister();
|
||||
// setValue.destroy();
|
||||
setValue.dispose();
|
||||
setValue = null;
|
||||
}
|
||||
|
@ -314,14 +318,16 @@ public class SetValueDialog extends CaveJFACEDialog implements
|
|||
setValue = new VectorSetValue(valueFrame, activeParm);
|
||||
|
||||
} else if (gridType.equals(GridType.WEATHER)) {
|
||||
setValue = new WxSetValue(valueFrame, activeParm, true, true, true);
|
||||
setValue = new WxSetValue(valueFrame, activeParm, true, true,
|
||||
true);
|
||||
|
||||
} else if (gridType.equals(GridType.DISCRETE)) {
|
||||
setValue = new DiscreteSetValue(valueFrame, activeParm, true, true,
|
||||
true);
|
||||
setValue = new DiscreteSetValue(valueFrame, activeParm, true,
|
||||
true, true);
|
||||
}
|
||||
|
||||
setValue.pack(true);
|
||||
}
|
||||
valueFrame.layout();
|
||||
valueFrame.setSize(valueFrame.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||
getShell().layout();
|
||||
|
|
|
@ -111,7 +111,7 @@ public class GridParm {
|
|||
* Creates a new empty GridParm
|
||||
*/
|
||||
public GridParm() {
|
||||
|
||||
this.id = new ParmID();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue