1 11 package org.eclipse.ui.texteditor; 12 13 import org.eclipse.jface.text.BadLocationException; 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.jface.text.Position; 16 17 import org.eclipse.core.resources.IMarker; 18 19 20 24 class MarkerUpdater implements IMarkerUpdater { 25 26 private final static String [] ATTRIBUTES= {IMarker.CHAR_START, IMarker.CHAR_END, IMarker.LINE_NUMBER}; 27 28 31 public String [] getAttribute() { 32 return ATTRIBUTES; 33 } 34 35 38 public String getMarkerType() { 39 return null; 40 } 41 42 45 public boolean updateMarker(IMarker marker, IDocument document, Position position) { 46 47 if (position.isDeleted()) 48 return false; 49 50 if (MarkerUtilities.getCharStart(marker) != -1 && MarkerUtilities.getCharEnd(marker) != -1) { 51 MarkerUtilities.setCharStart(marker, position.getOffset()); 52 MarkerUtilities.setCharEnd(marker, position.getOffset() + position.getLength()); 53 } 54 if (MarkerUtilities.getLineNumber(marker) != -1) { 55 try { 56 MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1); 58 } catch (BadLocationException x) { 59 } 60 } 61 62 return true; 63 } 64 } 65 | Popular Tags |