new DocumentRenderer(this, DocumentRenderer.PROCESS_POSITIONS, toMemory).render();
DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.OUT_KIND_CONSTRUCTOR, kind); int offset = renderer.renderToInt(); int line = renderer.getLine(); int column = renderer.getColumn();
/** Writes the kind to stream */ public void write (DataOutput os) throws IOException { /* pre-33165 int offset = getOffset(); int line = getLine(); int column = getColumn(); */ DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.POSITION_KIND_WRITE, this); int offset = renderer.renderToIntIOE(); int line = renderer.getLine(); int column = renderer.getColumn(); if(offset < 0 || line < 0 || column < 0) { throw new IOException( "Illegal PositionKind: " + pos + "[offset=" // NOI18N + offset + ",line=" // NOI18N + line + ",column=" + column + "] in " // NOI18N + mgr.getDoc () + " used by " + mgr.support + "." // NOI18N ); } os.writeInt(offset); os.writeInt(line); os.writeInt(column); }
new DocumentRenderer(this, DocumentRenderer.PROCESS_POSITIONS, toMemory).render();
new DocumentRenderer(this, DocumentRenderer.PROCESS_POSITIONS, toMemory).render();
doc = mgr.getCloneableEditorSupport().openDocument(); int retOffset = new DocumentRenderer(mgr, DocumentRenderer.LINE_KIND_GET_OFFSET, this, line, column, doc).renderToInt(); return retOffset;
doc = mgr.getCloneableEditorSupport().openDocument(); int retOffset = new DocumentRenderer(mgr, DocumentRenderer.LINE_KIND_GET_OFFSET, this, line, column, doc).renderToInt(); return retOffset;
/** Offset */ public int getOffset() { /* pre-33165 try { StyledDocument doc = getCloneableEditorSupport().getDocument(); if (doc == null) { doc = getCloneableEditorSupport().openDocument(); } return NbDocument.findLineOffset (doc, line) + column; } catch (IOException e) { // what to do? hopefully unlikelly return 0; } */ try { StyledDocument doc = mgr.getCloneableEditorSupport().getDocument(); if (doc == null) { doc = mgr.getCloneableEditorSupport().openDocument(); } int retOffset = new DocumentRenderer( mgr, DocumentRenderer.LINE_KIND_GET_OFFSET, this, line, column, doc ).renderToInt(); return retOffset; } catch (IOException e) { // what to do? hopefully unlikelly return 0; } }
DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.OUT_KIND_CONSTRUCTOR, kind); int offset = renderer.renderToInt(); int line = renderer.getLine(); int column = renderer.getColumn();
/** Writes the kind to stream */ public void write (DataOutput os) throws IOException { /* pre-33165 int offset = getOffset(); int line = getLine(); int column = getColumn(); */ DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.POSITION_KIND_WRITE, this); int offset = renderer.renderToIntIOE(); int line = renderer.getLine(); int column = renderer.getColumn(); if(offset < 0 || line < 0 || column < 0) { throw new IOException( "Illegal PositionKind: " + pos + "[offset=" // NOI18N + offset + ",line=" // NOI18N + line + ",column=" + column + "] in " // NOI18N + mgr.getDoc () + " used by " + mgr.support + "." // NOI18N ); } os.writeInt(offset); os.writeInt(line); os.writeInt(column); }
/** Constructs the out kind from the position kind. */ public OutKind(PositionKind kind, PositionRef.Manager mgr) { super(mgr); /* pre-33165 int offset = kind.getOffset(); int line = kind.getLine(); int column = kind.getColumn(); */ DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.OUT_KIND_CONSTRUCTOR, kind); int offset = renderer.renderToInt(); int line = renderer.getLine(); int column = renderer.getColumn(); if ((offset < 0) || (line < 0) || (column < 0)) { throw new IndexOutOfBoundsException( "Illegal OutKind[offset=" // NOI18N +offset + ",line=" // NOI18N +line + ",column=" + column + "] in " // NOI18N +mgr.getDoc() + " used by " + mgr.support + "." // NOI18N ); } this.offset = offset; this.line = line; this.column = column; }
/** Writes the kind to stream */ public void write(DataOutput os) throws IOException { /* pre-33165 int offset = getOffset(); int line = getLine(); int column = getColumn(); */ DocumentRenderer renderer = new DocumentRenderer(mgr, DocumentRenderer.POSITION_KIND_WRITE, this); int offset = renderer.renderToIntIOE(); int line = renderer.getLine(); int column = renderer.getColumn(); if ((offset < 0) || (line < 0) || (column < 0)) { throw new IOException( "Illegal PositionKind: " + pos + "[offset=" // NOI18N +offset + ",line=" // NOI18N +line + ",column=" + column + "] in " // NOI18N +mgr.getDoc() + " used by " + mgr.support + "." // NOI18N ); } os.writeInt(offset); os.writeInt(line); os.writeInt(column); }
/** Converts the kind to representation in memory */ public PositionKind toMemory(boolean insertAfter) { /* pre-33165 // try to find the right position Position p; try { p = NbDocument.createPosition (doc, NbDocument.findLineOffset (doc, line) + column, insertAfter ? Position.Bias.Forward : Position.Bias.Backward); } catch (BadLocationException e) { p = doc.getEndPosition (); } */ Position p = (Position) new DocumentRenderer( mgr, DocumentRenderer.LINE_KIND_TO_MEMORY, this, line, column, insertAfter ).renderToObject(); return new PositionKind(p, mgr); } }
/** Converts the kind to representation in memory */ public PositionKind toMemory (boolean insertAfter) { /* pre-33165 // try to find the right position Position p; try { p = NbDocument.createPosition (doc, NbDocument.findLineOffset (doc, line) + column, insertAfter ? Position.Bias.Forward : Position.Bias.Backward); } catch (BadLocationException e) { p = doc.getEndPosition (); } */ Position p = (Position)new DocumentRenderer(mgr, DocumentRenderer.LINE_KIND_TO_MEMORY, this, line, column, insertAfter).renderToObject(); return new PositionKind (p, mgr); }
/** Adds the position to this manager. */ Kind addPosition(final PositionRef pos) { Kind kind; /* pre-33165 synchronized(this) { head.next = new ChainItem(pos, queue, head.next); kind = (doc == null ? pos.kind : pos.kind.toMemory(pos.insertAfter)); } */ kind = (Kind)new DocumentRenderer(this, DocumentRenderer.ADD_POSITION, pos).renderToObject(); checkQueue(); return kind; }
/** Adds the position to this manager. */ Kind addPosition(final PositionRef pos) { Kind kind; /* pre-33165 synchronized(this) { head.next = new ChainItem(pos, queue, head.next); kind = (doc == null ? pos.kind : pos.kind.toMemory(pos.insertAfter)); } */ kind = (Kind)new DocumentRenderer(this, DocumentRenderer.ADD_POSITION, pos).renderToObject(); checkQueue(); return kind; }
void render() { StyledDocument d = mgr.getDoc (); Object prev = DOCUMENT.get (); try { if (d != null) { DOCUMENT.set (d); d.render(this); } else { DOCUMENT.set (mgr); this.run(); } } finally { DOCUMENT.set (prev); } }
/** Converts the kind to representation in memory */ public PositionKind toMemory (boolean insertAfter) { /* pre-33165 // try to find the right position Position p; try { p = NbDocument.createPosition (doc, getOffset (), insertAfter ? Position.Bias.Forward : Position.Bias.Backward); } catch (BadLocationException e) { p = doc.getEndPosition (); } return new PositionKind (p); */ return (PositionKind)new DocumentRenderer(mgr, DocumentRenderer.KIND_TO_MEMORY, this, insertAfter).renderToObject(); }
/** Converts the kind to representation in memory */ public PositionKind toMemory (boolean insertAfter) { /* pre-33165 // try to find the right position Position p; try { p = NbDocument.createPosition (doc, getOffset (), insertAfter ? Position.Bias.Forward : Position.Bias.Backward); } catch (BadLocationException e) { p = doc.getEndPosition (); } return new PositionKind (p); */ return (PositionKind)new DocumentRenderer(mgr, DocumentRenderer.KIND_TO_MEMORY, this, insertAfter).renderToObject(); }
void render() { StyledDocument d = mgr.getDoc (); Object prev = DOCUMENT.get (); try { if (d != null) { DOCUMENT.set (d); d.render(this); } else { DOCUMENT.set (mgr); this.run(); } } finally { DOCUMENT.set (prev); } }