Module jEdit

Class View

All Implemented Interfaces:
Dockable, DockableComponent, DockComponent, ContentPaneContainer, Disposable, ImageObserver, MenuContainer, Serializable, Accessible, InputHandlerProvider

public class View extends ViewBase implements InputHandlerProvider
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.

  • When a view is being created, its initialization routine iterates through the collection of loaded plugins and constructs the Plugins menu using the properties as specified in the EditPlugin class.
  • The view also creates and initializes a DockableWindowManager object. This object is responsible for creating, closing and managing dockable windows.
This class does not have a public constructor. Views can be opened and closed using methods in the jEdit class.
Version:
$Id: View.java 25349 2020-06-10 12:07:06Z makarius $
Author:
Slava Pestov, John Gellene (API documentation)
See Also:
  • Field Details

  • Method Details

    • getDockableWindowManager

      public DockableWindowManager getDockableWindowManager()
      Returns the dockable window manager associated with this view.
      Since:
      jEdit 2.6pre3
    • getDockingFrameworkName

      public static String getDockingFrameworkName()
    • getDockingFrameworkProvider

      public static DockingFrameworkProvider getDockingFrameworkProvider()
    • getToolBar

      public Container getToolBar()
      Returns the view's tool bar.
      Since:
      jEdit 4.2pre1
    • addToolBar

      public void addToolBar(Component toolBar)
      Adds a tool bar to this view.
      Parameters:
      toolBar - The tool bar
    • addToolBar

      public void addToolBar(int group, 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:
    • addToolBar

      public void addToolBar(int group, int layer, 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:
    • removeToolBar

      public void removeToolBar(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 KeyListener getKeyEventInterceptor()
      Returns the listener that will handle all key events in this view, if any.
      Returns:
      the key event interceptor or null
    • setKeyEventInterceptor

      public void setKeyEventInterceptor(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.
      Specified by:
      getInputHandler in interface InputHandlerProvider
    • 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(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 JComponent
    • processKeyEvent

      public void processKeyEvent(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(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.
      Returns:
      the new editPane
      Since:
      jEdit 4.1pre2
    • splitVertically

      public EditPane splitVertically()
      Splits the view vertically.
      Returns:
      the new editPane
      Since:
      jEdit 4.1pre2
    • split

      public EditPane split(int orientation)
      Splits the view.
      Parameters:
      orientation - the orientation JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT
      Returns:
      the new editPane
      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
    • getSplitConfig

      public String getSplitConfig()
      Split configurations are recorded in a simple RPN "language".
      Returns:
      The split configuration, describing where splitpanes are, which buffers are open in each EditPane, etc.
    • setSplitConfig

      public void setSplitConfig(Buffer buffer, String splitConfig)
      sets the split configuration as per the splitConfig.
      Parameters:
      buffer - if null, checks all buffers to restore View's split config.
      splitConfig - the split config, as returned by getSplitConfig()
    • 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 JSplitPane getSplitPane()
      Returns the top-level split pane, if any.
      Returns:
      the top JSplitPane if any.
      Since:
      jEdit 2.3pre2
    • getBuffer

      public Buffer getBuffer()
      Returns the current edit pane's buffer.
      Returns:
      the current edit pane's buffer, it can be null
    • getBuffers

      public Buffer[] getBuffers()
      Returns all Buffers opened in this View, Sorted according to View options. (as of jEdit 5.2) With order preserved for unsorted buffersets (as of jEdit 5.3)
      Since:
      jEdit 5.1
    • setBuffer

      public void setBuffer(Buffer buffer)
      Sets the current edit pane's buffer.
      Parameters:
      buffer - The 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
      Returns:
      the current edit pane
      Since:
      jEdit 4.2pre1
    • showBuffer

      public EditPane showBuffer(Buffer buffer)
      If this buffer is open in one of the view's edit panes, activates that edit pane. Otherwise, opens the buffer in the currently active edit pane. But the focus is not moved.
      Parameters:
      buffer - The buffer to show
      Returns:
      the current edit pane
      Since:
      jEdit 4.3pre13
    • getTextArea

      public JEditTextArea getTextArea()
      Returns the current edit pane's text area.
      Specified by:
      getTextArea in class ViewBase
      Returns:
      the current edit pane's text area, or null if there is no edit pane yet
    • getEditPane

      public EditPane getEditPane()
      Returns the current edit pane.
      Returns:
      the current edit pane
      Since:
      jEdit 2.5pre2
    • getEditPanes

      public EditPane[] getEditPanes()
      Returns all edit panes.
      Returns:
      an array of all edit panes in the view
      Since:
      jEdit 2.5pre2
    • forEachEditPane

      public void forEachEditPane(Consumer<? super EditPane> action)
      Perform the given action on every EditPane
      Parameters:
      action - an action to perform on every EditPane
    • getViewConfig

      public View.ViewConfig getViewConfig()
      Returns:
      a ViewConfig instance for the current view
      Since:
      jEdit 4.2pre1
    • isClosed

      public boolean isClosed()
      Returns true if this view has been closed with jEdit.closeView(View).
      Returns:
      true if the view is closed
    • isPlainView

      public boolean isPlainView()
      Returns true if this is an auxilliary view with no dockable windows.
      Returns:
      true if the view is plain
      Since:
      jEdit 4.1pre2
    • getNext

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

      public View getPrev()
      Returns the previous view in the list.
      Returns:
      the preview view
    • setPrev

      public void setPrev(View prev)
      Set the previous view in linked list. To be used by BufferManager only
      Parameters:
      prev -
      Since:
      jEdit 5.6pre1
    • setNext

      public void setNext(View next)
      Set the next view in linked list. To be used by BufferManager only
      Parameters:
      next -
      Since:
      jEdit 5.6pre1
    • handlePropertiesChanged

      public void handlePropertiesChanged(PropertiesChanged msg)
    • handleSearchSettingsChanged

      public void handleSearchSettingsChanged(SearchSettingsChanged msg)
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • setWaitSocket

      public void setWaitSocket(Socket waitSocket)
      This socket is closed when the buffer is closed.
    • toString

      public String toString()
      Overrides:
      toString in class Component
    • updateTitle

      public void updateTitle()
      Updates the title bar.
    • setUserTitle

      public void setUserTitle(String title)
      Sets a user-defined title for this view instead of the "view.title" property.
    • showUserTitleDialog

      public void showUserTitleDialog()
      Shows a dialog for selecting a user-defined title for this view.
    • getPrefixFocusOwner

      public Component getPrefixFocusOwner()
    • setPrefixFocusOwner

      public void setPrefixFocusOwner(Component prefixFocusOwner)
    • visit

      public void visit(JEditVisitor visitor)
      Visit the the editpanes and textareas of the view
      Parameters:
      visitor - the visitor
      Since:
      jEdit 4.3pre13
    • closeAllMenus

      public void closeAllMenus()
      closes any popup menus that may have been opened
      Since:
      jEdit 4.4pre1
    • updateFullScreenProps

      public void updateFullScreenProps()
    • isFullScreenMode

      public boolean isFullScreenMode()
    • toggleFullScreen

      public void toggleFullScreen()
    • propertiesChanged

      public void propertiesChanged()
      Reloads various settings from the properties.
      Overrides:
      propertiesChanged in class ViewBase
    • updateBufferSwitcherStates

      public void updateBufferSwitcherStates()
      Enables or Disables the "Focus Buffer Switcher" menu item in the View menu depending on the visible state of the buffer switcher. The menu item is intended to have the same effect as clicking on the buffer switcher combo box, and it doesn't make sense to have this action available if the buffer switcher isn't visible. Also shows or hides the Buffer Switcher itself, since this can be invoked after the toggle buffer switcher action.
    • handleBufferUpdate

      public void handleBufferUpdate(BufferUpdate msg)
    • handleEditPaneUpdate

      public void handleEditPaneUpdate(EditPaneUpdate msg)
    • handleViewUpdate

      public void handleViewUpdate(ViewUpdate msg)
    • adjust

      public void adjust(View parent, View.ViewConfig config)
    • revalidate

      void revalidate()
    • getContentPane

      Container getContentPane()