Module jEdit

Class VFSBrowser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, DefaultFocusComponent, DockableWindow

public class VFSBrowser extends JPanel implements DefaultFocusComponent, DockableWindow
The main class of the VFS browser. Used as dockable, and also embedded inside the VFSFileChooserDialog.
Version:
$Id: VFSBrowser.java 25239 2020-04-14 20:00:17Z kpouer $
Author:
Slava Pestov
See Also:
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • OPEN_DIALOG

      public static final int OPEN_DIALOG
      Open file dialog mode. Equals JFileChooser.OPEN_DIALOG for backwards compatibility.
      See Also:
    • SAVE_DIALOG

      public static final int SAVE_DIALOG
      Save file dialog mode. Equals JFileChooser.SAVE_DIALOG for backwards compatibility.
      See Also:
    • BROWSER_DIALOG

      public static final int BROWSER_DIALOG
      File Open Dialog with extra context menu actions like the BROWSER mode.
      See Also:
    • CHOOSE_DIRECTORY_DIALOG

      public static final int CHOOSE_DIRECTORY_DIALOG
      Choose directory dialog mode.
      See Also:
    • BROWSER

      public static final int BROWSER
      Stand-alone dockable browser mode.
      See Also:
    • M_OPEN

      public static final int M_OPEN
      See Also:
    • M_OPEN_NEW_VIEW

      public static final int M_OPEN_NEW_VIEW
      See Also:
    • M_OPEN_NEW_PLAIN_VIEW

      public static final int M_OPEN_NEW_PLAIN_VIEW
      See Also:
    • M_OPEN_NEW_SPLIT

      public static final int M_OPEN_NEW_SPLIT
      See Also:
    • M_INSERT

      public static final int M_INSERT
      See Also:
  • Constructor Details

    • VFSBrowser

      public VFSBrowser(View view, String position)
      Creates a new VFS browser.
      Parameters:
      view - The view to open buffers in by default
    • VFSBrowser

      public VFSBrowser(View view, String path, int mode, boolean multipleSelection, String position)
      Creates a new VFS browser.
      Parameters:
      view - The view to open buffers in by default
      path - The path to display
      mode - The browser mode
      multipleSelection - True if multiple selection should be allowed
      position - Where the browser is located
      Since:
      jEdit 4.2pre1
  • Method Details

    • browseDirectoryInNewWindow

      public static void browseDirectoryInNewWindow(View view, String path)
      Opens the specified directory in a new, floating, file system browser.
      Parameters:
      view - The view
      path - The directory's path
      Since:
      jEdit 4.1pre2
    • browseDirectory

      public static void browseDirectory(View view, String path)
      Opens the specified directory in a file system browser.
      Parameters:
      view - The view
      path - The directory's path
      Since:
      jEdit 4.0pre3
    • getActionContext

      public static ActionContext getActionContext()
      Returns the browser action context.
      Since:
      jEdit 4.2pre1
    • focusOnDefaultComponent

      public void focusOnDefaultComponent()
      Description copied from interface: DefaultFocusComponent
      Sets focus on the default component.
      Specified by:
      focusOnDefaultComponent in interface DefaultFocusComponent
    • addNotify

      public void addNotify()
      Overrides:
      addNotify in class JComponent
    • removeNotify

      public void removeNotify()
      Overrides:
      removeNotify in class JComponent
    • handlePropertiesChanged

      public void handlePropertiesChanged(PropertiesChanged msg)
    • handleBufferUpdate

      public void handleBufferUpdate(BufferUpdate bmsg)
    • handlePluginUpdate

      public void handlePluginUpdate(PluginUpdate pmsg)
    • handleVFSUpdate

      public void handleVFSUpdate(VFSUpdate msg)
    • getView

      public View getView()
    • getMode

      public int getMode()
    • isMultipleSelectionEnabled

      public boolean isMultipleSelectionEnabled()
    • isHorizontalLayout

      public boolean isHorizontalLayout()
    • getShowHiddenFiles

      public boolean getShowHiddenFiles()
    • setShowHiddenFiles

      public void setShowHiddenFiles(boolean showHiddenFiles)
    • getVFSFileFilter

      public VFSFileFilter getVFSFileFilter()
      Returns the currently active VFSFileFilter.
      Since:
      jEdit 4.3pre7
    • addVFSFileFilter

      public void addVFSFileFilter(VFSFileFilter filter)
      Adds a file filter to the browser.
      Since:
      jEdit 4.3pre7
    • setFilenameFilter

      public void setFilenameFilter(@Nullable String filter)
    • getDirectoryField

      public HistoryTextField getDirectoryField()
    • getDirectory

      public String getDirectory()
    • previousDirectory

      public void previousDirectory()
      Since:
      jedit 4.3pre15
    • nextDirectory

      public void nextDirectory()
      Since:
      jEdit 4.3pre15
    • getLastVisitedPath

      public static String getLastVisitedPath()
      Returns the last path visited by VFSBrowser. If no path was ever visited, returns null,
      Since:
      5.1
    • setDirectory

      public void setDirectory(String path)
    • getRootDirectory

      public static String getRootDirectory()
    • rootDirectory

      public void rootDirectory()
      Goes to the local drives directory.
      Since:
      jEdit 4.0pre4
    • reloadDirectory

      public void reloadDirectory()
    • delete

      public void delete(VFSFile[] files)
      Note that all files must be on the same VFS.
      Since:
      jEdit 4.3pre2
    • rename

      public void rename(VFSFile from)
      Rename a file. It will prompt for the new name.
      Parameters:
      from - the file to rename
      Since:
      jEdit 4.5pre1
    • rename

      public void rename(VFSFile from, String to)
      Rename a file. It will prompt for the new name.
      Parameters:
      from - the file to rename
      to - the target name
      Since:
      jEdit 4.5pre1
    • rename

      public void rename(String from)
    • rename

      public void rename(String from, String newname)
      Rename a file
      Parameters:
      from - the full path name of the file to be renamed
      newname - the new name (only filename, not full path)
    • mkdir

      public void mkdir()
    • newFile

      public void newFile()
      Creates a new file in the current directory.
      Since:
      jEdit 4.0pre2
    • fileProperties

      public void fileProperties(VFSFile[] files)
      Show selected file's properties.
    • searchInDirectory

      public void searchInDirectory()
      Opens a directory search in the current directory.
      Since:
      jEdit 4.0pre2
    • searchInDirectory

      public void searchInDirectory(String path, boolean directory)
      Opens a directory search in the specified directory.
      Parameters:
      path - The path name
      directory - True if the path is a directory, false if it is a file
      Since:
      jEdit 4.2pre1
    • getSelectedFiles

      public VFSFile[] getSelectedFiles()
      Return the selected files in the lower browser tree.
      Since:
      jEdit 4.3pre2
    • getSelectedFiles

      public VFSFile[] getSelectedFiles(Component source)
      Return the selected files from the point of view of the given component. This may be the selected directory from the upper tree component of the browser (directory tree) or the selected files in the bottom tree component. This method is to be used by code running inside VFSBrowser such as a DynamicMenuProvider. Use the other method otherwise. The main difference is this function searches the component hierarchy for a BrowserView.ParentDirectoryList to get the list of currently selected files from there. Otherwise, it returns what getSelectedFiles() would return.
      Parameters:
      source - the source component to start from when navigating the component hierarchy
      Since:
      jEdit 4.4pre1
    • paste

      public void paste(VFSFile file) throws IOException, UnsupportedFlavorException
      Paste the file contained in the clipboard. If the clipboard do not contains files, nothing happens.
      Parameters:
      file - the target, it can be a file, in that case it will be pasted to the parent directory, or a directory.
      Throws:
      IOException
      UnsupportedFlavorException
    • locateFile

      public void locateFile(String path)
      Goes to the given file's directory and selects the file in the list.
      Parameters:
      path - The file
      Since:
      jEdit 4.2pre2
    • createPluginsMenu

      public JComponent createPluginsMenu(JComponent pluginMenu, boolean showManagerOptions)
    • addBrowserListener

      public void addBrowserListener(BrowserListener l)
    • removeBrowserListener

      public void removeBrowserListener(BrowserListener l)
    • filesActivated

      public void filesActivated(int mode, boolean canDoubleClickClose)
      This method does the "double-click" handling. It is public so that browser.actions.xml can bind to it.
      Since:
      jEdit 4.2pre2
    • dispose

      public void dispose()
      Disposes the browser, regardless of whether it is a dialog or a dockable
    • move

      public void move(String newPosition)
      Description copied from interface: DockableWindow
      Notifies a dockable window before its docking position is changed.
      Specified by:
      move in interface DockableWindow
      Parameters:
      newPosition - The docking position to which the window is moving.