diff --git a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/java/tk/eclipse/plugin/htmleditor/assist/CSSAssistProcessor.java b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/java/tk/eclipse/plugin/htmleditor/assist/CSSAssistProcessor.java index 84e0dabe0d..c4281d48be 100644 --- a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/java/tk/eclipse/plugin/htmleditor/assist/CSSAssistProcessor.java +++ b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/java/tk/eclipse/plugin/htmleditor/assist/CSSAssistProcessor.java @@ -9,6 +9,7 @@ import com.helger.css.ECSSVersion; import com.helger.css.decl.CSSSelectorSimpleMember; import com.helger.css.decl.CascadingStyleSheet; +import com.helger.css.decl.ICSSSelectorMember; import com.helger.css.reader.CSSReader; import jp.aonir.fuzzyxml.FuzzyXMLAttribute; @@ -145,13 +146,19 @@ private void processStylesheet(String css) { CascadingStyleSheet styles = CSSReader.readFromString(css, ECSSVersion.LATEST); styles.getAllStyleRules().stream().forEach(stylerule ->{ stylerule.getAllSelectors().forEach(sel ->{ - //FIXME add to _rules here - sel.getAllMembers().stream().forEach(mem ->{ + //add to _rules here + String currentTag = "*"; + ArrayList currentClasses = _rules.computeIfAbsent(currentTag, k -> new ArrayList<>()); + for(ICSSSelectorMember mem: sel.getAllMembers()) { if(mem instanceof CSSSelectorSimpleMember m) { if(m.isElementName()) { + currentTag = m.getValue(); + currentClasses = _rules.computeIfAbsent(currentTag, k -> new ArrayList<>()); + } else if(m.isClass()) { + currentClasses.add(m.getValue().substring(1)); } } - }); + } }); }); }