public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { int nextActivityOffset; coloring = null; if (mark == null) return false; if (ctx.getEditorUI().getComponent() == null || !mark.activateLayer) return false; BaseDocument doc = ctx.getEditorUI().getDocument(); // Gets the active annotation attached to this mark. It is possible // that // no active annotation might exist for the mark AnnotationDesc anno = doc.getAnnotations().getActiveAnnotation(mark); if (anno == null) return false; int nextLineStart = -1; try { nextLineStart = Utilities.getRowStart(doc, ctx.getFragmentOffset(), 1); } catch (BadLocationException e) { return false; } if (nextLineStart < 0) { // end of doc nextLineStart = Integer.MAX_VALUE; } if (anno.isWholeLine()) { nextActivityOffset = nextLineStart; } else { nextActivityOffset = ctx.getFragmentOffset() + anno.getLength(); if (nextActivityOffset > nextLineStart) nextActivityOffset = nextLineStart; } setNextActivityChangeOffset(nextActivityOffset); coloring = anno.getColoring(); // The following code ensures that if active annotation does not // have highlight the color of next one will be used. // It was decided that it will not be used // // if (coloring.getBackColor() == null) { // AnnotationDesc[] annos = // doc.getAnnotations().getPasiveAnnotations(anno.getLine()); // if (annos != null) { // for (int i=0; i<annos.length; i++) { // if (annos[i].getColoring().getBackColor() != null) { // coloring = annos[i].getColoring(); // break; // } // } // } // } return true; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active; if (enabled) { int pos = ctx.getFragmentOffset(); if (pos == blocks[curInd]) { active = true; setNextActivityChangeOffset(blocks[curInd + 1]); } else if (pos == blocks[curInd + 1]) { active = false; curInd += 2; setNextActivityChangeOffset(blocks[curInd]); if (pos == blocks[curInd]) { // just follows setNextActivityChangeOffset(blocks[curInd + 1]); active = true; } } else { setNextActivityChangeOffset(blocks[curInd]); active = false; } } else { active = false; } return active; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active; if (mark != null) { active = mark.activateLayer; } else { active = doc.isPosGuarded(ctx.getFragmentOffset()); } return active; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active = false; if (enabled) { if (ctx.getFragmentOffset() == pos) { active = true; setNextActivityChangeOffset(pos + len); } } return active; }
public void updateContext(DrawContext ctx) { int pos = ctx.getFragmentOffset(); if (pos >= blocks[curInd] && pos < blocks[curInd + 1]) { if (coloring == null) { coloring = ctx.getEditorUI().getColoring(SettingsNames.HIGHLIGHT_SEARCH_COLORING); } if (coloring != null) { coloring.apply(ctx); } } }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active; if (mark != null) { active = mark.activateLayer; } else { JTextComponent c = ctx.getEditorUI().getComponent(); active = (c != null) && c.getCaret().isSelectionVisible() && ctx.getFragmentOffset() >= c.getSelectionStart() && ctx.getFragmentOffset() < c.getSelectionEnd(); } return active; }
public boolean isActive(DrawContext ctx, MarkFactory.DrawMark mark) { boolean active = false; if (mark != null) { active = (ctx.getEditorUI().getComponent() != null) && mark.activateLayer; if (active) { try { BaseDocument doc = ctx.getEditorUI().getDocument(); int nextRowStartPos = Utilities.getRowStart(doc, ctx.getFragmentOffset(), 1); if (nextRowStartPos < 0) { // end of doc nextRowStartPos = Integer.MAX_VALUE; } setNextActivityChangeOffset(nextRowStartPos); } catch (BadLocationException e) { active = false; } } } return active; }