Auto-Completion Feature

For discussions about the source code and how to get involved in the development of muCommander.

Auto-Completion Feature

Postby arik » Sat May 31, 2008 4:39 pm

Hey Maxence,

Another release for this feature :) - Please check this one and let me know your opinion.

Eventually I returned the LocationComboBox although I don't like it that way - I think that if we keep it as combo-box, it should contain the last 10 visited directories or something like that instead to the parent folders - if you agree with this, I'll love to implement a window like IntelliJ's cntrl+E window for parent directories and make the combo-box to contain the last visited directories.

patch:
autocomplete.patch
patch (for directory "com" under the source directory)
(106.58 KiB) Downloaded 301 times


Arik
arik
 
Posts: 69
Joined: Sat Mar 01, 2008 10:48 am

Re: Auto-Completion Feature

Postby arik » Sat May 31, 2008 6:54 pm

Sorry, fixed patch:
autocomplete2.patch
(for directory "source")
(57.94 KiB) Downloaded 303 times
arik
 
Posts: 69
Joined: Sat Mar 01, 2008 10:48 am

Re: Auto-Completion Feature

Postby maxence » Sun Jun 01, 2008 11:12 pm

Hi Arik,
Thanks for this new version of the auto-completer! This version fixes all of the issues I had previously reported by email.

I'm glad to report that your patch has been committed, the auto-completion will be in the next nightly build. Please note that I made the following minor changes :

- moved BookmarkManager#getSortedBookmarksNames() to LocationCompleter as it currently is used only by this class and is a somewhat specialized method. Same goes for RootFolders#getSortedRootFoldersNames(), except that this method is also used by FileCompleter so I had to make it public static, not pretty :) Maybe those two methods could be moved to a util class, or LocationCompleter could derive from FileCompleter since they share a lot of code. Just some thoughts.

- I've noticed a minor issue under Mac OS X while testing: the suggestion popup would sometimes show an horizontal scrollbar even though there is plenty enough horizontal space to display the suggestion list (see attached screenshot). To work around this problem, I have set the JScrollPane's horizontal policy to NEVER. It is rather unlikely that the list/popup's width will exceed the screen width so it shouldn't be a problem.

- commented the two lines you added to LocationComboBox#focusLost that ensure the text field's text is set to the current directory's path. It used to be this way before but it had the annoying side effect of resetting the text field's contents when you switched to another application. Sometimes you start typing a path and then need to check something in another application, go back to muCommander and finish typing. In that case, you don't want to lose your half-entered path and start all over again.
As it currently is, you can end up having the location field's text set to a value that doesn't correspond to the current folder (or to any folder for that matter) but I don't think it's that big of an issue. Please let me know if that is a problem for the auto-completer or if you have another idea regarding this.

I have a suggestion regarding the auto-completion in the location field. It currently suggests regular / non-browsable files (in addition to browsable files), which is not really necessary in the case of the location field, unlike in the copy/move/... dialogs where we might want to use a regular file as the destination. The completers could take a com.mucommander.file.filter.FileFilter in the constructor ; the AttributeFileFilter class could then be used to retain only browsable files in the location field completer.

Feel free to send me any update as a patch and I'll promptly integrate them.

That's about it for now, thank you once again for this great feature, it rocks!

Cheers,
Maxence
Attachments
autocomplete_suggestions_horizontal_sb.jpg
Unnecessary horizontal scrollbar under OS X
autocomplete_suggestions_horizontal_sb.jpg (52.88 KiB) Viewed 2788 times
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm

Re: Auto-Completion Feature

Postby maxence » Sun Jun 01, 2008 11:18 pm

Oh and regarding a popup list a la IntelliJ's ctrl+e, I'm all for it of course! :) By having a clear separation between the model and the implementations as you did with the auto-completer, we could have several implementations : one for recently-accessed folders, one for recently-executed files, one for parent folders, one for bookmarks, etc...

Let's further discuss this whenever you like.
My best,
Maxence
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm

Re: Auto-Completion Feature

Postby maxence » Thu Jun 05, 2008 8:10 pm

Hi again Arik,
I have just added auto-completion capabilities to all existing path fields that weren't already enabled, namely in the following dialogs:
- Pack files
- Mkdir/Mkfile
- Preferences (in the 'Folders' and 'Misc' tabs)
- Edit bookmarks

I have added a FilePathField class to the com.mucommander.ui.text package which is simply a text field with auto-completion capabilities. This class is used in all the above-mentioned dialogs, and in TransferDestinationDialog. All changes are in SVN.

Thanks again for this wonderful contribution!
Cheers,
Maxence
User avatar
maxence
Site Admin
 
Posts: 436
Joined: Wed Aug 21, 2002 8:18 pm


Return to Developer's corner

Who is online

Users browsing this forum: Griessyprepus and 1 guest

cron