boolean after = false; boolean before = false; while ((rel = curMark.compare(pos)) != 0) { // just match if (rel > 0) { // this mark after pos if (before) {
public boolean removeMark(MarkFactory.ChainDrawMark mark) { if (mark == null) { throw new NullPointerException(); } if (curMark != mark) { // dumb impl curMark = chain; while (curMark != null) { if (curMark == mark) { break; } curMark = curMark.next; } } if (curMark != null) { boolean first = (curMark == chain); curMark = curMark.removeChain(); if (first) { chain = curMark; } return true; } else { return false; } }
boolean after = false; boolean before = false; while ((rel = curMark.compare(pos)) != 0) { // just match if (rel > 0) { // this mark after pos if (before) {
if (curMark != null) { if (curMark == chain) { // curMark is first mark chain = curMark.insertChain(mark); curMark.insertChain(mark); if (curMark != null) { if (curMark.next != null) { curMark.next.insertChain(mark); curMark.setNextChain(mark);
recentlyAddedMark = mark; if (curMark == chain) { // curMark is first mark chain = curMark.insertChain(mark); } else { // curMark is not first mark curMark.insertChain(mark); if (curMark != null) { if (curMark == chain) { // curMark is first mark chain = curMark.insertChain(mark); } else { // curMark is not first mark curMark.insertChain(mark); if (curMark != null) { if (curMark.next != null) { curMark.next.insertChain(mark); } else { // last mark in chain curMark.setNextChain(mark);
/** Get the position of the next bookmark. * @pos position from which to search * @wrap wrap around the end of document * @return position of the next bookmark or -1 if there is no mark */ public int getNextBookmark(int pos, boolean wrap) throws BadLocationException { try { pos = Utilities.getRowStart(this, pos); int rel = bookmarkChain.compareMark(pos); MarkFactory.ChainDrawMark mark = bookmarkChain.getCurMark(); if (rel <= 0) { // right at this line, go next if (mark != null) { if (mark.next != null) { return mark.next.getOffset(); } else { // last bookmark return (wrap && bookmarkChain.chain != null) ? bookmarkChain.chain.getOffset() : -1; } } else { // no marks return -1; } } else { // mark after pos return mark.getOffset(); } } catch (InvalidMarkException e) { Utilities.annotateLoggable(e); return 0; } }
/** * Remove this mark from the chain * * @return next chain member or null for end of chain */ public ChainDrawMark removeChain() { ChainDrawMark thisNext = this.next; ChainDrawMark thisPrev = this.prev; if (thisPrev != null) { // not the first thisPrev.next = thisNext; this.prev = null; } if (thisNext != null) { // not the last thisNext.prev = thisPrev; this.next = null; } try { this.remove(); // remove the mark from DocMarks } catch (InvalidMarkException e) { // already removed } return thisNext; }
/** Remove this mark from the chain * @return next chain member or null for end of chain */ public ChainDrawMark removeChain() { ChainDrawMark thisNext = this.next; ChainDrawMark thisPrev = this.prev; if (thisPrev != null) { // not the first thisPrev.next = thisNext; this.prev = null; } if (thisNext != null) { // not the last thisNext.prev = thisPrev; this.next = null; } try { this.remove(); // remove the mark from DocMarks } catch (InvalidMarkException e) { // already removed } return thisNext; }
public String toStringChain() { return toString() + (next != null ? "\n" + next.toStringChain() : ""); // NOI18N }
/** Remove non-empty block from area covered by blocks from chain */ public boolean removeMark(int pos) { int rel = compareMark(pos); if (rel == 0) { boolean first = (curMark == chain); curMark = curMark.removeChain(); if (first) { chain = curMark; } return true; } else { // not found return false; } }
public String toString() { return "MarkChain: curMark=" + curMark + ", mark chain: " // NOI18N + (chain != null ? ("\n" + chain.toStringChain()) : "Empty"); // NOI18N }
public String toString() { return "MarkChain: curMark=" + curMark + ", mark chain: " // NOI18N + (chain != null ? ("\n" + chain.toStringChain()) : "Empty"); // NOI18N }
/** Remove non-empty block from area covered by blocks from chain */ public boolean removeMark(int pos) { int rel = compareMark(pos); if (rel == 0) { boolean first = (curMark == chain); curMark = curMark.removeChain(); if (first) { chain = curMark; } return true; } else { // not found return false; } }
public String toStringChain() { return toString() + (next != null ? "\n" + next.toStringChain() : ""); // NOI18N }
protected MarkFactory.ChainDrawMark createMark() { MarkFactory.ChainDrawMark mark = new MarkFactory.ChainDrawMark(layerName, null); mark.backwardBias = true; // stay at line begining mark.activateLayer = true; return mark; }
protected MarkFactory.ChainDrawMark createMark() { MarkFactory.ChainDrawMark mark = new MarkFactory.ChainDrawMark(layerName, null, Position.Bias.Backward); mark.activateLayer = true; return mark; }
protected MarkFactory.ChainDrawMark createAndInsertNewMark(int pos) throws BadLocationException { MarkFactory.ChainDrawMark mark = createMark(); try { mark.insert(doc, pos); } catch (InvalidMarkException e) { Utilities.annotateLoggable(e); } return mark; }