|
From: Slava P. <sp...@gj...> - 2001-01-19 00:08:27
|
"Timothy N. Jones" wrote:
>
> I'm noodling around with some macros for source code control (checkout,
> etc.). The macros invoke a command line program to do the actual work
> using the Console plugin. Some operations, such as checkout, cause the
> read-only status of the buffer's file to change. I'd like to update
> the GUI to reflect the new status. Reloading the buffer from within
> the macros ("buffer.reload(view)") seems to have no effect, but
> manually reloading after the macro runs (either through the File /
> Reload or Utilities / Evaluate BeanShell Expression menus) works.
Are you sure 'buffer' points to the correct buffer? It will always point
to the buffer that was active when the macro was _started_, regardless
of any subsequent view.setBuffer() calls. So the following code will
reload the wrong buffer:
view.setBuffer(jEdit.getBuffer("/some/path"));
buffer.reload(view);
Whereas the following will work fine:
view.setBuffer(jEdit.getBuffer("/some/path"));
view.getBuffer().reload(view);
You could also write:
buffer = view.getBuffer();
after the setBuffer() call and then use the 'buffer' variable as
before.
Slava
|