public LockedDocument(FileObject fo) throws IOException { this.fo = fo; editor = (CloneableEditorSupport)getEditorCookie(fo); document = (BaseDocument)editor.openDocument(); }
public static StyledDocument openDocument(CloneableEditorSupport ces) { if (ces == null) { return null; } StyledDocument document = null; try { try { document = ces.openDocument(); } catch (UserQuestionException e) { e.confirmed(); document = ces.openDocument(); } } catch (IOException ex) { Exceptions.printStackTrace(ex); } ces.prepareDocument().waitFinished(); return document; }
/** Get the column number */ public int getColumn() throws IOException { // pre-33165 return NbDocument.findLineColumn (getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_COLUMN, this, offset).renderToIntIOE(); }
/** Get the column number */ public int getColumn() throws IOException { // pre-33165 return NbDocument.findLineColumn (getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_COLUMN, this, offset).renderToIntIOE(); }
/** Get the line number */ public int getLine() throws IOException { // pre-33165 return NbDocument.findLineNumber(getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document is fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_LINE, this, offset).renderToIntIOE(); }
/** Get the column number */ public int getColumn() throws IOException { // pre-33165 return NbDocument.findLineColumn (getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_COLUMN, this, offset).renderToIntIOE(); }
/** Get the line number */ public int getLine() throws IOException { // pre-33165 return NbDocument.findLineNumber(getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document is fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_LINE, this, offset).renderToIntIOE(); }
/** @return the position as swing.text.Position object. * @exception IOException when an exception occured during reading the file. */ public Position getPosition() throws IOException { if(manager.getCloneableEditorSupport().getDocument() == null) { manager.getCloneableEditorSupport ().openDocument (); } synchronized(manager.getLock()) { Manager.PositionKind p = (Manager.PositionKind)kind; return p.pos; } }
/** @return the position as swing.text.Position object. * @exception IOException when an exception occured during reading the file. */ public Position getPosition() throws IOException { if(manager.getCloneableEditorSupport().getDocument() == null) { manager.getCloneableEditorSupport ().openDocument (); } synchronized(manager.getLock()) { Manager.PositionKind p = (Manager.PositionKind)kind; return p.pos; } }
/** Get the line number */ public int getLine() throws IOException { // pre-33165 return NbDocument.findLineNumber(getCloneableEditorSupport().openDocument(), offset); mgr.getCloneableEditorSupport().openDocument(); // make sure document is fully read return new DocumentRenderer(mgr, DocumentRenderer.OFFSET_KIND_GET_LINE, this, offset).renderToIntIOE(); }
/** Finds the text contained in this range. * @return the text * @exception IOException if any I/O problem occurred during document loading (if that was necessary) * @exception BadLocationException if the positions are out of the bounds of the document */ public String getText() throws BadLocationException, IOException { StyledDocument doc = begin.getCloneableEditorSupport().openDocument(); int p1 = begin.getOffset(); int p2 = end.getOffset(); return doc.getText(p1, p2 - p1); }
/** Finds the text contained in this range. * @return the text * @exception IOException if any I/O problem occurred during document loading (if that was necessary) * @exception BadLocationException if the positions are out of the bounds of the document */ public String getText() throws BadLocationException, IOException { StyledDocument doc = begin.getCloneableEditorSupport().openDocument(); int p1 = begin.getOffset(); int p2 = end.getOffset(); return doc.getText(p1, p2 - p1); }
/** Finds the text contained in this range. * @return the text * @exception IOException if any I/O problem occurred during document loading (if that was necessary) * @exception BadLocationException if the positions are out of the bounds of the document */ public String getText() throws BadLocationException, IOException { StyledDocument doc = begin.getCloneableEditorSupport().openDocument(); int p1 = begin.getOffset(); int p2 = end.getOffset(); return doc.getText(p1, p2 - p1); }
/** @return the position as swing.text.Position object. * @exception IOException when an exception occured during reading the file. */ public Position getPosition() throws IOException { // Hold the document reference to prevent document to be closed StyledDocument doc = manager.getCloneableEditorSupport().getDocument(); if (doc == null) { doc = manager.getCloneableEditorSupport().openDocument(); } synchronized (manager.getLock()) { // Fix for IZ#67761 - ClassCastException: org.openide.text.PositionRef$Manager$OffsetKind Manager.PositionKind p = kind.toMemory( insertAfter ); return p.pos; } }
/** Overrides superclass method, first processes document preparation. * @see #prepareDocument */ public void open() { try { if (getListener ().loadExc instanceof UserQuestionException) { getListener ().loadExc = null; prepareTask = null; documentStatus = DOCUMENT_NO; } openDocument(); super.open(); } catch (final UserQuestionException e) { if (SwingUtilities.isEventDispatchThread ()) { askUserAndDoOpen (e); } else { SwingUtilities.invokeLater (new Runnable () { public void run () { askUserAndDoOpen (e); } }); } } catch (IOException e) { ErrorManager.getDefault().notify( ErrorManager.INFORMATIONAL, e); } }
/** Overrides superclass method, first processes document preparation. * @see #prepareDocument */ public void open() { try { if (getListener ().loadExc instanceof UserQuestionException) { getListener ().loadExc = null; prepareTask = null; documentStatus = DOCUMENT_NO; } openDocument(); super.open(); } catch (final UserQuestionException e) { if (SwingUtilities.isEventDispatchThread ()) { askUserAndDoOpen (e); } else { SwingUtilities.invokeLater (new Runnable () { public void run () { askUserAndDoOpen (e); } }); } } catch (IOException e) { ErrorManager.getDefault().notify( ErrorManager.INFORMATIONAL, e); } }
StyledDocument doc = mgr.getCloneableEditorSupport().getDocument(); if (doc == null) { doc = mgr.getCloneableEditorSupport().openDocument();
/** 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; } }
StyledDocument doc = mgr.getCloneableEditorSupport().getDocument(); if (doc == null) { doc = mgr.getCloneableEditorSupport().openDocument();
prepareTask = null; documentStatus = DOCUMENT_NO; openDocument ();