public ActionSetFieldWidget( RuleModeller mod, EventBus eventBus, ActionSetField set, Boolean readOnly) { super(mod, eventBus); this.model = set; this.layout = new DirtyableFlexTable(); layout.setStyleName("model-builderInner-Background"); PackageDataModelOracle completions = this.getModeller().getSuggestionCompletions(); if (completions.isGlobalVariable(set.getVariable())) { this.fieldCompletions = completions.getFieldCompletionsForGlobalVariable(set.getVariable()); this.variableClass = completions.getGlobalVariable(set.getVariable()); } else { String type = mod.getModel().getLHSBindingType(set.getVariable()); if (type != null) { this.fieldCompletions = completions.getFieldCompletions(FieldAccessorsAndMutators.MUTATOR, type); this.variableClass = type; this.isBoundFact = true; } else { ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact(set.getVariable()); if (patternRhs != null) { this.fieldCompletions = completions.getFieldCompletions( FieldAccessorsAndMutators.MUTATOR, patternRhs.getFactType()); this.variableClass = patternRhs.getFactType(); this.isBoundFact = true; } } } if (this.variableClass == null) { readOnly = true; ErrorPopup.showMessage(Constants.INSTANCE.CouldNotFindTheTypeForVariable0(set.getVariable())); } this.isFactTypeKnown = completions.isFactTypeRecognized(this.variableClass); if (readOnly == null) { this.readOnly = !this.isFactTypeKnown; } else { this.readOnly = readOnly; } if (this.readOnly) { layout.addStyleName("editor-disabled-widget"); } doLayout(); initWidget(this.layout); }
public void onDelete() { boolean used = false; for (Fixture fixture : definitionList) { if (fixture instanceof FactData) { final FactData factData = (FactData) fixture; if (scenario.isFactDataReferenced(factData)) { used = true; break; } } } if (used) { ErrorPopup.showMessage( TestScenarioConstants.INSTANCE.CantRemoveThisBlockAsOneOfTheNamesIsBeingUsed()); } else { super.onDelete(); } }