Пример #1
0
  @Override
  public StyledString getStyledText(Object element) {
    if (element instanceof AddNewFunctionModel) {
      return new StyledString("Add new function", StyledString.COUNTER_STYLER);
    } else if (element instanceof SetFunctionModel) {
      return new StyledString("Set function", StyledString.COUNTER_STYLER);
    } else if (element instanceof FunctionModel) {
      FunctionModel functionModel = (FunctionModel) element;
      IFunction function = functionModel.getFunction();
      if (function instanceof JexlExpressionFunction) {
        return getJexlStyledText((JexlExpressionFunction) function);
      } else {
        return new StyledString(function.getName());
      }
    } else if (element instanceof OperatorModel) {
      OperatorModel operatorModel = (OperatorModel) element;
      IOperator operator = operatorModel.getOperator();
      return new StyledString(operator.getName());
    } else if (element instanceof ParameterModel) {
      ParameterModel parameterModel = (ParameterModel) element;
      return new StyledString(parameterModel.getParameter().getName());
    }

    return new StyledString("");
  }
 @Override
 public void run() {
   FunctionModelElement model = viewer.getSelectedFunctionModel();
   if (model instanceof ParameterModel) {
     ParameterModel parameterModel = (ParameterModel) model;
     IParameter fittedParameter = parameterModel.getFittedParameter();
     if (fittedParameter != null) {
       parameterModel.setParameterValue(fittedParameter.getValue());
       viewer.refresh(parameterModel.getParameter());
     }
   }
 }