diff --git a/trick_source/java/src/trick/common/utils/VariableServerConnection.java b/trick_source/java/src/trick/common/utils/VariableServerConnection.java index d1670da3..6d6f216f 100644 --- a/trick_source/java/src/trick/common/utils/VariableServerConnection.java +++ b/trick_source/java/src/trick/common/utils/VariableServerConnection.java @@ -224,12 +224,8 @@ public class VariableServerConnection implements AutoCloseable { put("trick.var_send()"); } - /** - * attempts to resolve all invalid variables - * @throws IOException IOException - */ - public void resolveInvalidReferences() throws IOException { - put("trick.var_retry_bad_ref()"); + public void setValidateAddresses(boolean validate) throws IOException { + put("trick.var_validate_address(" + (validate ? "True" : "False") + ")"); } /** diff --git a/trick_source/java/src/trick/montemonitor/MonteMonitorApplication.java b/trick_source/java/src/trick/montemonitor/MonteMonitorApplication.java index 864f80d1..f957ac92 100644 --- a/trick_source/java/src/trick/montemonitor/MonteMonitorApplication.java +++ b/trick_source/java/src/trick/montemonitor/MonteMonitorApplication.java @@ -584,7 +584,6 @@ public class MonteMonitorApplication extends RunTimeTrickApplication { slave.name = data[dataIndex++]; if (data[dataIndex++].equals("BAD_REF")) { slave.currentRun = new Integer(-1); - variableServerConnection.resolveInvalidReferences(); } else { slave.currentRun = new Integer(data[dataIndex - 1]); diff --git a/trick_source/java/src/trick/tv/TVApplication.java b/trick_source/java/src/trick/tv/TVApplication.java index b2e7ae13..5882f831 100644 --- a/trick_source/java/src/trick/tv/TVApplication.java +++ b/trick_source/java/src/trick/tv/TVApplication.java @@ -183,6 +183,9 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi /** whether or not to treat character arrays as strings */ boolean characterArraysAsStrings = false; + /** validate pointer addresses */ + boolean validateAddresses = false; + /** strip chart manager */ protected StripChartManager stripChartManager = new StripChartManager(); @@ -205,6 +208,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi final String fontSizeKey = "fontSize"; final String defaultUnitsKey = "defaultUnits"; final String characterArraysAsStringsKey = "characterArraysAsStrings"; + final String validateAddressesKey = "validateAddresses"; /** new action */ protected AbstractAction newAction = new AbstractAction("New", @@ -515,6 +519,9 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi characterArraysAsStrings = Boolean.parseBoolean(trickProperties.getProperty( characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings))); + validateAddresses = Boolean.parseBoolean(trickProperties.getProperty( + validateAddressesKey, Boolean.toString(validateAddresses))); + for (UnitType type : UnitType.values()) { String units = trickProperties.getProperty(type.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( + "" + + "Validate pointer addresses
" + + "" + ); + }}; + { - setBorder(new TitledBorder("Variable Addition") {{ + setBorder(new TitledBorder("Variable Properties") {{ setTitleJustification(CENTER); }}); @@ -762,11 +777,15 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi add(asStringsCheckBox, constraints); + constraints.gridy = 2; + add(validateAddressCheckBox, constraints); + settingsDialog.addBecomingVisibleListener(new BecomingVisibleListener() { @Override public void becomingVisible() { comboBox.setSelectedItem(position); asStringsCheckBox.setSelected(characterArraysAsStrings); + validateAddressCheckBox.setSelected(validateAddresses); } }); @@ -780,6 +799,14 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi public void commitChanges() { position = (Position)comboBox.getSelectedItem(); 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(); + variableServerConnection.setValidateAddresses(validateAddresses); } /** @@ -1629,22 +1657,6 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi add(manualField, constraints); 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() { { putValue(NAME, "Purge"); @@ -1864,6 +1876,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi trickProperties.setProperty(fontSizeKey, Integer.toString(variableTree.getFont().getSize())); trickProperties.setProperty(defaultUnitsKey, Boolean.toString(defaultAllUnits)); trickProperties.setProperty(characterArraysAsStringsKey, Boolean.toString(characterArraysAsStrings)); + trickProperties.setProperty(validateAddressesKey, Boolean.toString(validateAddresses)); for (UnitType type : UnitType.values()) { trickProperties.setProperty(type.toString(), defaultUnits.get(type.ordinal()).toString());