From f6c3ba6c2d6bddcee285463ab022711bbe758619 Mon Sep 17 00:00:00 2001 From: Ramsey Gurley Date: Thu, 2 Jan 2025 11:08:16 +0900 Subject: [PATCH] Fix broken CSSAssistProcessor and dependency. --- wolips.targetplatform/wolips.targetplatform.target | 10 ++++++++++ .../META-INF/MANIFEST.MF | 4 +++- .../htmleditor/assist/CSSAssistProcessor.java | 13 ++++++++++--- .../org.objectstyle.wolips.tkhtmleditor/pom.xml | 6 ------ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/wolips.targetplatform/wolips.targetplatform.target b/wolips.targetplatform/wolips.targetplatform.target index 17f80285d5..3d21d3fb0b 100644 --- a/wolips.targetplatform/wolips.targetplatform.target +++ b/wolips.targetplatform/wolips.targetplatform.target @@ -50,5 +50,15 @@ + + + + com.helger + ph-css + 7.0.3 + jar + + + \ No newline at end of file diff --git a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/META-INF/MANIFEST.MF b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/META-INF/MANIFEST.MF index ea34610ec7..3fce31e85b 100644 --- a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/META-INF/MANIFEST.MF +++ b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/META-INF/MANIFEST.MF @@ -159,7 +159,9 @@ Require-Bundle: org.eclipse.ui.editors, org.objectstyle.wolips.preferences, org.objectstyle.wolips.bindings, org.objectstyle.wolips.variables;bundle-version="1.0.6", - org.eclipse.e4.core.contexts;bundle-version="1.3.0" + org.eclipse.e4.core.contexts;bundle-version="1.3.0", + com.helger.ph-css;bundle-version="7.0.3", + com.helger.commons.ph-commons;bundle-version="11.1.8" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-ClassPath: lib/xercesImpl.jar, 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)); } } - }); + } }); }); } diff --git a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/pom.xml b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/pom.xml index 3b080f4bbc..459e80b7bf 100644 --- a/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/pom.xml +++ b/wolips/plugins/org.objectstyle.wolips.tkhtmleditor/pom.xml @@ -10,12 +10,6 @@ eclipse-plugin org.objectstyle.wolips.tkhtmleditor - - - com.helger - ph-css - - java