private static String[] internalGetCSSClasses(Document doc) {
Collection c = Collections.EMPTY_SET;
if (doc instanceof INodeNotifier) {
IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) ((INodeNotifier) doc)
.getAdapterFor(IStyleSheetListAdapter.class);
StyleSheetList ssl = (adapter == null ? null : adapter
.getStyleSheets());
CSSClassTraverser traverser = new CSSClassTraverser();
if (ssl != null) {
for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) {
// loop for styles (<style> and <link>)
org.w3c.dom.stylesheets.StyleSheet ss = ssl.item(i);
try {
traverser.apply((ICSSNode) ss);
} catch (ClassCastException ex) {
JSFCorePlugin.log(ex, "Unable to cast to CSS style"); //$NON-NLS-1$