Revision 44259 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.swing/org.gvsig.expressionevaluator.swing.impl/src/main/java/org/gvsig/expressionevaluator/swing/impl/AbstractAutomaticExpressionChecker.java
AbstractAutomaticExpressionChecker.java | ||
---|---|---|
51 | 51 |
private static final Color COLOR_ERROR = new Color(255,225,232); |
52 | 52 |
|
53 | 53 |
private final JTextComponent text; |
54 |
private final ExpressionBuilderConfig config;
|
|
54 |
private final ExpressionBuilderConfig builderConfig;
|
|
55 | 55 |
|
56 | 56 |
private Color color_ok; |
57 | 57 |
private Timer timerExpression; |
... | ... | |
69 | 69 |
|
70 | 70 |
public AbstractAutomaticExpressionChecker(ExpressionBuilderConfig config, JTextComponent theText) { |
71 | 71 |
this.text = theText; |
72 |
this.config = config;
|
|
72 |
this.builderConfig = config;
|
|
73 | 73 |
this.initComponents(); |
74 | 74 |
} |
75 | 75 |
|
... | ... | |
162 | 162 |
} |
163 | 163 |
|
164 | 164 |
private void doCheckExpression() { |
165 |
if( this.text == null || this.config == null ) {
|
|
165 |
if( this.text == null || this.builderConfig == null ) {
|
|
166 | 166 |
return; |
167 | 167 |
} |
168 | 168 |
Expression expression = this.getExpression(); |
... | ... | |
184 | 184 |
} |
185 | 185 |
final Mutable<String> theTip = new MutableObject<>(null); |
186 | 186 |
expression.setSQLCompatible(false); |
187 |
if (this.config.getPreviewSymbolTable() == null) {
|
|
187 |
if (this.builderConfig.getPreviewSymbolTable() == null) {
|
|
188 | 188 |
try { |
189 | 189 |
ExpressionEvaluatorManager theManager = ExpressionEvaluatorLocator.getManager(); |
190 | 190 |
MutableSymbolTable symbolTable = theManager.createSymbolTable(); |
... | ... | |
195 | 195 |
} |
196 | 196 |
} else { |
197 | 197 |
try { |
198 |
Object theValue = expression.execute(this.config.getPreviewSymbolTable());
|
|
198 |
Object theValue = expression.execute(this.builderConfig.getPreviewSymbolTable());
|
|
199 | 199 |
this.setPreview(theValue); |
200 | 200 |
} catch (ExpressionRuntimeException ex) { |
201 | 201 |
theTip.setValue(ex.getTip()); |
... | ... | |
204 | 204 |
this.setMessage(JOptionPane.ERROR_MESSAGE, "Runtime error. " + ex.getMessage()); |
205 | 205 |
} |
206 | 206 |
} |
207 |
if( this.config.isSQLCompatible() ) {
|
|
207 |
if( this.builderConfig.getPreferences().isSQLCompatible() ) {
|
|
208 | 208 |
Code code = expression.getCode(); |
209 | 209 |
try { |
210 | 210 |
code.accept(new Visitor() { |
... | ... | |
219 | 219 |
} |
220 | 220 |
break; |
221 | 221 |
case Code.IDENTIFIER: |
222 |
if( config.getPreviewSymbolTable()!=null &&
|
|
223 |
!config.getPreviewSymbolTable().isSQLCompatible(((Identifier)code).name()) ) {
|
|
222 |
if( builderConfig.getPreviewSymbolTable()!=null &&
|
|
223 |
!builderConfig.getPreviewSymbolTable().isSQLCompatible(((Identifier)code).name()) ) {
|
|
224 | 224 |
theTip.setValue(I18N.Avoid_the_use_of_functions_not_compatible_with_SQL_in_this_data_source(((Identifier)code).name())); |
225 | 225 |
} |
226 | 226 |
break; |
Also available in: Unified diff