Package org.eclipse.wst.xml.core.internal.contentmodel.util

Examples of org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo


    if (cmDocument != null) {
      result = (List) cmDocument.getProperty("http://org.eclipse.wst/cm/properties/completeNamespaceInfo"); //$NON-NLS-1$
      if (result != null) {
        int size = result.size();
        for (int i = 0; i < size; i++) {
          NamespaceInfo info = (NamespaceInfo) result.get(i);
          if (i == 0) {
            String locationInfo = null;
            if (xmlCatalogEntry != null) {
              if (xmlCatalogEntry.getEntryType() == ICatalogEntry.ENTRY_TYPE_PUBLIC) {
                locationInfo = xmlCatalogEntry.getAttributeValue(ICatalogEntry.ATTR_WEB_URL);
              }
              else {
                locationInfo = xmlCatalogEntry.getKey();
              }
            }
            if (locationInfo == null) {
              locationInfo = defaultSystemId;
            }
            info.locationHint = locationInfo;
            info.setProperty("locationHint-readOnly", "true"); //$NON-NLS-1$ //$NON-NLS-2$
            info.setProperty("uri-readOnly", "true"); //$NON-NLS-1$ //$NON-NLS-2$
            info.setProperty("unremovable", "true"); //$NON-NLS-1$ //$NON-NLS-2$
          } else {
            info.locationHint = null;
          }
        }
      }
View Full Code Here



  public boolean isMissingNamespaceLocation() {
    boolean result = false;
    for (Iterator i = namespaceInfoList.iterator(); i.hasNext();) {
      NamespaceInfo info = (NamespaceInfo) i.next();
      if (info.locationHint == null) {
        result = true;
        break;
      }
    }
View Full Code Here

    public CMDocument getCMDocument(Element element, String namespaceURI) {
      CMDocument result = null;
      if ((namespaceURI != null) && (namespaceURI.trim().length() > 0)) {
        String locationHint = null;
        for (Iterator i = namespaceInfoList1.iterator(); i.hasNext();) {
          NamespaceInfo info = (NamespaceInfo) i.next();
          if (namespaceURI.equals(info.uri)) {
            locationHint = info.locationHint;
            break;
          }
        }
View Full Code Here

        NamespaceTable namespaceTable = new NamespaceTable(element.getOwnerDocument());
        namespaceTable.addElementLineage(element);
        List list = namespaceTable.getNamespaceInfoList();
        for (Iterator i = list.iterator(); i.hasNext();)
        {
          NamespaceInfo info = (NamespaceInfo)i.next();
          if (info.uri != null && !info.uri.equals(excludedURI))
          {
            CMDocument document = xmlAssociationProvider.getCMDocument(info.uri, info.locationHint, "XSD"); //$NON-NLS-1$
            if (document != null)
            {
View Full Code Here

  protected Map createPrefixMapping(List oldList, List newList) {
    Map map = new Hashtable();

    Hashtable oldURIToPrefixTable = new Hashtable();
    for (Iterator i = oldList.iterator(); i.hasNext();) {
      NamespaceInfo oldInfo = (NamespaceInfo) i.next();
      oldURIToPrefixTable.put(oldInfo.uri, oldInfo);
    }

    for (Iterator i = newList.iterator(); i.hasNext();) {
      NamespaceInfo newInfo = (NamespaceInfo) i.next();
      NamespaceInfo oldInfo = (NamespaceInfo) oldURIToPrefixTable.get(newInfo.uri != null ? newInfo.uri : ""); //$NON-NLS-1$


      // if oldInfo is non null ... there's a matching URI in the old
      // set
      // we can use its prefix to detemine out mapping
View Full Code Here

        // here we store a copy of the old info for each NamespaceInfo
        // this info will be used in createPrefixMapping() to figure out
        // how to update the document
        // in response to these changes
        for (Iterator i = namespaceInfoList.iterator(); i.hasNext();) {
          NamespaceInfo info = (NamespaceInfo) i.next();
          NamespaceInfo oldCopy = new NamespaceInfo(info);
          info.setProperty("oldCopy", oldCopy); //$NON-NLS-1$
        }
 
        dialog.setNamespaceInfoList(namespaceInfoList);
        dialog.create();
View Full Code Here

          list.add(item.getData());
        }
      }
    }
    else {
      NamespaceInfo info = new NamespaceInfo();
      info.prefix = editNamespaceControl.prefixField.getText();
      info.uri = editNamespaceControl.uriField.getText();
      info.locationHint = editNamespaceControl.locationHintField.getText();
      list.add(info);
    }
View Full Code Here

  public void performEdit() {
    Object selection = getSelection(tableViewer.getSelection());
    if (selection != null) {
      boolean editTargetNamespace = false;
      NamespaceInfo nsInfo = (NamespaceInfo) selection;
      if (getTargetNamespace().equals(nsInfo.uri)) {
        editTargetNamespace = true;
      }

      invokeDialog(XMLUIMessages._UI_LABEL_NEW_NAMESPACE_INFORMATION, nsInfo);
View Full Code Here

    targetNamespaceField.setText(targetNamespace);
    // updateTargetNamespaceAndNamespaceInfo(targetNamespace);
  }

  void updateTargetNamespaceAndNamespaceInfo(String oldTargetNamespace, String newTargetNamespace) {
    NamespaceInfo info = getNamespaceInfo(newTargetNamespace);
    if (info == null) {
      info = getNamespaceInfo(oldTargetNamespace);
      if (info == null) {
        info = new NamespaceInfo(newTargetNamespace, "tns", null); //$NON-NLS-1$
        namespaceInfoList.add(info);
      }
      else {
        info.uri = targetNamespace;
      }
View Full Code Here

  protected void addBuiltInNamespaces(List list) {
    String xsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"; //$NON-NLS-1$
    String xsdNamespace = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$
    if (!isAlreadyDeclared(xsiNamespace)) {
      list.add(new NamespaceInfo("http://www.w3.org/2001/XMLSchema-instance", "xsi", null)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (!isAlreadyDeclared(xsdNamespace)) {
      list.add(new NamespaceInfo("http://www.w3.org/2001/XMLSchema", "xsd", null)); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.