Example #1
0
  public CallMethodWidget(
      String factName,
      ScenarioParentWidget parent,
      Scenario scenario,
      CallMethod mCall,
      ExecutionTrace executionTrace,
      PackageDataModelOracle dmo) {
    super();
    this.factName = factName;
    this.parent = parent;
    this.scenario = scenario;
    this.mCall = mCall;
    this.executionTrace = executionTrace;
    this.dmo = dmo;

    this.layout = new DirtyableFlexTable();

    layout.setStyleName("model-builderInner-Background"); // NON-NLS

    if (dmo.isGlobalVariable(mCall.getVariable())) {

      List<MethodInfo> infos = dmo.getMethodInfosForGlobalVariable(mCall.getVariable());
      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) dmo.getGlobalVariable(mCall.getVariable());
    } else {
      FactData pattern = (FactData) scenario.getFactTypes().get(mCall.getVariable());
      if (pattern != null) {
        List<String> methodList = dmo.getMethodNames(pattern.getType());
        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.getType();
        this.isBoundFact = true;
      }
    }

    doLayout();
    initWidget(this.layout);
  }
Example #2
0
  public CallMethodWidget(
      final String factName,
      final ScenarioParentWidget parent,
      final Scenario scenario,
      final CallMethod mCall,
      final ExecutionTrace executionTrace,
      final AsyncPackageDataModelOracle oracle) {
    super();
    this.factName = factName;
    this.parent = parent;
    this.scenario = scenario;
    this.mCall = mCall;
    this.executionTrace = executionTrace;
    this.oracle = oracle;

    this.layout = new DirtyableFlexTable();

    layout.setStyleName("model-builderInner-Background"); // NON-NLS

    if (this.oracle.isGlobalVariable(mCall.getVariable())) {

      this.oracle.getMethodInfosForGlobalVariable(
          mCall.getVariable(),
          new Callback<List<MethodInfo>>() {
            @Override
            public void callback(final List<MethodInfo> infos) {
              CallMethodWidget.this.fieldCompletionTexts = new String[infos.size()];
              CallMethodWidget.this.fieldCompletionValues = new String[infos.size()];
              int i = 0;
              for (MethodInfo info : infos) {
                CallMethodWidget.this.fieldCompletionTexts[i] = info.getName();
                CallMethodWidget.this.fieldCompletionValues[i] = info.getNameWithParameters();
                i++;
              }

              CallMethodWidget.this.variableClass =
                  (String) CallMethodWidget.this.oracle.getGlobalVariable(mCall.getVariable());
            }
          });
    } else {

      final FactData pattern = (FactData) scenario.getFactTypes().get(mCall.getVariable());
      if (pattern != null) {
        this.oracle.getMethodInfos(
            pattern.getType(),
            new Callback<List<MethodInfo>>() {
              @Override
              public void callback(final List<MethodInfo> methodInfos) {
                CallMethodWidget.this.fieldCompletionTexts = new String[methodInfos.size()];
                CallMethodWidget.this.fieldCompletionValues = new String[methodInfos.size()];
                int i = 0;
                for (MethodInfo methodInfo : methodInfos) {
                  CallMethodWidget.this.fieldCompletionTexts[i] = methodInfo.getName();
                  CallMethodWidget.this.fieldCompletionValues[i] =
                      methodInfo.getNameWithParameters();
                  i++;
                }
                CallMethodWidget.this.variableClass = pattern.getType();
                CallMethodWidget.this.isBoundFact = true;
              }
            });
      }
    }

    doLayout();
    initWidget(this.layout);
  }