Examples of HTMLHyperlinkInfo


Examples of tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo

   
    if(element.getName().equals("jsp:include") && attrName.equals("page")){
      IPath path = file.getParent().getProjectRelativePath();
      IResource resource = file.getProject().findMember(path.append(attrValue));
      if(resource!=null && resource.exists() && resource instanceof IFile){
        HTMLHyperlinkInfo info = new HTMLHyperlinkInfo();
        info.setObject(resource);
        info.setOffset(0);
        info.setLength(attrValue.length());
        return info;
      }
    }
   
    return null;
View Full Code Here

Examples of tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo

   
    for(int i=0;i<attrNames.length;i++){
      if(attrName.equals(attrNames[i])){
        IType type = findType(javaProject, attrValue);
        if(type!=null){
          HTMLHyperlinkInfo info = new HTMLHyperlinkInfo();
          info.setObject(type);
          info.setOffset(0);
          info.setLength(attrValue.length());
          return info;
        }
      }
    }
   
View Full Code Here

Examples of tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo

    FuzzyXMLElement element = document.getElementByOffset(offset);
    if (element == null) {
      return null;
    }
    FuzzyXMLAttribute[] attrs = element.getAttributes();
    HTMLHyperlinkInfo info = getOpenFileInfo(document, element, null, null, offset);
    if (info != null) {
      return (IHyperlink) info.getObject();
    }
    else {
      for (int i = 0; i < attrs.length; i++) {
        if (attrs[i].getOffset() < offset && offset < attrs[i].getOffset() + attrs[i].getLength()) {
          int attrOffset = getAttributeValueOffset(doc.get(), attrs[i]);
          int attrLength = attrs[i].getValue().length();
          if (attrOffset >= 0 && attrLength >= 0 && attrOffset <= offset) {
            info = getOpenFileInfo(document, element, attrs[i].getName(), attrs[i].getValue(), offset - attrOffset);
            IHyperlink hyperlink = null;
            if (info != null && info.getObject() != null) {
              if (info.getObject() instanceof IHyperlink) {
                hyperlink = (IHyperlink) info.getObject();
              }
              else {
                hyperlink = new HTMLHyperlink(new Region(attrOffset + info.getOffset(), info.getLength()), info.getObject());
              }
            }
            return hyperlink;
          }
        }
View Full Code Here

Examples of tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo

        return null;
      }
      IFile file = ((IFileEditorInput) editor.getEditorInput()).getFile();
      for (int i = 0; i < providers.size(); i++) {
        IHyperlinkProvider provider = this.providers.get(i);
        HTMLHyperlinkInfo info = provider.getHyperlinkInfo(file, doc, element, attrName, attrValue, offset);
        if (info != null && info.getObject() != null) {
          return info;
        }
      }
      if (attrName != null && attrName.equalsIgnoreCase("href")) {
        String href = attrValue;
        if (href.indexOf("#") > 0) {
          href = href.substring(0, href.indexOf("#"));
        }
        IPath path = file.getParent().getProjectRelativePath();
        IResource resource = project.findMember(path.append(href));
        if (resource != null && resource.exists() && resource instanceof IFile) {
          HTMLHyperlinkInfo info = new HTMLHyperlinkInfo();
          info.setObject(resource);
          info.setOffset(0);
          info.setLength(attrValue.length());
          return info;
        }
      }
    }
    catch (Exception ex) {
View Full Code Here

Examples of tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo

import tk.eclipse.plugin.htmleditor.IHyperlinkProvider;
import tk.eclipse.plugin.htmleditor.editors.HTMLHyperlinkInfo;

public class InlineWodElementHyperlinkProvider implements IHyperlinkProvider {
  public HTMLHyperlinkInfo getHyperlinkInfo(IFile file, FuzzyXMLDocument doc, FuzzyXMLElement element, String attrName, String attrValue, int offset) {
    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();
            if (valuePosition != null) {
              hyperlinkInfo = new HTMLHyperlinkInfo();
              hyperlinkInfo.setOffset(valuePosition.getOffset());
              hyperlinkInfo.setLength(valuePosition.getLength());
              hyperlinkInfo.setObject(WodBindingValueHyperlink.toBindingValueHyperlink(wodElement, attrName, cache));
            }
          }
        }
      }
    }
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.