コード例 #1
0
 public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
   if (region.getAxis() != null
       && region.getAxis().toLowerCase().endsWith(CSS_CLASS_TOKEN)
       && !region.getAxis().toLowerCase().endsWith(EXCLUSION_TOKEN)) // Fix for JBIDE-5056
   return true;
   return false;
 }
  /**
   * @see
   *     com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
   *     com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
   */
  protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
    StructuredModelWrapper smw = new StructuredModelWrapper();
    smw.init(document);
    try {
      Document xmlDocument = smw.getDocument();
      if (xmlDocument == null) return null;

      if (!recognize(document, offset, superRegion)) return null;
      IHyperlinkRegion r = getRegion(document, offset);
      if (r == null) return null;

      String axis = getAxis(document, offset);
      String contentType = superRegion.getContentType();
      String type = getPartitionType();

      return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
    } finally {
      smw.dispose();
    }
  }
  /**
   * @see
   *     com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
   *     com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
   */
  protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
    StructuredModelWrapper smw = new StructuredModelWrapper();
    smw.init(document);
    try {
      Document xmlDocument = smw.getDocument();
      if (xmlDocument == null) return null;

      Utils.findNodeForOffset(xmlDocument, offset);
      IRegion r = getRegion(document, offset);
      if (r == null) return null;

      String axis = getAxis(document, offset);
      String contentType = superRegion.getContentType();
      String type = JSF_JSP_TAG_NAME_PARTITION;

      return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
    } finally {
      smw.dispose();
    }
  }
コード例 #4
0
  /**
   * @see
   *     com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
   *     com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
   */
  protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
    StructuredModelWrapper smw = new StructuredModelWrapper();
    try {
      smw.init(document);
      Document xmlDocument = smw.getDocument();
      if (xmlDocument == null) return null;

      Node n = Utils.findNodeForOffset(xmlDocument, offset);
      if (n == null || !(n instanceof Attr)) return null;

      String axis = getAxis(document, offset);
      String contentType = superRegion.getContentType();
      String type = getPartitionType(axis);

      IRegion r = getRegion(document, offset);
      if (r == null) return null;

      return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
    } finally {
      smw.dispose();
    }
  }