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

Examples of org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery


  public TaglibVariable[] getTaglibVariables(String tagToAdd, IStructuredDocument structuredDoc, ITextRegionCollection customTag, List problems) {

    List results = new ArrayList();
    if (problems == null)
      problems = new ArrayList();
    ModelQuery mq = getModelQuery(structuredDoc);
    if (mq != null) {
      TLDCMDocumentManager mgr = TaglibController.getTLDCMDocumentManager(structuredDoc);

      // TaglibSupport support = ((TaglibModelQuery)
      // mq).getTaglibSupport();
View Full Code Here


  /**
   * @return Returns the fModelQuery.
   */
  public ModelQuery getModelQuery(IDocument doc) {
    IStructuredModel model = null;
    ModelQuery mq = null;
    try {
      model = StructuredModelManager.getModelManager().getExistingModelForRead(doc);
      mq = ModelQueryUtil.getModelQuery(model);
    }
    finally {
View Full Code Here

      CompletionProposalInvocationContext context) {

    if(!this.isXHTML) {
      IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
 
      ModelQuery mq = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
      if (mq != null) {
        CMDocument doc = mq.getCorrespondingCMDocument(node);
        // this shouldn't have to have the prefix coded in
        if (doc instanceof JSPCMDocument || doc instanceof CMNodeWrapper ||
            node.getNodeName().startsWith("jsp:")) { //$NON-NLS-1$
          return;
        }
View Full Code Here

            }
          }
          idResolver = new XMLCatalogIdResolver(baseLocation, null);
        }

        ModelQuery modelQuery = createModelQuery(model, idResolver);
        modelQuery.setEditMode(ModelQuery.EDIT_MODE_UNCONSTRAINED);
        modelQueryAdapterImpl = new JSPModelQueryAdapterImpl(new CMDocumentCache(), modelQuery, idResolver);
      }
    }
    return modelQueryAdapterImpl;
  }
View Full Code Here

  public void release() {
    // default is to do nothing
  }

  private static boolean isTagAvailable(Document document, String elementName) {
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
    if (modelQuery != null) {
      CMDocument cmdoc = modelQuery.getCorrespondingCMDocument(document);
      CMNamedNodeMap map = cmdoc.getElements();
      if ((CMElementDeclaration) map.getNamedItem(elementName) != null) {
        return true;
      }
    }
View Full Code Here

    return false;
  }

  private static boolean isAttributeAvailable(Element element, String attrName) {
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if (modelQuery != null) {
      CMElementDeclaration decl = modelQuery.getCMElementDeclaration(element);
      if (decl != null) {
        CMNamedNodeMap map = decl.getAttributes();
        if ((CMAttributeDeclaration) map.getNamedItem(attrName) != null) {
          return true;
        }
View Full Code Here

    Document document = element.getOwnerDocument();
    if (document == null)
      // undefined tag, return default
      return false;

    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
    if (modelQuery == null)
      // undefined tag, return default
      return false;

    CMElementDeclaration decl = modelQuery.getCMElementDeclaration(element);
    if (decl == null)
      // undefined tag, return default
      return false;

    return (decl.getContentType() == CMElementDeclaration.EMPTY);
View Full Code Here

    return newNode;
  }


  protected ModelQuery getModelQuery(Node node) {
    ModelQuery result = null;
    if (node.getNodeType() == Node.DOCUMENT_NODE) {
      result = ModelQueryUtil.getModelQuery((Document) node);
    }
    else {
      result = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
View Full Code Here

  }

  protected 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();
        Iterator it = attrMap.iterator();
        CMAttributeDeclaration attr = null;
        while (it.hasNext()) {
View Full Code Here

  private void processDirective(IReporter reporter, IFile file, IStructuredModel model, IStructuredDocumentRegion documentRegion) {
    IndexedRegion ir = model.getIndexedRegion(documentRegion.getStartOffset());
    if (ir instanceof IDOMElement) {
      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);
            if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
              allAttributes.put(cmnode);
            }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery

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.