diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/dom/parsers/CSSParserTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/dom/parsers/CSSParserTest.java deleted file mode 100644 index 83d08ef2269..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/dom/parsers/CSSParserTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.dom.parsers; - -import org.akrogen.tkui.css.core.resources.CSSCoreResources; -import org.w3c.css.sac.InputSource; -import org.w3c.dom.css.CSSRule; -import org.w3c.dom.css.CSSRuleList; -import org.w3c.dom.css.CSSStyleSheet; - -public class CSSParserTest { - - public static void main(String[] args) { - try { - ICSSParserFactory factory = CSSParserFactory.newInstance(); - CSSParser cssParser = factory.makeCSSParser(); - - InputSource styleSheetSource = new InputSource(); - styleSheetSource.setByteStream(CSSCoreResources.getHTMLSimple()); - - CSSStyleSheet styleSheet = cssParser - .parseStyleSheet(styleSheetSource); - - // Loop for CSS Rules list parsed - CSSRuleList ruleList = styleSheet.getCssRules(); - int length = ruleList.getLength(); - for (int i = 0; i < length; i++) { - CSSRule rule = ruleList.item(i); - System.out.println(rule); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java deleted file mode 100644 index 1e405ac1a7f..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.examples.csseditors; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Date; - -import org.akrogen.tkui.css.core.dom.IElementProvider; -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.core.engine.CSSErrorHandler; -import org.akrogen.tkui.css.core.serializers.CSSHTMLSerializerConfiguration; -import org.akrogen.tkui.css.core.serializers.CSSSerializer; -import org.akrogen.tkui.css.core.serializers.CSSSerializerConfiguration; - -/** - * Abstract CSS Editor. - * - * @version 1.0.0 - * @author Angelo ZERR - */ -public abstract class AbstractCSSEditor { - - /** - * CSS Engine. - */ - protected CSSEngine engine; - - /** - * CSS Serializer - */ - protected CSSSerializer serializer; - - protected String nativeWidgetDir; - - protected java.util.List cssFiles = new ArrayList(); - - protected AbstractCSSEditor(String nativeWidgetDir) { - this.nativeWidgetDir = nativeWidgetDir; - } - - /** - * Return CSS Engine configured. - */ - protected CSSEngine getCSSEngine() { - if (engine == null) { - // Get SWT CSS Engine - engine = createCSSEngine(); - // Error - engine.setErrorHandler(new CSSErrorHandler() { - public void error(Exception e) { - handleExceptions(e); - } - }); - - } else { - // Remove all style sheets. - engine.reset(); - } - - if (isHTMLSelector()) { - // Register HTML Element Provider to retrieve - // w3c Element HTMLElement coming from Native Widget. - engine.setElementProvider(getHTMLElementProvider()); - } else { - // Register Native Widget (SWT, Swing...) Element Provider to - // retrieve - // w3c Element Element coming from Native Widget. - engine.setElementProvider(getNativeWidgetElementProvider()); - } - return engine; - } - - /** - * Apply Styles comming from getStyleSheetContent() method to - * implement widget. - */ - protected void applyStyles(Object widget) { - try { - Date d1 = new Date(); - engine = getCSSEngine(); - // 1. Parse Style Sheet coming from getStyleSheetContent(). - StringReader reader = new StringReader(getStyleSheetContent()); - engine.parseStyleSheet(reader); - - // 2. Apply styles - engine.applyStyles(widget, true, true); - Date d2 = new Date(); - - // 3. Display time elapsed - setCSSEngineStatuts("Apply style with " - + (d2.getTime() - d1.getTime()) + "ms."); - - } catch (Exception ex) { - handleExceptions(ex); - } - } - - /** - * Apply styles to the fully window or left panel widget. - */ - protected void applyStyles() { - if (mustApplyStylesToWindow()) { - applyStyles(getWindowNativeWidget()); - } else - applyStyles(getLeftPanelNativeWidget()); - } - - protected void fillTextareaWithStyleSheetContent(File file) { - try { - fillTextareaWithStyleSheetContent(new FileInputStream(file)); - } catch (Exception e) { - handleExceptions(e); - } - } - - /** - * Fill the TextArea which store the style sheet content with the - * stream content. - */ - protected void fillTextareaWithStyleSheetContent(InputStream stream) { - try { - StringWriter writer = new StringWriter(); - InputStreamReader streamReader = new InputStreamReader(stream); - BufferedReader buffer = new BufferedReader(streamReader); - String line = ""; - boolean b = false; - while (null != (line = buffer.readLine())) { - if (b) - writer.write("\n"); - writer.write(line); - b = true; - } - buffer.close(); - streamReader.close(); - String content = writer.toString(); - setStyleSheetContent(content); - } catch (Exception e) { - handleExceptions(e); - } - } - - protected void fillTextareaWithDefaultStyleSheetContent() { - if (mustApplyStylesToWindow()) - fillTextareaWithDefaultStyleSheetContent(getWindowNativeWidget()); - else - fillTextareaWithDefaultStyleSheetContent(getLeftPanelNativeWidget()); - } - - protected void fillTextareaWithDefaultStyleSheetContent(Object widget) { - if (serializer == null) - this.serializer = new CSSSerializer(); - StringWriter writer = new StringWriter(); - try { - CSSSerializerConfiguration configuration = (isHTMLSelector() ? getCSSHTMLSerializerConfiguration() - : getCSSNativeWidgetSerializerConfiguration()); - serializer.serialize(writer, getCSSEngine(), widget, true, - configuration); - setStyleSheetContent(writer.toString()); - } catch (Exception e) { - handleExceptions(e); - } - } - - protected void applyStylesFromSelectedFile() { - int index = getCSSFilesWidgetSelectionIndex(); - if (index == -1) - if (getCSSFilesWidgetItemCount() > 1) { - index = 1; - selectCSSFilesWidget(index); - // cssFilesWidget.select(index); - } - if (index < 1) { - setStyleSheetContent(""); - return; - } - File file = (File) cssFiles.get(index - 1); - fillTextareaWithStyleSheetContent(file); - } - - protected void populateCSSFiles() { - removeAllCSSFilesWidget(); - int size = cssFiles.size(); - for (int i = 0; i < size; i++) { - cssFiles.remove(0); - } - addItemCSSFilesWidget("None"); - File baseDir = getBaseStyleDir(); - File[] files = baseDir.listFiles(); - for (int i = 0; i < files.length; i++) { - File file = files[i]; - if (file.isFile()) { - addItemCSSFilesWidget(file.getName()); - cssFiles.add(file); - } - } - } - - /** - * Display CSS Engine error - */ - protected void handleExceptions(Exception e) { - e.printStackTrace(); - } - - protected File getBaseStyleDir() { - if (isHTMLSelector()) - return new File(getBaseStyleDirName() + "/html"); - if (nativeWidgetDir != null) - return new File(getBaseStyleDirName() + "/" + nativeWidgetDir); - return new File(getBaseStyleDirName()); - } - - protected String getBaseStyleDirName() { - return "styles"; - } - - /** - * Create Instance of CSS Engine - */ - protected abstract CSSEngine createCSSEngine(); - - /** - * Return true if HTML selector must be used and false if Native Widget - * Selector must be used. - */ - protected abstract boolean isHTMLSelector(); - - /** - * Return Native Widget Element provider. - */ - protected abstract IElementProvider getNativeWidgetElementProvider(); - - /** - * Return HTML Element provider. - */ - protected abstract IElementProvider getHTMLElementProvider(); - - /** - * Return style sheet content. - */ - protected abstract String getStyleSheetContent(); - - /** - * Set style sheet content. - */ - protected abstract void setStyleSheetContent(String content); - - /** - * Set CSS Engine status. - */ - protected abstract void setCSSEngineStatuts(String status); - - /** - * Return true if Styles must be applied to the fully Window and false - * otherwise. - */ - protected abstract boolean mustApplyStylesToWindow(); - - /** - * Get Window Native Widget. - */ - protected abstract Object getWindowNativeWidget(); - - /** - * Get Left Panel Native widget. - */ - protected abstract Object getLeftPanelNativeWidget(); - - /** - * Return CSS Serializer configuration for Native Widget. - */ - protected abstract CSSSerializerConfiguration getCSSNativeWidgetSerializerConfiguration(); - - /** - * Return CSS Serializer configuration for HTML. - */ - protected CSSSerializerConfiguration getCSSHTMLSerializerConfiguration() { - return CSSHTMLSerializerConfiguration.INSTANCE; - } - - /** - * Return selection index of CSS files widget. - */ - protected abstract int getCSSFilesWidgetSelectionIndex(); - - /** - * Return item count of CSS files widget. - */ - protected abstract int getCSSFilesWidgetItemCount(); - - /** - * Select item of CSS files widget at index. - */ - protected abstract void selectCSSFilesWidget(int index); - - /** - * Remove all items of CSS files widget. - */ - protected abstract void removeAllCSSFilesWidget(); - - /** - * Add item of CSS files widget. - */ - protected abstract void addItemCSSFilesWidget(String item); - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/CSSCoreResources.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/CSSCoreResources.java deleted file mode 100644 index fcf5d9c7e64..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/CSSCoreResources.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.resources; - -import java.io.InputStream; - -public class CSSCoreResources { - - /*--- HTML Styles --*/ - - public static InputStream getHTMLSimple() { - return CSSCoreResources.class.getResourceAsStream("html/simple-html.css"); - } - - public static InputStream getHTMLFont() { - return CSSCoreResources.class.getResourceAsStream("html/font-html.css"); - } - - - public static InputStream getHTMLMatrix() { - return CSSCoreResources.class.getResourceAsStream("html/Matrix.css"); - } - - public static InputStream getStyleCLass() { - return CSSCoreResources.class.getResourceAsStream("style-class.css"); - } - - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/font-html.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/font-html.css deleted file mode 100644 index 4d67609a31e..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/font-html.css +++ /dev/null @@ -1,14 +0,0 @@ -font { - color:red; -} - -font#MyId { - color:yellow; - font-size:5; -} - -.purpleClass { - color:purple; - font-weight:bold; - font-style:italic; -} \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/simple-html.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/simple-html.css deleted file mode 100644 index 253ecf00820..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/html/simple-html.css +++ /dev/null @@ -1,46 +0,0 @@ -body { - text-decoration: none; - color: navy; - font-family: "arial"; - font-size: 12pt; - font-weight: medium; -} -.title { - text-decoration: bold; - color: green; - font-family: "ms sans serif"; - font-size: 24pt; - font-weight: heavy; -} - -.bold { - text-decoration: bold; - color: black; - font-family: "courier, arial"; - font-size: 14pt; - font-weight: heavy; -} - -a:link { - text-decoration: none; - color: red; - font-family: - "ms sans serif"; - font-size: 12pt; - font-weight: heavy; -} - -.head { - color: #000000; - font-family: "ms sans serif"; - font-size: 35px; - margin-top: 35px; - margin-left: 28px; -} - -.foo { - text-decoration: underline; - color: #00FF00; - font-family: "courier"; - font-size: 14pt; - font-weight: heavy; } \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/style-class.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/style-class.css deleted file mode 100644 index 78540b99ac8..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/resources/style-class.css +++ /dev/null @@ -1,15 +0,0 @@ -.blueClass { - color:blue; -} - -.greenClass { - color:green; -} - -.redClass { - color:red; -} - -.yellowClass { - color:yellow; -} \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/MockDocumentHandler.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/MockDocumentHandler.java deleted file mode 100644 index a2ab298dca5..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/MockDocumentHandler.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2023 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.sac; - -import org.w3c.css.sac.AttributeCondition; -import org.w3c.css.sac.CSSException; -import org.w3c.css.sac.Condition; -import org.w3c.css.sac.ConditionalSelector; -import org.w3c.css.sac.ElementSelector; -import org.w3c.css.sac.InputSource; -import org.w3c.css.sac.LexicalUnit; -import org.w3c.css.sac.SACMediaList; -import org.w3c.css.sac.Selector; -import org.w3c.css.sac.SelectorList; - -public class MockDocumentHandler implements org.w3c.css.sac.DocumentHandler { - - public void comment(String text) throws CSSException { - System.out.println("MockDocumentHandler#comment], text=" + text); - - } - - public void endDocument(InputSource source) throws CSSException { - System.out.println("[MockDocumentHandler#endDocument], source= " - + source); - - } - - public void endFontFace() throws CSSException { - System.out.println("[MockDocumentHandler#endFontFace]"); - - } - - public void endMedia(SACMediaList media) throws CSSException { - System.out.println("[MockDocumentHandler#media], media=" + media); - - } - - public void endPage(String name, String pseudo_page) throws CSSException { - System.out.println("[MockDocumentHandler#endPage], name=" + name - + ", pseudo_page=" + pseudo_page); - - } - - public void endSelector(SelectorList selectors) throws CSSException { - int length = selectors.getLength(); - System.out.println("[MockDocumentHandler#endSelector], selectors=" - + selectors + ", length=" + length); - for (int i = 0; i < length; i++) { - Selector selector = selectors.item(i); - if (selector instanceof ElementSelector elementSelector) { - // Element selector - System.out.println("\tElementSelector=> localName=" - + elementSelector.getLocalName()); - } else if (selector instanceof ConditionalSelector conditionalSelector) { - System.out.println("\tConditionalSelector"); - Condition condition = conditionalSelector.getCondition(); - if (condition instanceof AttributeCondition attributeCondition) { - System.out - .println("\t\tCondition (type=AttributeCondition)=> localName=" - + attributeCondition.getLocalName() - + ", value=" - + attributeCondition.getValue()); - } else { - System.out.println("\t\tCondition=>" + condition); - } - - } else - System.out.println(selector); - } - - } - - public void ignorableAtRule(String atRule) throws CSSException { - // TODO Auto-generated method stub - - } - - public void importStyle(String uri, SACMediaList media, - String defaultNamespaceURI) throws CSSException { - // TODO Auto-generated method stub - - } - - public void namespaceDeclaration(String prefix, String uri) - throws CSSException { - // TODO Auto-generated method stub - - } - - public void property(String name, LexicalUnit value, boolean important) - throws CSSException { - System.out.println("[MockDocumentHandler#property], name=" + name - + ", value=" + value); - - } - - public void startDocument(InputSource source) throws CSSException { - // TODO Auto-generated method stub - - } - - public void startFontFace() throws CSSException { - // TODO Auto-generated method stub - - } - - public void startMedia(SACMediaList media) throws CSSException { - // TODO Auto-generated method stub - - } - - public void startPage(String name, String pseudo_page) throws CSSException { - // TODO Auto-generated method stub - - } - - public void startSelector(SelectorList selectors) throws CSSException { - // TODO Auto-generated method stub - - } - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/AbstractParseStyleSheet.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/AbstractParseStyleSheet.java deleted file mode 100644 index 07d8c822507..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/AbstractParseStyleSheet.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.sac.parsers; - -import org.akrogen.tkui.css.core.resources.CSSCoreResources; -import org.akrogen.tkui.css.core.sac.ISACParserFactory; -import org.akrogen.tkui.css.core.sac.MockDocumentHandler; -import org.akrogen.tkui.css.core.sac.SACParserFactory; -import org.w3c.css.sac.DocumentHandler; -import org.w3c.css.sac.InputSource; -import org.w3c.css.sac.Parser; - -public abstract class AbstractParseStyleSheet { - - private String parserName; - - public AbstractParseStyleSheet(String parserName) { - this.parserName = parserName; - } - - public void parseStyleSheet() { - ISACParserFactory factory = SACParserFactory.newInstance(); - try { - // 1. Get SAC Parser - Parser parser = factory.makeParser(parserName); - if (parser != null) { - System.out.println("SAC Parser used=" - + parser.getClass().getName()); - // 2. Set SAC Document Handler into parser - DocumentHandler handler = new MockDocumentHandler(); - parser.setDocumentHandler(handler); - // 3. Parse text.css - InputSource styleSheetSource = new InputSource(); - styleSheetSource - .setByteStream(CSSCoreResources.getHTMLSimple()); - parser.parseStyleSheet(styleSheetSource); - } - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/batik/ParseStyleSheet.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/batik/ParseStyleSheet.java deleted file mode 100644 index 962d6bf65bf..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/batik/ParseStyleSheet.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.sac.parsers.batik; - -import org.akrogen.tkui.css.core.SACConstants; -import org.akrogen.tkui.css.core.sac.parsers.AbstractParseStyleSheet; - -public class ParseStyleSheet extends AbstractParseStyleSheet { - - public ParseStyleSheet() { - super(SACConstants.SACPARSER_BATIK); - } - - public static void main(String[] args) { - ParseStyleSheet p = new ParseStyleSheet(); - p.parseStyleSheet(); - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/flute/ParseStyleSheet.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/flute/ParseStyleSheet.java deleted file mode 100644 index c406887bdd8..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/core/test/org/akrogen/tkui/css/core/sac/parsers/flute/ParseStyleSheet.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.sac.parsers.flute; - -import org.akrogen.tkui.css.core.SACConstants; -import org.akrogen.tkui.css.core.sac.parsers.AbstractParseStyleSheet; - -public class ParseStyleSheet extends AbstractParseStyleSheet { - - public ParseStyleSheet() { - super(SACConstants.SACPARSER_FLUTE); - } - - public static void main(String[] args) { - ParseStyleSheet p = new ParseStyleSheet(); - p.parseStyleSheet(); - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Osx.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Osx.css deleted file mode 100644 index 46390e099c7..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Osx.css +++ /dev/null @@ -1,10 +0,0 @@ -body { - font-family: "Lucida Grande",Serif; - font-size: 11; -} - -input { - font-family: "Lucida Grande",Serif; - font-size: 9; -} - diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Vista.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Vista.css deleted file mode 100644 index 09093bd55c2..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/html/Vista.css +++ /dev/null @@ -1,12 +0,0 @@ -body, Tree { - font-family: Calibri; - font-size: 10; - background-color: rgb(233,234,238); - color: rgb(70,70,70); -} - - -input { - font-family: Calibri; - font-size: 10; -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Osx.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Osx.css deleted file mode 100644 index fddfa8212d6..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Osx.css +++ /dev/null @@ -1,12 +0,0 @@ -Shell, SashForm { - font-family: "Lucida Grande",Serif; - font-size: 11; - background: url(./images/osx_back.jpg); -} - -ToolBar, Text, Button { - font-family: "Lucida Grande",Serif; - font-size: 9; - background: url(./images/osx_back.jpg); -} - diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Vista.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Vista.css deleted file mode 100644 index cacaa82ac5e..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/styles/swt/Vista.css +++ /dev/null @@ -1,13 +0,0 @@ -Shell, Tree { - font-family: Calibri; - font-size: 10; - background-color: rgb(233,234,238); - color: rgb(70,70,70); -} -SashForm { - background-color: black; -} -Text { - font-family: Calibri; - font-size: 10; -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java deleted file mode 100644 index 1e405ac1a7f..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/core/examples/csseditors/AbstractCSSEditor.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.core.examples.csseditors; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Date; - -import org.akrogen.tkui.css.core.dom.IElementProvider; -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.core.engine.CSSErrorHandler; -import org.akrogen.tkui.css.core.serializers.CSSHTMLSerializerConfiguration; -import org.akrogen.tkui.css.core.serializers.CSSSerializer; -import org.akrogen.tkui.css.core.serializers.CSSSerializerConfiguration; - -/** - * Abstract CSS Editor. - * - * @version 1.0.0 - * @author Angelo ZERR - */ -public abstract class AbstractCSSEditor { - - /** - * CSS Engine. - */ - protected CSSEngine engine; - - /** - * CSS Serializer - */ - protected CSSSerializer serializer; - - protected String nativeWidgetDir; - - protected java.util.List cssFiles = new ArrayList(); - - protected AbstractCSSEditor(String nativeWidgetDir) { - this.nativeWidgetDir = nativeWidgetDir; - } - - /** - * Return CSS Engine configured. - */ - protected CSSEngine getCSSEngine() { - if (engine == null) { - // Get SWT CSS Engine - engine = createCSSEngine(); - // Error - engine.setErrorHandler(new CSSErrorHandler() { - public void error(Exception e) { - handleExceptions(e); - } - }); - - } else { - // Remove all style sheets. - engine.reset(); - } - - if (isHTMLSelector()) { - // Register HTML Element Provider to retrieve - // w3c Element HTMLElement coming from Native Widget. - engine.setElementProvider(getHTMLElementProvider()); - } else { - // Register Native Widget (SWT, Swing...) Element Provider to - // retrieve - // w3c Element Element coming from Native Widget. - engine.setElementProvider(getNativeWidgetElementProvider()); - } - return engine; - } - - /** - * Apply Styles comming from getStyleSheetContent() method to - * implement widget. - */ - protected void applyStyles(Object widget) { - try { - Date d1 = new Date(); - engine = getCSSEngine(); - // 1. Parse Style Sheet coming from getStyleSheetContent(). - StringReader reader = new StringReader(getStyleSheetContent()); - engine.parseStyleSheet(reader); - - // 2. Apply styles - engine.applyStyles(widget, true, true); - Date d2 = new Date(); - - // 3. Display time elapsed - setCSSEngineStatuts("Apply style with " - + (d2.getTime() - d1.getTime()) + "ms."); - - } catch (Exception ex) { - handleExceptions(ex); - } - } - - /** - * Apply styles to the fully window or left panel widget. - */ - protected void applyStyles() { - if (mustApplyStylesToWindow()) { - applyStyles(getWindowNativeWidget()); - } else - applyStyles(getLeftPanelNativeWidget()); - } - - protected void fillTextareaWithStyleSheetContent(File file) { - try { - fillTextareaWithStyleSheetContent(new FileInputStream(file)); - } catch (Exception e) { - handleExceptions(e); - } - } - - /** - * Fill the TextArea which store the style sheet content with the - * stream content. - */ - protected void fillTextareaWithStyleSheetContent(InputStream stream) { - try { - StringWriter writer = new StringWriter(); - InputStreamReader streamReader = new InputStreamReader(stream); - BufferedReader buffer = new BufferedReader(streamReader); - String line = ""; - boolean b = false; - while (null != (line = buffer.readLine())) { - if (b) - writer.write("\n"); - writer.write(line); - b = true; - } - buffer.close(); - streamReader.close(); - String content = writer.toString(); - setStyleSheetContent(content); - } catch (Exception e) { - handleExceptions(e); - } - } - - protected void fillTextareaWithDefaultStyleSheetContent() { - if (mustApplyStylesToWindow()) - fillTextareaWithDefaultStyleSheetContent(getWindowNativeWidget()); - else - fillTextareaWithDefaultStyleSheetContent(getLeftPanelNativeWidget()); - } - - protected void fillTextareaWithDefaultStyleSheetContent(Object widget) { - if (serializer == null) - this.serializer = new CSSSerializer(); - StringWriter writer = new StringWriter(); - try { - CSSSerializerConfiguration configuration = (isHTMLSelector() ? getCSSHTMLSerializerConfiguration() - : getCSSNativeWidgetSerializerConfiguration()); - serializer.serialize(writer, getCSSEngine(), widget, true, - configuration); - setStyleSheetContent(writer.toString()); - } catch (Exception e) { - handleExceptions(e); - } - } - - protected void applyStylesFromSelectedFile() { - int index = getCSSFilesWidgetSelectionIndex(); - if (index == -1) - if (getCSSFilesWidgetItemCount() > 1) { - index = 1; - selectCSSFilesWidget(index); - // cssFilesWidget.select(index); - } - if (index < 1) { - setStyleSheetContent(""); - return; - } - File file = (File) cssFiles.get(index - 1); - fillTextareaWithStyleSheetContent(file); - } - - protected void populateCSSFiles() { - removeAllCSSFilesWidget(); - int size = cssFiles.size(); - for (int i = 0; i < size; i++) { - cssFiles.remove(0); - } - addItemCSSFilesWidget("None"); - File baseDir = getBaseStyleDir(); - File[] files = baseDir.listFiles(); - for (int i = 0; i < files.length; i++) { - File file = files[i]; - if (file.isFile()) { - addItemCSSFilesWidget(file.getName()); - cssFiles.add(file); - } - } - } - - /** - * Display CSS Engine error - */ - protected void handleExceptions(Exception e) { - e.printStackTrace(); - } - - protected File getBaseStyleDir() { - if (isHTMLSelector()) - return new File(getBaseStyleDirName() + "/html"); - if (nativeWidgetDir != null) - return new File(getBaseStyleDirName() + "/" + nativeWidgetDir); - return new File(getBaseStyleDirName()); - } - - protected String getBaseStyleDirName() { - return "styles"; - } - - /** - * Create Instance of CSS Engine - */ - protected abstract CSSEngine createCSSEngine(); - - /** - * Return true if HTML selector must be used and false if Native Widget - * Selector must be used. - */ - protected abstract boolean isHTMLSelector(); - - /** - * Return Native Widget Element provider. - */ - protected abstract IElementProvider getNativeWidgetElementProvider(); - - /** - * Return HTML Element provider. - */ - protected abstract IElementProvider getHTMLElementProvider(); - - /** - * Return style sheet content. - */ - protected abstract String getStyleSheetContent(); - - /** - * Set style sheet content. - */ - protected abstract void setStyleSheetContent(String content); - - /** - * Set CSS Engine status. - */ - protected abstract void setCSSEngineStatuts(String status); - - /** - * Return true if Styles must be applied to the fully Window and false - * otherwise. - */ - protected abstract boolean mustApplyStylesToWindow(); - - /** - * Get Window Native Widget. - */ - protected abstract Object getWindowNativeWidget(); - - /** - * Get Left Panel Native widget. - */ - protected abstract Object getLeftPanelNativeWidget(); - - /** - * Return CSS Serializer configuration for Native Widget. - */ - protected abstract CSSSerializerConfiguration getCSSNativeWidgetSerializerConfiguration(); - - /** - * Return CSS Serializer configuration for HTML. - */ - protected CSSSerializerConfiguration getCSSHTMLSerializerConfiguration() { - return CSSHTMLSerializerConfiguration.INSTANCE; - } - - /** - * Return selection index of CSS files widget. - */ - protected abstract int getCSSFilesWidgetSelectionIndex(); - - /** - * Return item count of CSS files widget. - */ - protected abstract int getCSSFilesWidgetItemCount(); - - /** - * Select item of CSS files widget at index. - */ - protected abstract void selectCSSFilesWidget(int index); - - /** - * Remove all items of CSS files widget. - */ - protected abstract void removeAllCSSFilesWidget(); - - /** - * Add item of CSS files widget. - */ - protected abstract void addItemCSSFilesWidget(String item); - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineSimpleTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineSimpleTest.java deleted file mode 100644 index 79840df1af8..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineSimpleTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEngineSimpleTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Create SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - // Parse style sheet - engine.parseStyleSheet(new StringReader( - "Label {color:red;} Text {background-color:green;}")); - - /*--- Start UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineTest.java deleted file mode 100644 index 2828d497e14..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/CSSSWTEngineTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEngineTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(CSSSWTResources.getSWT()); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label 2 [label.setData('MyId')]"); - label2.setData("id", "MyId"); - - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3 [label.setData('MyId2')]"); - label3.setData("id", "MyId2"); - - // Composite - Composite panel2 = new Composite(panel1, SWT.NONE); - panel2.setLayout(new FillLayout()); - - // Label - Label label4 = new Label(panel2, SWT.NONE); - label4.setText("Label 4"); - - /*--- End UI SWT ---*/ - - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/className/CSSSWTEngineCLassNameTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/className/CSSSWTEngineCLassNameTest.java deleted file mode 100644 index 0332b5ec753..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/className/CSSSWTEngineCLassNameTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.className; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEngineCLassNameTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - // Parse style class name. - engine - .parseStyleSheet(new StringReader( - ".blueClass {color:blue;} .greenClass {color:green;} .redClass {color:red;} .yellowClass {color:yellow;}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [class=redClass]"); - label1.setData("class", "redClass"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label 2 [class=blueClass]"); - label2.setData("class", "blueClass"); - - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3 [class=yellowClass]"); - label3.setData("class", "yellowClass"); - - // Composite - Composite panel2 = new Composite(panel1, SWT.NONE); - panel2.setLayout(new FillLayout()); - - // Label - Label label4 = new Label(panel2, SWT.NONE); - label4.setText("Label 4 [class=greenClass]"); - label4.setData("class", "greenClass"); - - /*--- End UI SWT ---*/ - - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/html/CSSSWTHTMLEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/html/CSSSWTHTMLEngineTest.java deleted file mode 100644 index f2973ae798f..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/html/CSSSWTHTMLEngineTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.html; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTHTMLEngineTest { - public static void main(String[] args) { - try { - Display display = new Display(); - // Create SWT CSS Engine - CSSEngine engine = new CSSSWTHTMLEngineImpl(display); - // Parse style sheet - engine.parseStyleSheet(new StringReader( - "label {color:red;} input {background-color:green;}")); - - /*--- Start UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyEngineTest.java deleted file mode 100644 index cecb9ac8b4d..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyEngineTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.lazy; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTLazyEngineTest { - - public static void main(String[] args) { - try { - - // Instanciate Display at first - Display display = new Display(); - - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display, true); - engine.parseStyleSheet(CSSSWTResources.getSWT()); - - /*--- UI SWT ---*/ - - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label 2 [label.setData('MyId')]"); - label2.setData("id", "MyId"); - - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3 [label.setData('MyId2')]"); - label3.setData("id", "MyId2"); - - // Composite - Composite panel2 = new Composite(panel1, SWT.NONE); - panel2.setLayout(new FillLayout()); - - // Label - Label label4 = new Label(panel2, SWT.NONE); - label4.setText("Label 4"); - - /*--- End UI SWT ---*/ - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyHandlerEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyHandlerEngineTest.java deleted file mode 100644 index d78a1bd7e2d..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/lazy/CSSSWTLazyHandlerEngineTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.lazy; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.impl.engine.CSSErrorHandlerImpl; -import org.akrogen.tkui.css.swt.engine.CSSSWTLazyHandlerEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTLazyHandlerEngineTest { - - public static void main(String[] args) { - Display display = new Display(); - CSSSWTLazyHandlerEngineImpl engine = new CSSSWTLazyHandlerEngineImpl( - display); - // CSSEngine Print stack trace when Exception is thrown - engine.setErrorHandler(CSSErrorHandlerImpl.INSTANCE); - - try { - engine - .parseStyleSheet(new StringReader( - "Label:hover {color:red;border:solid green 2px;font:30px Arial italic normal;background: url(./images/icons/type/class.gif) yellow;} " - + "Text {cursor:wait;background-color:white red 100%;} ")); - - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("vfvfvf"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - // engine.getResourcesRegistry().dispose(); - - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/pseudoClasses/CSSSWTEnginePseudoClassesTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/pseudoClasses/CSSSWTEnginePseudoClassesTest.java deleted file mode 100644 index 2c430415bf3..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/pseudoClasses/CSSSWTEnginePseudoClassesTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.pseudoClasses; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEnginePseudoClassesTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(CSSSWTResources.getSWTPseudoCLass()); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - text1.setEnabled(false); - - Text text2 = new Text(panel1, SWT.NONE); - text2.setText("bla bla bla..."); - - Text text3 = new Text(panel1, SWT.NONE); - text3.setText("bla bla bla..."); - - final Button checkbox = new Button(panel1, SWT.CHECK); - checkbox.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - System.out.println(checkbox.getSelection()); - } - }); - - final Button radio = new Button(panel1, SWT.RADIO); - - final Button button = new Button(panel1, SWT.BORDER); - button.setText("SWT Button"); - - /*--- End UI SWT ---*/ - - shell.pack(); - shell.open(); - - // Apply Styles - engine.applyStyles(shell, true); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/style/CSSSWTEngineStyleTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/style/CSSSWTEngineStyleTest.java deleted file mode 100644 index b8e6bd87fb5..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/style/CSSSWTEngineStyleTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.style; - -import org.akrogen.tkui.css.core.dom.CSSStylableElement; -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.w3c.dom.css.CSS2Properties; - -public class CSSSWTEngineStyleTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - // engine.parseStyleSheet(CSSCoreResources.getStyleCLass()); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - CSSStylableElement stylableElement = (CSSStylableElement) engine - .getElement(label1); - CSS2Properties style = stylableElement.getStyle(); - style.setBackgroundColor("red"); - style.setFontSize("20"); - style.setFontFamily("Roman"); - style.setFontWeight("bold"); - style.setFontStyle("italic"); - style.setColor("white"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest.java deleted file mode 100644 index b3ccce6c233..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.styleDeclaration; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEngineStyleDeclarationTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - // engine.parseStyleSheet(CSSCoreResources.getStyleCLass()); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - engine.parseAndApplyStyleDeclaration(label1, "color:red;"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label 2 [color:blue;]"); - engine.parseAndApplyStyleDeclaration(label2, "color:blue;"); - - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3 [color:yellow;]"); - engine.parseAndApplyStyleDeclaration(label3, "color:yellow;"); - - // Composite - Composite panel2 = new Composite(panel1, SWT.NONE); - panel2.setLayout(new FillLayout()); - - // Label - Label label4 = new Label(panel2, SWT.NONE); - label4.setText("Label 4 [color:green;]"); - engine.parseAndApplyStyleDeclaration(label4, "color:green;"); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest2.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest2.java deleted file mode 100644 index 93cfae911b3..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/styleDeclaration/CSSSWTEngineStyleDeclarationTest2.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.styleDeclaration; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSWTEngineStyleDeclarationTest2 { - - public static void main(String[] args) { - try { - Display display = new Display(); - // Instanciate SWT CSS Engine - CSSEngine engine = new CSSSWTEngineImpl(display); - - // engine.parseStyleSheet(CSSCoreResources.getStyleCLass()); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - label1.setData("style", "color:red;"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label 2 [color:blue;]"); - label2.setData("style", "color:blue;"); - - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3 [color:yellow;]"); - label3.setData("style", "color:yellow;"); - - // Composite - Composite panel2 = new Composite(panel1, SWT.NONE); - panel2.setLayout(new FillLayout()); - - // Label - Label label4 = new Label(panel2, SWT.NONE); - label4.setText("Label 4 [color:green;]"); - label4.setData("style", "color:green;"); - - /*--- End UI SWT ---*/ - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest.java deleted file mode 100644 index 52e474df96d..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.table; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.engine.table.viewers.MyCSSLabelProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -public class CSSSWTTableViewerEngineTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - - CSSEngine engine = new CSSSWTEngineImpl(display); - engine - .parseStyleSheet(new StringReader( - "TableItem:odd {font:Roman 12 italic normal; background-color: #2BAFFA; color:white; background-image: url(./images/icons/type/class.gif);}" - + "TableItem:even {background-color:#edb5f4, 100%; color:black;}")); - - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - final List datas = new ArrayList(); - for (int i = 0; i < 20; i++) { - datas.add("Item" + i); - } - - final TableViewer tableViewer = new TableViewer(panel1); - tableViewer.setContentProvider(ArrayContentProvider.getInstance()); - tableViewer.setLabelProvider(new MyCSSLabelProvider(engine, - tableViewer)); - - Table table = tableViewer.getTable(); - table.setHeaderVisible(true); - - TableColumn tableColumn = new TableColumn(table, SWT.LEFT, 0); - tableColumn.setText("Name"); - tableColumn.setWidth(200); - table.setLinesVisible(true); - - tableViewer.setInput(datas); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest2.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest2.java deleted file mode 100644 index 090a8546cc6..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/CSSSWTTableViewerEngineTest2.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.table; - -import java.io.StringReader; -import java.util.ArrayList; -import java.util.List; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.engine.table.viewers.MyCSSTableLabelProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -public class CSSSWTTableViewerEngineTest2 { - - public static void main(String[] args) { - try { - Display display = new Display(); - - CSSEngine engine = new CSSSWTEngineImpl(display); - engine - .parseStyleSheet(new StringReader( - "TableItem:odd {font:Roman 12 italic normal; background-color: #2BAFFA; color:white; background-image: url(./images/icons/type/class.gif);}" - + "TableItem:even {background-color:#edb5f4, 100%; color:black;}")); - - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - - final List datas = new ArrayList(); - for (int i = 0; i < 20; i++) { - datas.add(new Item("Item" + i + "_0", "Item" + i + "_1")); - } - - final TableViewer tableViewer = new TableViewer(panel1); - tableViewer.setContentProvider(ArrayContentProvider.getInstance()); - tableViewer.setLabelProvider(new MyCSSTableLabelProvider(engine, - tableViewer)); - - Table table = tableViewer.getTable(); - table.setHeaderVisible(true); - - TableColumn tableColumn1 = new TableColumn(table, SWT.LEFT, 0); - tableColumn1.setText("Name"); - tableColumn1.setWidth(200); - - TableColumn tableColumn2 = new TableColumn(table, SWT.LEFT, 0); - tableColumn2.setText("Lastname"); - tableColumn2.setWidth(200); - - table.setLinesVisible(true); - - tableViewer.setInput(datas); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - public static class Item { - - private String item0; - private String item1; - - public Item(String item0, String item1) { - this.item0 = item0; - this.item1 = item1; - } - - public String getItem0() { - return item0; - } - - public String getItem1() { - return item1; - } - - } - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSLabelProvider.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSLabelProvider.java deleted file mode 100644 index 2e9ea9113c0..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSLabelProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.table.viewers; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.jface.viewers.CSSLabelProvider; -import org.eclipse.jface.viewers.TableViewer; - -public class MyCSSLabelProvider extends CSSLabelProvider { - - public MyCSSLabelProvider(CSSEngine engine, TableViewer tableViewer) { - super(engine, tableViewer); - } - - public String getText(Object element) { - return element.toString(); - } - -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSTableLabelProvider.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSTableLabelProvider.java deleted file mode 100644 index 29f1511343e..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/engine/table/viewers/MyCSSTableLabelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.engine.table.viewers; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.jface.viewers.CSSTableLabelProvider; -import org.akrogen.tkui.css.swt.engine.table.CSSSWTTableViewerEngineTest2; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.graphics.Image; - -public class MyCSSTableLabelProvider extends CSSTableLabelProvider { - - public MyCSSTableLabelProvider(CSSEngine engine, TableViewer tableViewer) { - super(engine, tableViewer); - } - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - CSSSWTTableViewerEngineTest2.Item item = (CSSSWTTableViewerEngineTest2.Item) element; - switch (columnIndex) { - case 0: - return item.getItem0(); - case 1: - return item.getItem1(); - } - return null; - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/AbstractChatExample.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/AbstractChatExample.java deleted file mode 100644 index 41d03633379..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/AbstractChatExample.java +++ /dev/null @@ -1,286 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.chat; - -import java.io.InputStream; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.core.impl.engine.CSSErrorHandlerImpl; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.ToolBar; -import org.eclipse.swt.widgets.ToolItem; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.swt.widgets.Widget; - -public abstract class AbstractChatExample { - - protected static Display display; - private static CTabFolder tabFolder; - private static Tree tree; - private static final String[] GROUPS = new String[] { "Work", "RCP Dev", - "Friends" }; - private static final String[] NAMES = new String[] { "Betty Zechman", - "Susan Adams", "Samantha Daryn", "Ted Amado" }; - private static final String INPUT_TEXT = "Do you know where I can find the Eclipsecon ppt template?"; - private static final String OUTPUT_TEXT = "Matt> Gotta sec to chat?\n\r\n\rBetty> Sure what's up"; - - private InputStream styleSheetStream; - - protected CSSEngine engine; - - public AbstractChatExample(InputStream styleSheetStream) { - this.styleSheetStream = styleSheetStream; - } - - public void display() throws Exception { - /* - * Create the display and shell. - */ - display = new Display(); - final Shell shell = new Shell(display); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 3; - shell.setLayout(layout); - /* - * Create a toolbar - */ - { - ToolBar toolbar = new ToolBar(shell, SWT.FLAT | SWT.RIGHT - | SWT.NO_FOCUS); - toolbar.setForeground(display.getSystemColor(SWT.COLOR_RED)); - toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL - | GridData.GRAB_HORIZONTAL)); - ToolItem item = new ToolItem(toolbar, SWT.PUSH); - item.setText("File"); - item = new ToolItem(toolbar, SWT.PUSH); - item.setText("Edit"); - item = new ToolItem(toolbar, SWT.PUSH); - item.setText("Help"); - } - - - if (styleSheetStream == null) { - // Create Styles themes - createThemesStyleComposite(shell); - } - - /* - * Create a sash form. - */ - SashForm form = new SashForm(shell, SWT.NONE); - form.setLayoutData(new GridData(GridData.FILL_BOTH)); - /* - * Create the buddylist tree. - */ - { - tree = new Tree(form, SWT.SINGLE); - tree.addSelectionListener(new SelectionAdapter() { - public void widgetDefaultSelected(SelectionEvent e) { - if (((TreeItem) e.item).getParentItem() != null) { - try { - createChatControl(e.item); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } - - }); - for (int i = 0; i < GROUPS.length; i++) { - String g = GROUPS[i]; - TreeItem parentItem = new TreeItem(tree, SWT.NONE); - parentItem.setText(g); - for (int j = 0; j < NAMES.length; j++) { - String n = NAMES[j]; - TreeItem item = new TreeItem(parentItem, SWT.NONE); - item.setText(n); - } - parentItem.setExpanded(true); - } - } - /* - * Add the tabfolder - */ - { - tabFolder = new CTabFolder(form, SWT.CLOSE); - tabFolder.setUnselectedCloseVisible(true); - tabFolder.setUnselectedImageVisible(true); - form.setWeights(new int[] { 30, 70 }); - // open a couple chats - createChatControl(tree.getItem(0).getItems()[0]); - createChatControl(tree.getItem(0).getItems()[1]); - tabFolder.setSelection(tabFolder.getItem(0)); - } - /* - * Create a statusbar - */ - { - CLabel statusbar = new CLabel(shell, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL - | GridData.GRAB_HORIZONTAL); - statusbar.setLayoutData(gd); - statusbar.setText("Samantha Daryn is online"); - } - /* - * StyleHelper is used to parse and apply styles. - */ - engine = getCSSEngine(); - if (styleSheetStream != null) { - engine.parseStyleSheet(styleSheetStream); - engine.applyStyles(shell, true); - } - /* - * Now we open the shell. - */ - shell.setSize(new Point(600, 600)); - shell.open(); - shell.setText("CSS Instant Messaging"); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } - - /* - * The key listeners we add workaround a bug int Text that don't repaint - * properly when they have background images. - */ - protected void createChatControl(Widget item) throws Exception { - CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE); - tabItem.setText("Chat with " + ((TreeItem) item).getText()); - SashForm textForm = new SashForm(tabFolder, SWT.VERTICAL); - final Text text1 = new Text(textForm, SWT.MULTI); - text1.setData("id", "output"); - text1.setText(OUTPUT_TEXT); - text1.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { - text1.redraw(); - } - }); - final Text text2 = new Text(textForm, SWT.MULTI); - text2.setData("id", "input"); - text2.setText(INPUT_TEXT); - text2.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { - text2.redraw(); - } - }); - tabItem.setControl(textForm); - textForm.setWeights(new int[] { 80, 20 }); - getCSSEngine().applyStyles(textForm, false); - tabFolder.setSelection(tabItem); - } - - protected void createThemesStyleComposite(final Composite parent) { - Composite themesComposite = new Composite(parent, SWT.NONE); - FillLayout fillLayout = new FillLayout(); - themesComposite.setLayout(fillLayout); - // no style Radio - Label noStyleLabel = new Label(themesComposite, SWT.NONE); - noStyleLabel.setText("No style"); - Button noStyleRadio = new Button(themesComposite, SWT.RADIO); - noStyleRadio.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - CSSEngine engine = getCSSEngine(); - engine.reset(); - engine.applyStyles(parent, true, true); - } - }); - // Matrix style Radio - Label matrixStyleLabel = new Label(themesComposite, SWT.NONE); - matrixStyleLabel.setText("Matrix style"); - Button matrixStyleRadio = new Button(themesComposite, SWT.RADIO); - matrixStyleRadio.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - CSSEngine engine = getCSSEngine(); - engine.reset(); - try { - engine.parseStyleSheet(CSSSWTResources.getSWTMatrix()); - engine.applyStyles(parent, true, true); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - }); - // Osx style Radio - Label osxStyleLabel = new Label(themesComposite, SWT.NONE); - osxStyleLabel.setText("Osx style"); - Button osxStyleRadio = new Button(themesComposite, SWT.RADIO); - osxStyleRadio.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - CSSEngine engine = getCSSEngine(); - engine.reset(); - try { - engine.parseStyleSheet(CSSSWTResources.getSWTOsx()); - engine.applyStyles(parent, true, true); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - }); - // Vista style Radio - Label vistaStyleLabel = new Label(themesComposite, SWT.NONE); - vistaStyleLabel.setText("Vista style"); - Button vistaStyleRadio = new Button(themesComposite, SWT.RADIO); - vistaStyleRadio.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - CSSEngine engine = getCSSEngine(); - engine.reset(); - try { - engine.parseStyleSheet(CSSSWTResources.getSWTVista()); - engine.applyStyles(parent, true, true); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - }); - } - - protected CSSEngine getCSSEngine() { - if (engine == null) { - engine = new CSSSWTEngineImpl(display); - // Print stack trace when Exception is thrown - engine.setErrorHandler(CSSErrorHandlerImpl.INSTANCE); - } - return engine; - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithMatrixStyle.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithMatrixStyle.java deleted file mode 100644 index 4de15f55a6b..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithMatrixStyle.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.chat; - -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; - - -public class ChatWithMatrixStyle extends AbstractChatExample { - - public ChatWithMatrixStyle() { - super(CSSSWTResources.getSWTMatrix()); - } - - public static void main(String[] args) { - ChatWithMatrixStyle testMatrix = new ChatWithMatrixStyle(); - try { - testMatrix.display(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithOsxStyle.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithOsxStyle.java deleted file mode 100644 index 1c4f7860df6..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithOsxStyle.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.chat; - -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; - -public class ChatWithOsxStyle extends AbstractChatExample { - - public ChatWithOsxStyle() { - super(CSSSWTResources.getSWTOsx()); - } - - public static void main(String[] args) { - ChatWithOsxStyle testOsx = new ChatWithOsxStyle(); - try { - testOsx.display(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithStylesAppliedAtRuntime.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithStylesAppliedAtRuntime.java deleted file mode 100644 index 27311d7a581..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithStylesAppliedAtRuntime.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.chat; - -public class ChatWithStylesAppliedAtRuntime extends AbstractChatExample { - - public ChatWithStylesAppliedAtRuntime() { - super(null); - } - - public static void main(String[] args) { - ChatWithStylesAppliedAtRuntime chat = new ChatWithStylesAppliedAtRuntime(); - try { - chat.display(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithVistaStyle.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithVistaStyle.java deleted file mode 100644 index 212d2abe588..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/chat/ChatWithVistaStyle.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.chat; - -import org.akrogen.tkui.css.swt.resources.CSSSWTResources; - -public class ChatWithVistaStyle extends AbstractChatExample { - - public ChatWithVistaStyle() { - super(CSSSWTResources.getSWTVista()); - } - - public static void main(String[] args) { - ChatWithVistaStyle testVista = new ChatWithVistaStyle(); - try { - testVista.display(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/AbstractCSSSWTEditor.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/AbstractCSSSWTEditor.java deleted file mode 100644 index 1b7e33e0347..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/AbstractCSSSWTEditor.java +++ /dev/null @@ -1,662 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2019 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.csseditors; - -import java.io.File; -import java.util.ArrayList; - -import org.akrogen.tkui.css.core.css2.CSS2FontPropertiesHelpers; -import org.akrogen.tkui.css.core.dom.IElementProvider; -import org.akrogen.tkui.css.core.dom.properties.css2.CSS2FontProperties; -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.core.examples.csseditors.AbstractCSSEditor; -import org.akrogen.tkui.css.core.serializers.CSSSerializerConfiguration; -import org.akrogen.tkui.css.swt.dom.SWTElementProvider; -import org.akrogen.tkui.css.swt.dom.html.SWTHTMLElementProvider; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.serializers.CSSSWTSerializerConfiguration; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.ColorDialog; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.FontDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.w3c.dom.css.CSSValue; - -/** - * Abstract CSS SWT Editor. - * - * @version 1.0.0 - * @author Angelo ZERR - */ -public abstract class AbstractCSSSWTEditor extends AbstractCSSEditor { - - protected static final String[] CSS_FILE_EXTENSION = { "*.css" }; - - private Display display; - - /** - * Textarea wich contains content of CSS style sheet. - */ - private StyledText textArea; - - private Button cacheResourcesCheckbox; - - /** - * HTML checkbox to set if CSS must be typed with HTML syntaxe or SWT - * syntax. - */ - private Button htmlCheckbox; - - /** - * Label wich display time elapsed when CSS Engine apply styles. - */ - private Label statusLabel; - - /** - * Apply style when text area change - */ - private Button applyStyleWhenTextAreaChangeCheckbox; - - /** - * Launch Apply style - */ - private Button applyStyleToShellCheckbox; - - private Shell shell; - - private Composite leftPanel; - - private List cssFilesWidget; - - private java.util.List cssFiles = new ArrayList(); - - private Text selectedCSSPropertyNameText = null; - - private Text selectedCSSPropertyValueText = null; - - protected int currentLine = -1; - - protected AbstractCSSSWTEditor(String nativeWidgetDir, - String[] styleFileExtension) { - super(nativeWidgetDir); - } - - protected AbstractCSSSWTEditor() { - super("swt"); - } - - public void display() { - - display = new Display(); - shell = new Shell(display, SWT.SHELL_TRIM); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 3; - shell.setLayout(layout); - - // create Menus - createMenus(shell); - - /* - * Create a sash form. - */ - SashForm form = new SashForm(shell, SWT.NONE); - form.setLayoutData(new GridData(GridData.FILL_BOTH)); - - /* - * Create left panel with SWT Contents. - */ - createLeftPanel(form); - - /* - * Create right panel with TextArea which contains CSS to load. - */ - createRightPanel(form); - form.setWeights(new int[] { 30, 80 }); - - /* - * Now we open the shell. - */ - shell.setSize(new Point(800, 600)); - shell.open(); - shell.setText("CSS Editors"); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - display.dispose(); - } - - /*-------------------- Menus --------------------**/ - - /** - * Create Menus File, Options - */ - protected void createMenus(Shell shell) { - Menu menu = new Menu(shell, SWT.BAR); - shell.setMenuBar(menu); - // Create File item Menu - createMenuItemFile(menu, shell); - // Create Options item Menu - // createMenuItemOptions(menu); - } - - /** - * Create Menu item File with sub menu New and Open - */ - protected void createMenuItemFile(Menu menu, final Shell shell) { - MenuItem menuFileHeader = new MenuItem(menu, SWT.CASCADE); - menuFileHeader.setText("&File"); - // File menu - Menu menuFile = new Menu(shell, SWT.DROP_DOWN); - menuFileHeader.setMenu(menuFile); - // New item menu - MenuItem itemNew = new MenuItem(menuFile, SWT.PUSH); - itemNew.setText("&New..."); - itemNew.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - fillTextareaWithDefaultStyleSheetContent(); - } - }); - // Open item menu - MenuItem itemOpen = new MenuItem(menuFile, SWT.PUSH); - itemOpen.setText("&Open..."); - itemOpen.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - FileDialog dialog = new FileDialog(shell, SWT.NULL); - dialog.setFilterExtensions(CSS_FILE_EXTENSION); - dialog.setText("Select CSS style file"); - dialog.setFilterPath(getBaseStyleDir().getAbsolutePath()); - String path = dialog.open(); - if (path != null) { - File file = new File(path); - fillTextareaWithStyleSheetContent(file); - } - } - }); - - } - - /** - * Create Menu item Options - */ - protected void createMenuItemOptions(Menu menu) { - MenuItem menuOptionsHeader = new MenuItem(menu, SWT.CASCADE); - menuOptionsHeader.setText("&Options"); - // Options menu - Menu menuOptions = new Menu(shell, SWT.DROP_DOWN); - menuOptionsHeader.setMenu(menuOptions); - // New item menu - MenuItem itemNew = new MenuItem(menuOptions, SWT.CHECK); - itemNew.setText("&Cache Resource..."); - - } - - /*-------------------- Panel --------------------**/ - - protected void createLeftPanel(Composite parent) { - leftPanel = new Composite(parent, SWT.NONE); - leftPanel.setLayout(new FillLayout()); - createContent(leftPanel); - } - - protected void createRightPanel(Composite parent) { - - SashForm form = new SashForm(parent, SWT.NONE); - form.setLayoutData(new GridData(GridData.FILL_BOTH)); - - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 3; - Composite composite = new Composite(form, SWT.NONE); - composite.setLayout(layout); - - statusLabel = new Label(composite, SWT.NONE); - statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Create TextArea which contains CSS content. - textArea = new StyledText(composite, SWT.MULTI | SWT.V_SCROLL - | SWT.BORDER); - textArea.setLayoutData(new GridData(GridData.FILL_BOTH)); - textArea.addModifyListener(e -> { - if (applyStyleWhenTextAreaChangeCheckbox.getSelection()) - applyStyles(); - }); - - textArea.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { - displaySelectedCSSProperty(); - } - }); - textArea.addMouseListener(new MouseAdapter() { - public void mouseDown(MouseEvent e) { - displaySelectedCSSProperty(); - } - }); - - layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 3; - composite = new Composite(form, SWT.NONE); - composite.setLayout(layout); - - Group group = new Group(composite, SWT.NONE); - group.setText("Selected CSS Property"); - layout = new GridLayout(2, true); - layout.verticalSpacing = 3; - group.setLayout(layout); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label label = new Label(group, SWT.NONE); - label.setText("CSS Property name"); - selectedCSSPropertyNameText = new Text(group, SWT.BORDER - | SWT.READ_ONLY); - selectedCSSPropertyNameText.setLayoutData(new GridData( - GridData.FILL_HORIZONTAL)); - - label = new Label(group, SWT.NONE); - label.setText("CSS Property value"); - selectedCSSPropertyValueText = new Text(group, SWT.BORDER); - selectedCSSPropertyValueText.setLayoutData(new GridData( - GridData.FILL_HORIZONTAL)); - selectedCSSPropertyValueText.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { - - String property = selectedCSSPropertyNameText.getText(); - property += ":"; - property += selectedCSSPropertyValueText.getText(); - updateSelectedCSSPropertyValue(property); - } - }); - - final Button b = new Button(group, SWT.PUSH | SWT.BORDER); - b.setText("Change Color"); - b.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - ColorDialog colorDialog = new ColorDialog(shell); - colorDialog.setText("ColorDialog Demo"); - String cssValue = selectedCSSPropertyValueText.getText(); - if (cssValue != null && cssValue.length() > 0) { - try { - CSSValue value = engine.parsePropertyValue(cssValue); - RGB rgb = (RGB) engine.convert(value, RGB.class, null); - if (rgb != null) - colorDialog.setRGB(rgb); - } catch (Exception ex) { - handleExceptions(ex); - } - // engine.convert(, RGB.class,); - } - RGB newColor = colorDialog.open(); - if (newColor != null) { - try { - cssValue = engine.convert(newColor, RGB.class, - selectedCSSPropertyNameText.getText()); - if (cssValue == null) - return; - selectedCSSPropertyValueText.setText(cssValue); - String property = selectedCSSPropertyNameText.getText(); - property += ":"; - property += selectedCSSPropertyValueText.getText(); - updateSelectedCSSPropertyValue(property); - } catch (Exception ex) { - handleExceptions(ex); - } - } - } - }); - - final Button b2 = new Button(group, SWT.PUSH | SWT.BORDER); - b2.setText("Change Font"); - b2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - FontDialog fontDialog = new FontDialog(shell); - fontDialog.setText("Choose the font"); - String value = selectedCSSPropertyValueText.getText(); - try { - String propertyName = selectedCSSPropertyNameText.getText(); - CSSValue cssValue = engine.parsePropertyValue(value); - CSS2FontProperties fontProperties = CSS2FontPropertiesHelpers - .createCSS2FontProperties(cssValue, propertyName); - FontData fontData = (FontData) engine.convert(fontProperties, - FontData.class, display); - if (fontData != null) { - FontData[] fontDatas = { fontData }; - fontDialog.setFontList(fontDatas); - } - } catch (Exception ex) { - handleExceptions(ex); - } - FontData newFontData = fontDialog.open(); - if (newFontData != null) { - try { - String cssValue = engine.convert(newFontData, - FontData.class, selectedCSSPropertyNameText - .getText()); - if (cssValue == null) - return; - selectedCSSPropertyValueText.setText(cssValue); - String property = selectedCSSPropertyNameText.getText(); - property += ":"; - property += selectedCSSPropertyValueText.getText(); - updateSelectedCSSPropertyValue(property); - } catch (Exception ex) { - handleExceptions(ex); - } - } - } - }); - - group = new Group(composite, SWT.NONE); - group.setText("CSS Engine options"); - layout = new GridLayout(); - layout.verticalSpacing = 3; - group.setLayout(layout); - group.setLayoutData(new GridData(GridData.FILL_BOTH)); - - cacheResourcesCheckbox = new Button(group, SWT.CHECK); - cacheResourcesCheckbox.setText("Cache Color, Font and Cursor"); - cacheResourcesCheckbox.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (!cacheResourcesCheckbox.getSelection()) { - engine.getResourcesRegistry().dispose(); - } - } - }); - cacheResourcesCheckbox.setSelection(true); - - applyStyleWhenTextAreaChangeCheckbox = new Button(group, SWT.CHECK); - applyStyleWhenTextAreaChangeCheckbox - .setText("Apply style when textarea change"); - applyStyleWhenTextAreaChangeCheckbox.setSelection(true); - - htmlCheckbox = new Button(group, SWT.CHECK); - htmlCheckbox.setText("is HTML Selector? (otherwise it's SWT Selector)"); - htmlCheckbox.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - populateCSSFiles(); - applyStylesFromSelectedFile(); - } - }); - - // Create CSS files list - cssFilesWidget = new List(group, SWT.NONE); - cssFilesWidget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - cssFilesWidget.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - applyStylesFromSelectedFile(); - } - }); - populateCSSFiles(); - - // Create Apply Style Button. - applyStyleToShellCheckbox = new Button(group, SWT.CHECK); - applyStyleToShellCheckbox.setText("Apply sytle to fully Shell?"); - applyStyleToShellCheckbox.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - if (applyStyleToShellCheckbox.getSelection()) { - applyStyles(); - } else { - // Apply styles with NONE style to reset - // styles applied into TextArea... - engine = getCSSEngine(); - engine.applyStyles(shell, true); - // Apply styles - applyStyles(); - } - - } - }); - - Button applyStyleButton = new Button(group, SWT.BORDER); - applyStyleButton.setText("Apply style"); - applyStyleButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - applyStyles(); - } - }); - - form.setWeights(new int[] { 120, 90 }); - - // Select the first CSS style file - applyStylesFromSelectedFile(); - } - - public abstract void createContent(Composite parent); - - protected void displaySelectedCSSProperty() { - selectedCSSPropertyNameText.setText(""); - selectedCSSPropertyValueText.setText(""); - int start = -1; - int end = -1; - -// if (currentLine != -1) -// textArea.setLineBackground(currentLine, 1, null); - - currentLine = textArea.getLineAtOffset(textArea.getCaretOffset()); - if (currentLine + 1 >= textArea.getLineCount()) - return; - start = textArea.getOffsetAtLine(currentLine); - end = textArea.getOffsetAtLine(currentLine + 1) - 2; - if (start <= end) { - String lineText = textArea.getText(start, end); - lineText = lineText.trim(); - int index = lineText.indexOf(':'); - if (index > 0) { - if (lineText.indexOf('{') != -1) - return; - String property = lineText.substring(0, index); - String value = lineText.substring(index + 1, lineText.length()); - value = value.replaceAll(";", ""); - // Remove comment - int commentIndex = value.indexOf("/*"); - if (commentIndex > 0) - value = value.substring(0, commentIndex); - selectedCSSPropertyNameText.setText(property); - selectedCSSPropertyValueText.setText(value); - -// textArea.setLineBackground(currentLine, 1, display -// .getSystemColor(SWT.COLOR_MAGENTA)); - } - } - } - - protected void updateSelectedCSSPropertyValue(String text) { - if (currentLine != -1 && currentLine + 1 >= textArea.getLineCount()) - return; - int start = textArea.getOffsetAtLine(currentLine); - int end = textArea.getOffsetAtLine(currentLine + 1) - 2; - - String startLineText = textArea.getText(0, start); - String endLineText = textArea.getText(end, textArea.getCharCount() - 1); - if (!text.endsWith(";") && !endLineText.startsWith(";")) - text += ";"; - if (endLineText.startsWith(":")) - endLineText.substring(1, endLineText.length()); - String newContent = startLineText + text + endLineText; - textArea.setText(newContent); - } - - /*-------------------- AbstractCSSEditor methods implementation --------------------**/ - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#createCSSEngine() - */ - protected CSSEngine createCSSEngine() { - return new CSSSWTEngineImpl(shell.getDisplay()); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getHTMLElementProvider() - */ - protected IElementProvider getHTMLElementProvider() { - return SWTHTMLElementProvider.INSTANCE; - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getNativeWidgetElementProvider() - */ - protected IElementProvider getNativeWidgetElementProvider() { - return SWTElementProvider.INSTANCE; - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#isHTMLSelector() - */ - protected boolean isHTMLSelector() { - return htmlCheckbox.getSelection(); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getStyleSheetContent() - */ - protected String getStyleSheetContent() { - return textArea.getText(); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#setStyleSheetContent(java.lang.String) - */ - protected void setStyleSheetContent(String content) { - textArea.setText(content); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#setCSSEngineStatuts(java.lang.String) - */ - protected void setCSSEngineStatuts(String status) { - statusLabel.setText(status); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#mustApplyStylesToWindow() - */ - protected boolean mustApplyStylesToWindow() { - return applyStyleToShellCheckbox.getSelection(); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getLeftPanelNativeWidget() - */ - protected Object getLeftPanelNativeWidget() { - return leftPanel; - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getWindowNativeWidget() - */ - protected Object getWindowNativeWidget() { - return shell; - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getCSSNativeWidgetSerializerConfiguration() - */ - protected CSSSerializerConfiguration getCSSNativeWidgetSerializerConfiguration() { - return CSSSWTSerializerConfiguration.INSTANCE; - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getCSSFileWidgetItemCount() - */ - protected int getCSSFilesWidgetItemCount() { - return cssFilesWidget.getItemCount(); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#getCSSFileWidgetSelectionIndex() - */ - protected int getCSSFilesWidgetSelectionIndex() { - return cssFilesWidget.getSelectionIndex(); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#selectCSSFileWidget(int) - */ - protected void selectCSSFilesWidget(int index) { - cssFilesWidget.select(index); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#addCSSFilesWidget(java.lang.String) - */ - protected void addItemCSSFilesWidget(String item) { - cssFilesWidget.add(item); - } - - /* - * (non-Javadoc) - * - * @see org.akrogen.tkui.core.css.examples.csseditors.AbstractCSSEditor#removeAllCSSFilesWidget() - */ - protected void removeAllCSSFilesWidget() { - cssFilesWidget.removeAll(); - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/CSSEditorSWTWidgets.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/CSSEditorSWTWidgets.java deleted file mode 100644 index 6b96023b452..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/examples/csseditors/CSSEditorSWTWidgets.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.examples.csseditors; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolder; -import org.eclipse.swt.custom.CTabItem; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.TreeItem; - -public class CSSEditorSWTWidgets extends AbstractCSSSWTEditor { - - public void createContent(Composite parent) { - - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 3; - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(layout); - - // Create SWT Text - Text text = new Text(composite, SWT.BORDER); - text.setText("bla bla bla..."); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Create SWT Text [SWT.MULTI] - Text textArea = new Text(composite, SWT.MULTI | SWT.BORDER); - textArea.setText("bla bla bla...[SWT.MULTI]"); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.heightHint = 100; - textArea.setLayoutData(gridData); - - // Create SWT Label - Label label = new Label(composite, SWT.NONE); - label.setText("bla bla bla..."); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Create Button - Button button = new Button(composite, SWT.BORDER); - button.setText("SWT Button"); - - // Create Button [SWT.CHECK] - Button checkbox = new Button(composite, SWT.CHECK); - checkbox.setText("SWT Button [SWT.CHECK]"); - - // Create Button [SWT.RADIO] - Button radio = new Button(composite, SWT.RADIO); - radio.setText("SWT Button [SWT.RADIO]"); - - // Create Combo - Combo combo = new Combo(composite, SWT.BORDER); - combo.add("Item 1"); - combo.add("Item 2"); - combo.select(0); - - // Create CTabFolder - CTabFolder tabFolder = new CTabFolder(composite, SWT.CLOSE); - tabFolder.setUnselectedCloseVisible(true); - tabFolder.setUnselectedImageVisible(true); - - CTabItem tabItem1 = new CTabItem(tabFolder, SWT.NONE); - tabItem1.setText("Tab 1"); - - CTabItem tabItem2 = new CTabItem(tabFolder, SWT.NONE); - tabItem2.setText("Tab 2"); - - tabFolder.setSelection(0); - } - - public static void main(String[] args) { - CSSEditorSWTWidgets editor = new CSSEditorSWTWidgets(); - editor.display(); - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/CSSSWTResources.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/CSSSWTResources.java deleted file mode 100644 index aa5b16809e9..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/CSSSWTResources.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.resources; - -import java.io.InputStream; - -public class CSSSWTResources { - - /*--- SWT Styles --*/ - - public static InputStream getSWT() { - return CSSSWTResources.class.getResourceAsStream("swt/swt.css"); - } - - public static InputStream getSWTMatrix() { - return CSSSWTResources.class.getResourceAsStream("swt/Matrix.css"); - } - - public static InputStream getSWTVista() { - return CSSSWTResources.class.getResourceAsStream("swt/Vista.css"); - } - - public static InputStream getSWTOsx() { - return CSSSWTResources.class.getResourceAsStream("swt/Osx.css"); - } - - public static InputStream getSWTPseudoCLass() { - return CSSSWTResources.class - .getResourceAsStream("swt/pseudo-class.css"); - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Osx.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Osx.css deleted file mode 100644 index 55cedbaed73..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Osx.css +++ /dev/null @@ -1,31 +0,0 @@ -Shell, SashForm, Button, Label { - font-family: "Lucida Grande",Serif; - font-size: 11; - background: url(./images/osx_back.jpg); -} - -ToolBar, CLabel { - font-family: "Lucida Grande",Serif; - font-size: 9; - background: url(./images/osx_back.jpg); -} - -Tree { - font-family: "Lucida Grande",Serif; - font-size: 11; - background-color: lightgrey, white, white, lightgrey, 10%, 90% 100%; -} - -CTabFolder:selected { - background: url(./images/osx_tab.jpg); - background-color: rgb(162,208,242); - color: black; -} - -CTabFolder { - font-family: "Lucida Grande",Serif; - font-size: 11; - font-weight: normal; - background-color: lightgrey; - color: black; -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Vista.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Vista.css deleted file mode 100644 index 228ec7a017c..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/Vista.css +++ /dev/null @@ -1,50 +0,0 @@ -Shell, Tree, Button, Label { - font-family: Roman; - font-size: 10; - background-color: rgb(233,234,238); - color: rgb(70,70,70); -} -SashForm { - background-color: black; -} -Text { - font-family: Calibri; - font-size: 10; -} -ToolBar { - background-color: gradient, - white, - white, - rgb(214,222,223), - rgb(219,226,228), - rgb(210,217,219), - rgb(224,229,231), - white, - white, - 5%, 5%, 45%, 45%, 98%, 98%, 100%; - color: white; -} - -CLabel { - font-family: Calibri; - font-size: 10; - background-color: gradient, - rgb(67,71,82), - rgb(59,62,70), - rgb(47,48,48), - rgb(76,76,76), - 40%, 40%, 100%; - color: white; -} - -CTabFolder:selected { - background: url(./images/vista_tab2.jpg); - color: white; -} - -CTabFolder { - font-family: Calibri; - font-size: 10; - background-color: rgb(233,234,238); - color: rgb(70,70,70); -} \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/pseudo-class.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/pseudo-class.css deleted file mode 100644 index 40076cef3a8..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/pseudo-class.css +++ /dev/null @@ -1,19 +0,0 @@ -Text:disabled { - background-color:blue; -} - -Text:focus { - background-color:red; -} - -Button[type="checkbox"][visible="true"] { - background-color:green; -} - -Button[type="radio"] { - background-color:yellow; -} - -Button[type="button"] { - background: url(./images/icons/type/class.gif); -} \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/swt.css b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/swt.css deleted file mode 100644 index 5dca81ff330..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/resources/swt/swt.css +++ /dev/null @@ -1,24 +0,0 @@ -Composite Composite Label { - font-weight:normal; - font-style: italic; - color:green; -} - -Label { - font-weight:bold; - font-family: "Arial"; - color:red; - font-size: 20; -} - -Label#MyId { - color:blue; -} - -Label#MyId2 { - color:yellow; -} - -Text { - background-color:#6495ED; -} \ No newline at end of file diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest1.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest1.java deleted file mode 100644 index 1bbba524b10..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest1.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector= E[foo] an E element with a "foo" attribute - */ -public class SWTAttributeSelectorTest1 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "bar"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest2.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest2.java deleted file mode 100644 index c7c31ea6039..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest2.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[foo="bar"] an E element whose "foo" attribute value is exactly - * equal to "bar" - */ -public class SWTAttributeSelectorTest2 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo=\"bar\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "bar"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest3.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest3.java deleted file mode 100644 index e55ff258c0d..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest3.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[foo~="bar"] an E element whose "foo" attribute value is a list of - * space-separated values, one of which is exactly equal to "bar" - */ -public class SWTAttributeSelectorTest3 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo~=\"bar\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "it's bar"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest4.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest4.java deleted file mode 100644 index 13db11641c3..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest4.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[foo^="bar"] an E element whose "foo" attribute value begins - * exactly with the string "bar" - * - * NOT SUPPORTED (CSS3) - */ -public class SWTAttributeSelectorTest4 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo^=\"bar\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "bar bla bla bla"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest5.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest5.java deleted file mode 100644 index abc255c5b92..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest5.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[foo$="bar"] an E element whose "foo" attribute value ends exactly - * with the string "bar" - * - * NOT SUPPORTED (CSS3) - */ -public class SWTAttributeSelectorTest5 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo$=\"bar\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "bar bla bla bla"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest6.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest6.java deleted file mode 100644 index 738f3e7db5c..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest6.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[foo*="bar"] an E element whose "foo" attribute value contains the - * substring "bar" - * - * NOT SUPPORTED (CSS3) - */ -public class SWTAttributeSelectorTest6 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[foo*=\"bar\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label foo"); - label1.setData("foo", "bar bla bla bla"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest7.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest7.java deleted file mode 100644 index 90137d9895e..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/attribute/SWTAttributeSelectorTest7.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.attribute; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * - * Selector=E[hreflang|="en"] an E element whose "hreflang" attribute has a - * hyphen-separated list of values beginning (from the left) with "en" - */ -public class SWTAttributeSelectorTest7 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label[hreflang|=\"en\"] {color:red} Label {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label england"); - label1.setData("hreflang", "england"); - - // Label - Label label2 = new Label(panel1, SWT.NONE); - label2.setText("Label "); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/type/SWTTypeSelectorTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/type/SWTTypeSelectorTest.java deleted file mode 100644 index b0c162113ad..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/type/SWTTypeSelectorTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.type; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * Selector= label Text - */ -public class SWTTypeSelectorTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "Label {color:red} Text {color:green}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/SWTUniversalSelectorTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/SWTUniversalSelectorTest.java deleted file mode 100644 index a764d5c5d0a..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/SWTUniversalSelectorTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.universal; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * Selector= * {color:red} - */ -public class SWTUniversalSelectorTest { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader("* {color:red}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest1.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest1.java deleted file mode 100644 index 7a329666935..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest1.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.universal.ns; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * Selector= swt|* {color:red} => all elements org.eclipse.swt.widgets - */ -public class SWTUniversalSelectorNSTest1 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader( - "@namespace swt \"org.eclipse.swt.widgets\"; " - + "swt|* {color:red}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest2.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest2.java deleted file mode 100644 index ba4ca41b7be..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest2.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.universal.ns; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * Selector= *|* {color:red} => all elements - */ -public class SWTUniversalSelectorNSTest2 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader("*|* {color:red}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest3.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest3.java deleted file mode 100644 index aea40e64a3b..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/selectors/universal/ns/SWTUniversalSelectorNSTest3.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.selectors.universal.ns; - -import java.io.StringReader; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * - * Selector= |* {color:red} => all elements without any declared namespace - */ -public class SWTUniversalSelectorNSTest3 { - - public static void main(String[] args) { - try { - Display display = new Display(); - CSSEngine engine = new CSSSWTEngineImpl(display); - engine.parseStyleSheet(new StringReader("|* {color:red}")); - - /*--- UI SWT ---*/ - Shell shell = new Shell(display, SWT.SHELL_TRIM); - FillLayout layout = new FillLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new FillLayout()); - - // Label - Label label1 = new Label(panel1, SWT.NONE); - label1.setText("Label 0 [color:red;]"); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - /*--- End UI SWT ---*/ - // Apply Styles - engine.applyStyles(shell, true); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/serializers/CSSSerializerSWTTest.java b/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/serializers/CSSSerializerSWTTest.java deleted file mode 100644 index 737c34834bd..00000000000 --- a/tests/org.eclipse.e4.ui.tests.css.swt/tkuiTestsToRefactor/swt/test/org/akrogen/tkui/css/swt/serializers/CSSSerializerSWTTest.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2018 Angelo Zerr and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Angelo Zerr - initial API and implementation - *******************************************************************************/ -package org.akrogen.tkui.css.swt.serializers; - -import java.io.StringWriter; - -import org.akrogen.tkui.css.core.engine.CSSEngine; -import org.akrogen.tkui.css.core.serializers.CSSHTMLSerializerConfiguration; -import org.akrogen.tkui.css.core.serializers.CSSSerializer; -import org.akrogen.tkui.css.swt.engine.CSSSWTEngineImpl; -import org.akrogen.tkui.css.swt.engine.html.CSSSWTHTMLEngineImpl; -import org.akrogen.tkui.css.swt.serializers.CSSSWTSerializerConfiguration; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public class CSSSerializerSWTTest { - - private static Color COLOR_GREEN = null; - - private static Cursor CURSOR_HELP = null; - - public static void main(String[] args) { - try { - - /*--- UI SWT ---*/ - Display display = new Display(); - createResources(display); - Shell shell = new Shell(display, SWT.SHELL_TRIM); - GridLayout layout = new GridLayout(); - shell.setLayout(layout); - - Composite panel1 = new Composite(shell, SWT.NONE); - panel1.setLayout(new GridLayout()); - - // Text - Text text1 = new Text(panel1, SWT.NONE); - text1.setText("bla bla bla..."); - - // TextArea - Text textarea = new Text(panel1, SWT.MULTI); - textarea.setText("bla bla bla..."); - - // Label - Label label3 = new Label(panel1, SWT.NONE); - label3.setText("Label 3"); - label3.setBackground(COLOR_GREEN); - label3.setCursor(CURSOR_HELP); - - // Create Button - Button button = new Button(panel1, SWT.BORDER); - button.setText("SWT Button"); - - // Create Button [SWT.CHECK] - Button checkbox = new Button(panel1, SWT.CHECK); - checkbox.setText("SWT Button [SWT.CHECK]"); - - // Create Button [SWT.RADIO] - Button radio = new Button(panel1, SWT.RADIO); - radio.setText("SWT Button [SWT.RADIO]"); - - // Create Combo - Combo combo = new Combo(panel1, SWT.BORDER); - combo.add("Item 1"); - combo.add("Item 2"); - combo.select(0); - - /*--- End UI SWT ---*/ - - // Serialize Shell and children SWT Widgets - // STWT Selector - CSSEngine engine = new CSSSWTEngineImpl(display); - System.out - .println("***************** CSS SWT Selector *****************"); - CSSSerializer serializer = new CSSSerializer(); - StringWriter writer = new StringWriter(); - serializer.serialize(writer, engine, shell, true, - CSSSWTSerializerConfiguration.INSTANCE); - System.out.println(writer.toString()); - - // HTML Selector - engine = new CSSSWTHTMLEngineImpl(display); - System.out - .println("***************** CSS SWT-HTML Selector *****************"); - writer = new StringWriter(); - serializer.serialize(writer, engine, shell, true, - CSSHTMLSerializerConfiguration.INSTANCE); - System.out.println(writer.toString()); - - shell.pack(); - shell.open(); - - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - - display.dispose(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void createResources(Display display) { - COLOR_GREEN = new Color(0, 255, 0); - CURSOR_HELP = new Cursor(display, SWT.CURSOR_HELP); - - display.addListener(SWT.Dispose, event -> disposeResources()); - } - - private static void disposeResources() { - COLOR_GREEN.dispose(); - CURSOR_HELP.dispose(); - } -}