Examples of CMElementDeclaration


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

    if (isJSPTag()) {
      // exclude JSP directive
      return (matchTagName(JSPTag.JSP_SCRIPTLET) || matchTagName(JSPTag.JSP_DECLARATION) || matchTagName(JSPTag.JSP_EXPRESSION));
    }
    if (!isXMLTag()) { // non-XML tag
      CMElementDeclaration decl = getDeclaration();
      if (decl == null)
        return true; // undefined tag
      return (decl.getContentType() != CMElementDeclaration.EMPTY);
    }
    return true;
  }
View Full Code Here

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

      return false;
    if (isCommentTag())
      return false;
    if (!isXMLTag())
      return false;
    CMElementDeclaration decl = getDeclaration();
    if (decl == null)
      return false;
    return (decl.getContentType() == CMElementDeclaration.EMPTY);
  }
View Full Code Here

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

   * @param node
   *
   */
  private IContextInformation[] getInfoForElement(IDOMNode node) {
    IContextInformation[] results = EMPTY_CONTEXT_INFO;
    CMElementDeclaration decl = fModelUtil.getModelQuery().getCMElementDeclaration((Element) node);
    if (decl != null) {
      CMNamedNodeMap attributes = decl.getAttributes();

      CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attributes);
      List nodes = ModelQueryUtil.getModelQuery(node.getOwnerDocument()).getAvailableContent((Element) node, decl, ModelQuery.INCLUDE_ATTRIBUTES);
      for (int k = 0; k < nodes.size(); k++) {
        CMNode cmnode = (CMNode) nodes.get(k);
View Full Code Here

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

  IContextInformation[] getInfoForText(IDOMNode node) {
    Node parent = node.getParentNode();
    String contextString = node.getNodeName();
    StringBuffer info = new StringBuffer(" "); //$NON-NLS-1$
    if ((parent != null) && (parent.getNodeType() == Node.ELEMENT_NODE)) {
      CMElementDeclaration decl = fModelUtil.getModelQuery().getCMElementDeclaration((Element) parent);
      CMContent content = decl.getContent();
      if (content instanceof CMGroup) {
        CMGroup cmGroup = (CMGroup) content;
        CMNodeList children = cmGroup.getChildNodes();
        CMNode cmNode = null;
        for (int i = 0; i < children.getLength(); i++) {
View Full Code Here

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

            }

            // try referring to content model for information on
            // whitespace & indent strategy
            ModelQueryAdapter adapter = (ModelQueryAdapter) ((IDOMDocument) currentNode.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);
            CMElementDeclaration elementDeclaration = (CMElementDeclaration) adapter.getModelQuery().getCMNode(currentNode);
            if (elementDeclaration != null) {
              // follow whitespace strategy preference for
              // pcdata content
              int contentType = elementDeclaration.getContentType();
             
              String facetValue = null;
              if(elementDeclaration.getDataType() != null)
                facetValue = (String) elementDeclaration.getDataType().getProperty(PROPERTY_WHITESPACE_FACET);
              if(facetValue != null) {
                if(PRESERVE.equals(facetValue))
                  childConstraints.setWhitespaceStrategy(XMLFormattingConstraints.PRESERVE);
                // For XSD types, "collapse" corresponds to the IGNOREANDTRIM strategy
                else if(COLLAPSE.equals(facetValue))
                  childConstraints.setWhitespaceStrategy(XMLFormattingConstraints.IGNOREANDTRIM);
                else if(REPLACE.equals(facetValue))
                  childConstraints.setWhitespaceStrategy(XMLFormattingConstraints.REPLACE);
              }
              else if (contentType == CMElementDeclaration.PCDATA && parentConstraints != null && !XMLFormattingConstraints.PRESERVE.equals(parentConstraints.getWhitespaceStrategy())) {
                childConstraints.setWhitespaceStrategy(preferences.getPCDataWhitespaceStrategy());
              }
              else if (contentType == CMElementDeclaration.ELEMENT && parentConstraints != null && !XMLFormattingConstraints.PRESERVE.equals(parentConstraints.getWhitespaceStrategy())) {
                childConstraints.setWhitespaceStrategy(XMLFormattingConstraints.IGNORE);
                childConstraints.setIndentStrategy(XMLFormattingConstraints.INDENT);
                childConstraints.setIsWhitespaceStrategyAHint(true);
                childConstraints.setIsIndentStrategyAHint(true);
              }
              else {
                // look for xml:space in content model
                CMNamedNodeMap cmAttributes = elementDeclaration.getAttributes();

                // Not needed - we're looking for xml:space
                //CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(cmAttributes);
                //List nodes = ModelQueryUtil.getModelQuery(currentNode.getOwnerDocument()).getAvailableContent((Element) currentNode, elementDeclaration, ModelQuery.INCLUDE_ATTRIBUTES);
                //for (int k = 0; k < nodes.size(); k++) {
View Full Code Here

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

  private String getElementValueHelper(Element element) {
    String result = null;

    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if ((result == null) && (mq != null)) {
      CMElementDeclaration ed = mq.getCMElementDeclaration(element);
      if ((ed != null) && !Boolean.TRUE.equals(ed.getProperty("isInferred"))) { //$NON-NLS-1$
        result = descriptionBuilder.buildDescription(ed);
      }
    }
    return result != null ? result : ""; //$NON-NLS-1$
  }
View Full Code Here

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

  private List getRequiredAttrs(Node node) {
    List result = new ArrayList();

    ModelQuery modelQuery = getModelQuery(node);
    if (modelQuery != null) {
      CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node);
      if (elementDecl != null) {
        CMNamedNodeMap attrMap = elementDecl.getAttributes();

        CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attrMap);
        List nodes = ModelQueryUtil.getModelQuery(node.getOwnerDocument()).getAvailableContent((Element) node, elementDecl, ModelQuery.INCLUDE_ATTRIBUTES);
        for (int k = 0; k < nodes.size(); k++) {
          CMNode cmnode = (CMNode) nodes.get(k);
View Full Code Here

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

  public String getElementValueHelper(Element element) {
    String result = null;

    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if ((result == null) && (mq != null)) {
      CMElementDeclaration ed = mq.getCMElementDeclaration(element);
      if ((ed != null) && !Boolean.TRUE.equals(ed.getProperty("isInferred"))) { //$NON-NLS-1$
        result = decriptionBuilder.buildDescription(ed);
      }
    }
    return result != null ? result : ""; //$NON-NLS-1$
  }
View Full Code Here

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

   */
  CMNamedNodeMap getCMAttributes(Element element) {
    CMNamedNodeMap map = (CMNamedNodeMap) fCMCache.get(element);
    if (map == null) {
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(this);
      CMElementDeclaration decl = modelQuery != null ? modelQuery.getCMElementDeclaration(element) : null;
      if (decl != null) {
        map = decl.getAttributes();
        fCMCache.put(element, map);
      }
    }
    return map;
  }
View Full Code Here

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

      CompletionProposalInvocationContext context) {
   
    IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
    IStructuredDocumentRegion sdRegion = contentAssistRequest.getDocumentRegion();
    // retrieve the list of attributes
    CMElementDeclaration elementDecl = getCMElementDeclaration(node);
    if (elementDecl != null) {
      CMNamedNodeMapImpl attributes = new CMNamedNodeMapImpl(elementDecl.getAttributes());
      addModelQueryAttributeDeclarations(node, elementDecl,attributes);

      String matchString = contentAssistRequest.getMatchString();
      int cursorOffset = context.getInvocationOffset();
      // check whether an attribute really exists for the replacement
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.