Package org.eclipse.wst.xml.core.internal.ssemodelquery

Examples of org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter


              childConstraints.setIsIndentStrategyAHint(true);
            }

            // 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();
             
View Full Code Here


    //only returns anything if looking for child nodes
    if(((includeOptions & ModelQuery.INCLUDE_CHILD_NODES) != 0) && parentElement instanceof IDOMNode) {
      IDOMNode node = (IDOMNode)parentElement;
      // get position dependent CMDocuments and insert their tags as
      // proposals
      ModelQueryAdapter mqAdapter = null;
      if (node.getNodeType() == Node.DOCUMENT_NODE) {
        mqAdapter = (ModelQueryAdapter) 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(node);
          CMNamedNodeMap jspelements = jcmdoc.getElements();

          /* For a built-in JSP action the content model is properly
View Full Code Here

        }
       
        potentialModelQueryObject = (ModelQuery) embeddedModelQueries.get(effectiveContentType);
       
        if (potentialModelQueryObject == null) {
          ModelQueryAdapter embeddedAdapter = (ModelQueryAdapter) pageDirectiveAdapter.adapt((INodeNotifier) node, ModelQueryAdapter.class);
          if (embeddedAdapter != null) {
            // we will cache one model query per content type
            embeddedModelQuery = embeddedAdapter.getModelQuery();
            embeddedModelQueries.put(effectiveContentType, embeddedModelQuery);
          }
        }
        else {
          embeddedModelQuery = potentialModelQueryObject;
View Full Code Here

    // create a new instance from the old data. Note: I think this
    // "forced fit" only works here since the implementation of
    // ModelQueryAdapter does not
    // have to be released.

    ModelQueryAdapter modelQueryAdapter = getModelQueryAdapter(model);
    if (modelQueryAdapter == null) {
      modelQueryAdapter = getModelQueryAdapter(oldModel);
      IDOMDocument document = ((IDOMModel) model).getDocument();
      document.addAdapter(new JSPModelQueryAdapterImpl(modelQueryAdapter.getCMDocumentCache(), modelQueryAdapter.getModelQuery(), modelQueryAdapter.getIdResolver()));

    }


View Full Code Here

  }

  private ModelQueryAdapter getModelQueryAdapter(IStructuredModel model) {
    IDOMDocument document = ((IDOMModel) model).getDocument();

    ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter) ((INodeNotifier) document).getAdapterFor(ModelQueryAdapter.class);
    return modelQueryAdapter;
  }
View Full Code Here

      }

      // 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();

          /*
 
View Full Code Here

    }
    INodeNotifier notifier = (INodeNotifier) element.getOwnerDocument();
    if (notifier == null) {
      return null;
    }
    ModelQueryAdapter mqa = (ModelQueryAdapter) notifier
        .getAdapterFor(ModelQueryAdapter.class);
    if (mqa == null) {
      return null;
    }
    return mqa.getModelQuery().getCMElementDeclaration(element);
  }
View Full Code Here

          insertAfterNode(lastChild, lineDelimiter + nodeIndentation);
      }
      else if (lastChild == null && firstStructuredDocumentRegionContainsLineDelimiters(node)) {
        // BUG174243 do not indent end tag if node has empty content
        // (otherwise new text node would be introduced)
        ModelQueryAdapter adapter = (ModelQueryAdapter) ((IDOMDocument) node.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);
        CMElementDeclaration elementDeclaration = (CMElementDeclaration) adapter.getModelQuery().getCMNode(node);
        if ((elementDeclaration == null) || (elementDeclaration.getContentType() != CMElementDeclaration.EMPTY)) {
          // indent end tag
          replace(structuredDocument, node.getFirstStructuredDocumentRegion().getEndOffset(), 0, lineDelimiter + nodeIndentation);
        }
      }
View Full Code Here

      // one in the DTD.
      // We do not check for a conflict between a DTD's 'fixed' value
      // and the attribute value found in the instance document, we
      // leave that to the validator.
      if (!sawXmlSpace) {
        ModelQueryAdapter adapter = (ModelQueryAdapter) ((IDOMDocument) node.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);
        CMElementDeclaration elementDeclaration = (CMElementDeclaration) adapter.getModelQuery().getCMNode(node);
        if (elementDeclaration != null) {
          int contentType = elementDeclaration.getContentType();
          if (preferences.isPreservePCDATAContent() && contentType == CMElementDeclaration.PCDATA) {
            formatContraints.setInPreserveSpaceElement(true);
          }
View Full Code Here

              childConstraints.setIsIndentStrategyAHint(true);
            }

            // 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();
             
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.ssemodelquery.ModelQueryAdapter

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.