jface.preference.FileFieldEditor无法指定新文件 [英] jface.preference.FileFieldEditor can't specify a new file
问题描述
当我查看 org.eclipse.jface.preference.FileFieldEditor
,唯一的解决方案是扩展它,并且编写自己的版本的 FileFieldEditor
,其中包含:
- 覆盖
changePressed()
方法,以便保留文件路径,即使文件不存在 - 覆盖
checkState()
方法以避免该错误消息。
所以我没有办法避免在这里 FileFieldEditor
扩展。
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!
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.
这篇关于jface.preference.FileFieldEditor无法指定新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!