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

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


  public IPropertyDescriptor createTextPropertyDescriptor(Text text) {
    IPropertyDescriptor result = null;
    Node parentNode = text.getParentNode();
    if ((parentNode != null) && (parentNode.getNodeType() == Node.ELEMENT_NODE)) {
      Element parentElement = (Element) parentNode;
      ModelQuery mq = ModelQueryUtil.getModelQuery(text.getOwnerDocument());
      CMElementDeclaration ed = null;
      if (mq != null) {
        ed = mq.getCMElementDeclaration(parentElement);
      }
      if (ed != null) {
        result = createPropertyDescriptorHelper(HACK, parentElement, ed);
      }
      else {
View Full Code Here


  public IPropertyDescriptor createAttributePropertyDescriptor(Attr attr) {
    IPropertyDescriptor result = null;

    String attributeName = attr.getName();
    ModelQuery mq = ModelQueryUtil.getModelQuery(attr.getOwnerDocument());

    CMAttributeDeclaration ad = null;
    if (mq != null) {
      ad = mq.getCMAttributeDeclaration(attr);
    }
    if (ad != null) {
      result = createPropertyDescriptorHelper(attributeName, attr.getOwnerElement(), ad);
    }
View Full Code Here

    }
    else {
      // ENUMERATED values
      String[] valueStrings = null;
      // valueStrings = valuesHelper.getEnumeratedValues();
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fNode.getOwnerDocument());
      if ((modelQuery != null) && (fNode.getNodeType() == Node.ELEMENT_NODE)) {
        valueStrings = modelQuery.getPossibleDataTypeValues((Element) fNode, attrDecl);
      }
      else {
        valueStrings = attrDecl.getAttrType().getEnumeratedValues();
      }
      if (valueStrings != null) {
View Full Code Here

   * @return CMElementDeclaration
   */
  private CMElementDeclaration getCMElementDeclaration(Element element) {
    CMElementDeclaration ed = null;

    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if (mq != null) {
      ed = mq.getCMElementDeclaration(element);
    }
    return ed;
  }
View Full Code Here

  private CMElementDeclaration getDeclaration() {
    if ((fNode == null) || (fNode.getNodeType() != Node.ELEMENT_NODE)) {
      return null;
    }
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fNode.getOwnerDocument());
    if (modelQuery != null) {
      return modelQuery.getCMElementDeclaration((Element) fNode);
    }
    return null;
  }
View Full Code Here

    CMElementDeclaration ed = getDeclaration();
    CMNamedNodeMap attrMap = null;
    if (ed != null) {
      attrMap = ed.getAttributes();
      CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attrMap);
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fNode.getOwnerDocument());
      if(modelQuery != null) {
      List nodes = modelQuery.getAvailableContent((Element) fNode, ed, 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

  public static String SMALL_ICON_URL = "small-icon"; //$NON-NLS-1$

  public static CMNode getDeclaration(Node node) {
    CMNode decl = null;
    ModelQuery mq = null;
    switch (node.getNodeType()) {
      case Node.ATTRIBUTE_NODE : {
        mq = ModelQueryUtil.getModelQuery(((Attr) node).getOwnerDocument());
        decl = mq.getCMAttributeDeclaration((Attr) node);
      }
        break;
      case Node.ELEMENT_NODE : {
        mq = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
        decl = mq.getCMElementDeclaration((Element) node);
      }
        break;
    }
    return decl;
  }
View Full Code Here

  public void invokeCMDocumentLoad() {
    if (fIsDisabled) return;
    try {
      fIsLoading = true;
     
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fDocument);
      if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null)) {
        CMDocumentLoader loader = isGrammarInferenceEnabled ? new InferredGrammarBuildingCMDocumentLoader(fDocument, modelQuery) : new CMDocumentLoader(fDocument, modelQuery);
        loader.loadCMDocuments();
      }
    } finally {
      fIsLoading = false;
View Full Code Here

   *         <code>null</code> if not possible
   */
  protected CMElementDeclaration getCMElementDeclaration(Node node) {
    CMElementDeclaration result = null;
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
      if (modelQuery != null) {
        result = modelQuery.getCMElementDeclaration((Element) node);
      }
    }
    return result;
  }
View Full Code Here

    Assert.isTrue(fCMDocumentManagerListener == null);

    // register for CMDocumentManager events
    ModelQueryAdapter mqadapter = (ModelQueryAdapter) node.getAdapterFor(ModelQueryAdapter.class);
    if (mqadapter != null) {
      ModelQuery mquery = mqadapter.getModelQuery();
      if ((mquery != null) && (mquery.getCMDocumentManager() != null)) {
        cmDocumentManager = mquery.getCMDocumentManager();
        fCMDocumentManagerListener = new CMDocumentManagerListenerImpl();
        cmDocumentManager.addListener(fCMDocumentManagerListener);
      }
    }
  }
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.