@Override
 public String getText(Object element) {
   if (element instanceof Signature) {
     Signature s = (Signature) element;
     IFileWrapper f = FileData.getFile(s);
     return (f != null ? f.getPath() : "(embedded)");
   } else if (element instanceof Control) {
     Control c = (Control) element;
     String name = c.getName();
     INamePolicy n = ParameterUtilities.getParameterPolicy(c);
     if (n != null) name += " (" + n.getClass().getSimpleName() + ")";
     return name;
   } else return null;
 }
Пример #2
0
 private boolean recProcessSignature(List<String> names, Signature s) throws SaveFailedException {
   boolean parameterised = false;
   for (Control c : s.getControls()) {
     if (names.contains(c.getName())) continue;
     INamePolicy policy = ParameterUtilities.getParameterPolicy(c);
     if (policy == null) {
       writeControl(c, null);
     } else parameterised = true;
   }
   for (Signature t : s.getSignatures()) {
     if (recProcessSignature(names, t)) parameterised = true;
   }
   return parameterised;
 }
Пример #3
0
 private PortSpec makePortSpec(Element e, Control c) {
   PortSpec.Identifier pid =
       new PortSpec.Identifier(
           getAttributeNS(e, SIGNATURE, "name"), c.getIdentifier(getScratch()));
   addChange(new Control.ChangeAddPortSpecDescriptor(pid));
   return executeUndecorators(pid.lookup(getScratch(), sig), e);
 }
Пример #4
0
  private void writeControl(Control c, String param) throws SaveFailedException {
    String name = normaliseName(c.getName());
    if (param != null) name += "_P__" + normaliseName(param);

    if (!controlNames.contains(name)) {
      switch (c.getKind()) {
        case ACTIVE:
        case ATOMIC:
        default:
          write("%active ");
          break;
        case PASSIVE:
          write("%passive ");
          break;
      }

      write(name + " : ");
      write(c.getPorts().size() + ";\n");

      controlNames.add(name);
    }
  }