this.model = set;
this.layout = new DirtyableFlexTable();
layout.setStyleName( "model-builderInner-Background" );
AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
if ( oracle.isGlobalVariable( set.getVariable() ) ) {
oracle.getFieldCompletionsForGlobalVariable( set.getVariable(),
new Callback<ModelField[]>() {
@Override
public void callback( ModelField[] fieldCompletions ) {
ActionSetFieldWidget.this.fieldCompletions = fieldCompletions;
}
} );
this.variableClass = oracle.getGlobalVariable( set.getVariable() );
} else {
String type = mod.getModel().getLHSBindingType( set.getVariable() );
if ( type != null ) {
oracle.getFieldCompletions( type,
FieldAccessorsAndMutators.MUTATOR,
new Callback<ModelField[]>() {
@Override
public void callback( final ModelField[] fields ) {
fieldCompletions = fields;
}
} );
this.variableClass = type;
this.isBoundFact = true;
} else {
ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.getVariable() );
if ( patternRhs != null ) {
oracle.getFieldCompletions( patternRhs.getFactType(),
FieldAccessorsAndMutators.MUTATOR,
new Callback<ModelField[]>() {
@Override
public void callback( final ModelField[] fields ) {
fieldCompletions = fields;
}
}
);
this.variableClass = patternRhs.getFactType();
this.isBoundFact = true;
}
}
}
if ( this.variableClass == null ) {
readOnly = true;
ErrorPopup.showMessage( GuidedRuleEditorResources.CONSTANTS.CouldNotFindTheTypeForVariable0( set.getVariable() ) );
}
this.isFactTypeKnown = oracle.isFactTypeRecognized( this.variableClass );
if ( readOnly == null ) {
this.readOnly = !this.isFactTypeKnown;
} else {
this.readOnly = readOnly;
}