Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2013-11-27 20:20:01 +0000
committerLars Vogel2013-11-27 20:20:01 +0000
commit1337593288b15da51af8ec09b2a051478563a17c (patch)
tree123313f30f54b9733d7f82f331ed569817cda104
parent85dd91600c3987be555e4ddfea64b2a63f2dbb14 (diff)
downloadeclipse.platform.ui-1337593288b15da51af8ec09b2a051478563a17c.tar.gz
eclipse.platform.ui-1337593288b15da51af8ec09b2a051478563a17c.tar.xz
eclipse.platform.ui-1337593288b15da51af8ec09b2a051478563a17c.zip
Bug 422702 - Code cleanup in the org.eclipse.e4.ui.css.* projects
Change-Id: I691f872f1419effbe2c3f8af2cebf8c689bdd6fd Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/DocumentCSSImpl.java19
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/StyleWrapper.java5
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/ViewCSSImpl.java6
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/parsers/AbstractCSSParser.java20
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyBackgroundXMLHandler.java8
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyFontXMLHandler.java9
-rw-r--r--bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyTextXMLHandler.java7
7 files changed, 50 insertions, 24 deletions
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/DocumentCSSImpl.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/DocumentCSSImpl.java
index a18aad13630..fab04b5e2eb 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/DocumentCSSImpl.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/DocumentCSSImpl.java
@@ -8,6 +8,7 @@
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
* IBM Corporation - ongoing development
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.core.impl.dom;
@@ -26,6 +27,7 @@ import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSStyleSheet;
+import org.w3c.dom.css.DocumentCSS;
import org.w3c.dom.stylesheets.StyleSheet;
import org.w3c.dom.stylesheets.StyleSheetList;
@@ -80,8 +82,9 @@ public class DocumentCSSImpl implements ExtendedDocumentCSS {
public List querySelector(int selectorType, int conditionType) {
List list = getCSSStyleDeclarationList(selectorType, conditionType);
- if (list != null)
+ if (list != null) {
return list;
+ }
int l = styleSheetList.getLength();
for (int i = 0; i < l; i++) {
CSSStyleSheet styleSheet = (CSSStyleSheet) styleSheetList.item(i);
@@ -104,7 +107,7 @@ public class DocumentCSSImpl implements ExtendedDocumentCSS {
// Loop for SelectorList
int l = selectorList.getLength();
for (int j = 0; j < l; j++) {
- Selector selector = (Selector) selectorList.item(j);
+ Selector selector = selectorList.item(j);
if (selector.getSelectorType() == selectorType) {
// It's conditional selector
ConditionalSelector conditionalSelector = (ConditionalSelector) selector;
@@ -138,12 +141,15 @@ public class DocumentCSSImpl implements ExtendedDocumentCSS {
protected Integer getKey(int selectorType, int conditionType) {
if (selectorType == Selector.SAC_CONDITIONAL_SELECTOR) {
- if (conditionType == SAC_CLASS_CONDITION.intValue())
+ if (conditionType == SAC_CLASS_CONDITION.intValue()) {
return SAC_CLASS_CONDITION;
- if (conditionType == SAC_ID_CONDITION.intValue())
+ }
+ if (conditionType == SAC_ID_CONDITION.intValue()) {
return SAC_ID_CONDITION;
- if (conditionType == SAC_PSEUDO_CLASS_CONDITION.intValue())
+ }
+ if (conditionType == SAC_PSEUDO_CLASS_CONDITION.intValue()) {
return SAC_PSEUDO_CLASS_CONDITION;
+ }
return OTHER_SAC_CONDITIONAL_SELECTOR;
}
@@ -151,8 +157,9 @@ public class DocumentCSSImpl implements ExtendedDocumentCSS {
}
protected Map getStyleDeclarationMap() {
- if (styleDeclarationMap == null)
+ if (styleDeclarationMap == null) {
styleDeclarationMap = new HashMap();
+ }
return styleDeclarationMap;
}
}
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/StyleWrapper.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/StyleWrapper.java
index 64e10280867..2b3c47e8b69 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/StyleWrapper.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/StyleWrapper.java
@@ -7,6 +7,7 @@
* Contributors:
* EclipseSource - initial API and implementation
* IBM Corporation - ongoing development
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
******************************************************************************/
package org.eclipse.e4.ui.css.core.impl.dom;
@@ -24,8 +25,8 @@ final class StyleWrapper {
public int compare(final StyleWrapper object1, final StyleWrapper object2) {
int result = 0;
- StyleWrapper wrapper1 = (StyleWrapper) object1;
- StyleWrapper wrapper2 = (StyleWrapper) object2;
+ StyleWrapper wrapper1 = object1;
+ StyleWrapper wrapper2 = object2;
if (wrapper1.specificity > wrapper2.specificity) {
result = 1;
} else if (wrapper1.specificity < wrapper2.specificity) {
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/ViewCSSImpl.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/ViewCSSImpl.java
index 511fdab594f..3c6cfe2fa5c 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/ViewCSSImpl.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/ViewCSSImpl.java
@@ -8,6 +8,7 @@
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
* IBM Corporation - ongoing development
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.core.impl.dom;
@@ -63,8 +64,9 @@ public class ViewCSSImpl implements ViewCSS {
CSSStyleSheet styleSheet = (CSSStyleSheet) styleSheetList.item(i);
CSSStyleDeclaration styleDeclaration = getComputedStyle(styleSheet,
elt, pseudoElt);
- if (styleDeclaration != null)
+ if (styleDeclaration != null) {
return styleDeclaration;
+ }
}
return null;
}
@@ -85,7 +87,7 @@ public class ViewCSSImpl implements ViewCSS {
// Loop for SelectorList
int l = selectorList.getLength();
for (int j = 0; j < l; j++) {
- Selector selector = (Selector) selectorList.item(j);
+ Selector selector = selectorList.item(j);
if (selector instanceof ExtendedSelector) {
ExtendedSelector extendedSelector = (ExtendedSelector) selector;
if (extendedSelector.match(elt, pseudoElt)) {
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/parsers/AbstractCSSParser.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/parsers/AbstractCSSParser.java
index f1d049d2b21..7e99a80b748 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/parsers/AbstractCSSParser.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/impl/dom/parsers/AbstractCSSParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Angelo Zerr and others.
+ * Copyright (c) 2008, 2013 Angelo Zerr and others.
* 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
@@ -8,6 +8,7 @@
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
* IBM Corporation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.core.impl.dom.parsers;
@@ -74,7 +75,7 @@ public class AbstractCSSParser implements CSSParser {
throws IOException {
CSSStyleDeclarationImpl styleDeclaration = new CSSStyleDeclarationImpl(
null);
- parseStyleDeclaration(((CSSStyleDeclaration) (styleDeclaration)),
+ parseStyleDeclaration(((styleDeclaration)),
source);
return styleDeclaration;
}
@@ -150,8 +151,9 @@ public class AbstractCSSParser implements CSSParser {
* @return
*/
public DocumentHandlerFactory getDocumentHandlerFactory() {
- if (documentHandlerFactory == null)
+ if (documentHandlerFactory == null) {
return defaultDocumentHandlerFactory;
+ }
return documentHandlerFactory;
}
@@ -171,18 +173,21 @@ public class AbstractCSSParser implements CSSParser {
* @return
*/
public Parser getParser() {
- if (parser == null)
+ if (parser == null) {
try {
parser = getSACParserFactory().makeParser();
- if (conditionFactory != null)
+ if (conditionFactory != null) {
parser.setConditionFactory(conditionFactory);
- if (selectorFactory != null)
+ }
+ if (selectorFactory != null) {
parser.setSelectorFactory(selectorFactory);
+ }
} catch (Exception e) {
// TODO : manage error.
// e.printStackTrace();
throw new ParserNotFoundException(e);
}
+ }
return parser;
}
@@ -201,8 +206,9 @@ public class AbstractCSSParser implements CSSParser {
* @return
*/
public ISACParserFactory getSACParserFactory() {
- if (parserFactory == null)
+ if (parserFactory == null) {
return defaultParserFactory;
+ }
return parserFactory;
}
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyBackgroundXMLHandler.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyBackgroundXMLHandler.java
index da1bf85c33f..3083d83f48d 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyBackgroundXMLHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyBackgroundXMLHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Angelo Zerr and others.
+ * Copyright (c) 2008 -2013 Angelo Zerr and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.xml.properties.css2;
@@ -20,14 +21,15 @@ import org.w3c.dom.css.CSSValue;
*
*/
public class CSSPropertyBackgroundXMLHandler extends
- AbstractCSSPropertyBackgroundHandler {
+AbstractCSSPropertyBackgroundHandler {
public final static ICSSPropertyBackgroundHandler INSTANCE = new CSSPropertyBackgroundXMLHandler();
+ @Override
public boolean applyCSSProperty(Object node, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if (node instanceof Element) {
- super.applyCSSProperty((Element) node, property, value, pseudo,
+ super.applyCSSProperty(node, property, value, pseudo,
engine);
return true;
}
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyFontXMLHandler.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyFontXMLHandler.java
index 0c76d96bac7..45957686bde 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyFontXMLHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyFontXMLHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Angelo Zerr and others.
+ * Copyright (c) 2008 - 2013 Angelo Zerr and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.xml.properties.css2;
@@ -26,16 +27,18 @@ public class CSSPropertyFontXMLHandler extends AbstractCSSPropertyFontHandler {
public final static ICSSPropertyFontHandler INSTANCE = new CSSPropertyFontXMLHandler();
+ @Override
public boolean applyCSSProperty(Object node, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if (node instanceof Element && ((Node) node).getOwnerDocument() != null) {
- super.applyCSSProperty((Element) node, property, value, pseudo,
+ super.applyCSSProperty(node, property, value, pseudo,
engine);
return true;
}
return false;
}
+ @Override
public void applyCSSPropertyFontSize(Object node, CSSValue value,
String pseudo, CSSEngine engine) throws Exception {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
@@ -47,6 +50,7 @@ public class CSSPropertyFontXMLHandler extends AbstractCSSPropertyFontHandler {
}
}
+ @Override
public void applyCSSPropertyFontWeight(Object node, CSSValue value,
String pseudo, CSSEngine engine) throws Exception {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
@@ -58,6 +62,7 @@ public class CSSPropertyFontXMLHandler extends AbstractCSSPropertyFontHandler {
}
}
+ @Override
public void applyCSSPropertyFontStyle(Object node, CSSValue value,
String pseudo, CSSEngine engine) throws Exception {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyTextXMLHandler.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyTextXMLHandler.java
index 119dcd98ca0..add9fc0d306 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyTextXMLHandler.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/xml/properties/css2/CSSPropertyTextXMLHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Angelo Zerr and others.
+ * Copyright (c) 2008 - 2013 Angelo Zerr and others.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Bug 422702
*******************************************************************************/
package org.eclipse.e4.ui.css.xml.properties.css2;
@@ -24,16 +25,18 @@ public class CSSPropertyTextXMLHandler extends AbstractCSSPropertyTextHandler {
public final static ICSSPropertyTextHandler INSTANCE = new CSSPropertyTextXMLHandler();
+ @Override
public boolean applyCSSProperty(Object node, String property,
CSSValue value, String pseudo, CSSEngine engine) throws Exception {
if (node instanceof Element) {
- super.applyCSSProperty((Element) node, property, value, pseudo,
+ super.applyCSSProperty(node, property, value, pseudo,
engine);
return true;
}
return false;
}
+ @Override
public void applyCSSPropertyColor(Object node, CSSValue value,
String pseudo, CSSEngine engine) throws Exception {
if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {

Back to the top