Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Position


      int annotationLayer = annotationAccess.getLayer(annotation);
      if (annotationAccess != null)
        if (annotationLayer < layer)
          continue;

      Position position = model.getPosition(annotation);
      if (!includesRulerLine(position, document))
        continue;

      boolean isReadOnly = fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly();
      if (!isReadOnly) {
View Full Code Here


      } else {
        this.preferences.line_separator = Util.LINE_SEPARATOR;
      }
      this.preferences.initial_indentation_level = indentationLevel;
      this.newCodeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length, null);
      final CommentRegion region = createRegion(kind, new Document(source), new Position(offset, length), this.newCodeFormatter);
      if (region != null) {
        return this.newCodeFormatter.format(source, region);
      }
    }
    return new MultiTextEdit();
View Full Code Here

      this.string= string;
      this.kind= kind;
    }
   
    public String getPrefix(int indent) {
      Position pos= new Position(this.start, this.length);
      String str= this.string;
      TextEdit res= formatString(this.kind, str, 0, str.length(), indent);
      if (res != null) {
        str= evaluateFormatterEdit(str, res, new Position[] { pos });
      }
View Full Code Here

    }
   
    public String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore events) {
      String nodeString= ASTRewriteFlattener.asString(node, events);
      String str= this.prefix + nodeString;
      Position pos= new Position(this.start, this.prefix.length() + 1 - this.start);

      TextEdit res= formatString(CodeFormatter.K_STATEMENTS, str, 0, str.length(), indent);
      if (res != null) {
        str= evaluateFormatterEdit(str, res, new Position[] { pos });
      }
View Full Code Here

      int nodeStart= this.prefix.length();
      int nodeEnd= nodeStart + nodeString.length() - 1;
     
      String str= this.prefix + nodeString + this.suffix;
     
      Position pos1= new Position(this.start, nodeStart + 1 - this.start);
      Position pos2= new Position(nodeEnd, 2);

      TextEdit res= formatString(CodeFormatter.K_STATEMENTS, str, 0, str.length(), indent);
      if (res != null) {
        str= evaluateFormatterEdit(str, res, new Position[] { pos1, pos2 });
      }
View Full Code Here

      final boolean isLastCode= previous.hasAttribute(COMMENT_CODE);
     
      final int base= getOffset();
     
      if (!isLastCode && isCurrentCode)
        fCodePositions.add(new Position(base + previous.getOffset()));
      else if (isLastCode && !isCurrentCode)
        fCodePositions.add(new Position(base + next.getOffset() + next.getLength()));
     
      if (previous.hasAttribute(COMMENT_IMMUTABLE) && next.hasAttribute(COMMENT_IMMUTABLE))
        return false;
     
      return true;
View Full Code Here

        if (fCodePositions.size() > 0) {
         
          int begin= 0;
          int end= 0;
         
          Position position= null;
         
          final IDocument document= getDocument();
         
          for (int index= fCodePositions.size() - 1; index >= 0;) {
           
            position= (Position)fCodePositions.get(index--);
            begin= position.getOffset();
           
            if (index >= 0) {
              position= (Position)fCodePositions.get(index--);
              end= position.getOffset();
            } else {
              /*
               * Handle missing closing tag
               * see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=57011
               */
 
View Full Code Here

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
            if (annotation instanceof MarkerAnnotation && canFix(annotation)) {
                Position position = model.getPosition(annotation);
                if (isAtPosition(context.getOffset(), position)) {
                    IMarker marker = ((MarkerAnnotation) annotation).getMarker();
                    String errorType = marker.getAttribute("$bndType", null);
                    if (errorType != null) {
                        BuildErrorDetailsHandler handler = BuildErrorDetailsHandlers.INSTANCE.findHandler(errorType);
View Full Code Here

        @SuppressWarnings("rawtypes")
        Iterator iter = model.getAnnotationIterator();
        while (iter.hasNext()) {
            Annotation annotation = (Annotation) iter.next();
            if (annotation instanceof MarkerAnnotation && canFix(annotation)) {
                Position position = model.getPosition(annotation);
                if (isAtPosition(context.getOffset(), position)) {
                    IMarker marker = ((MarkerAnnotation) annotation).getMarker();
                    String errorType = marker.getAttribute("$bndType", null);
                    if (errorType != null) {
                        BuildErrorDetailsHandler handler = BuildErrorDetailsHandlers.INSTANCE.findHandler(errorType);
View Full Code Here

                if (object instanceof SimpleMarkerAnnotation) {
                    SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object;
                    IMarker marker = markerAnnotation.getMarker();
                    try {
                        if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
                            Position position = annotationModel.getPosition(markerAnnotation);
                            int line = document.getLineOfOffset(position.getOffset());
                            if (line == fRulerInfo.getLineOfLastMouseButtonActivity()) {
                                IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint(marker);
                                if (breakpoint != null) {
                                    return breakpoint;
                                }
View Full Code Here

TOP

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

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.