Package tk.eclipse.plugin.jspeditor.editors

Source Code of tk.eclipse.plugin.jspeditor.editors.JSPHyperlinkProvider

package tk.eclipse.plugin.jspeditor.editors;

import jp.aonir.fuzzyxml.FuzzyXMLDocument;
import jp.aonir.fuzzyxml.FuzzyXMLElement;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;

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

public class JSPHyperlinkProvider implements IHyperlinkProvider {

  public HTMLHyperlinkInfo getHyperlinkInfo(IFile file, FuzzyXMLDocument doc,
      FuzzyXMLElement element, String attrName, String attrValue,int offset) {
   
    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;
  }

}
TOP

Related Classes of tk.eclipse.plugin.jspeditor.editors.JSPHyperlinkProvider

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.