@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
 protected <T extends ModelObject> T loadRelative(
     String replacement, Class<? extends T> klass, XMLLoader loader) throws LoadFailedException {
   if (replacement != null) {
     if (getFile() == null)
       throw new Error("BUG: relative path to resolve, " + "but no IFileWrapper set on " + this);
     IResourceWrapper rw = getFile().getParent().getResource(replacement);
     if (rw instanceof IFileWrapper) {
       IFileWrapper fw = (IFileWrapper) rw;
       loader.setFile(fw).setInputStream(fw.getContents());
       ModelObject mo = loader.importObject();
       if (klass.isInstance(mo)) {
         return klass.cast(mo);
       } else
         throw new LoadFailedException(
             "Referenced document \"" + replacement + "\" is not of the correct type");
     } else
       throw new LoadFailedException("Referenced document \"" + replacement + "\" is not valid");
   } else return null;
 }