|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.gjt.sp.jedit.EditPlugin
org.gjt.sp.jedit.EBPlugin
bufferstats.BufferStatsPlugin
public class BufferStatsPlugin
The BufferStatsPlugin uses the EditBus to track Buffers as they are opened/
loaded, saved, and activated. Buffers begin to be tracked as soon as the plugin
is loaded. If plugin loading is deferred, you can use the
monitorOpenBuffers() to track open buffers.
To get usage statistics for a Buffer, several calls are available. Assume you have initialized a variable called plugin for the BufferStatsPlugin instance, and a variable called buffer for the buffer you want information on.
plugin.whenLoaded(buffer)
plugin.whenLastActivated(buffer)
plugin.countActivated(buffer)
plugin.activatedTime(buffer)
The plugin can also return sorted arrays of open buffers, based on usage.
plugin.listBuffersByActivationQuantity()
plugin.listBuffersByActivationFrequency()
plugin.listBuffersByActivationOrder()
The plugin is currently shipped with several macros useful for closing unused buffers based on certain rules. See the plugin HTML documentation for details.
Note that "activation" for a Buffer may not be as expected, as some Buffer-management plugins cause Buffers to briefly activate when one switches between them. That is, if using keyboard shortcuts to page through open Buffers, a Buffer will briefly become active even if it is not the one you settle on. BufferStatsPlugin will report the activation count, and time, based on the EditBus messages related to Buffer changing. Because of this, depending on what question you are asking, you may want to use the total time a Buffer was active, rather than the count of times it was active.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.gjt.sp.jedit.EditPlugin |
|---|
org.gjt.sp.jedit.EditPlugin.Broken, org.gjt.sp.jedit.EditPlugin.Deferred, org.gjt.sp.jedit.EditPlugin.JAR |
| Field Summary | |
|---|---|
static java.lang.String |
MENU
Standard EditPlugin field, plugin menu option prefix |
static java.lang.String |
NAME
Standard EditPlugin field, plugin name |
static java.lang.String |
OPTION_PREFIX
Standard EditPlugin field, plugin options prefix |
static java.lang.String |
PROPERTY_PREFIX
Standard EditPlugin field, plugin property option prefix |
| Constructor Summary | |
|---|---|
BufferStatsPlugin()
Constructor for the BufferStatsPlugin object |
|
| Method Summary | |
|---|---|
long |
activatedTime(org.gjt.sp.jedit.Buffer buffer)
Returns the time, in milliseconds, that the Buffer has been the user's active Buffer, since it was opened. |
int |
countActivated(org.gjt.sp.jedit.Buffer buffer)
Returns the number of times the Buffer instance has been made the active Buffer. |
void |
handleMessage(org.gjt.sp.jedit.EBMessage message)
Implementation of EBComponent.handleMessage()--in this case, to listen to messages relating to Buffer opening, closing, etc. |
org.gjt.sp.jedit.Buffer[] |
listBuffersByActivationFrequency()
Returns an array of open Buffers sorted by the number of times they have been made active since opened, from most to least active. |
org.gjt.sp.jedit.Buffer[] |
listBuffersByActivationOrder()
Returns an array of open Buffers sorted by the timestamp of their last activation, from most to least active. |
org.gjt.sp.jedit.Buffer[] |
listBuffersByActivationQuantity()
Returns an array of open Buffers sorted by the amount of time they have been the active buffer, from most to least active. |
long |
longestActivatedTime()
Returns the time in milliseconds the most-active Buffer has been activate. |
void |
monitorOpenBuffers()
Loads list of open Buffers in JEdit and starts to track their usage. |
int |
mostActivatedCount()
Returns the number of times the most-often activated Buffer has been activated |
void |
start()
Standard EBPlugin start() method. |
void |
stop()
Standard EBPlugin stop() method. |
long |
whenLastActivated(org.gjt.sp.jedit.Buffer buffer)
Returns the long timestamp (see System.currentTimeMillis)
since the Buffer was last made the active Buffer (active EditPane) in
JEdit. |
long |
whenLoaded(org.gjt.sp.jedit.Buffer buffer)
Returns the long timestamp (see System.currentTimeMillis)
since the Buffer was loaded/opened. |
| Methods inherited from class org.gjt.sp.jedit.EditPlugin |
|---|
createBrowserMenuItems, createMenuItems, createMenuItems, createOptionPanes, getClassName, getJAR, getPluginJAR |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String NAME
public static final java.lang.String MENU
public static final java.lang.String PROPERTY_PREFIX
public static final java.lang.String OPTION_PREFIX
| Constructor Detail |
|---|
public BufferStatsPlugin()
| Method Detail |
|---|
public void start()
start in class org.gjt.sp.jedit.EditPluginpublic void stop()
stop in class org.gjt.sp.jedit.EditPluginpublic void monitorOpenBuffers()
public org.gjt.sp.jedit.Buffer[] listBuffersByActivationFrequency()
public org.gjt.sp.jedit.Buffer[] listBuffersByActivationOrder()
public org.gjt.sp.jedit.Buffer[] listBuffersByActivationQuantity()
public long whenLoaded(org.gjt.sp.jedit.Buffer buffer)
System.currentTimeMillis)
since the Buffer was loaded/opened.
buffer - A Buffer instance you want to check.
public long whenLastActivated(org.gjt.sp.jedit.Buffer buffer)
System.currentTimeMillis)
since the Buffer was last made the active Buffer (active EditPane) in
JEdit.
buffer - A Buffer instance you want to check.
public int countActivated(org.gjt.sp.jedit.Buffer buffer)
buffer - A Buffer instance you want to check.
public int mostActivatedCount()
public long activatedTime(org.gjt.sp.jedit.Buffer buffer)
buffer - The Buffer instance to check.
public long longestActivatedTime()
public void handleMessage(org.gjt.sp.jedit.EBMessage message)
handleMessage in interface org.gjt.sp.jedit.EBComponenthandleMessage in class org.gjt.sp.jedit.EBPluginmessage - The EBMessage sent on the EditBus.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||