// ElementSelectors:
if (target instanceof ElementSelector) {
stylesheet root = (stylesheet) resource.getContents().get(0);
for (ruleset r : root.getRuleset()) {
for (selector s : r.getSelectors()) {
selector cur = s;
while (cur != null) {
for (simple_selector ss : cur.getSimpleselectors()) {
if (ss.getElement() != null) {
ElementSelector check = ss.getElement();
if (check.getName().equals(((ElementSelector) target).getName())) {
ITextRegion declarationRegion = locationInFileProvider.getFullTextRegion(ss.getElement());
addOccurrenceAnnotation(DECLARATION_ANNOTATION_TYPE, document, declarationRegion, m);
}
}
}
cur = cur.getSelector();
}
}
}
}
// ClassSelector:
if (target instanceof ClassSelector) {
stylesheet root = (stylesheet) resource.getContents().get(0);
for (ruleset r : root.getRuleset()) {
for (selector s : r.getSelectors()) {
selector cur = s;
while (cur != null) {
for (simple_selector ss : cur.getSimpleselectors()) {
for (CssSelector subSel : ss.getSubSelectors()) {
if (subSel instanceof ClassSelector) {
ClassSelector check = (ClassSelector) subSel;
if (check.getName() != null) {
// TODO i don't get get a ClassSelectors name can be null
if (check.getName().equals(((ClassSelector) target).getName())) {
ITextRegion declarationRegion = locationInFileProvider.getFullTextRegion(subSel);
addOccurrenceAnnotation(DECLARATION_ANNOTATION_TYPE, document, declarationRegion, m);
}
}
}
}
if (ss.getElement() != null) {
}
}
cur = cur.getSelector();
}
}
}
}
// ClassSelector:
if (target instanceof IdSelector) {
stylesheet root = (stylesheet) resource.getContents().get(0);
for (ruleset r : root.getRuleset()) {
for (selector s : r.getSelectors()) {
selector cur = s;
while (cur != null) {
for (simple_selector ss : cur.getSimpleselectors()) {
for (CssSelector subSel : ss.getSubSelectors()) {
if (subSel instanceof IdSelector) {
IdSelector check = (IdSelector) subSel;
if (check.getName().equals(((IdSelector) target).getName())) {
ITextRegion declarationRegion = locationInFileProvider.getFullTextRegion(subSel);
addOccurrenceAnnotation(DECLARATION_ANNOTATION_TYPE, document, declarationRegion, m);
}
}
}
if (ss.getElement() != null) {
}
}
cur = cur.getSelector();
}
}
}
}