Пример #1
0
 public static String getCustomLabel(
     Message message, Operation operation, Collection<String> displayValue) {
   StringBuffer buffer = new StringBuffer();
   buffer.append(" "); // adds " " first for correct display considerations
   // visibility
   if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
     buffer.append(NamedElementUtil.getVisibilityAsSign(operation));
   }
   // name
   if (displayValue.contains(ICustomAppearance.DISP_NAME)) {
     buffer.append(" ");
     buffer.append(StringHelper.trimToEmpty(operation.getName()));
   }
   //
   // parameters : '(' parameter-list ')'
   buffer.append("(");
   buffer.append(getParametersAsString(message, operation, displayValue));
   buffer.append(")");
   // return type
   if (displayValue.contains(ICustomAppearance.DISP_RT_TYPE)
       || displayValue.contains(ICustomAppearance.DISP_TYPE)) {
     buffer.append(getReturnTypeAsString(operation, displayValue));
   }
   // modifiers
   if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
     String modifiers = getModifiersAsString(operation);
     if (!modifiers.equals("")) {
       buffer.append("{");
       buffer.append(modifiers);
       buffer.append("}");
     }
   }
   return buffer.toString();
 }
Пример #2
0
 public static String getCustomLabel(
     Message e, int paramIndex, Parameter parameter, Collection<String> displayValue) {
   StringBuffer buffer = new StringBuffer();
   // visibility
   buffer.append(" ");
   if (displayValue.contains(ICustomAppearance.DISP_VISIBILITY)) {
     buffer.append(NamedElementUtil.getVisibilityAsSign(parameter));
   }
   // direction property
   if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) {
     buffer.append(" ");
     buffer.append(parameter.getDirection().getLiteral());
   }
   boolean showEqualMark = false;
   // name
   if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) {
     buffer.append(" ");
     String name = StringHelper.trimToEmpty(parameter.getName());
     if (name.trim().length() > 0) {
       showEqualMark = true;
     }
     buffer.append(name);
   }
   if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) {
     // type
     if (parameter.getType() != null) {
       buffer.append(": " + StringHelper.trimToEmpty(parameter.getType().getName()));
     } else {
       buffer.append(": " + TypeUtil.UNDEFINED_TYPE_NAME);
     }
     showEqualMark = true;
   }
   if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY)) {
     // multiplicity -> do not display [1]
     String multiplicity = MultiplicityElementUtil.getMultiplicityAsString(parameter);
     buffer.append(multiplicity);
   }
   if (displayValue.contains(ICustomAppearance.DISP_DERIVE)) {
     String value = getValue(e, paramIndex, parameter);
     if (value != null) {
       if (showEqualMark) {
         buffer.append(" = ");
       }
       buffer.append(value);
     }
   } else if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT)) {
     // default value
     if (parameter.getDefault() != null) {
       if (showEqualMark) {
         buffer.append(" = ");
       }
       buffer.append(parameter.getDefault());
     }
   }
   if (displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) {
     boolean multiLine = displayValue.contains(ICustomAppearance.DISP_MULTI_LINE);
     // property modifiers
     String modifiers = ParameterUtil.getModifiersAsString(parameter, multiLine);
     if (!modifiers.equals("")) {
       if (multiLine) {
         buffer.append("\n");
       }
       buffer.append(modifiers);
     }
   }
   return buffer.toString();
 }
Пример #3
0
 /**
  * Sets this Expression's body
  *
  * @param body
  */
 public void setBody(String body) {
   if (!StringHelper.equals(body, this.body)) {
     this.body = body;
     fireChange();
   }
 }
Пример #4
0
 /**
  * Sets this Expression's language
  *
  * @param language
  */
 public void setLanguage(String language) {
   if (!StringHelper.equals(language, this.language)) {
     this.language = language;
     fireChange();
   }
 }