@Override public IBuffer createBuffer(ICompilationUnit workingCopy) { return new DocumentAdapter(workingCopy, fileStore, path); } };
@Override public void append(char[] text) { append(new String(text)); }
@Override public char[] getCharacters() { String content= getContents(); return content == null ? null : content.toCharArray(); }
private String stripJavaComments(String comment) { DocumentAdapter documentAdapter= new DocumentAdapter(null, fCreatedPackageFragment.getPath()); try { documentAdapter.setContents(comment); return getString(new JavaDoc2HTMLTextReader(new JavaDocCommentReader(documentAdapter, 0, comment.length()))); } finally { documentAdapter.close(); } }
public void close() { if (isClosed()) return; IDocument d= fDocument; fDocument= null; d.removePrenotifiedDocumentListener(this); if (fTextFileBuffer != null) { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); try { manager.disconnect(fPath, fLocationKind, new NullProgressMonitor()); } catch (CoreException x) { // ignore } fTextFileBuffer= null; } fireBufferChanged(new BufferChangedEvent(this, 0, 0, null)); fBufferListeners.clear(); }
@Override public void replace(int position, int length, String text) { if (DEBUG_LINE_DELIMITERS) { validateLineDelimiters(text); } fReplaceCmd.replace(position, length, text); }
@Override public void run() { if (!isClosed()) fDocument.set(fContents); }
/** * Constructs a new document adapter. * * @param owner the owner of this buffer * @param file the <code>IFile</code> that backs the buffer */ public DocumentAdapter(IOpenable owner, IFile file) { fOwner= owner; fFile= file; fPath= fFile.getFullPath(); fLocationKind= LocationKind.IFILE; initialize(); }
@Override public void setContents(char[] contents) { setContents(new String(contents)); }
@Override public boolean isReadOnly() { if (fTextFileBuffer != null) return !fTextFileBuffer.isCommitable(); IResource resource= getUnderlyingResource(); if (resource == null) return true; final ResourceAttributes attributes= resource.getResourceAttributes(); return attributes == null ? false : attributes.isReadOnly(); }
@Override public void replace(int position, int length, char[] text) { replace(position, length, new String(text)); }
@Override public void documentChanged(DocumentEvent event) { fireBufferChanged(new BufferChangedEvent(this, event.getOffset(), event.getLength(), event.getText())); }
private String stripJavaComments(String comment) { DocumentAdapter documentAdapter= new DocumentAdapter(null, fCreatedPackageFragment.getPath()); try { documentAdapter.setContents(comment); return getString(new JavaDoc2HTMLTextReader(new JavaDocCommentReader(documentAdapter, 0, comment.length()))); } finally { documentAdapter.close(); } }
@Override public void close() { if (isClosed()) return; IDocument d= fDocument; fDocument= new Document(); fIsClosed= true; d.removeDocumentListener(this); if (fTextFileBuffer != null) { ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager(); try { if (fFileStore != null) manager.disconnectFileStore(fFileStore, new NullProgressMonitor()); else manager.disconnect(fPath, fLocationKind, new NullProgressMonitor()); } catch (CoreException x) { // ignore } fTextFileBuffer= null; } fireBufferChanged(new BufferChangedEvent(this, 0, 0, null)); fBufferListeners.clear(); }
public void replace(int position, int length, String text) { if (DEBUG_LINE_DELIMITERS) { validateLineDelimiters(text); } fReplaceCmd.replace(position, length, text); }
@Override public void run() { try { if (!isClosed()) fDocument.replace(fOffset, fLength, fText); } catch (BadLocationException x) { // ignore } }
/** * Constructs a new document adapter. * * @param owner the owner of this buffer * @param file the <code>IFile</code> that backs the buffer */ public DocumentAdapter(IOpenable owner, IFile file) { fOwner= owner; fFile= file; fPath= fFile.getFullPath(); fLocationKind= LocationKind.IFILE; initialize(); }
@Override public void setContents(char[] contents) { setContents(new String(contents)); }
@Override public boolean isReadOnly() { if (fTextFileBuffer != null) return !fTextFileBuffer.isCommitable(); IResource resource= getUnderlyingResource(); if (resource == null) return true; final ResourceAttributes attributes= resource.getResourceAttributes(); return attributes == null ? false : attributes.isReadOnly(); }
@Override public void replace(int position, int length, char[] text) { replace(position, length, new String(text)); }