mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 13:43:10 +00:00
Add option to validate pointer addresses in variable server clients
Added an option on the settings panel in TV to toggle validating addresses. Removed the now deprecated resolve_bad_refs button. refs #193
This commit is contained in:
parent
13a55f1fb3
commit
7d5e501012
@ -224,12 +224,8 @@ public class VariableServerConnection implements AutoCloseable {
|
|||||||
put("trick.var_send()");
|
put("trick.var_send()");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setValidateAddresses(boolean validate) throws IOException {
|
||||||
* attempts to resolve all invalid variables
|
put("trick.var_validate_address(" + (validate ? "True" : "False") + ")");
|
||||||
* @throws IOException IOException
|
|
||||||
*/
|
|
||||||
public void resolveInvalidReferences() throws IOException {
|
|
||||||
put("trick.var_retry_bad_ref()");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -584,7 +584,6 @@ public class MonteMonitorApplication extends RunTimeTrickApplication {
|
|||||||
slave.name = data[dataIndex++];
|
slave.name = data[dataIndex++];
|
||||||
if (data[dataIndex++].equals("BAD_REF")) {
|
if (data[dataIndex++].equals("BAD_REF")) {
|
||||||
slave.currentRun = new Integer(-1);
|
slave.currentRun = new Integer(-1);
|
||||||
variableServerConnection.resolveInvalidReferences();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
slave.currentRun = new Integer(data[dataIndex - 1]);
|
slave.currentRun = new Integer(data[dataIndex - 1]);
|
||||||
|
@ -183,6 +183,9 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
/** whether or not to treat character arrays as strings */
|
/** whether or not to treat character arrays as strings */
|
||||||
boolean characterArraysAsStrings = false;
|
boolean characterArraysAsStrings = false;
|
||||||
|
|
||||||
|
/** validate pointer addresses */
|
||||||
|
boolean validateAddresses = false;
|
||||||
|
|
||||||
/** strip chart manager */
|
/** strip chart manager */
|
||||||
protected StripChartManager stripChartManager = new StripChartManager();
|
protected StripChartManager stripChartManager = new StripChartManager();
|
||||||
|
|
||||||
@ -205,6 +208,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
final String fontSizeKey = "fontSize";
|
final String fontSizeKey = "fontSize";
|
||||||
final String defaultUnitsKey = "defaultUnits";
|
final String defaultUnitsKey = "defaultUnits";
|
||||||
final String characterArraysAsStringsKey = "characterArraysAsStrings";
|
final String characterArraysAsStringsKey = "characterArraysAsStrings";
|
||||||
|
final String validateAddressesKey = "validateAddresses";
|
||||||
|
|
||||||
/** new action */
|
/** new action */
|
||||||
protected AbstractAction newAction = new AbstractAction("New",
|
protected AbstractAction newAction = new AbstractAction("New",
|
||||||
@ -515,6 +519,9 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
characterArraysAsStrings = Boolean.parseBoolean(trickProperties.getProperty(
|
characterArraysAsStrings = Boolean.parseBoolean(trickProperties.getProperty(
|
||||||
characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings)));
|
characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings)));
|
||||||
|
|
||||||
|
validateAddresses = Boolean.parseBoolean(trickProperties.getProperty(
|
||||||
|
validateAddressesKey, Boolean.toString(validateAddresses)));
|
||||||
|
|
||||||
for (UnitType type : UnitType.values()) {
|
for (UnitType type : UnitType.values()) {
|
||||||
String units = trickProperties.getProperty(type.toString());
|
String units = trickProperties.getProperty(type.toString());
|
||||||
if (units != null && !units.equals(Unit.DEFAULT_UNITS.toString())) {
|
if (units != null && !units.equals(Unit.DEFAULT_UNITS.toString())) {
|
||||||
@ -744,8 +751,16 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
);
|
);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
JCheckBox validateAddressCheckBox = new JCheckBox("validate addresses") {{
|
||||||
|
setToolTipText(
|
||||||
|
"<html>" +
|
||||||
|
"Validate pointer addresses<br>" +
|
||||||
|
"</html>"
|
||||||
|
);
|
||||||
|
}};
|
||||||
|
|
||||||
{
|
{
|
||||||
setBorder(new TitledBorder("Variable Addition") {{
|
setBorder(new TitledBorder("Variable Properties") {{
|
||||||
setTitleJustification(CENTER);
|
setTitleJustification(CENTER);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
@ -762,11 +777,15 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
|
|
||||||
add(asStringsCheckBox, constraints);
|
add(asStringsCheckBox, constraints);
|
||||||
|
|
||||||
|
constraints.gridy = 2;
|
||||||
|
add(validateAddressCheckBox, constraints);
|
||||||
|
|
||||||
settingsDialog.addBecomingVisibleListener(new BecomingVisibleListener() {
|
settingsDialog.addBecomingVisibleListener(new BecomingVisibleListener() {
|
||||||
@Override
|
@Override
|
||||||
public void becomingVisible() {
|
public void becomingVisible() {
|
||||||
comboBox.setSelectedItem(position);
|
comboBox.setSelectedItem(position);
|
||||||
asStringsCheckBox.setSelected(characterArraysAsStrings);
|
asStringsCheckBox.setSelected(characterArraysAsStrings);
|
||||||
|
validateAddressCheckBox.setSelected(validateAddresses);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -780,6 +799,14 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
public void commitChanges() {
|
public void commitChanges() {
|
||||||
position = (Position)comboBox.getSelectedItem();
|
position = (Position)comboBox.getSelectedItem();
|
||||||
characterArraysAsStrings = asStringsCheckBox.isSelected();
|
characterArraysAsStrings = asStringsCheckBox.isSelected();
|
||||||
|
validateAddresses = validateAddressCheckBox.isSelected();
|
||||||
|
if (getConnectionState()) {
|
||||||
|
try {
|
||||||
|
variableServerConnection.setValidateAddresses(validateAddresses);
|
||||||
|
}
|
||||||
|
catch (IOException ignoreMe) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1077,6 +1104,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendCyclePeriod();
|
sendCyclePeriod();
|
||||||
|
variableServerConnection.setValidateAddresses(validateAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1629,22 +1657,6 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
add(manualField, constraints);
|
add(manualField, constraints);
|
||||||
constraints.weightx = 0;
|
constraints.weightx = 0;
|
||||||
|
|
||||||
add(new JXButton(new AbstractAction() {
|
|
||||||
{
|
|
||||||
putValue(NAME, "Resolve");
|
|
||||||
putValue(SHORT_DESCRIPTION, "Attempt to resolve all invalid references.");
|
|
||||||
putValue(MNEMONIC_KEY, KeyEvent.VK_V);
|
|
||||||
}
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
try {
|
|
||||||
variableServerConnection.resolveInvalidReferences();
|
|
||||||
}
|
|
||||||
catch (IOException ioException) {
|
|
||||||
disconnect(ioException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}), constraints);
|
|
||||||
|
|
||||||
add(new JXButton(new AbstractAction() {
|
add(new JXButton(new AbstractAction() {
|
||||||
{
|
{
|
||||||
putValue(NAME, "Purge");
|
putValue(NAME, "Purge");
|
||||||
@ -1864,6 +1876,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
trickProperties.setProperty(fontSizeKey, Integer.toString(variableTree.getFont().getSize()));
|
trickProperties.setProperty(fontSizeKey, Integer.toString(variableTree.getFont().getSize()));
|
||||||
trickProperties.setProperty(defaultUnitsKey, Boolean.toString(defaultAllUnits));
|
trickProperties.setProperty(defaultUnitsKey, Boolean.toString(defaultAllUnits));
|
||||||
trickProperties.setProperty(characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings));
|
trickProperties.setProperty(characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings));
|
||||||
|
trickProperties.setProperty(validateAddressesKey, Boolean.toString(validateAddresses));
|
||||||
for (UnitType type : UnitType.values()) {
|
for (UnitType type : UnitType.values()) {
|
||||||
trickProperties.setProperty(type.toString(),
|
trickProperties.setProperty(type.toString(),
|
||||||
defaultUnits.get(type.ordinal()).toString());
|
defaultUnits.get(type.ordinal()).toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user