public class URLChooser extends DefaultTraversablePanel implements GridBagConstants
URLChooser is a replacement file chooser for JFileChooser. The URLChooser is designed to
 work in terms of URL rather than File instances.
 In general, most client code should not call the URLChooser 
 constructors directly. Instead, use one of the 
 DialogUtil.newURLChooser 
 variants, as this ensures that the chooser will be initialized consistently 
 throughout the application. When the URLChooser must be subclassed, 
 however, the constructors can be called directly but this should be followed 
 by a call to 
 DialogUtil.initURLChooser(URLChooser,oracle.ide.Context).
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description | 
|---|---|
| static URLFilter | ALL_FILES_FILTERThe standard "All Files (*.*)"  URLFilterfor accepting allURLs. | 
| static int | APPROVE_OPTIONReturn value from  showOpenDialog(...)andshowSaveDialog(...)methods if open/save is chosen. | 
| static int | CANCEL_OPTIONReturn value from  showOpenDialog(...)andshowSaveDialog(...)methods if cancel is chosen. | 
| static int | DIRECTORIES_ONLY | 
| static int | DIRECTORIES_OR_FILES | 
| static int | ERROR_OPTIONReturn value from  showOpenDialog(...)andshowSaveDialog(...)methods if an I/O error occurred. | 
| static int | FILES_ONLY | 
| protected static java.lang.String | HELP_TOPIC_SELECT_DIRECTORIES | 
| protected static java.lang.String | HELP_TOPIC_SELECT_FILES | 
| protected static java.lang.String | HELP_TOPIC_SELECT_FILES_OR_DIRECTORIES | 
| static int | MULTIPLE_INTERVAL_SELECTIONA value for  setSelectionMode(int)meaning that one or
 more continuous ranges of files can be selected at a time. | 
| static int | SINGLE_INTERVAL_SELECTIONA value for  setSelectionMode(int)meaning that one
 continuous range of files can be selected at a time. | 
| static int | SINGLE_SELECTIONA value for  setSelectionMode(int)meaning that one
 file can be selected at a time. | 
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description | 
|---|
| URLChooser()Constructs a default  URLChooserwith all file system
 roots as reported byURLFileSystem.listRoots(). | 
| URLChooser(java.net.URL defaultSelection)Constructs a default  URLChooserwith all file system
 roots as reported byURLFileSystem.listRoots(). | 
| URLChooser(java.net.URL[] roots,
          java.net.URL defaultSelection)Constructs a  URLFilterto display the specified
 array ofURLs as its "root" file systems and the
 specifiedURLas the default selection. | 
| URLChooser(java.net.URL[] roots,
          java.net.URL defaultSelection,
          boolean showJarsAsDirs)Deprecated. 
 Replace with  URLChooser(URL[],URL)andsetShowJarsAsDirs(boolean). | 
| URLChooser(java.net.URL defaultSelection,
          boolean showJarsAsDirs)Deprecated. 
 Replace with  URLChooser(URL)andsetShowJarsAsDirs(boolean). | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | accept(java.net.URL url)Returns  trueif the specifiedURLshould be
 displayed in theURLChooser. | 
| void | addChooseableURLFilter(URLFilter filter)Adds the specified  URLFilterto be one of the filters
 that are shown in the "File type" combo box. | 
| void | addNotify() | 
| void | addShortcutButton(javax.swing.Icon icon,
                 java.lang.String description,
                 java.net.URL url)This method adds a shortcut button to the button panel on the
 left side of the  URLChooser. | 
| void | addURLChooserListener(oracle.ide.net.URLChooserListener ucl)Add a  URLChooserListenerto this URLChooser | 
| boolean | approveSelection() | 
| void | cancelSelection()This method is called when the  URLChooseris being
 canceled. | 
| protected java.net.URL | canonicalizeApprovalURL(java.net.URL url)Template helper method for  approveSelection()to
 canonicalize theURLto be approved. | 
| void | changeToParentDirectory() | 
| protected boolean | checkApprovalParentExists(java.net.URL url)Template helper method for  approveSelection()to check that
 the parent directory for the approvalURLexists. | 
| void | clearChooseableURLFilters()Clears the list of chooseable  URLFilters. | 
| void | flush()Clears the results of all file system queries that have been cached
 by the  URLChooser, so a single chooser instance can be
 reused multiple times in a session. | 
| protected java.net.URL | getApprovalFileListURL()Template helper method for  approveSelection()andgetSelectedURL()to get theURLof the selected
 node in the file list. | 
| URLFilter[] | getChooseableURLFilters()Returns all of the  URLFilters shown in the "File type" combo
 box as an array. | 
| DialogRunnerCallback | getDialogRunnerCallback() | 
| java.net.URL[] | getExtraURLs()Returns an array containing all  URLs that have been
 registered as "extra"URLs; returnsnullif
 noURLs have previously been registed viasetExtraURLs(URL[]). | 
| java.lang.String | getFileNameURL() | 
| URLFilter | getSelectedFilter()Returns the  URLFilterthat is currently selected in the
 file type combo box. | 
| java.net.URL | getSelectedURL()Returns the  URLof the node (which may be a directory or
 a file) that is currently selected in theURLChooser. | 
| java.net.URL[] | getSelectedURLs()Returns an array of  URLs representing the current
 selections in theURLChooser. | 
| boolean | getShowJarsAsDirs()Returns whether the  URLChooserallows browsing into
 archives. | 
| void | removeNotify() | 
| void | removeShortcutButtons()Removes all shortcut buttons from the button panel on the left side
 of the  URLChooser, allowing theURLChooserinstance to be reused in a different context without retaining the
 existing shortcut buttons. | 
| void | removeURLChooserListener(oracle.ide.net.URLChooserListener ucl)Remove a  URLChooserListenerfrom this URLChooser | 
| void | setDialogRunnerCallback(DialogRunnerCallback callBack) | 
| void | setExtraURLs(java.net.URL[] extraURLs)Registers a  URLarray that corresponds to resources that
 exist only in memory and not in the file system (for example, unsaved
 files). | 
| void | setFileNameURL(java.lang.String text) | 
| void | setRoots(java.net.URL[] roots)Sets the root  URLs that will be traversed by theURLChooser. | 
| void | setSelectedURL(java.net.URL selection)Sets the selected directory such that the specified  URLis shown in the file list. | 
| void | setSelectionMode(int selectionMode)Sets the selection mode for the  URLChooser. | 
| void | setSelectionScope(int selectionScope)Valid values are  FILES_ONLYandDIRECTORIES_ONLY. | 
| void | setShowJarsAsDirs(boolean showJarsAsDirs)Sets whether the  URLChoosershould allow browsing into
 archives. | 
| void | setURLFilter(URLFilter filter)Sets the active  URLFilter. | 
| void | setURLFolderFilter(URLFilter folderFilter)Sets the active  URLFilterfor folders. | 
| int | showOpenDialog(java.awt.Component parent) | 
| int | showOpenDialog(java.awt.Component parent,
              java.lang.String title) | 
| int | showOpenDialog(java.awt.Component parent,
              Traversable content,
              java.lang.String title) | 
| int | showSaveDialog(java.awt.Component parent) | 
| int | showSaveDialog(java.awt.Component parent,
              java.lang.String title) | 
| int | showSaveDialog(java.awt.Component parent,
              Traversable content,
              java.lang.String title) | 
gbc, gbc, getComponent, getDefaultTitle, getExitTransition, getHelpID, getText, onEntry, onExit, setDefaultTitle, setHelpIDgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, updateadd, 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, validateTreeaction, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final URLFilter ALL_FILES_FILTER
URLFilter for accepting all
 URLs.public static final int CANCEL_OPTION
showOpenDialog(...) and
 showSaveDialog(...) methods if cancel is chosen.public static final int APPROVE_OPTION
showOpenDialog(...) and
 showSaveDialog(...) methods if open/save is chosen.public static final int ERROR_OPTION
showOpenDialog(...) and
 showSaveDialog(...) methods if an I/O error occurred.public static final int MULTIPLE_INTERVAL_SELECTION
setSelectionMode(int) meaning that one or
 more continuous ranges of files can be selected at a time.public static final int SINGLE_INTERVAL_SELECTION
setSelectionMode(int) meaning that one
 continuous range of files can be selected at a time.public static final int SINGLE_SELECTION
setSelectionMode(int) meaning that one
 file can be selected at a time.public static final int FILES_ONLY
public static final int DIRECTORIES_ONLY
public static final int DIRECTORIES_OR_FILES
protected static final java.lang.String HELP_TOPIC_SELECT_FILES
protected static final java.lang.String HELP_TOPIC_SELECT_DIRECTORIES
protected static final java.lang.String HELP_TOPIC_SELECT_FILES_OR_DIRECTORIES
public URLChooser()
URLChooser  with all file system
 roots as reported by URLFileSystem.listRoots(). No
 default  (directory or file) is set.
 
 In general, client code should not call the URLChooser 
 constructors directly. Instead, use one of the 
 DialogUtil.newURLChooser 
 variants: this will ensure that the chooser will be initialized 
 consistently throughout the application.public URLChooser(java.net.URL defaultSelection)
URLChooser with all file system
 roots as reported by URLFileSystem.listRoots(). The
 specified URL is used as the default selection; if
 null, there will be no default selection.
 
 In general, client code should not call the URLChooser 
 constructors directly. Instead, use one of the 
 DialogUtil.newURLChooser 
 variants: this will ensure that the chooser will be initialized 
 consistently throughout the application.public URLChooser(java.net.URL[] roots,
                  java.net.URL defaultSelection)
URLFilter to display the specified
 array of URLs as its "root" file systems and the
 specified URL as the default selection. The "root"
 file systems only need to be directories and don't necessarily
 have to be actual file system roots.Note: File name auto-completion is not supported for the case where there are multiple roots but the defaultSelection is null. Name completion requires either a single root or that the dialog have a selected URL. The selected URL may become non-null as a result of user interaction with the dialog.
@Deprecated
public URLChooser(java.net.URL defaultSelection,
                              boolean showJarsAsDirs)
URLChooser(URL) and setShowJarsAsDirs(boolean).@Deprecated
public URLChooser(java.net.URL[] roots,
                              java.net.URL defaultSelection,
                              boolean showJarsAsDirs)
URLChooser(URL[],URL) and setShowJarsAsDirs(boolean).public void setExtraURLs(java.net.URL[] extraURLs)
URL array that corresponds to resources that
 exist only in memory and not in the file system (for example, unsaved
 files). While it is allowable to register a URL for a
 resource that physically does exist, it is not recommended for
 performance reasons.
 Nonexistent extra resources registered in this manner will appear in
 the URLChooser file list in italic font. This allows
 the user to distinguish between actual file system resources and
 in-memory only resources.
 Extra resources should be registered each time the
 URLChooser becomes displayed, and they should be cleared
 each time it becomes undisplayed. Displayability changes to the
 URLChooser can be detected by adding a HierarchyListener to it with Component.addHierarchyListener(java.awt.event.HierarchyListener).
extraURLs - the URL array specifying all in-memory only
 resources, or null to clear the previously registered
 URLs.HierarchyEvent.SHOWING_CHANGEDpublic java.net.URL[] getExtraURLs()
URLs that have been
 registered as "extra" URLs; returns null if
 no URLs have previously been registed via setExtraURLs(URL[]).public void setDialogRunnerCallback(DialogRunnerCallback callBack)
public DialogRunnerCallback getDialogRunnerCallback()
public void setShowJarsAsDirs(boolean showJarsAsDirs)
URLChooser should allow browsing into
 archives.public boolean getShowJarsAsDirs()
URLChooser allows browsing into
 archives.public boolean accept(java.net.URL url)
true if the specified URL should be
 displayed in the URLChooser. Returns
 false otherwise.public void addChooseableURLFilter(URLFilter filter)
URLFilter to be one of the filters
 that are shown in the "File type" combo box. If the specified
 filter is null or if the specified filter has
 already been added, this method does nothing.public void clearChooseableURLFilters()
URLFilters.public URLFilter[] getChooseableURLFilters()
URLFilters shown in the "File type" combo
 box as an array. If there are no filters, then an empty array is
 returned.public void addShortcutButton(javax.swing.Icon icon,
                              java.lang.String description,
                              java.net.URL url)
URLChooser. When the user clicks
 on the shortcut button, the current location of the
 URLChooser will be changed to be the URL
 URL.
 If the specified URL is null, this method
 does nothing. If no shortcut buttons are added, then the shortcut
 panel is not drawn.public void removeShortcutButtons()
URLChooser, allowing the URLChooser
 instance to be reused in a different context without retaining the
 existing shortcut buttons. The shortcut panel will no longer be
 visible after calling this method.public boolean approveSelection()
true if the URLChooser is ready
 to be dismissed; false if the user's current
 selection only indicates that a custom wildcard filter or
 directory change should occur instead.public void cancelSelection()
URLChooser is being
 canceled.public void changeToParentDirectory()
public java.net.URL getSelectedURL()
URL of the node (which may be a directory or
 a file) that is currently selected in the URLChooser.public java.lang.String getFileNameURL()
public void setFileNameURL(java.lang.String text)
public java.net.URL[] getSelectedURLs()
URLs representing the current
 selections in the URLChooser. This array will
 contain only one element if there is only one selection or
 if the user typed the name of the file into the text field.public void setSelectionMode(int selectionMode)
URLChooser. By
 default, the URLChooser allows multiple interval
 selection.selectionMode - The specified mode must be one of
 MULTIPLE_INTERVAL_SELECTION,
 SINGLE_INTERVAL_SELECTION, or SINGLE_SELECTION.java.lang.IllegalArgumentException - if the specified
 selection mode is not one of the legal vales.public void setRoots(java.net.URL[] roots)
URLs that will be traversed by the
 URLChooser. The roots can be any URL
 that represents a directory. Even directories within jar
 files are allowed.public void setSelectedURL(java.net.URL selection)
URL
 is shown in the file list. If the URL itself is a
 directory, then that directory is selected.public void setSelectionScope(int selectionScope)
FILES_ONLY and DIRECTORIES_ONLY.
 Note:  This method must be called from the AWT event
 thread.public void setURLFilter(URLFilter filter)
public void flush()
URLChooser, so a single chooser instance can be
 reused multiple times in a session. It is not necessary to use this
 method for a chooser instance that is used only once and then
 released.
 This method is generally called immediately after a call to
 showOpenDialog() or showSaveDialog() has
 completed. If it is called before showing the chooser dialog, then
 it should be called before any other initialization of the chooser is
 done.
public int showOpenDialog(java.awt.Component parent)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.public int showOpenDialog(java.awt.Component parent,
                          java.lang.String title)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.public int showOpenDialog(java.awt.Component parent,
                          Traversable content,
                          java.lang.String title)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.public int showSaveDialog(java.awt.Component parent)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.public int showSaveDialog(java.awt.Component parent,
                          java.lang.String title)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.public int showSaveDialog(java.awt.Component parent,
                          Traversable content,
                          java.lang.String title)
APPROVE_OPTION, CANCEL_OPTION, or
 ERROR_OPTION.protected java.net.URL canonicalizeApprovalURL(java.net.URL url)
approveSelection() to
 canonicalize the URL to be approved.
 The default implementation calls URLFileSystem.canonicalize(URL). Subclasses may override to
 provide differing behavior.
protected java.net.URL getApprovalFileListURL()
approveSelection() and
 getSelectedURL() to get the URL of the selected
 node in the file list.
 The default implementation gets the URL of the selected
 node in the file list. Subclasses may wish to override to
 return null in order to ignore the file list
 selection.
protected boolean checkApprovalParentExists(java.net.URL url)
approveSelection() to check that
 the parent directory for the approval URL exists.
 The default implementation gets the parent of the specified URL via URLFileSystem.getParent(URL) and tests for that
 directory's existence with URLFileSystem.exists(URL).
 Subclasses may override to provide differing behavior (for example,
 to always return true if the parent directory need not
 exist).
public void addURLChooserListener(oracle.ide.net.URLChooserListener ucl)
URLChooserListener to this URLChooserpublic void removeURLChooserListener(oracle.ide.net.URLChooserListener ucl)
URLChooserListener from this URLChooserpublic void addNotify()
addNotify in class javax.swing.JComponentpublic void removeNotify()
removeNotify in class javax.swing.JComponentpublic final URLFilter getSelectedFilter()
URLFilter that is currently selected in the
 file type combo box. The value returned by this method should
 always be non-null.