@Override
public Pair<ParameterBlock, ModelParameterFileReaderFactory> getFactoryParameter(
Window parentWindow) {
chosenURI = null;
final BrowseFSDialogViaFactories dialog =
new BrowseFSDialogViaFactories(parentWindow,
"Search for Model Parameter files", factories) {
/**
* Serialization ID
*/
private static final long serialVersionUID = 4373755720333003469L;
@Override
protected boolean checkFile(File f) {
try {
for (ModelParameterReaderFactory fac : factories) {
if (fac.supportsURI(Files.getURIFromFile(f))) {
System.out.println(f);
return true;
}
}
} catch (Exception e) {
SimSystem.report(e);
}
return false;
}
@Override
protected ModelParameterTableData getComponent(File f) {
System.out.println(f);
return new ModelParameterTableData(f);
}
};
dialog.addBrowseFSDialogListener(new IBrowseFSDialogListener() {
@Override
public void elementChosen(IBrowseFSDialogEntry element) {
try {
chosenURI = Files.getURIFromFile(element.getFile());
} catch (URISyntaxException e1) {
SimSystem.report(e1);
}
dialog.setVisible(false);
}
});
dialog.setVisible(true);
if (chosenURI == null) {
return null;
}