Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.IRegion


    private void ensureRanges(final IDocument document, final IMarker marker,
            final int line) throws BadLocationException {
        if (line < 0 || line > document.getNumberOfLines()) {
            return;
        }
        final IRegion region = document.getLineInformation(line - 1);
        final int charstart = region.getOffset();
        final int charend = charstart + region.getLength();
        MarkerUtilities.setCharStart(marker, charstart);
        MarkerUtilities.setCharEnd(marker, charend);
    }
View Full Code Here


    /* java file region, html file region, properties file region */
    final IRegion[] wicketRegions = findWicketRegions(javaEditor, textViewer, offset);
    if (wicketRegions == null) {
      return null;
    }
    final IRegion widRegion = wicketRegions[0];
    final IRegion wcRegion = wicketRegions[1];
    final IRegion wcPropertiesRegion = wicketRegions[2];
    if (widRegion == null || wcRegion == null) {
      return null;
    }

    try {
View Full Code Here

    final IDocument document = textViewer.getDocument();

    final IRegion[] regions = new IRegion[3];

    try {
      final IRegion wicketIdRegion = findStringArgumentRegion(document, offset);
      if (wicketIdRegion == null) {
        return null;
      }
      final IRegion wicketComponentRegion = findWicketComponentRegion(document, wicketIdRegion.getOffset());
      if (wicketComponentRegion == null) {
        return null;
      }
      final IRegion javaRegion = JavaWordFinder.findWord(document, wicketComponentRegion.getOffset());
      final IJavaElement input = EditorUtility.getEditorInputJavaElement(editor, false);
      final IJavaElement[] javaElements = ((ICodeAssist) input).codeSelect(javaRegion.getOffset(), javaRegion.getLength());
      if (javaElements == null || javaElements.length == 0) {
        return null;
      }
      for (final IJavaElement javaElement : javaElements)
      {
View Full Code Here

          {
            if (iType.getFullyQualifiedName().equals("org.apache.wicket.Component"))
            {
              try {
                final IDocument document = textViewer.getDocument();
                final IRegion lineInfo = document.getLineInformationOfOffset(offset);
                final String line = document.get(lineInfo.getOffset(), lineInfo.getLength());
                final int lineRelativeOffset = offset - lineInfo.getOffset();
                final int index = line.indexOf(javaElement.getElementName());
                return new Region(offset - lineRelativeOffset + index, javaElement.getElementName().length());
              } catch (final Exception ex) {
                return null;
              }
View Full Code Here

  /** finds an argument between "" */
  private static IRegion findStringArgumentRegion(final IDocument document, final int offset)
  {
    try {
      final IRegion lineInfo = document.getLineInformationOfOffset(offset);
      final String line = document.get(lineInfo.getOffset(), lineInfo.getLength());
      final int lineRelativeOffset = offset - lineInfo.getOffset();
      int start = line.lastIndexOf("(", lineRelativeOffset) + 1;
      start = line.indexOf('"', start) + 1;
      if (start == 0)
        return null;
      final int end = line.indexOf('"', start);
View Full Code Here

  /** finds the JavaElement that is a subtype of org.apache.wicket.Component */
  private static IRegion findWicketComponentRegion(final IDocument document, final int offset)
  {
    try {
      final IRegion lineInfo = document.getLineInformationOfOffset(offset);
      final String line = document.get(lineInfo.getOffset(), lineInfo.getLength());
      final int lineRelativeOffset = offset - lineInfo.getOffset();
      // first check for generics
      int start = line.lastIndexOf('<', lineRelativeOffset);
      if (start == -1) {
        start = line.lastIndexOf('(', lineRelativeOffset);
      }
View Full Code Here

   
    String[] ids = wicketId.split("/");
   
    try
    {
      IRegion region = null;
      int index = 0;
     
      for(int i=0; i<ids.length; i++)
      {
        region = frda.find(index, '"' + ids[i] + '"', true, true, false, false);
        if(region != null)
        {
          index = region.getOffset();
        }
      }

      if(region != null)
      {
        htmlEditor.selectAndReveal(region.getOffset()+1, region.getLength()-2);
      }
     
      setActiveEditor(htmlEditor);
      htmlEditor.setFocus();
     
View Full Code Here

    if (document instanceof IDocumentExtension4) {
      int offset = selection.getOffset();
      long currentModificationStamp = ((IDocumentExtension4) document)
          .getModificationStamp();
      IRegion markOccurrenceTargetRegion = fMarkOccurrenceTargetRegion;
      if (markOccurrenceTargetRegion != null
          && currentModificationStamp == fMarkOccurrenceModificationStamp) {
        if (markOccurrenceTargetRegion.getOffset() <= offset
            && offset <= markOccurrenceTargetRegion.getOffset()
                + markOccurrenceTargetRegion.getLength())
          return;
      }
      fMarkOccurrenceTargetRegion = JavaWordFinder.findWord(document,
          offset);
      fMarkOccurrenceModificationStamp = currentModificationStamp;
View Full Code Here

    if (document == null) {
      return null;
    }

    String wicketId = null;
    final IRegion widRegion = findWicketId(textViewer, offset);
    if (widRegion == null) {
      return null;
    }

    try {
      wicketId = document.get(widRegion.getOffset(), widRegion.getLength());
      if (wicketId == null) {
        return null;
      }

    } catch (final Exception e) {
View Full Code Here

  private IRegion findWicketId(final ITextViewer textViewer, final int offset)
  {
    Assert.isNotNull(textViewer);
    final IDocument document = textViewer.getDocument();

    IRegion wordRegion = findStringArgument(document, offset, "wicket:id");
    if (wordRegion == null)
    {
      wordRegion = findStringArgument(document, offset, "wicket:message key");
      if (wordRegion != null)
      {
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.IRegion

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.