org.gjt.sp.jedit
Class View

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.gjt.sp.jedit.View
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, EBComponent

public class View
extends javax.swing.JFrame
implements EBComponent

A View is jEdit's top-level frame window.

In a BeanShell script, you can obtain the current view instance from the view variable.

The largest component it contains is an EditPane that in turn contains a JEditTextArea that displays a Buffer. A view can have more than one edit pane in a split window configuration. A view also contains a menu bar, an optional toolbar and other window decorations, as well as docked windows.

The View class performs two important operations dealing with plugins: creating plugin menu items, and managing dockable windows.

This class does not have a public constructor. Views can be opened and closed using methods in the jEdit class.

See Also:
jEdit.newView(View), jEdit.newView(View,Buffer), jEdit.newView(View,Buffer,boolean), jEdit.closeView(View), Serialized Form

Nested Class Summary
static class View.ViewConfig
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int ABOVE_ACTION_BAR_LAYER
          Deprecated. Status bar no longer added as a tool bar.
static int ABOVE_SYSTEM_BAR_LAYER
          Above system tool bar layer.
static int ACTION_BAR
           
static int ACTION_BAR_LAYER
          Action bar layer.
static int BELOW_SEARCH_BAR_LAYER
          Below search bar layer.
static int BELOW_STATUS_BAR_LAYER
          Status bar layer.
static int BELOW_SYSTEM_BAR_LAYER
          Below system tool bar layer.
static int BOTTOM_GROUP
          The group of tool bars below the DockableWindowManager
static int BOTTOM_LAYER
          The lowest possible layer.
static int DEFAULT_GROUP
           
static int DEFAULT_LAYER
          The default layer for tool bars with no preference.
static int SEARCH_BAR_LAYER
          Search bar layer.
static int STATUS_BAR_LAYER
          Status bar layer.
static int SYSTEM_BAR_LAYER
          System tool bar layer.
static int TEXT_AREA
           
static int TOP_GROUP
          The group of tool bars above the DockableWindowManager
static int TOP_LAYER
          The highest possible layer.
static int VIEW
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void actionBar()
          Shows the action bar if needed, and sends keyboard focus there.
 void addToolBar(java.awt.Component toolBar)
          Adds a tool bar to this view.
 void addToolBar(int group, java.awt.Component toolBar)
          Adds a tool bar to this view.
 void addToolBar(int group, int layer, java.awt.Component toolBar)
          Adds a tool bar to this view.
 ActionBar getActionBar()
          Returns the action bar.
 Buffer getBuffer()
          Returns the current edit pane's buffer.
 DockableWindowManager getDockableWindowManager()
          Returns the dockable window manager associated with this view.
 EditPane getEditPane()
          Returns the current edit pane.
 EditPane[] getEditPanes()
          Returns all edit panes.
 InputHandler getInputHandler()
          Returns the input handler.
 java.awt.event.KeyListener getKeyEventInterceptor()
          Returns the listener that will handle all key events in this view, if any.
 Macros.Recorder getMacroRecorder()
          Returns the macro recorder.
 java.awt.Dimension getMinimumSize()
           
 View getNext()
          Returns the next view in the list.
 View getPrev()
          Returns the previous view in the list.
 SearchBar getSearchBar()
          Returns the search bar.
 javax.swing.JSplitPane getSplitPane()
          Returns the top-level split pane, if any.
 StatusBar getStatus()
          Returns the status bar.
 JEditTextArea getTextArea()
          Returns the current edit pane's text area.
 javax.swing.Box getToolBar()
          Returns the view's tool bar.
 View.ViewConfig getViewConfig()
           
 EditPane goToBuffer(Buffer buffer)
          If this buffer is open in one of the view's edit panes, sets focus to that edit pane.
 void handleMessage(EBMessage msg)
          Handles a message sent on the EditBus.
 void hideWaitCursor()
          Hides the wait cursor.
 boolean isClosed()
          Returns true if this view has been closed with jEdit.closeView(View).
 boolean isPlainView()
          Returns true if this is an auxilliary view with no dockable windows.
 void nextTextArea()
          Moves keyboard focus to the next text area.
 void prevTextArea()
          Moves keyboard focus to the previous text area.
 void processKeyEvent(java.awt.event.KeyEvent evt)
          Forwards key events directly to the input handler.
 void processKeyEvent(java.awt.event.KeyEvent evt, boolean calledFromTextArea)
          Forwards key events directly to the input handler.
 void processKeyEvent(java.awt.event.KeyEvent evt, int from)
          Forwards key events directly to the input handler.
 void quickHyperSearch(boolean word)
          Quick HyperSearch.
 void quickIncrementalSearch(boolean word)
          Quick search.
 void removeToolBar(java.awt.Component toolBar)
          Removes a tool bar from this view.
 void resplit()
          Restore the split configuration as it was before unsplitting.
 void setBuffer(Buffer buffer)
          Sets the current edit pane's buffer.
 void setInputHandler(InputHandler inputHandler)
          Sets the input handler.
 void setKeyEventInterceptor(java.awt.event.KeyListener listener)
          Sets the listener that will handle all key events in this view.
 void setMacroRecorder(Macros.Recorder recorder)
          Sets the macro recorder.
 void setWaitSocket(java.net.Socket waitSocket)
          This socket is closed when the buffer is closed.
 void showWaitCursor()
          Shows the wait cursor.
 EditPane split(int orientation)
          Splits the view.
 EditPane splitHorizontally()
          Splits the view horizontally.
 EditPane splitVertically()
          Splits the view vertically.
 java.lang.String toString()
           
 void unsplit()
          Unsplits the view.
 void unsplitCurrent()
          Removes the current split.
 void updateTitle()
          Updates the title bar.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

TOP_GROUP

public static final int TOP_GROUP
The group of tool bars above the DockableWindowManager

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

BOTTOM_GROUP

public static final int BOTTOM_GROUP
The group of tool bars below the DockableWindowManager

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

DEFAULT_GROUP

public static final int DEFAULT_GROUP
See Also:
Constant Field Values

TOP_LAYER

public static final int TOP_LAYER
The highest possible layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

DEFAULT_LAYER

public static final int DEFAULT_LAYER
The default layer for tool bars with no preference.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

BOTTOM_LAYER

public static final int BOTTOM_LAYER
The lowest possible layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

ABOVE_SYSTEM_BAR_LAYER

public static final int ABOVE_SYSTEM_BAR_LAYER
Above system tool bar layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

SYSTEM_BAR_LAYER

public static final int SYSTEM_BAR_LAYER
System tool bar layer. jEdit uses this for the main tool bar.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

BELOW_SYSTEM_BAR_LAYER

public static final int BELOW_SYSTEM_BAR_LAYER
Below system tool bar layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

SEARCH_BAR_LAYER

public static final int SEARCH_BAR_LAYER
Search bar layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

BELOW_SEARCH_BAR_LAYER

public static final int BELOW_SEARCH_BAR_LAYER
Below search bar layer.

Since:
jEdit 4.0pre7
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

ABOVE_ACTION_BAR_LAYER

public static final int ABOVE_ACTION_BAR_LAYER
Deprecated. Status bar no longer added as a tool bar.
See Also:
Constant Field Values

ACTION_BAR_LAYER

public static final int ACTION_BAR_LAYER
Action bar layer.

Since:
jEdit 4.2pre1
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

STATUS_BAR_LAYER

public static final int STATUS_BAR_LAYER
Status bar layer.

Since:
jEdit 4.2pre1
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

BELOW_STATUS_BAR_LAYER

public static final int BELOW_STATUS_BAR_LAYER
Status bar layer.

Since:
jEdit 4.2pre1
See Also:
addToolBar(int,int,java.awt.Component), Constant Field Values

VIEW

public static final int VIEW
See Also:
Constant Field Values

TEXT_AREA

public static final int TEXT_AREA
See Also:
Constant Field Values

ACTION_BAR

public static final int ACTION_BAR
See Also:
Constant Field Values
Method Detail

getDockableWindowManager

public DockableWindowManager getDockableWindowManager()
Returns the dockable window manager associated with this view.

Since:
jEdit 2.6pre3

getToolBar

public javax.swing.Box getToolBar()
Returns the view's tool bar.

Since:
jEdit 4.2pre1

addToolBar

public void addToolBar(java.awt.Component toolBar)
Adds a tool bar to this view.

Parameters:
toolBar - The tool bar

addToolBar

public void addToolBar(int group,
                       java.awt.Component toolBar)
Adds a tool bar to this view.

Parameters:
group - The tool bar group to add to
toolBar - The tool bar
Since:
jEdit 4.0pre7
See Also:
ToolBarManager

addToolBar

public void addToolBar(int group,
                       int layer,
                       java.awt.Component toolBar)
Adds a tool bar to this view.

Parameters:
group - The tool bar group to add to
layer - The layer of the group to add to
toolBar - The tool bar
Since:
jEdit 4.0pre7
See Also:
ToolBarManager

removeToolBar

public void removeToolBar(java.awt.Component toolBar)
Removes a tool bar from this view.

Parameters:
toolBar - The tool bar

showWaitCursor

public void showWaitCursor()
Shows the wait cursor. This method and hideWaitCursor() are implemented using a reference count of requests for wait cursors, so that nested calls work correctly; however, you should be careful to use these methods in tandem.

To ensure that hideWaitCursor() is always called after a showWaitCursor(), use a try/finally block, like this:

try
{
    view.showWaitCursor();
    // ...
}
finally
{
    view.hideWaitCursor();
}


hideWaitCursor

public void hideWaitCursor()
Hides the wait cursor.


getSearchBar

public final SearchBar getSearchBar()
Returns the search bar.

Since:
jEdit 2.4pre4

getActionBar

public final ActionBar getActionBar()
Returns the action bar.

Since:
jEdit 4.2pre3

getStatus

public StatusBar getStatus()
Returns the status bar. The StatusBar.setMessage(String) and StatusBar.setMessageAndClear(String) methods can be called on the return value of this method to display status information to the user.

Since:
jEdit 3.2pre2

quickIncrementalSearch

public void quickIncrementalSearch(boolean word)
Quick search.

Since:
jEdit 4.0pre3

quickHyperSearch

public void quickHyperSearch(boolean word)
Quick HyperSearch.

Since:
jEdit 4.0pre3

actionBar

public void actionBar()
Shows the action bar if needed, and sends keyboard focus there.

Since:
jEdit 4.2pre1

getKeyEventInterceptor

public java.awt.event.KeyListener getKeyEventInterceptor()
Returns the listener that will handle all key events in this view, if any.


setKeyEventInterceptor

public void setKeyEventInterceptor(java.awt.event.KeyListener listener)
Sets the listener that will handle all key events in this view. For example, the complete word command uses this so that all key events are passed to the word list popup while it is visible.

Parameters:
listener - The key event interceptor.

getInputHandler

public InputHandler getInputHandler()
Returns the input handler.


setInputHandler

public void setInputHandler(InputHandler inputHandler)
Sets the input handler.

Parameters:
inputHandler - The new input handler

getMacroRecorder

public Macros.Recorder getMacroRecorder()
Returns the macro recorder.


setMacroRecorder

public void setMacroRecorder(Macros.Recorder recorder)
Sets the macro recorder.

Parameters:
recorder - The macro recorder

processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent evt)
Forwards key events directly to the input handler. This is slightly faster than using a KeyListener because some Swing overhead is avoided.

Overrides:
processKeyEvent in class java.awt.Component

processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent evt,
                            boolean calledFromTextArea)
Forwards key events directly to the input handler. This is slightly faster than using a KeyListener because some Swing overhead is avoided.


processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent evt,
                            int from)
Forwards key events directly to the input handler. This is slightly faster than using a KeyListener because some Swing overhead is avoided.


splitHorizontally

public EditPane splitHorizontally()
Splits the view horizontally.

Since:
jEdit 4.1pre2

splitVertically

public EditPane splitVertically()
Splits the view vertically.

Since:
jEdit 4.1pre2

split

public EditPane split(int orientation)
Splits the view.

Since:
jEdit 4.1pre2

unsplit

public void unsplit()
Unsplits the view.

Since:
jEdit 2.3pre2

unsplitCurrent

public void unsplitCurrent()
Removes the current split.

Since:
jEdit 2.3pre2

resplit

public void resplit()
Restore the split configuration as it was before unsplitting.

Since:
jEdit 4.3pre1

nextTextArea

public void nextTextArea()
Moves keyboard focus to the next text area.

Since:
jEdit 2.7pre4

prevTextArea

public void prevTextArea()
Moves keyboard focus to the previous text area.

Since:
jEdit 2.7pre4

getSplitPane

public javax.swing.JSplitPane getSplitPane()
Returns the top-level split pane, if any.

Since:
jEdit 2.3pre2

getBuffer

public Buffer getBuffer()
Returns the current edit pane's buffer.


setBuffer

public void setBuffer(Buffer buffer)
Sets the current edit pane's buffer.


goToBuffer

public EditPane goToBuffer(Buffer buffer)
If this buffer is open in one of the view's edit panes, sets focus to that edit pane. Otherwise, opens the buffer in the currently active edit pane.

Parameters:
buffer - The buffer
Since:
jEdit 4.2pre1

getTextArea

public JEditTextArea getTextArea()
Returns the current edit pane's text area.


getEditPane

public EditPane getEditPane()
Returns the current edit pane.

Since:
jEdit 2.5pre2

getEditPanes

public EditPane[] getEditPanes()
Returns all edit panes.

Since:
jEdit 2.5pre2

getViewConfig

public View.ViewConfig getViewConfig()
Since:
jEdit 4.2pre1

isClosed

public boolean isClosed()
Returns true if this view has been closed with jEdit.closeView(View).


isPlainView

public boolean isPlainView()
Returns true if this is an auxilliary view with no dockable windows.

Since:
jEdit 4.1pre2

getNext

public View getNext()
Returns the next view in the list.


getPrev

public View getPrev()
Returns the previous view in the list.


handleMessage

public void handleMessage(EBMessage msg)
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:
msg - The message

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Container

setWaitSocket

public void setWaitSocket(java.net.Socket waitSocket)
This socket is closed when the buffer is closed.


toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

updateTitle

public void updateTitle()
Updates the title bar.