I'm setting up a series of preferences in my Eclipse (3.5.2) application and I'm having a problem with the FileFieldEditor. I want to allow the user to specify a log file to print output to. Often, this will be a new file. But when I use the file select dialog with FileFieldEditor, it complains that the file doesn't exists ("Value must be an existing file"). Is there a way, without extending the FileFieldEditor class, to suppress this error and have Java create that file if it doesn't exist? Thanks!
+1
A:
When I look the source code of org.eclipse.jface.preference.FileFieldEditor
, the only solution would be to extend it and write your own version of a FileFieldEditor
, with:
- an overwritten
changePressed()
method in order to keep the file path even if the file does not exists - an overwritten
checkState()
method in order to avoid that error message.
So I do not see a way to avoid that FileFieldEditor
extension here.
VonC
2010-03-29 07:42:53
ah that was what i was afraid of. not a big deal, but i was hoping for a simpler solution. thanks!
G33k
2010-03-29 11:02:57