String rawSourcePath = binding.getSourcePath();
if ( rawOutputPath == null )
rawOutputPath = rawSourcePath;
XModel rootNode = XProjectManager.getCurrentProject().getModel();
if ( rawOutputPath != null ) {
String outputPath = evaluator.evaluatePath( rawOutputPath );
if (( outputPath != null ) && ( outputPath.length() > 0 )) {
if (( rawOutputPath.indexOf( "${" ) < 0 ) || !rawOutputPath.equals( outputPath )) {
// Strip any attribute values as the output node should not be
// distinguished by the selected values
String evaluatedPath = evaluator.stripAttributeValues( outputPath );
boolean appendByDefault = XBaseModel.getAppendByDefault();
XBaseModel.setAppendByDefault( true );
XModel outputNode = ( XModel )rootNode.get( XModel.prefixOutputPath( evaluatedPath ));
XBaseModel.setAppendByDefault( appendByDefault );
// If an attribute had been specified then the newNode might not
// have the selected value and we would need to set it or else the
// bound component won't show the correct initial value
if ( !evaluatedPath.equals( outputPath ) ) {
XModel valueNode = ( XModel )rootNode.get( XModel.prefixOutputPath( outputPath ));
if ( valueNode != null ) {
Object outputValue = valueNode.get();
if ( outputValue != null )
outputNode.set( outputValue );
}
}
binding.setOutput( outputNode, outputPath );
}
}
}
if ( rawSourcePath != null ) {
String sourcePath = evaluator.evaluatePath( rawSourcePath );
if (( sourcePath != null ) && ( sourcePath.length() > 0 )) {
if (( rawSourcePath.indexOf( "${" ) < 0 ) || !rawSourcePath.equals( sourcePath )) {
XModel sourceNode = ( XModel )rootNode.get( sourcePath );
binding.setSource( sourceNode );
binding.get();
}
}
}