How to clean file history from simple node

Hello ,

Any idea how I can clean the file history used in my simple reader node? So every time after resetting it there will be no history in the file chooser field?

 

I am using - DialogComponentFileChooser to add file chooser to the tab.

Thanks in advance!

Hi!

Unfortunately there is no way to programmatically clear the history. You could delete the history file manually, but that is not what you are looking for, right?

 - Peter.

Hi,

Unfortunately you cannot directly extend the DialogComponentFileChooser as all the properties are defined as "private" (why?).

But you can make your own DialogComponentFileChooser copying the source code from the original one. Then you can add a function, e.g. "resetHistory()", where you set a new history:

m_fileHistory = StringHistory.getInstance(someRandomString);

The main problem I think is to link the particular instance of the NodeDialog to the instance of  the NodeModel that is going to be resetted. Although this should be doable via the createNodeDialogPane() method of the NodeFactory...

So just save a reference to the NodeDialog in the NodeModel, and when the "reset()" function of the NodeModel is invoked, call a reset function in your NodeDialog which in turn calls the resetHistory function of your own DialogComponentFileChooser.

I have not tried it but it looks possbile to me!

cheers, Ulrich

Okay - using a new history ID every time sounds like a hackaround - it does produce a lohot of history files in your workspace though! If you can, wait for the next release and use StringHistory#clearHistory().

 - Peter.

Thanks Peter!