org.gjt.sp.jedit.bufferset
Class BufferSetManager

java.lang.Object
  extended by org.gjt.sp.jedit.bufferset.BufferSetManager
All Implemented Interfaces:
EBComponent

public class BufferSetManager
extends java.lang.Object
implements EBComponent

The buffersets manager.

Since:
jEdit 4.3pre15

Nested Class Summary
static interface BufferSetManager.BufferSetVisitor
           
static class BufferSetManager.NewBufferSetAction
           
 
Constructor Summary
BufferSetManager()
           
 
Method Summary
 void addAllBuffers(BufferSet bufferSet)
          Add all buffers to the bufferSet.
 void addBuffer(BufferSet bufferSet, Buffer buffer)
          Add a buffer in the given bufferSet.
 void addBuffer(EditPane editPane, Buffer buffer)
          Add a buffer into the current editPane of the given editPane.
 void addBuffer(View view, Buffer buffer)
          Add a buffer into the current editPane of the given view.
 void clear()
          Close all buffers.
 int countBufferSets(Buffer buffer)
          Count the bufferSets in which the buffer is.
 BufferSet getEditPaneBufferSet(EditPane editPane)
          Returns a EditPane bufferSet for the given EditPane.
 BufferSet getGlobalBufferSet()
          Returns the global bufferSet.
 BufferSet getViewBufferSet(View view)
          Returns a view bufferSet for the given view.
 void handleMessage(EBMessage message)
          Handles a message sent on the EditBus.
 boolean hasListeners(Buffer buffer)
          Check if a buffer is in at least one bufferSet that as some listeners.
 void mergeBufferSet(BufferSet target, BufferSet source)
          Merge the content of the source bufferSet into the target bufferSet
 void removeBuffer(Buffer buffer)
          remove a buffer from all bufferSets.
 void removeBuffer(EditPane editPane, Buffer buffer)
          Remove a buffer from the EditPane's bufferSet.
 void visit(BufferSetManager.BufferSetVisitor visitor)
          This method will visit all buffersets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferSetManager

public BufferSetManager()
Method Detail

handleMessage

public void handleMessage(EBMessage message)
Description copied from interface: EBComponent
Handles a message sent on the EditBus. This method must specify the type of responses the plugin will have for various subclasses of the EBMessage class. Typically this is done with one or more if blocks that test whether the message is an instance of a derived message class in which the component has an interest. For example:
 if(msg instanceof BufferUpdate) {
     // a buffer's state has changed!
 }
 else if(msg instanceof ViewUpdate) {
     // a view's state has changed!
 }
 // ... and so on

Specified by:
handleMessage in interface EBComponent
Parameters:
message - The message

getGlobalBufferSet

public BufferSet getGlobalBufferSet()
Returns the global bufferSet.

Returns:
the global bufferSet

getViewBufferSet

public BufferSet getViewBufferSet(View view)
Returns a view bufferSet for the given view. If it doesn't exists it is created

Parameters:
view - a view
Returns:
the view's bufferSet

getEditPaneBufferSet

public BufferSet getEditPaneBufferSet(EditPane editPane)
Returns a EditPane bufferSet for the given EditPane. If it doesn't exists it is created

Parameters:
editPane - the editPAne
Returns:
the EditPane's bufferSet

mergeBufferSet

public void mergeBufferSet(BufferSet target,
                           BufferSet source)
Merge the content of the source bufferSet into the target bufferSet

Parameters:
target - the target bufferSet
source - the source bufferSet
See Also:
EditPane.setBuffer(org.gjt.sp.jedit.Buffer)

countBufferSets

public int countBufferSets(Buffer buffer)
Count the bufferSets in which the buffer is.

Parameters:
buffer - the buffer
Returns:
the number of buffersets in which buffer is
See Also:
jEdit.closeBuffer(org.gjt.sp.jedit.EditPane, org.gjt.sp.jedit.Buffer)

addBuffer

public void addBuffer(View view,
                      Buffer buffer)
Add a buffer into the current editPane of the given view. If the view is null, it will be added to the global bufferSet

Parameters:
view - a view (or null)
buffer - the buffer to add

addBuffer

public void addBuffer(EditPane editPane,
                      Buffer buffer)
Add a buffer into the current editPane of the given editPane. If the editPane is null, it will be added to the global bufferSet

Parameters:
editPane - an EditPane (or null)
buffer - the buffer to add

addBuffer

public void addBuffer(BufferSet bufferSet,
                      Buffer buffer)
Add a buffer in the given bufferSet.

Parameters:
bufferSet - the bufferSet
buffer - the buffer to add

addAllBuffers

public void addAllBuffers(BufferSet bufferSet)
Add all buffers to the bufferSet.

Parameters:
bufferSet - the bufferSet

removeBuffer

public void removeBuffer(EditPane editPane,
                         Buffer buffer)
Remove a buffer from the EditPane's bufferSet.

Parameters:
editPane - the editPane It cannot be null
buffer - the buffer

hasListeners

public boolean hasListeners(Buffer buffer)
Check if a buffer is in at least one bufferSet that as some listeners. Otherwise nobody can see it.

Parameters:
buffer - the buffer
Returns:
true if the buffer is in a bufferSet that has listeners

removeBuffer

public void removeBuffer(Buffer buffer)
remove a buffer from all bufferSets.

Parameters:
buffer - the buffer that must be removed

clear

public void clear()
Close all buffers.


visit

public void visit(BufferSetManager.BufferSetVisitor visitor)
This method will visit all buffersets.

Parameters:
visitor - the bufferset visitor