if (rc == JFileChooser.APPROVE_OPTION) {
File tsFile = fileChooser.getSelectedFile();
if (tsFile.exists() && tsFile.isFile()) {
try {
this.main.setXcasFileOpenDir(tsFile.getParentFile());
Timer time = new Timer();
time.start();
Object descriptor = UIMAFramework.getXMLParser().parse(new XMLInputSource(tsFile));
// instantiate CAS to get type system. Also build style
// map file if there is none.
TypeSystemDescription tsDesc = (TypeSystemDescription) descriptor;
tsDesc.resolveImports();
this.main.destroyAe();
this.main.setCas(CasCreationUtils
.createCas(tsDesc, null, new FsIndexDescription[0]));
this.main.setRunOnCasEnabled();
this.main.setRerunEnabled(false);
this.main.getTextArea().setText("");
this.main.resetTrees();
this.main.setTypeSystemViewerEnabled(true);
this.main.setEnableCasFileReadingAndWriting();
time.stop();
this.main.setStatusbarMessage("Done loading type system file in " + time.getTimeSpan() + ".");
} catch (Exception e) {
e.printStackTrace();
this.main.handleException(e);
}
}