// added or removed to the type system
IFile styleFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
getStyleFileForTypeSystem(typeSystemFile.getFullPath().toPortableString())));
DotCorpus dotCorpus = styles.get(styleFile.getFullPath().toPortableString());
if (dotCorpus == null) {
if (styleFile.exists()) {
InputStream styleFileIn = null;;
try {
styleFileIn = styleFile.getContents();
dotCorpus = DotCorpusSerializer.parseDotCorpus(styleFileIn);
}
finally {
if (styleFileIn != null)
try {
styleFileIn.close();
} catch (IOException e) {
CasEditorPlugin.log(e);
}
}
}
if (dotCorpus == null) {
dotCorpus = new DotCorpus();
// Initialize colors
CAS cas = DocumentUimaImpl.getVirginCAS(typeSystemFile);
TypeSystem ts = cas.getTypeSystem();
Collection<AnnotationStyle> defaultStyles = dotCorpus.getAnnotationStyles();
Collection<AnnotationStyle> newStyles = DefaultColors.assignColors(ts, defaultStyles);
for (AnnotationStyle style : newStyles) {
dotCorpus.setStyle(style);
}
}
styles.put(styleFile.getFullPath().toPortableString(), dotCorpus);
}