java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.gjt.sp.jedit.browser.VFSBrowser
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Stand-alone dockable browser mode.static final int
File Open Dialog with extra context menu actions like the BROWSER mode.static final int
Choose directory dialog mode.static final int
static final int
static final int
static final int
static final int
static final String
static final int
Open file dialog mode.static final int
Save file dialog mode.Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionVFSBrowser
(View view, String position) Creates a new VFS browser.VFSBrowser
(View view, String path, int mode, boolean multipleSelection, String position) Creates a new VFS browser. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
addVFSFileFilter
(VFSFileFilter filter) Adds a file filter to the browser.static void
browseDirectory
(View view, String path) Opens the specified directory in a file system browser.static void
browseDirectoryInNewWindow
(View view, String path) Opens the specified directory in a new, floating, file system browser.createPluginsMenu
(JComponent pluginMenu, boolean showManagerOptions) void
Note that all files must be on the same VFS.void
dispose()
Disposes the browser, regardless of whether it is a dialog or a dockablevoid
fileProperties
(VFSFile[] files) Show selected file's properties.void
filesActivated
(int mode, boolean canDoubleClickClose) This method does the "double-click" handling.void
Sets focus on the default component.static ActionContext
Returns the browser action context.static String
Returns the last path visited by VFSBrowser.int
getMode()
static String
VFSFile[]
Return the selected files in the lower browser tree.VFSFile[]
getSelectedFiles
(Component source) Return the selected files from the point of view of the given component.boolean
Returns the currently active VFSFileFilter.getView()
void
void
void
void
handleVFSUpdate
(VFSUpdate msg) boolean
boolean
void
locateFile
(String path) Goes to the given file's directory and selects the file in the list.void
mkdir()
void
Notifies a dockable window before its docking position is changed.void
newFile()
Creates a new file in the current directory.void
void
Paste the file contained in the clipboard.void
void
void
void
void
void
Rename a filevoid
Rename a file.void
Rename a file.void
Goes to the local drives directory.void
Opens a directory search in the current directory.void
searchInDirectory
(String path, boolean directory) Opens a directory search in the specified directory.void
setDirectory
(String path) void
setFilenameFilter
(String filter) void
setShowHiddenFiles
(boolean showHiddenFiles) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
NAME
- See Also:
-
OPEN_DIALOG
public static final int OPEN_DIALOGOpen file dialog mode. Equals JFileChooser.OPEN_DIALOG for backwards compatibility.- See Also:
-
SAVE_DIALOG
public static final int SAVE_DIALOGSave file dialog mode. Equals JFileChooser.SAVE_DIALOG for backwards compatibility.- See Also:
-
BROWSER_DIALOG
public static final int BROWSER_DIALOGFile Open Dialog with extra context menu actions like the BROWSER mode.- See Also:
-
CHOOSE_DIRECTORY_DIALOG
public static final int CHOOSE_DIRECTORY_DIALOGChoose directory dialog mode.- See Also:
-
BROWSER
public static final int BROWSERStand-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
Creates a new VFS browser.- Parameters:
view
- The view to open buffers in by default
-
VFSBrowser
Creates a new VFS browser.- Parameters:
view
- The view to open buffers in by defaultpath
- The path to displaymode
- The browser modemultipleSelection
- True if multiple selection should be allowedposition
- Where the browser is located- Since:
- jEdit 4.2pre1
-
-
Method Details
-
browseDirectoryInNewWindow
Opens the specified directory in a new, floating, file system browser.- Parameters:
view
- The viewpath
- The directory's path- Since:
- jEdit 4.1pre2
-
browseDirectory
Opens the specified directory in a file system browser.- Parameters:
view
- The viewpath
- The directory's path- Since:
- jEdit 4.0pre3
-
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 interfaceDefaultFocusComponent
-
addNotify
public void addNotify()- Overrides:
addNotify
in classJComponent
-
removeNotify
public void removeNotify()- Overrides:
removeNotify
in classJComponent
-
handlePropertiesChanged
-
handleBufferUpdate
-
handlePluginUpdate
-
handleVFSUpdate
-
getView
-
getMode
public int getMode() -
isMultipleSelectionEnabled
public boolean isMultipleSelectionEnabled() -
isHorizontalLayout
public boolean isHorizontalLayout() -
getShowHiddenFiles
public boolean getShowHiddenFiles() -
setShowHiddenFiles
public void setShowHiddenFiles(boolean showHiddenFiles) -
getVFSFileFilter
Returns the currently active VFSFileFilter.- Since:
- jEdit 4.3pre7
-
addVFSFileFilter
Adds a file filter to the browser.- Since:
- jEdit 4.3pre7
-
setFilenameFilter
-
getDirectoryField
-
getDirectory
-
previousDirectory
public void previousDirectory()- Since:
- jedit 4.3pre15
-
nextDirectory
public void nextDirectory()- Since:
- jEdit 4.3pre15
-
getLastVisitedPath
Returns the last path visited by VFSBrowser. If no path was ever visited, returnsnull
,- Since:
- 5.1
-
setDirectory
-
getRootDirectory
-
rootDirectory
public void rootDirectory()Goes to the local drives directory.- Since:
- jEdit 4.0pre4
-
reloadDirectory
public void reloadDirectory() -
delete
Note that all files must be on the same VFS.- Since:
- jEdit 4.3pre2
-
rename
Rename a file. It will prompt for the new name.- Parameters:
from
- the file to rename- Since:
- jEdit 4.5pre1
-
rename
Rename a file. It will prompt for the new name.- Parameters:
from
- the file to renameto
- the target name- Since:
- jEdit 4.5pre1
-
rename
-
rename
Rename a file- Parameters:
from
- the full path name of the file to be renamednewname
- 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
Show selected file's properties. -
searchInDirectory
public void searchInDirectory()Opens a directory search in the current directory.- Since:
- jEdit 4.0pre2
-
searchInDirectory
Opens a directory search in the specified directory.- Parameters:
path
- The path namedirectory
- True if the path is a directory, false if it is a file- Since:
- jEdit 4.2pre1
-
getSelectedFiles
Return the selected files in the lower browser tree.- Since:
- jEdit 4.3pre2
-
getSelectedFiles
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 aBrowserView.ParentDirectoryList
to get the list of currently selected files from there. Otherwise, it returns whatgetSelectedFiles()
would return.- Parameters:
source
- the source component to start from when navigating the component hierarchy- Since:
- jEdit 4.4pre1
-
paste
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
Goes to the given file's directory and selects the file in the list.- Parameters:
path
- The file- Since:
- jEdit 4.2pre2
-
createPluginsMenu
-
addBrowserListener
-
removeBrowserListener
-
filesActivated
public void filesActivated(int mode, boolean canDoubleClickClose) This method does the "double-click" handling. It is public so thatbrowser.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
Description copied from interface:DockableWindow
Notifies a dockable window before its docking position is changed.- Specified by:
move
in interfaceDockableWindow
- Parameters:
newPosition
- The docking position to which the window is moving.
-