Examples of CMNamedNodeMap


Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      return null;
    try {
      if (fDefaultValueLookups == null)
        fDefaultValueLookups = new Stack();
      fDefaultValueLookups.push(name);
      CMNamedNodeMap map = ((DocumentImpl) getOwnerDocument()).getCMAttributes(this);
      if (map != null) {
        CMNode attribute = map.getNamedItem(name);
        if (attribute instanceof CMAttributeDeclaration)
          return ((CMAttributeDeclaration) attribute).getAttrType().getImpliedValue();
      }
      return unknownDefault;
    }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      if (mgr != null) {
        List moreCMDocuments = mgr.getCMDocumentTrackers(textInsertionOffset);
        if (moreCMDocuments != null) {
          for (int i = 0; i < moreCMDocuments.size(); i++) {
            CMDocument doc = (CMDocument) moreCMDocuments.get(i);
            CMNamedNodeMap elements = doc.getElements();
            if (elements != null) {
              for (int j = 0; j < elements.getLength(); j++) {
                CMElementDeclaration ed = (CMElementDeclaration) elements.item(j);
                elementDecls.add(ed);
              }
            }
          }
        }
      }

      // get position dependent CMDocuments and insert their tags as
      // proposals

      ModelQueryAdapter mqAdapter = null;
      if (node.getNodeType() == Node.DOCUMENT_NODE)
        mqAdapter = (ModelQueryAdapter) ((IDOMNode) node).getAdapterFor(ModelQueryAdapter.class);
      else
        mqAdapter = (ModelQueryAdapter) ((IDOMNode) node.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);

      if (mqAdapter != null) {
        CMDocument doc = mqAdapter.getModelQuery().getCorrespondingCMDocument(node);
        if (doc != null) {
          CMDocument jcmdoc = getDefaultJSPCMDocument((IDOMNode) node);
          CMNamedNodeMap jspelements = jcmdoc.getElements();

          /*
           * For a built-in JSP action the content model is properly
           * set up, so don't just blindly add the rest--unless this
           * will be a direct child of the document
           */
          if (jspelements != null && (!(doc instanceof JSPCMDocument) || node.getNodeType() == Node.DOCUMENT_NODE)) {
            List rejectElements = new ArrayList();

            // determine if the document is in XML form
            Document domDoc = null;
            if (node.getNodeType() == Node.DOCUMENT_NODE)
              domDoc = (Document) node;
            else
              domDoc = node.getOwnerDocument();

            // Show XML tag forms of JSP markers if jsp:root is
            // the document element OR it's HTML but
            // isn't really in the text.
            // If the document isn't strictly XML, pull out the
            // XML tag forms it is xml format
            rejectElements.add(JSP12Namespace.ElementName.SCRIPTLET);
            rejectElements.add(JSP12Namespace.ElementName.EXPRESSION);
            rejectElements.add(JSP12Namespace.ElementName.DECLARATION);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_INCLUDE);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_PAGE);
            rejectElements.add(JSP12Namespace.ElementName.TEXT);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_TAGLIB);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_TAG);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_ATTRIBUTE);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_VARIABLE);
            if (isXMLFormat(domDoc)) {
              // jsp actions
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.USEBEAN);
              rejectElements.add(JSP12Namespace.ElementName.GETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.SETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.INCLUDE);
              rejectElements.add(JSP12Namespace.ElementName.FORWARD);
              rejectElements.add(JSP12Namespace.ElementName.PLUGIN);
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.PARAM);
              rejectElements.add(JSP12Namespace.ElementName.PARAMS);
            }


            // don't show jsp:root if a document element already
            // exists
            Element docElement = domDoc.getDocumentElement();
            if (docElement != null && ((docElement.getNodeName().equals("jsp:root")) || ((((IDOMNode) docElement).getStartStructuredDocumentRegion() != null || ((IDOMNode) docElement).getEndStructuredDocumentRegion() != null)))) //$NON-NLS-1$
              rejectElements.add(JSP12Namespace.ElementName.ROOT);

            for (int j = 0; j < jspelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) jspelements.item(j);
              if (rejectElements.contains(ed.getNodeName()))
                continue;
              elementDecls.add(ed);
            }

          }
        }
        // No cm document (such as for the Document (a non-Element) node itself)
        else {
          CMNamedNodeMap jspElements = getDefaultJSPCMDocument((IDOMNode) node).getElements();
          int length = jspElements.getLength();
          for (int i = 0; i < length; i++) {
            elementDecls.add(jspElements.item(i));
          }
        }
      }
    }
    return elementDecls;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

    }

    // make sure that root elements are only added after the doctype (if any)
    if (rootElement == null && index > doctypeIndex)
    {
      CMNamedNodeMap map = cmDocument.getElements();
      int mapLength = map.getLength();
      for (int i = 0; i < mapLength; i++)
      {
        CMNode cmNode = map.item(i);

        boolean canAdd = true;
        if (validityChecking == ModelQuery.VALIDITY_STRICT)
        {
          canAdd = doctype == null || doctype.getName().equals(cmNode.getNodeName());
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

            return tagElement;
        }

        public final Map<String, ITagElement> getAllViewElements()
        {
            final CMNamedNodeMap elementMap = _tldDoc.getElements();
            final Map<String, ITagElement> tags = getOrCreateMap(elementMap
                    .getLength());
            if (!isInitialized())
            {
                // if we create the table with this call, bias the table size
                // to be 1 bigger than the number of tags, since we know if it's
                // smaller, it'll cause at least one buffer resize
               
   
                for (int i = 0; i < elementMap.getLength(); i++)
                {
                    final CMNode cmNode = elementMap.item(i);
                    getViewElement(cmNode.getNodeName());
                }
            }
            return tags;
        }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

        List trackers = mgr.getCMDocumentTrackers(-1);
        Iterator taglibs = trackers.iterator();
 
        CMDocument doc = null;
        CMNamedNodeMap elements = null;
        while (taglibs.hasNext()) {
          doc = (CMDocument) taglibs.next();
          CMNode node = null;
          if ((elements = doc.getElements()) != null && (node = elements.getNamedItem(tagToAdd)) != null && node.getNodeType() == CMNode.ELEMENT_DECLARATION) {
 
            if (node instanceof CMNodeWrapper) {
              node = ((CMNodeWrapper) node).getOriginNode();
            }
            TLDElementDeclaration tldElementDecl = (TLDElementDeclaration) node;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      // return new TaglibVariable[0];
      //
      // Iterator taglibs =
      // support.getCMDocuments(customTag.getStartOffset()).iterator();
      CMDocument doc = null;
      CMNamedNodeMap elements = null;
      while (taglibs.hasNext()) {
        doc = (CMDocument) taglibs.next();
        CMNode node = null;
        if ((elements = doc.getElements()) != null && (node = elements.getNamedItem(tagToAdd)) != null && node.getNodeType() == CMNode.ELEMENT_DECLARATION) {

          if (node instanceof CMNodeWrapper) {
            node = ((CMNodeWrapper) node).getOriginNode();
          }
          TLDElementDeclaration tldElementDecl = (TLDElementDeclaration) node;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

   */
  private TagInfo getTagInfo(final TLDElementDeclaration decl, TagExtraInfo tei, String prefix, String uri) {

    TagLibraryInfo libInfo = new TagLibraryInfoImpl(prefix, uri, decl);

    CMNamedNodeMap attrs = decl.getAttributes();
    TagAttributeInfo[] attrInfos = new TagAttributeInfo[attrs.getLength()];
    TLDAttributeDeclaration attr = null;
    String type = ""; //$NON-NLS-1$

    // get tag attribute infos
    for (int i = 0; i < attrs.getLength(); i++) {
      attr = (TLDAttributeDeclaration) attrs.item(i);
      type = attr.getType();
      // default value for type is String
      if (attr.getType() == null || attr.getType().equals("")) //$NON-NLS-1$
        type = "java.lang.String"; //$NON-NLS-1$
      attrInfos[i] = new TagAttributeInfo(attr.getAttrName(), attr.isRequired(), type, false);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

        enableTagsInDir(StringUtils.strip(prefix), StringUtils.strip(tagdir), anchorStructuredDocumentRegion);
      }
    }

    private void registerTaglib(String prefix, String uri, IStructuredDocumentRegion anchorStructuredDocumentRegion, CMDocument tld) {
      CMNamedNodeMap elements = tld.getElements();
      /*
       * Go through the CMDocument for any tags that must be marked as
       * block tags starting at the anchoring IStructuredDocumentRegion.
       * As the document is edited and the IStructuredDocumentRegion
       * moved around, the block tag enablement will automatically
       * follow it.
       */
      for (int i = 0; i < elements.getLength(); i++) {
        TLDElementDeclaration ed = (TLDElementDeclaration) elements.item(i);
        if (ed.getBodycontent() == JSP12TLDNames.CONTENT_TAGDEPENDENT)
          addBlockTag(prefix + ":" + ed.getNodeName(), anchorStructuredDocumentRegion); //$NON-NLS-1$
      }
      /*
       * Since modifications to StructuredDocumentRegions adjacent to a
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      if (mqAdapter != null) {
        CMDocument doc = mqAdapter.getModelQuery().getCorrespondingCMDocument(node);
        if (doc != null) {
          CMDocument jcmdoc = getDefaultJSPCMDocument(node);
          CMNamedNodeMap jspelements = jcmdoc.getElements();

          /* For a built-in JSP action the content model is properly
           * set up, so don't just blindly add the rest--unless this
           * will be a direct child of the document
           */
          if (jspelements != null && (!(doc instanceof JSPCMDocument) || node.getNodeType() == Node.DOCUMENT_NODE)) {
            List rejectElements = new ArrayList();

            // determine if the document is in XML form
            Document domDoc = null;
            if (node.getNodeType() == Node.DOCUMENT_NODE) {
              domDoc = (Document) node;
            } else {
              domDoc = node.getOwnerDocument();
            }

            // Show XML tag forms of JSP markers if jsp:root is
            // the document element OR it's HTML but
            // isn't really in the text.
            // If the document isn't strictly XML, pull out the
            // XML tag forms it is xml format
            rejectElements.add(JSP12Namespace.ElementName.SCRIPTLET);
            rejectElements.add(JSP12Namespace.ElementName.EXPRESSION);
            rejectElements.add(JSP12Namespace.ElementName.DECLARATION);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_INCLUDE);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_PAGE);
            rejectElements.add(JSP12Namespace.ElementName.TEXT);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_TAGLIB);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_TAG);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_ATTRIBUTE);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_VARIABLE);
            if (isXMLFormat(domDoc)) {
              // jsp actions
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.USEBEAN);
              rejectElements.add(JSP12Namespace.ElementName.GETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.SETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.INCLUDE);
              rejectElements.add(JSP12Namespace.ElementName.FORWARD);
              rejectElements.add(JSP12Namespace.ElementName.PLUGIN);
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.PARAM);
              rejectElements.add(JSP12Namespace.ElementName.PARAMS);
            }


            // don't show jsp:root if a document element already
            // exists
            Element docElement = domDoc.getDocumentElement();
            if (docElement != null &&((docElement.getNodeName().equals(TAG_JSP_ROOT)) ||
                ((((IDOMNode) docElement).getStartStructuredDocumentRegion() != null ||
                    ((IDOMNode) docElement).getEndStructuredDocumentRegion() != null)))) {
             
              rejectElements.add(JSP12Namespace.ElementName.ROOT);
            }
            //Add JSP elements into autocomplete menu
            for (int j = 0; j < jspelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) jspelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
              }
            }
           
            //Add Tapestry components into autocomplete menu
            jcmdoc = getDefaultTapestryCMDocument();
            CMNamedNodeMap tapestryelements = jcmdoc.getElements();
            for (int j = 0; j < tapestryelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) tapestryelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
              }
            }
           
          }
        }
        // No cm document (such as for the Document (a non-Element) node itself)
        else {
          CMNamedNodeMap jspElements = getDefaultJSPCMDocument(node).getElements();
          int length = jspElements.getLength();
          for (int i = 0; i < length; i++) {
            nodeList.add(jspElements.item(i));
          }
        }
      }
     
      nodes = (CMNode[])nodeList.toArray(new CMNode[nodeList.size()]);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      IDOMElement element = (IDOMElement) ir;
      ModelQuery query = ModelQueryUtil.getModelQuery(model);
      if (query != null) {
        CMElementDeclaration cmElement = query.getCMElementDeclaration(element);
        if (cmElement != null) {
          CMNamedNodeMap cmAttributes = null;

          CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl();
          List nodes = query.getAvailableContent(element, cmElement, ModelQuery.INCLUDE_ATTRIBUTES);
          for (int k = 0; k < nodes.size(); k++) {
            CMNode cmnode = (CMNode) nodes.get(k);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.