public boolean removeTextLocation(String category, MateTextLocation location) { try { mateText.getDocument().removePosition(category, (SwtMateTextLocation) location); return true; } catch (BadPositionCategoryException e) { e.printStackTrace(); } return false; }
public boolean addTextLocation(String category, MateTextLocation location) { try { mateText.getDocument().addPosition(category, (SwtMateTextLocation) location); return true; } catch (BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BadPositionCategoryException e) { e.printStackTrace(); } return false; }
public SwtMateDocument(MateText mateText) { this.mateText = mateText; this.document = (Document) mateText.getDocument(); for (IPositionUpdater u : document.getPositionUpdaters()) { document.removePositionUpdater(u); } document.addPositionCategory("scopes"); document.addPositionUpdater( new SwtScopePositionUpdater("scopes", SwtScopePositionUpdater.RIGHT_GRAVITY)); document.addPositionCategory("lefts"); document.addPositionUpdater( new SwtScopePositionUpdater("lefts", SwtScopePositionUpdater.LEFT_GRAVITY)); document.addPositionCategory("rights"); document.addPositionUpdater( new SwtScopePositionUpdater("rights", SwtScopePositionUpdater.RIGHT_GRAVITY)); }