Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Region


    public static void testTrailingWhitespaceAfterKey() throws Exception {
        String input = "   hello  :world";
        PropertiesLineReader reader = new PropertiesLineReader(input);

        assertEquals(entry, reader.next());
        assertEquals(new Region(0, 16), reader.region());
        assertEquals("hello", reader.key());
    }
View Full Code Here


    public static void testEscapedCharsInKey() throws Exception {
        String input = "hel\\ \\ lo: world\n" + "hell\\=o\\:world=foo";
        PropertiesLineReader reader = new PropertiesLineReader(input);

        assertEquals(entry, reader.next());
        assertEquals(new Region(0, 16), reader.region());
        assertEquals("hel  lo", reader.key());

        assertEquals(entry, reader.next());
        assertEquals(new Region(17, 18), reader.region());
        assertEquals("hell=o:world", reader.key());
    }
View Full Code Here

    public static void testEmptyValue() throws Exception {
        String input = "cheeses";
        PropertiesLineReader reader = new PropertiesLineReader(input);

        assertEquals(entry, reader.next());
        assertEquals(new Region(0, 7), reader.region());
        assertEquals("cheeses", reader.key());
    }
View Full Code Here

    public static void testCarriageReturnAndLineFeed() throws Exception {
        String input = "line1=foo\r\n" + "line2=foo,\\\r\n" + "  bar";
        PropertiesLineReader reader = new PropertiesLineReader(input);

        assertEquals(entry, reader.next());
        assertEquals(new Region(0, 9), reader.region());
        assertEquals("line1", reader.key());

        assertEquals(entry, reader.next());
        assertEquals(new Region(11, 18), reader.region());
        assertEquals("line2", reader.key());
    }
View Full Code Here

        if (continued) {
            int length = lastRegion.getLength();
            length += document.getLineDelimiter(lineNum - 1).length();
            length += lineInfo.getLength();
            lastRegion = new Region(lastRegion.getOffset(), length);
        } else {
            lastRegion = lineInfo;
        }

        lineNum++;
View Full Code Here

        if (continued) {
            int length = lastRegion.getLength();
            length += document.getLineDelimiter(lineNum - 1).length();
            length += lineInfo.getLength();
            lastRegion = new Region(lastRegion.getOffset(), length);
        } else {
            lastRegion = lineInfo;
        }

        lineNum++;
View Full Code Here

      MethodDeclaration mdec = (MethodDeclaration) node.getParent();
      mockMethod = mdec.resolveBinding();

      paramType = MockUtil.findMockedType(mdec, mockMethod);

      wordRegion = new Region(node.getStartPosition(), node.getLength());

      if( paramType != null && mockMethod != null )
      {
        realMethod = MockUtil.findRealMethodInType(paramType, mockMethod, astRoot.getAST());
      }
View Full Code Here

        DocumentTemplateContext context =
            (DocumentTemplateContext) contextType.createContext();

        int start = context.getStart();
        int end = context.getEnd();
        IRegion region = new Region(start, end - start);

        Template[] templates = Templates.getInstance().getTemplates();
        for (int i = 0; i != templates.length; i++)
        {
            if (context.canEvaluate(templates[i]))
View Full Code Here

    public String text() {
      return matcher.group(1);
    }

    public IHyperlink hyperlink(final String type, int startOffset, int endOffset) {
      final IRegion region= new Region(
          offset + matcher.start() + startOffset,
          matcher.end() - matcher.start() - startOffset + endOffset);
      return new IHyperlink() {

        @Override
View Full Code Here

        end =
          Math.min(
            partition.getOffset() + partition.getLength(),
            end);
        return new Region(start, end - start);

      } catch (BadLocationException x) {
      }
    }
View Full Code Here

TOP

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

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.