|
From: Slava P. <sl...@je...> - 2003-09-29 20:57:26
|
You do not need to use the temporary buffer API! Just call
jEdit.openFile() or newFile()...
On Fri, 2003-09-26 at 19:30, Dave Landers wrote:
> On Friday 26 September 2003 5:03 pm, chasee wrote:
> > Hi to all:
> >
> > I am stuck there. I have been trying to create a buffer for a string, then
> > create a view for this buffer and other buffers upon starting up of jedit.
> > I expect to see the string in the active text edit area of of the view
> > created. I think " buffer = newFile(null); buffer.insert(0,theString);
> > newView(null, buffer)" should work.
>
>
> I wrote a plugin (for P4 source control) which (among other things) downloads
> some file revision into a String and displays it in a new buffer. I use the
> following method to create a buffer and display the string. Works in 4.1.
> Hope it helps...
>
> Buffer makeBuffer( String buffName, String contents )
> {
> String tmpDir = System.getProperty( "java.io.tmpdir" );
>
> Buffer buffer = jEdit.openTemporary( jEdit.getActiveView(),
> tmpDir,
> buffName,
> true );
> jEdit.commitTemporary( buffer );
> buffer.setReadOnly( false );
> buffer.remove( 0, buffer.getLength() ); // should already be empty,
> but do it anyway
> buffer.insert( 0, contents );
> buffer.setReadOnly( true );
> buffer.setDirty( false );
>
> viewBuffers.put( buffer, null );
>
> return buffer;
> }
>
> I also do
> jEdit.getActiveView().setBuffer( b );
> on the buffer returned by the above method (to make it the current buffer).
>
>
> >
> > no luck in finding out why I cann't see the string in the edit pane...
> >
> > thanks for any hint
> >
> >
> >
> >
> >
> > ============
> > thanks,
> > chasee
> >
> > ---------------------------------
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product search
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
--
Slava Pestov
|