boolean newSource = true;
// Check if the source exists, and in this case change the expression on the fly
for (Iterator it = DataSourcePool.global.dataSources().iterator(); it.hasNext(); ) {
Object o = it.next();
if (!(o instanceof ExpressionDataSource)) continue;
ExpressionDataSource ds = (ExpressionDataSource)o;
if (name.equals(DataInfo.getLabel(ds)) || name.equals(DataInfo.getAlias(ds))) {
ds.changeExpression(exp, node);
newSource = false;
ExpressionPanel.this.sourceTree.setSelectedValue(ds);
TreeNode tn = (TreeNode)(ExpressionPanel.this.sourceTree.getSelectionPath().getLastPathComponent());
((DefaultTreeModel)(ExpressionPanel.this.sourceTree.getModel())).nodeChanged(tn);
break;
}
}
if (newSource) {
ExpressionDataSource eds = new ExpressionDataSource(new DataInfo(name, name, exp), node);
DataSourcePool.global.addDataSource(eds);
ExpressionPanel.this.sourceTree.setSelectedValue(eds);
}
}