this.model = set;
this.layout = new DirtyableFlexTable();
layout.setStyleName( "model-builderInner-Background" ); // NON-NLS
SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
if ( completions.isGlobalVariable( set.variable ) ) {
List<MethodInfo> infos = completions.getMethodInfosForGlobalVariable( set.variable );
this.fieldCompletionTexts = new String[infos.size()];
this.fieldCompletionValues = new String[infos.size()];
int i = 0;
for ( MethodInfo info : infos ) {
this.fieldCompletionTexts[i] = info.getName();
this.fieldCompletionValues[i] = info.getNameWithParameters();
i++;
}
this.variableClass = (String) completions.getGlobalVariable( set.variable );
} else {
FactPattern pattern = mod.getModel().getLHSBoundFact( set.variable );
if ( pattern != null ) {
List<String> methodList = completions.getMethodNames( pattern.getFactType() );
fieldCompletionTexts = new String[methodList.size()];
fieldCompletionValues = new String[methodList.size()];
int i = 0;
for ( String methodName : methodList ) {
fieldCompletionTexts[i] = methodName;
fieldCompletionValues[i] = methodName;
i++;
}
this.variableClass = pattern.getFactType();
this.isBoundFact = true;
} else {
/*
* if the call method is applied on a bound variable created in the rhs
*/
ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.variable );
if ( patternRhs != null ) {
List<String> methodList = completions.getMethodNames( patternRhs.factType );
fieldCompletionTexts = new String[methodList.size()];
fieldCompletionValues = new String[methodList.size()];
int i = 0;
for ( String methodName : methodList ) {
fieldCompletionTexts[i] = methodName;
fieldCompletionValues[i] = methodName;
i++;
}
this.variableClass = patternRhs.factType;
this.isBoundFact = true;
}
}
}
if ( readOnly == null ) {
this.readOnly = !completions.containsFactType( this.variableClass );
} else {
this.readOnly = readOnly;
}
if ( this.readOnly ) {