Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2011-11-17 14:22:01 +0000
committerBrian de Alwis2011-11-17 14:22:01 +0000
commit8262be6850f63fcb3f17c3411bf458d952df0505 (patch)
tree96e61fadbf6de257bda6d10d65c986a01bce9b5f
parent6aa15e97b44af1709ac4ab619fb45c3d1f2bfb34 (diff)
downloadorg.eclipse.e4.tools-8262be6850f63fcb3f17c3411bf458d952df0505.tar.gz
org.eclipse.e4.tools-8262be6850f63fcb3f17c3411bf458d952df0505.tar.xz
org.eclipse.e4.tools-8262be6850f63fcb3f17c3411bf458d952df0505.zip
Rename CSSHandler to CSSPropertyProvider
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSHandler.java58
-rw-r--r--bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSPropertyProvider.java53
2 files changed, 53 insertions, 58 deletions
diff --git a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSHandler.java b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSHandler.java
deleted file mode 100644
index e8946ca5..00000000
--- a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSHandler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Manumitting Technologies, Inc.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Brian de Alwis (MT) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.e4.tools.css.spy;
-
-import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
-import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
-import org.eclipse.e4.ui.css.core.engine.CSSEngine;
-import org.w3c.dom.css.CSSValue;
-
-public class CSSHandler {
-
- private String propertyName;
- private CSSStylableElement element;
- private ICSSPropertyHandler handler;
- private CSSEngine engine;
-
- public CSSHandler(String propertyName, CSSStylableElement element, ICSSPropertyHandler handler, CSSEngine engine) {
- this.propertyName = propertyName;
- this.element = element;
- this.handler = handler;
- this.engine = engine;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public String getValue() {
- try {
- return handler.retrieveCSSProperty(element, propertyName, "", engine);
- } catch (Exception e) {
- System.err.println("error retrieving '" + propertyName + "' from " + element + ": " + e);
- return null;
- }
- }
-
- public void setValue(CSSValue value) {
- try {
- handler.applyCSSProperty(element, propertyName, value, "", engine);
- } catch (Exception e) {
- System.err.println("error applying '" + propertyName + ": " + value + "' to " + element + ": " + e);
- }
- }
-
- @Override
- public String toString() {
- return propertyName;
- }
-
-}
diff --git a/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSPropertyProvider.java b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSPropertyProvider.java
new file mode 100644
index 00000000..bc298b1c
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.css.spy/src/org/eclipse/e4/tools/css/spy/CSSPropertyProvider.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Manumitting Technologies, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Brian de Alwis (MT) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.tools.css.spy;
+
+import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
+import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
+import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.w3c.dom.css.CSSValue;
+
+/**
+ * A getter and setter of a particular CSS property for a particular element.
+ */
+public class CSSPropertyProvider {
+
+ private String propertyName;
+ private CSSStylableElement element;
+ private ICSSPropertyHandler handler;
+ private CSSEngine engine;
+
+ public CSSPropertyProvider(String propertyName, CSSStylableElement element,
+ ICSSPropertyHandler handler, CSSEngine engine) {
+ this.propertyName = propertyName;
+ this.element = element;
+ this.handler = handler;
+ this.engine = engine;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getValue() throws Exception {
+ return handler.retrieveCSSProperty(element, propertyName, "", engine);
+ }
+
+ public void setValue(CSSValue value) throws Exception {
+ handler.applyCSSProperty(element, propertyName, value, "", engine);
+ }
+
+ @Override
+ public String toString() {
+ return propertyName;
+ }
+
+}

Back to the top