Index: api/doc/changes/apichanges.xml =================================================================== RCS file: /cvs/openide/api/doc/changes/apichanges.xml,v retrieving revision 1.191 diff -u -r1.191 apichanges.xml --- api/doc/changes/apichanges.xml 29 Mar 2004 13:24:36 -0000 1.191 +++ api/doc/changes/apichanges.xml 31 Mar 2004 10:33:12 -0000 @@ -116,6 +116,23 @@ + + There should exist just one FileObject for one resource (java.io.File or URL). + + + + + +
    +
  • Added method FileUtil.toFileObject as replacement for current method FileUtil.fromFile which was deprecated.
  • +
  • Added method URLMapper.findFileObject as replacement for current method URLMapper.findFileObjects which was deprecated .
  • +
+
+ + + +
+ Allow dynamically enable/disable Finish button Index: src/org/openide/filesystems/FileUtil.java =================================================================== RCS file: /cvs/openide/src/org/openide/filesystems/FileUtil.java,v retrieving revision 1.79 diff -u -r1.79 FileUtil.java --- src/org/openide/filesystems/FileUtil.java 30 Mar 2004 13:12:07 -0000 1.79 +++ src/org/openide/filesystems/FileUtil.java 31 Mar 2004 10:33:12 -0000 @@ -273,12 +273,24 @@ } /** Finds appropriate FileObjects to java.io.File if possible. + * If not possible then null is returned. + * @param file File whose coresponding FileObjects will be looked for + * @return corresponding FileObject or null + * @since X.XX + */ + public static FileObject toFileObject (File file) { + FileObject[] fileObjects = fromFile (file); + return (fileObjects != null && fileObjects.length > 0) ? fileObjects[0] : null; + } + + /** Finds appropriate FileObjects to java.io.File if possible. * If not possible then empty array is returned. More FileObjects may * correspond to one java.io.File that`s why array is returned. * @param file File whose coresponding FileObjects will be looked for * @return corresponding FileObjects or empty array if no * corresponding FileObject exists. * @since 1.29 + * @deprecated Use method {@link #toFileObject toFileObject} */ public static FileObject[] fromFile (File file) { assert file.equals(normalizeFile(file)) : file; @@ -821,29 +833,6 @@ } /** - * This method is very similar to URLMapper.findFileObjects(URL) with - * difference that it returns just one file object and that it knows - * which file object must be used from available ones. - * - * @param url url to be converted to file object - * @return file object corresponding to url or null if no one was found - * @since XXX - */ - public static FileObject findFileObject(URL url) { - FileObject fos[] = URLMapper.findFileObjects(url); - if (fos.length == 0) { - return null; - } - // prefer file object from master filesystem - for (int i=0; i findURL(FileObject fo, int type) . * @param url to wanted FileObjects * @return a suitable arry of FileObjects, or empty array if not successful - * @since 2.22*/ + * @since 2.22 + * @deprecated use method {@link #findFileObject findFileObject} + */ public static FileObject[] findFileObjects (URL url) { /** first basic implementation */ Set retSet = new HashSet (); @@ -131,9 +133,34 @@ return retVal; } - /** Get an array of FileObjects for this url + /** Find an appropiate instance of FileObject that addresses this url + * + * @param url url to be converted to file object + * @return file object corresponding to url or null if no one was found + * @since X.XX + */ + public static FileObject findFileObject (URL url) { + FileObject fos[] = URLMapper.findFileObjects(url); + if (fos.length == 0) { + return null; + } + // prefer file object from master filesystem + for (int i=0; i There isn't necessary to return array here. + * The only one reason is just backward compatibility.

* @param url to wanted FileObjects - * @return a suitable arry of FileObjects, or null + * @return an array of FileObjects with size no greater than one, or null * @since 2.22*/ public abstract FileObject[] getFileObjects (URL url);