static {
   Iterator i = xsdPrimitiveTypes.iterator();
   while (i.hasNext()) {
     XSDNamedComponent component = (XSDNamedComponent) i.next();
     xsdPrimitiveTypesNames.add(component.getName());
   }
 }
  /**
   * Ensure that the prefix mapping exists for the given namespace in the BPEL source.
   *
   * @param the schema component for which to create a BPEL prefix mappings.
   */
  private boolean ensureXSDTypeNamespaceMappings(Object obj) {

    String targetNamespace = null;

    if (obj instanceof XSDNamedComponent) {
      XSDNamedComponent namedComponent = (XSDNamedComponent) obj;
      targetNamespace = namedComponent.getTargetNamespace();
    }

    if (targetNamespace == null) {
      return true;
    }

    // Now check if the target namespace has a prefix mappings.
    String prefix = BPELUtils.getNamespacePrefix(modelObject, targetNamespace);
    if (prefix != null) {
      return true;
    }

    // We have to map the namespace to a prefix.
    NamespaceMappingDialog dialog = new NamespaceMappingDialog(getShell(), modelObject);
    dialog.setNamespace(targetNamespace);

    if (dialog.open() == Window.CANCEL) {
      return false;
    }

    // define the prefix
    BPELUtils.setPrefix(BPELUtils.getProcess(modelObject), targetNamespace, dialog.getPrefix());

    return true;
  }
 public String getName() {
   EObject eContainer = getXSDTypeDefinition().eContainer();
   if (eContainer instanceof XSDSchema || eContainer instanceof XSDRedefine) {
     return getXSDTypeDefinition().getName();
   } else {
     if (eContainer instanceof XSDNamedComponent) {
       XSDNamedComponent ed = (XSDNamedComponent) eContainer;
       return "(" + ed.getName() + "Type)"; // $NON-NLS-1$ //$NON-NLS-2$
     }
   }
   return null;
 }
예제 #4
0
  protected XmlElement generateSampleFragment(final XSDNamedComponent schemaComponent) {
    final XmlDocumentBuilder builder = XmlDocumentPlugin.createDocumentBuilder();
    final int levelsToBuild = getMaxNumberOfLevelsToBuild();
    if (levelsToBuild < 1) {
      return null;
    }
    builder.setNumberOfLevelsToBuild(levelsToBuild);

    // Create the root ...
    final XmlDocumentFactory factory = XmlDocumentFactory.eINSTANCE;
    final XmlRoot docRoot = factory.createXmlRoot();
    docRoot.setName(schemaComponent.getName());
    docRoot.setXsdComponent(schemaComponent);

    try {
      builder.buildDocument(docRoot, null);
    } catch (ModelerCoreException err) {
      // Do nothing ...
    }

    return docRoot;
  }
  public GetPropertyExecutor(Object parent, XSDNamedComponent content) {
    this.parent = parent;

    name = new QName(content.getTargetNamespace(), content.getName());
  }