Examples of WodParserCache


Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

  }

  @Override
  public void update() {
    try {
      WodParserCache cache = TemplateSourceEditor.this.getParserCache();
      cache.getHtmlEntry().setDocument(getDocumentProvider().getDocument(getEditorInput()));
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    super.update();
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

    }
  }

  protected void _validate() {
    try {
      WodParserCache cache = TemplateSourceEditor.this.getParserCache();
      cache.parse();
      cache.validate(false, true);
      if (_breadcrumb != null) {
        _breadcrumb.updateBreadcrumb();
      }
    }
    catch (Exception ex) {
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

    return doc;
  }

  public IWodElement getSelectedElement(boolean resolveWodElement, boolean refreshModel) throws Exception {
    IWodElement wodElement = null;
    WodParserCache cache = getParserCache();
    if (getSelectionProvider() != null) {
      ISelection realSelection = getSelectionProvider().getSelection();
      if (realSelection instanceof ITextSelection) {
        ITextSelection textSelection = (ITextSelection) realSelection;
        FuzzyXMLDocument document = getHtmlXmlDocument(refreshModel);
        if (document != null) {
          FuzzyXMLElement element = document.getElementByOffset(textSelection.getOffset());
          BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
          wodElement = WodHtmlUtils.getWodElement(element, buildProperties, resolveWodElement, cache);
        }
      }
      else if (realSelection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection = (IStructuredSelection) realSelection;
        Object obj = structuredSelection.getFirstElement();
        if (obj instanceof FuzzyXMLElement) {
          FuzzyXMLElement element = (FuzzyXMLElement) obj;
          BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
          wodElement = WodHtmlUtils.getWodElement(element, buildProperties, resolveWodElement, cache);
        }
      }
    }
    return wodElement;
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

  public IWodElement getWodElementAtPoint(Point point, boolean resolveWodElement, boolean refreshModel) throws Exception {
    IWodElement wodElement = null;
    FuzzyXMLElement element = getElementAtPoint(point, refreshModel);
    if (WodHtmlUtils.isWOTag(element)) {
      WodParserCache cache = getParserCache();
      BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
      wodElement = WodHtmlUtils.getWodElement(element, buildProperties, resolveWodElement, cache);
    }
    return wodElement;
  }
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

    HTMLHyperlinkInfo hyperlinkInfo = null;
    try {
      if (WodHtmlUtils.isWOTag(element.getName()) && WodHtmlUtils.isInline(element.getName())) {
        BuildProperties buildProperties = (BuildProperties)file.getProject().getAdapter(BuildProperties.class);
        if (attrName == null) {
          WodParserCache cache = WodParserCache.parser(file);
          SimpleWodElement wodElement = new FuzzyXMLWodElement(element, buildProperties);
          if (wodElement.isTypeWithin(new Region(offset, 0))) {
            hyperlinkInfo = new HTMLHyperlinkInfo();
            hyperlinkInfo.setOffset(wodElement.getElementTypePosition().getOffset());
            hyperlinkInfo.setLength(wodElement.getElementTypePosition().getLength());
            hyperlinkInfo.setObject(WodElementTypeHyperlink.toElementTypeHyperlink(wodElement, cache));
          }
        }
        else {
          WodParserCache cache;
          cache = WodParserCache.parser(file);
          SimpleWodElement wodElement = new FuzzyXMLWodElement(element, buildProperties);
          IWodBinding wodBinding = wodElement.getBindingNamed(attrName);
          if (wodBinding != null) {
            Position valuePosition = wodBinding.getValuePosition();
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

    updateBreadcrumb();
  }

  public void updateBreadcrumb() {
    try {
      WodParserCache cache = _editor.getParserCache();
      Point selectionRange = _editor.getSelectedRange();

      FuzzyXMLElement element = null;
      FuzzyXMLDocument document = cache.getHtmlEntry().getModel();
      if (document != null) {
        element = document.getElementByOffset(selectionRange.x);
      }

      Control[] children = getChildren();
      for (int i = children.length - 1; i >= 0; i--) {
        children[i].dispose();
      }

      boolean emptyBreadcrumb = true;
      if (element != null) {
        List<FuzzyXMLNode> elementStack = new LinkedList<FuzzyXMLNode>();
        FuzzyXMLNode currentNode = element;
        do {
          elementStack.add(currentNode);
          currentNode = currentNode.getParentNode();
        } while (currentNode != null);

        for (int i = elementStack.size() - 2; i >= 0; i--) {
          FuzzyXMLNode stackNode = elementStack.get(i);
          if (stackNode instanceof FuzzyXMLElement) {
            emptyBreadcrumb = false;
            FuzzyXMLElement stackElement = (FuzzyXMLElement) stackNode;

            FuzzyXMLElementWithWodElement data;
            String tagName = stackElement.getName();
            boolean isWOTag = WodHtmlUtils.isWOTag(tagName);
            String displayName = null;
            if (isWOTag) {
              BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
              IWodElement wodElement = WodHtmlUtils.getWodElement(stackElement, buildProperties, true, cache);
              if (wodElement != null) {
                displayName = wodElement.getElementType();
              }
              data = new FuzzyXMLElementWithWodElement(stackElement, wodElement);
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.core.completion.WodParserCache

   */
  @Override
  protected HTMLAssistProcessor createAssistProcessor() {
    try {
      IFile file = ((FileEditorInput) getEditorPart().getEditorInput()).getFile();
      WodParserCache parserCache = WodParserCache.parser(file);
      BuildProperties buildProperties = (BuildProperties)parserCache.getProject().getAdapter(BuildProperties.class);
      return new TemplateAssistProcessor(getEditorPart(), parserCache, buildProperties);
    }
    catch (Exception e) {
      throw new RuntimeException("Failed to create assist processor.", e);
    }
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.