Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/Activator.java4
-rwxr-xr-xplugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/CssSvgPostProcessor.java135
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java98
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/BooleanConverter.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java42
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/IntegerConverter.java14
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/StringConverter.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java174
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java18
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicy.java92
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java16
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicy.java111
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java11
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java34
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ElementProviderWrapper.java27
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java21
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java72
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFElementProvider.java17
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFErrorHandler.java7
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ICSSElementProviderFactory.java2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/LazyCSSEngine.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java38
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ProjectCSSEngine.java59
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java22
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/CSSComputedStyleImpl.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java44
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/StyleWrapper.java13
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java19
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSDOMSemanticElementHelper.java64
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSHelper.java16
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/GradientHelper.java72
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/LabelDisplayHelper.java16
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ParserHelper.java32
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ResetStyleHelper.java14
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/StringHelper.java14
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java90
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/listener/StyleSheetChangeListener.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedCSSRuleList.java16
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedSelectorList.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java4
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java10
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java43
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSStyles.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java52
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/StatefulView.java16
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java4
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferences.java4
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java12
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSClassContentProvider.java61
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java26
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java15
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationModel.java2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java44
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceAdapter.java24
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceFactory.java8
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/CssMarkerEventManagerService.java81
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/MarkerToPseudoSelectorMappingService.java22
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java132
60 files changed, 1065 insertions, 999 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/Activator.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/Activator.java
index 722dc09fbf1..03d4bb0d300 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/Activator.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/Activator.java
@@ -46,7 +46,7 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
@@ -58,7 +58,7 @@ public class Activator extends AbstractUIPlugin {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/CssSvgPostProcessor.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/CssSvgPostProcessor.java
index 3567038b5a8..3c0c9a0f803 100755
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/CssSvgPostProcessor.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/CssSvgPostProcessor.java
@@ -53,8 +53,8 @@ import org.w3c.dom.svg.SVGDocument;
*
* @author Laurent Wouters
*/
-//TODO: This post processor doesn't depend on the GMF/CSS integration. It could be possible to apply styles to SVG images
-//without having the GMF/CSS integration. This class might be moved to gmfdiag.common
+// TODO: This post processor doesn't depend on the GMF/CSS integration. It could be possible to apply styles to SVG images
+// without having the GMF/CSS integration. This class might be moved to gmfdiag.common
@SuppressWarnings("restriction")
public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPart {
@@ -108,6 +108,7 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
/**
* @see org.eclipse.papyrus.infra.gmfdiag.common.handler.IRefreshHandlerPart#refresh(org.eclipse.ui.IEditorPart)
*/
+ @Override
public void refresh(IEditorPart editorPart) {
relativePaths.clear();
loadedSheets.clear();
@@ -117,21 +118,21 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
}
/**
- * @see org.eclipse.papyrus.infra.gmfdiag.common.service.shape.SVGPostProcessor#postProcess(org.eclipse.emf.ecore.EObject,
- * org.w3c.dom.svg.SVGDocument)
+ * @see org.eclipse.papyrus.infra.gmfdiag.common.service.shape.SVGPostProcessor#postProcess(org.eclipse.emf.ecore.EObject, org.w3c.dom.svg.SVGDocument)
*/
+ @Override
public void postProcess(EObject view, SVGDocument document) {
- if(view instanceof org.eclipse.gmf.runtime.notation.Node) {
- View shape = (View)view;
+ if (view instanceof org.eclipse.gmf.runtime.notation.Node) {
+ View shape = (View) view;
// Retrieve the applied CSS stylesheet if necessary
- StringValueStyle nsURI = (StringValueStyle)shape.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), CSS_PROPERTY_SVG_STYLESHEET);
- if(nsURI != null) {
+ StringValueStyle nsURI = (StringValueStyle) shape.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), CSS_PROPERTY_SVG_STYLESHEET);
+ if (nsURI != null) {
loadStylesheet(getCanonicalURI(shape.getElement(), nsURI.getStringValue()));
}
// Retrieve the applied CSS class
- StringValueStyle nsClassName = (StringValueStyle)shape.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), CSS_PROPERTY_SVG_CLASS);
+ StringValueStyle nsClassName = (StringValueStyle) shape.getNamedStyle(NotationPackage.eINSTANCE.getStringValueStyle(), CSS_PROPERTY_SVG_CLASS);
String className = "";
- if(nsClassName != null) {
+ if (nsClassName != null) {
className = nsClassName.getStringValue();
}
// Apply the style
@@ -144,16 +145,16 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Loads the stylesheet at the given URI into the CSS engine
*
* @param uri
- * The URI to load the stylesheet from
+ * The URI to load the stylesheet from
*/
private void loadStylesheet(URI uri) {
- if(uri == null || uri.isEmpty()) {
+ if (uri == null || uri.isEmpty()) {
return;
}
- if(loadedSheets.contains(uri)) {
+ if (loadedSheets.contains(uri)) {
return;
}
- if(failedSheets.contains(uri)) {
+ if (failedSheets.contains(uri)) {
return;
}
InputStream stream;
@@ -176,7 +177,7 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
} catch (IOException e) {
}
}
- if(sheet != null) {
+ if (sheet != null) {
loadedSheets.add(uri);
}
}
@@ -186,33 +187,33 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* The URI may be relative to the currently edited EMF resource
*
* @param model
- * The model element used to retrieve the EMF resource that is currently edited
+ * The model element used to retrieve the EMF resource that is currently edited
* @param uri
- * The potentially relative URI of a stylesheet
+ * The potentially relative URI of a stylesheet
* @return The canonical URI of the resource
*/
private URI getCanonicalURI(EObject model, String uri) {
- if(uri.startsWith("platform:/")) {
+ if (uri.startsWith("platform:/")) {
return URI.createURI(uri);
}
Map<String, URI> resMap = relativePaths.get(model.eResource());
- if(resMap == null) {
+ if (resMap == null) {
resMap = new HashMap<String, URI>();
relativePaths.put(model.eResource(), resMap);
}
URI canonical = resMap.get(uri);
- if(canonical != null) {
+ if (canonical != null) {
return canonical;
}
URI resURI = model.eResource().getURI();
- if(!resURI.isPlatform()) {
+ if (!resURI.isPlatform()) {
return null;
}
StringBuilder builder = new StringBuilder("platform:/");
String[] segments = resURI.segments();
- for(int i = 0; i < segments.length - 1; i++) {
+ for (int i = 0; i < segments.length - 1; i++) {
builder.append(segments[i]);
builder.append("/");
}
@@ -227,12 +228,12 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Applies the CSS styles to the given SVG document
*
* @param document
- * The SVG document
+ * The SVG document
*/
private void applyStyles(SVGDocument document) {
List<CSSStyleRule> rules = getAllRulesIn(engine.getDocumentCSS());
Map<Element, Map<String, String>> originals = styledDocuments.get(document);
- if(originals == null) {
+ if (originals == null) {
originals = new HashMap<Element, Map<String, String>>();
styledDocuments.put(document, originals);
}
@@ -243,24 +244,24 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Recursively applies the CSS rule on this SVG element
*
* @param element
- * The SVG element
+ * The SVG element
* @param rules
- * The CSS rules in effect
+ * The CSS rules in effect
* @param originals
- * The original styling properties of the elements
+ * The original styling properties of the elements
*/
private void applyStyles(Element element, List<CSSStyleRule> rules, Map<Element, Map<String, String>> originals) {
// recursively apply to DOM elements
- for(int i = 0; i != element.getChildNodes().getLength(); i++) {
+ for (int i = 0; i != element.getChildNodes().getLength(); i++) {
Node child = element.getChildNodes().item(i);
- if(child instanceof Element) {
- applyStyles((Element)child, rules, originals);
+ if (child instanceof Element) {
+ applyStyles((Element) child, rules, originals);
}
}
// make a copy of the original styling properties
Map<String, String> style = originals.get(element);
- if(style == null) {
+ if (style == null) {
style = getBaseStyle(element);
originals.put(element, style);
}
@@ -269,15 +270,15 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
// get the applicable CSS rules
List<CSSStyleRule> applicable = getApplicableRules(element, rules);
// apply the CSS rules to the styling properties
- for(CSSStyleRule rule : applicable) {
+ for (CSSStyleRule rule : applicable) {
applyRuleTo(rule, style);
}
// serialize the result and put it back into the DOM
StringBuilder builder = new StringBuilder();
int count = 0;
- for(Entry<String, String> entry : style.entrySet()) {
- if(count != 0) {
+ for (Entry<String, String> entry : style.entrySet()) {
+ if (count != 0) {
builder.append(";");
}
builder.append(entry.getKey());
@@ -292,19 +293,19 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Builds a list of the CSS style rules for the given CSS document
*
* @param css
- * The CSS document
+ * The CSS document
* @return The CSS style rules
*/
private List<CSSStyleRule> getAllRulesIn(DocumentCSS css) {
List<CSSStyleRule> result = new ArrayList<CSSStyleRule>();
- for(int i = 0; i != css.getStyleSheets().getLength(); i++) {
+ for (int i = 0; i != css.getStyleSheets().getLength(); i++) {
StyleSheet ss = css.getStyleSheets().item(i);
- if(ss instanceof CSSStyleSheet) {
- CSSStyleSheet cs = (CSSStyleSheet)ss;
- for(int j = 0; j != cs.getCssRules().getLength(); j++) {
+ if (ss instanceof CSSStyleSheet) {
+ CSSStyleSheet cs = (CSSStyleSheet) ss;
+ for (int j = 0; j != cs.getCssRules().getLength(); j++) {
CSSRule rule = cs.getCssRules().item(j);
- if(rule.getType() == CSSRule.STYLE_RULE) {
- result.add((CSSStyleRule)rule);
+ if (rule.getType() == CSSRule.STYLE_RULE) {
+ result.add((CSSStyleRule) rule);
}
}
}
@@ -316,43 +317,43 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Filters the CSS rules that applies for the given SVG element
*
* @param svgElement
- * A SVG element
+ * A SVG element
* @param rules
- * The set of active rules
+ * The set of active rules
* @return The matching rules
*/
private List<CSSStyleRule> getApplicableRules(Element svgElement, List<CSSStyleRule> rules) {
List<CSSStyleRule> matching = new ArrayList<CSSStyleRule>();
// Matches the rules using the selectors
- for(CSSStyleRule rule : rules) {
- SelectorList selectors = ((CSSStyleRuleImpl)rule).getSelectorList();
+ for (CSSStyleRule rule : rules) {
+ SelectorList selectors = ((CSSStyleRuleImpl) rule).getSelectorList();
boolean match = true;
- for(int i = 0; i != selectors.getLength(); i++) {
- ExtendedSelector xs = (ExtendedSelector)selectors.item(i);
- if(!xs.match(svgElement, null)) {
+ for (int i = 0; i != selectors.getLength(); i++) {
+ ExtendedSelector xs = (ExtendedSelector) selectors.item(i);
+ if (!xs.match(svgElement, null)) {
match = false;
break;
}
}
- if(match) {
+ if (match) {
matching.add(rule);
}
}
// No match => stop
- if(matching.isEmpty()) {
+ if (matching.isEmpty()) {
return matching;
}
// Remove the parent rules
boolean[] available = new boolean[matching.size()];
Arrays.fill(available, 0, available.length, true);
- for(int i = 0; i != matching.size(); i++) {
+ for (int i = 0; i != matching.size(); i++) {
CSSStyleRule rule = matching.get(i);
- if(rule != null && rule.getParentRule() != null) {
- for(int j = 0; j != matching.size(); j++) {
- if(matching.get(i) == rule.getParentRule()) {
+ if (rule != null && rule.getParentRule() != null) {
+ for (int j = 0; j != matching.size(); j++) {
+ if (matching.get(i) == rule.getParentRule()) {
available[i] = false;
break;
}
@@ -360,8 +361,8 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
}
}
List<CSSStyleRule> result = new ArrayList<CSSStyleRule>();
- for(int i = 0; i != matching.size(); i++) {
- if(available[i]) {
+ for (int i = 0; i != matching.size(); i++) {
+ if (available[i]) {
result.add(matching.get(i));
}
}
@@ -372,21 +373,21 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Loads the styling properties of a SVG element from the DOM
*
* @param element
- * The SVG element
+ * The SVG element
* @return The styling properties in the DOM
*/
private Map<String, String> getBaseStyle(Element element) {
HashMap<String, String> result = new HashMap<String, String>();
String styleValue = element.getAttribute("style");
- if(styleValue != null && !styleValue.isEmpty()) {
+ if (styleValue != null && !styleValue.isEmpty()) {
String[] props = styleValue.split(";");
- for(int i = 0; i != props.length; i++) {
+ for (int i = 0; i != props.length; i++) {
String[] temp = props[i].split(":");
- if(temp.length == 2) {
+ if (temp.length == 2) {
result.put(temp[0], temp[1]);
- } else if(temp.length > 2) {
+ } else if (temp.length > 2) {
StringBuilder builder = new StringBuilder(temp[1]);
- for(int j = 2; j != temp.length; j++) {
+ for (int j = 2; j != temp.length; j++) {
builder.append(":");
builder.append(temp[j]);
}
@@ -401,15 +402,15 @@ public class CssSvgPostProcessor implements SVGPostProcessor, IRefreshHandlerPar
* Recursively applies the given CSS rule and its parent on the map of properties
*
* @param rule
- * The CSS rule to apply
+ * The CSS rule to apply
* @param properties
- * The map of CSS properties to build
+ * The map of CSS properties to build
*/
private void applyRuleTo(CSSStyleRule rule, Map<String, String> properties) {
- if(rule.getParentRule() != null) {
- applyRuleTo((CSSStyleRule)rule.getParentRule(), properties);
+ if (rule.getParentRule() != null) {
+ applyRuleTo((CSSStyleRule) rule.getParentRule(), properties);
}
- for(int i = 0; i != rule.getStyle().getLength(); i++) {
+ for (int i = 0; i != rule.getStyle().getLength(); i++) {
String name = rule.getStyle().item(i);
String value = rule.getStyle().getPropertyCSSValue(name).getCssText();
properties.put(name, value);
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java
index 726386e16b2..6c84c486bdc 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java
@@ -50,65 +50,65 @@ public class ResetStyleCommand extends RecordingCommand {
@Override
public void doExecute() {
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
Object selectedItem = iterator.next();
View view = NotationHelper.findView(selectedItem);
- if(view == null) {
+ if (view == null) {
continue;
}
- if(view instanceof Diagram) {
- resetDiagram((Diagram)view);
+ if (view instanceof Diagram) {
+ resetDiagram((Diagram) view);
break;
} else {
- //Reset the style attribute to their default value
+ // Reset the style attribute to their default value
resetStyle(view, true);
}
}
}
private void resetDiagram(Diagram diagram) {
- for(Object viewObject : diagram.getChildren()) {
- if(viewObject instanceof View) {
- resetStyle((View)viewObject, true);
+ for (Object viewObject : diagram.getChildren()) {
+ if (viewObject instanceof View) {
+ resetStyle((View) viewObject, true);
}
}
- for(Object lineObject : diagram.getEdges()) {
- if(lineObject instanceof View) {
- resetStyle((View)lineObject, true);
+ for (Object lineObject : diagram.getEdges()) {
+ if (lineObject instanceof View) {
+ resetStyle((View) lineObject, true);
}
}
}
private void resetStyle(View view, boolean recursive) {
resetStyle(view);
- if(recursive) {
- for(Object childObject : view.getChildren()) {
- if(childObject instanceof View) {
- resetStyle((View)childObject, recursive);
+ if (recursive) {
+ for (Object childObject : view.getChildren()) {
+ if (childObject instanceof View) {
+ resetStyle((View) childObject, recursive);
}
}
}
}
private void resetStyle(View view) {
- //Reset the view (Except for volatile/transient elements which are already derived, e.g. Stereotype compartments)
- if(view.eContainingFeature().isTransient()) {
+ // Reset the view (Except for volatile/transient elements which are already derived, e.g. Stereotype compartments)
+ if (view.eContainingFeature().isTransient()) {
return;
}
Iterator<?> styleIterator = view.getStyles().iterator();
- while(styleIterator.hasNext()) {
+ while (styleIterator.hasNext()) {
Object styleObject = styleIterator.next();
- if(styleObject instanceof NamedStyle) {
- NamedStyle customStyle = (NamedStyle)styleObject;
+ if (styleObject instanceof NamedStyle) {
+ NamedStyle customStyle = (NamedStyle) styleObject;
- if(!CSSStyles.RESERVED_KEYWORDS.contains(customStyle.getName())) {
+ if (!CSSStyles.RESERVED_KEYWORDS.contains(customStyle.getName())) {
- //Remove only NamedStyle which are supported by the CSS Implementation
- //See org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate.getCSSNamedStyle(EClass, String)
- //See Bug 425190 - [CSS] Loss of Notation information when CSS style is applied on Edges.
- switch(customStyle.eClass().getClassifierID()) {
+ // Remove only NamedStyle which are supported by the CSS Implementation
+ // See org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate.getCSSNamedStyle(EClass, String)
+ // See Bug 425190 - [CSS] Loss of Notation information when CSS style is applied on Edges.
+ switch (customStyle.eClass().getClassifierID()) {
case NotationPackage.STRING_VALUE_STYLE:
case NotationPackage.BOOLEAN_VALUE_STYLE:
case NotationPackage.INT_VALUE_STYLE:
@@ -118,59 +118,59 @@ public class ResetStyleCommand extends RecordingCommand {
}
}
- } else if(styleObject instanceof Style) {
- resetStyle((Style)styleObject);
+ } else if (styleObject instanceof Style) {
+ resetStyle((Style) styleObject);
}
}
- if(view instanceof Style) {
- resetStyle((Style)view);
+ if (view instanceof Style) {
+ resetStyle((Style) view);
}
- //Remove the "forceValue" annotations
+ // Remove the "forceValue" annotations
resetAnnotations(view);
- //Remove the Papyrus Style EAnnotations
+ // Remove the Papyrus Style EAnnotations
resetStyleAnnotations(view);
- //Reset the visibility
+ // Reset the visibility
view.eUnset(NotationPackage.eINSTANCE.getView_Visible());
}
private void resetStyle(Style style) {
- if(style instanceof NamedStyle) {
- //Skip custom styles.
- //TODO: We should skip CSS Styles (CSSClass, CSSId, CSSStyle, DiagramStyleSheets),
- //and reset custom GMF Styles (elementIcon, shadow, ...).
- //What about external custom styles (ie. unkwnown styles)?
- //They should be stylable, but they might contain something we don't want to reset...
+ if (style instanceof NamedStyle) {
+ // Skip custom styles.
+ // TODO: We should skip CSS Styles (CSSClass, CSSId, CSSStyle, DiagramStyleSheets),
+ // and reset custom GMF Styles (elementIcon, shadow, ...).
+ // What about external custom styles (ie. unkwnown styles)?
+ // They should be stylable, but they might contain something we don't want to reset...
return;
}
- for(EStructuralFeature feature : style.eClass().getEAllStructuralFeatures()) {
- //Only edit Style features
- if(NotationPackage.eINSTANCE.getStyle().isSuperTypeOf(feature.getEContainingClass())) {
- //Reset the value to default
+ for (EStructuralFeature feature : style.eClass().getEAllStructuralFeatures()) {
+ // Only edit Style features
+ if (NotationPackage.eINSTANCE.getStyle().isSuperTypeOf(feature.getEContainingClass())) {
+ // Reset the value to default
style.eUnset(feature);
}
}
}
- //Resets the "Force Value" annotations (Tags to indicate that the user
- //has manually selected a value, which will override the CSS Style)
+ // Resets the "Force Value" annotations (Tags to indicate that the user
+ // has manually selected a value, which will override the CSS Style)
private void resetAnnotations(View view) {
Iterator<EAnnotation> iterator = view.getEAnnotations().iterator();
- while(iterator.hasNext()) {
- if(CSSAnnotations.CSS_FORCE_VALUE.equals(iterator.next().getSource())) {
+ while (iterator.hasNext()) {
+ if (CSSAnnotations.CSS_FORCE_VALUE.equals(iterator.next().getSource())) {
iterator.remove();
}
}
}
- //Resets the "Custom style" Annotations (elementIcon, shadow, qualifiedName)
+ // Resets the "Custom style" Annotations (elementIcon, shadow, qualifiedName)
private void resetStyleAnnotations(View view) {
Iterator<EAnnotation> iterator = view.getEAnnotations().iterator();
- while(iterator.hasNext()) {
- if(papyrusStyleAnnotations.contains(iterator.next().getSource())) {
+ while (iterator.hasNext()) {
+ if (papyrusStyleAnnotations.contains(iterator.next().getSource())) {
iterator.remove();
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/BooleanConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/BooleanConverter.java
index 87b14cd71d2..cd3855e3543 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/BooleanConverter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/BooleanConverter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -21,7 +21,7 @@ import org.w3c.dom.css.CSSValue;
/**
* A Converter for Boolean values
* Converts a CSS String to a Java Boolean
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -34,13 +34,15 @@ public class BooleanConverter extends AbstractCSSValueConverter {
super(Boolean.class);
}
+ @Override
public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception {
- if(value instanceof CSSPrimitiveValue) {
- return Boolean.parseBoolean(((CSSPrimitiveValue)value).getStringValue());
+ if (value instanceof CSSPrimitiveValue) {
+ return Boolean.parseBoolean(((CSSPrimitiveValue) value).getStringValue());
}
throw new IllegalArgumentException("The value " + value + " is not a valid Boolean");
}
+ @Override
public String convert(Object value, CSSEngine engine, Object context, ICSSValueConverterConfig config) throws Exception {
throw new UnsupportedOperationException();
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java
index eaa9e63784d..f9b88166237 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/ColorToGMFConverter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2014 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 392301
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.converters;
@@ -25,7 +25,7 @@ import org.w3c.dom.css.RGBColor;
/**
* A Converter for GMF Colors
* Converts a CSS Color to a GMF-compatible color (RGB Integer)
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -43,12 +43,13 @@ public class ColorToGMFConverter extends AbstractCSSValueConverter {
super(GMFColor);
}
+ @Override
public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception {
RGBColor color;
- if(value instanceof RGBColor) {
- color = (RGBColor)value;
- } else if(value instanceof CSSPrimitiveValue) {
- CSSPrimitiveValue cssValue = (CSSPrimitiveValue)value;
+ if (value instanceof RGBColor) {
+ color = (RGBColor) value;
+ } else if (value instanceof CSSPrimitiveValue) {
+ CSSPrimitiveValue cssValue = (CSSPrimitiveValue) value;
color = CSS2ColorHelper.getRGBColor(cssValue.getStringValue());
} else {
throw new IllegalArgumentException("Cannot convert " + value + " to GMF Color");
@@ -57,15 +58,16 @@ public class ColorToGMFConverter extends AbstractCSSValueConverter {
return getIntColor(color);
}
+ @Override
public String convert(Object value, CSSEngine engine, Object context, ICSSValueConverterConfig config) throws Exception {
throw new UnsupportedOperationException();
}
/**
* Returns a GMF-compatible integer color from a CSS RGBColor object
- *
+ *
* @param color
- * The CSS RGBColor to convert
+ * The CSS RGBColor to convert
* @return
* A GMF-compatible integer color
*/
@@ -79,32 +81,32 @@ public class ColorToGMFConverter extends AbstractCSSValueConverter {
/**
* Returns an integer from a CSSPrimitiveValue
- *
+ *
* @param value
- * The CSSPrimitiveValue to convert
+ * The CSSPrimitiveValue to convert
* @return
* A Java integer equivalent to the CSSPrimitiveValue
*/
public static int getInt(CSSPrimitiveValue value) {
- if(value instanceof Measure) {
- Measure measure = (Measure)value;
+ if (value instanceof Measure) {
+ Measure measure = (Measure) value;
return measure.getIntegerValue(CSSValue.CSS_PRIMITIVE_VALUE);
}
- return (int)value.getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
+ return (int) value.getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
}
- //Unused
+ // Unused
public static int getIntColor(String value, CSSValue cssValue) {
RGBColor color;
- if(cssValue instanceof RGBColor) {
- //color:rgb(125, 255, 0);
- color = (RGBColor)cssValue;
+ if (cssValue instanceof RGBColor) {
+ // color:rgb(125, 255, 0);
+ color = (RGBColor) cssValue;
} else {
- //color:red; || color:#FFFFFF;
+ // color:red; || color:#FFFFFF;
color = CSS2ColorHelper.getRGBColor(value);
}
- if(color == null) {
+ if (color == null) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException ex) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/IntegerConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/IntegerConverter.java
index bf46886b42c..e22f112d1f8 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/IntegerConverter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/IntegerConverter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -21,7 +21,7 @@ import org.w3c.dom.css.CSSValue;
/**
* A Converter for Integer values
* Converts a CSS String to a Java Integer
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -34,16 +34,18 @@ public class IntegerConverter extends AbstractCSSValueConverter {
super(Integer.class);
}
+ @Override
public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception {
- if(value instanceof CSSPrimitiveValue) {
- return (int)((CSSPrimitiveValue)value).getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
+ if (value instanceof CSSPrimitiveValue) {
+ return (int) ((CSSPrimitiveValue) value).getFloatValue(CSSPrimitiveValue.CSS_NUMBER);
}
- if(value instanceof Measure) {
- return (int)((Measure)value).getIntegerValue(CSSPrimitiveValue.CSS_NUMBER);
+ if (value instanceof Measure) {
+ return (int) ((Measure) value).getIntegerValue(CSSPrimitiveValue.CSS_NUMBER);
}
throw new IllegalArgumentException("The value " + value + " is not a valid Integer");
}
+ @Override
public String convert(Object value, CSSEngine engine, Object context, ICSSValueConverterConfig config) throws Exception {
throw new UnsupportedOperationException();
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/StringConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/StringConverter.java
index 90ea287b37f..f90b5c2d75d 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/StringConverter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/converters/StringConverter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -20,7 +20,7 @@ import org.w3c.dom.css.CSSValue;
/**
* A Converter for String values
* Converts a CSS String to a Java String
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -33,13 +33,15 @@ public class StringConverter extends AbstractCSSValueConverter {
super(String.class);
}
+ @Override
public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception {
- if(value instanceof CSSPrimitiveValue) {
- return ((CSSPrimitiveValue)value).getStringValue();
+ if (value instanceof CSSPrimitiveValue) {
+ return ((CSSPrimitiveValue) value).getStringValue();
}
throw new IllegalArgumentException("The value " + value + " is not a valid String");
}
+ @Override
public String convert(Object value, CSSEngine engine, Object context, ICSSValueConverterConfig config) throws Exception {
throw new UnsupportedOperationException();
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
index 7a325c3cfef..5f3e7c14849 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/GMFElementAdapter.java
@@ -108,7 +108,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Returns the CSS ID of the selected element.
*
* @param sourceElement
- * The source element must be a GMF notation object (View, Style, ...)
+ * The source element must be a GMF notation object (View, Style, ...)
* @return
* The CSS ID associated to the source element, or null if it cannot be found
*/
@@ -122,7 +122,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* all classes, separated with spaces.
*
* @param sourceElement
- * The source element must be a GMF notation object (View, Style, ...)
+ * The source element must be a GMF notation object (View, Style, ...)
* @return
* The CSS Class associated to the source element, or null if it cannot be found
*/
@@ -135,7 +135,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Returns the source element's local CSS style.
*
* @param sourceElement
- * The source element must be a GMF notation object (View, Style, ...)
+ * The source element must be a GMF notation object (View, Style, ...)
* @return
* the source element's local CSS style.
*/
@@ -144,8 +144,8 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
private static String getCSSValue(EObject sourceElement, String key) {
- StringValueStyle style = (StringValueStyle)findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringValueStyle());
- if(style == null) {
+ StringValueStyle style = (StringValueStyle) findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringValueStyle());
+ if (style == null) {
return null;
}
@@ -154,8 +154,8 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@SuppressWarnings("unchecked")
private static List<String> getCSSValues(EObject sourceElement, String key) {
- StringListValueStyle style = (StringListValueStyle)findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringListValueStyle());
- if(style == null) {
+ StringListValueStyle style = (StringListValueStyle) findStyle(sourceElement, key, NotationPackage.eINSTANCE.getStringListValueStyle());
+ if (style == null) {
return Collections.emptyList();
}
@@ -165,7 +165,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
private static NamedStyle findStyle(EObject sourceElement, String key, EClass type) {
View view = findView(sourceElement);
- if(view == null) {
+ if (view == null) {
return null;
}
@@ -173,12 +173,12 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
private static View findView(EObject sourceElement) {
- if(sourceElement == null) {
+ if (sourceElement == null) {
return null;
}
- if(sourceElement instanceof View) {
- return (View)sourceElement;
+ if (sourceElement instanceof View) {
+ return (View) sourceElement;
}
return findView(sourceElement.eContainer());
@@ -188,15 +188,15 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Creates a new GMF Element Adapter for the requested view.
*
* @param view
- * The view to be adapted
+ * The view to be adapted
* @param engine
- * The associated CSS Engine
+ * The associated CSS Engine
*/
public GMFElementAdapter(View view, ExtendedCSSEngine engine) {
super(view, engine);
- //Bug 431694: Don't instantiate an ElementAdapter for an Orphaned view
- if(view == null || view.getDiagram() == null) {
+ // Bug 431694: Don't instantiate an ElementAdapter for an Orphaned view
+ if (view == null || view.getDiagram() == null) {
throw new IllegalArgumentException("Cannot handle orphaned view : " + view);
}
@@ -212,7 +212,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* The semantic element associated to this adapter
*/
public EObject getSemanticElement() {
- if(semanticElement == null) {
+ if (semanticElement == null) {
semanticElement = CSSDOMSemanticElementHelper.findSemanticElement(notationElement);
computePseudoInstances();
listenSemanticElement();
@@ -221,9 +221,9 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
private void computePseudoInstances() {
- if(CSSDOMSemanticElementHelper.isFloatingLabel(notationElement)) {
+ if (CSSDOMSemanticElementHelper.isFloatingLabel(notationElement)) {
String humanType = NotationTypesMap.instance.getHumanReadableType(notationElement);
- if(humanType == null) {
+ if (humanType == null) {
humanType = notationElement.getType();
}
@@ -232,7 +232,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
private Adapter getStyleListener() {
- if(styleListener == null) {
+ if (styleListener == null) {
styleListener = new StyleListener(this);
}
return styleListener;
@@ -241,18 +241,18 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
private void listenNotationElement() {
notationElement.eAdapters().add(getStyleListener());
- Collection<String> cssStyles = Arrays.asList(new String[]{ CSS_GMF_CLASS_KEY, CSS_GMF_ID_KEY, CSS_GMF_STYLE_KEY, CSS_DIAGRAM_STYLESHEETS_KEY });
+ Collection<String> cssStyles = Arrays.asList(new String[] { CSS_GMF_CLASS_KEY, CSS_GMF_ID_KEY, CSS_GMF_STYLE_KEY, CSS_DIAGRAM_STYLESHEETS_KEY });
notationElement.eAdapters().add(cssStyleListener = new CustomStyleListener(notationElement, this, cssStyles));
}
private ExtendedCSSEngine getEngine() {
- return (ExtendedCSSEngine)engine;
+ return (ExtendedCSSEngine) engine;
}
private void listenSemanticElement() {
- //FIXME: The semantic hierarchy is never refresh (children & parentNode)
- if(semanticElement != null) {
+ // FIXME: The semantic hierarchy is never refresh (children & parentNode)
+ if (semanticElement != null) {
semanticElement.eAdapters().add(getStyleListener());
}
}
@@ -265,27 +265,27 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
@Override
public Node getParentNode() {
- if(parentNode == null) {
+ if (parentNode == null) {
View gmfElement = notationElement;
- while(gmfElement != null) {
+ while (gmfElement != null) {
EObject semanticElement = CSSDOMSemanticElementHelper.findSemanticElement(gmfElement);
- if(semanticElement != this.getSemanticElement()) {
+ if (semanticElement != this.getSemanticElement()) {
break;
}
EObject container = gmfElement.eContainer();
- if(gmfElement == container || !(container instanceof View)) {
+ if (gmfElement == container || !(container instanceof View)) {
gmfElement = null;
break;
}
- gmfElement = (View)container;
+ gmfElement = (View) container;
}
parentNode = engine.getElement(gmfElement);
- if(parentNode == this) {
+ if (parentNode == this) {
return parentNode = null;
}
}
@@ -306,7 +306,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
@Override
public String getNamespaceURI() {
- if(namespaceURI == null) {
+ if (namespaceURI == null) {
namespaceURI = EMFHelper.getQualifiedName(getSemanticElement().eClass().getEPackage(), ".");
}
return namespaceURI;
@@ -344,20 +344,20 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
@Override
public String getLocalName() {
- if(localName == null) {
- if(getSemanticElement() instanceof Diagram) {
- Diagram diagram = (Diagram)getSemanticElement();
+ if (localName == null) {
+ if (getSemanticElement() instanceof Diagram) {
+ Diagram diagram = (Diagram) getSemanticElement();
String type = diagram.getType();
String humanType = NotationTypesMap.instance.getHumanReadableType(diagram);
- if(humanType != null) {
+ if (humanType != null) {
localName = humanType;
} else {
localName = type;
}
- } else if(getNotationElement() instanceof BasicCompartment) {
+ } else if (getNotationElement() instanceof BasicCompartment) {
return "Compartment";
- } else if(CSSDOMSemanticElementHelper.isFloatingLabel(getNotationElement())) {
+ } else if (CSSDOMSemanticElementHelper.isFloatingLabel(getNotationElement())) {
return "Label";
} else {
localName = getSemanticElement().eClass().getName();
@@ -375,7 +375,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@Override
public final String getAttribute(String attr) {
String value = doGetAttribute(attr);
- if(value != null) {
+ if (value != null) {
return value;
}
@@ -390,36 +390,36 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Returns null if the attribute is not known
*/
protected String doGetAttribute(String attr) {
- if(notationElement instanceof BasicCompartment) {
- //Compartments can be filtered by type (notation::View::type), or by title (From GmfGen model)
- //We add the "kind" attribute which is specific to the CSS (More user-friendly)
- if("kind".equals(attr)) {
+ if (notationElement instanceof BasicCompartment) {
+ // Compartments can be filtered by type (notation::View::type), or by title (From GmfGen model)
+ // We add the "kind" attribute which is specific to the CSS (More user-friendly)
+ if ("kind".equals(attr)) {
- BasicCompartment compartment = (BasicCompartment)notationElement;
+ BasicCompartment compartment = (BasicCompartment) notationElement;
String humanType = NotationTypesMap.instance.getHumanReadableType(compartment);
- if(humanType == null) {
+ if (humanType == null) {
return compartment.getType();
}
- return humanType; //7017, 7018, 7019 for Attribute/Operation/Classifier compartments
- //TODO: Create a mapping list between GMF ID (Type) and user-readable labels
+ return humanType; // 7017, 7018, 7019 for Attribute/Operation/Classifier compartments
+ // TODO: Create a mapping list between GMF ID (Type) and user-readable labels
}
}
EStructuralFeature feature = getSemanticElement().eClass().getEStructuralFeature(attr);
- if(feature != null) {
- if(feature.isMany()) {
- List<?> values = (List<?>)semanticElement.eGet(feature);
+ if (feature != null) {
+ if (feature.isMany()) {
+ List<?> values = (List<?>) semanticElement.eGet(feature);
List<String> cssValues = new LinkedList<String>();
- for(Object value : values) {
- if(value != null) {
+ for (Object value : values) {
+ if (value != null) {
cssValues.add(getCSSValue(feature, value));
}
}
return ListHelper.deepToString(cssValues, CSS_VALUES_SEPARATOR);
} else {
Object value = semanticElement.eGet(feature);
- if(value != null) {
+ if (value != null) {
return getCSSValue(feature, value);
}
}
@@ -439,15 +439,15 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* @return
*/
protected String getCSSValue(EStructuralFeature feature, Object value) {
- if(value == null) {
+ if (value == null) {
return null;
}
- if(feature instanceof EReference && value instanceof ENamedElement) {
- return ((ENamedElement)value).getName();
+ if (feature instanceof EReference && value instanceof ENamedElement) {
+ return ((ENamedElement) value).getName();
}
- //Standard case. For EObject values, it might be better to return null than a random label...
+ // Standard case. For EObject values, it might be better to return null than a random label...
return value.toString();
}
@@ -463,9 +463,9 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
- /////////////
- //Node List//
- /////////////
+ // ///////////
+ // Node List//
+ // ///////////
@@ -486,7 +486,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
protected Node[] getChildren() {
- if(children == null) {
+ if (children == null) {
children = computeChildren(notationElement, engine);
}
@@ -503,13 +503,13 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
protected static Node[] computeChildren(View notationElement, CSSEngine engine) {
EObject semanticElement = CSSDOMSemanticElementHelper.findSemanticElement(notationElement);
List<Node> childList = new LinkedList<Node>();
- for(EObject child : notationElement.eContents()) {
- if(child instanceof View) {
- View notationChild = (View)child;
- if(SemanticElementHelper.findSemanticElement(notationChild) != semanticElement) {
+ for (EObject child : notationElement.eContents()) {
+ if (child instanceof View) {
+ View notationChild = (View) child;
+ if (SemanticElementHelper.findSemanticElement(notationChild) != semanticElement) {
childList.add(engine.getElement(notationChild));
} else {
- //This is the same semantic element (e.g. label). Compute indirect children, if any
+ // This is the same semantic element (e.g. label). Compute indirect children, if any
childList.addAll(Arrays.asList(computeChildren(notationChild, engine)));
}
}
@@ -537,9 +537,9 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
return childList.toArray(new Node[childList.size()]);
}
- //////////////////////
- // Handle events //
- //////////////////////
+ // ////////////////////
+ // Handle events //
+ // ////////////////////
/**
@@ -557,7 +557,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Source: styleListener
*/
public void semanticElementChanged() {
- if(semanticElement != null && semanticElement != notationElement) {
+ if (semanticElement != null && semanticElement != notationElement) {
semanticElement.eAdapters().remove(styleListener);
semanticElement = null;
}
@@ -573,16 +573,16 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Handles a notification for Custom style change.
* Source: cssStyleListener
*/
- //Change incoming from one of the cssCustomStyles (class, id, local style or diagram stylesheets)
+ // Change incoming from one of the cssCustomStyles (class, id, local style or diagram stylesheets)
@Override
public void handleChange(ChangeEvent event) {
- if(notationElement instanceof CSSDiagram) {
- //TODO: Use a finer grained event (We should reset only when the
- //change occurs on a DiagramStyleSheet)
+ if (notationElement instanceof CSSDiagram) {
+ // TODO: Use a finer grained event (We should reset only when the
+ // change occurs on a DiagramStyleSheet)
getEngine().reset();
}
- //Notify the CSS Engine
+ // Notify the CSS Engine
getEngine().notifyChange(this);
}
@@ -597,7 +597,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
notationElement.eAdapters().remove(styleListener);
- if(semanticElement != null) {
+ if (semanticElement != null) {
semanticElement.eAdapters().remove(styleListener);
}
}
@@ -607,7 +607,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Source : styleListener
*/
public void notationPropertyChanged() {
- //Notify the CSSEngine
+ // Notify the CSSEngine
getEngine().notifyChange(this);
}
@@ -616,7 +616,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
* Source : styleListener
*/
public void semanticPropertyChanged() {
- //Notify the CSSEngine
+ // Notify the CSSEngine
getEngine().notifyChange(this);
}
@@ -626,7 +626,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
public void notationElementDisposed() {
dispose();
- //Notify the CSSEngine
+ // Notify the CSSEngine
getEngine().handleDispose(notationElement);
}
@@ -645,12 +645,12 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@Override
public boolean equals(Object other) {
- if(other instanceof String) {
- return ((String)other).equalsIgnoreCase(sourceString);
+ if (other instanceof String) {
+ return ((String) other).equalsIgnoreCase(sourceString);
}
- if(other instanceof StringIgnoreCase) {
- return equals(((StringIgnoreCase)other).sourceString);
+ if (other instanceof StringIgnoreCase) {
+ return equals(((StringIgnoreCase) other).sourceString);
}
return false;
@@ -658,7 +658,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@Override
public int hashCode() {
- if(sourceStringToLower == null) {
+ if (sourceStringToLower == null) {
return 0;
}
@@ -678,11 +678,11 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
}
- //The following methods (Static pseudo instances) are not supported.
+ // The following methods (Static pseudo instances) are not supported.
@Override
public void addStaticPseudoInstance(String pseudo) {
- //Disable the super implementation. Static pseudo instances are not supported.
+ // Disable the super implementation. Static pseudo instances are not supported.
throw new UnsupportedOperationException();
}
@@ -698,7 +698,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
@Override
public void addStates(Set<String> states) {
- for(String state : states) {
+ for (String state : states) {
this.pseudoInstances.add(new StringIgnoreCase(state));
}
getEngine().notifyChange(this);
@@ -711,7 +711,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
*/
@Override
public void removeStates(Set<String> states) {
- for(String state : states) {
+ for (String state : states) {
this.pseudoInstances.remove(new StringIgnoreCase(state));
}
getEngine().notifyChange(this);
@@ -720,7 +720,7 @@ public class GMFElementAdapter extends ElementAdapter implements NodeList, IChan
@Override
public Set<String> getStates() {
Set<String> result = new HashSet<String>();
- for(StringIgnoreCase element : pseudoInstances) {
+ for (StringIgnoreCase element : pseudoInstances) {
result.add(element.toString());
}
return result;
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
index 66aee7b704b..40b527b746a 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/dom/StyleListener.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -17,7 +17,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
/**
* A Listener for notation and semantic properties changes
- *
+ *
* @author Camille Letavernier
*/
public class StyleListener extends AdapterImpl {
@@ -26,9 +26,9 @@ public class StyleListener extends AdapterImpl {
/**
* Constructor
- *
+ *
* @param elementAdapter
- * The GMFElementAdapter to listen to
+ * The GMFElementAdapter to listen to
*/
public StyleListener(GMFElementAdapter elementAdapter) {
this.elementAdapter = elementAdapter;
@@ -36,12 +36,12 @@ public class StyleListener extends AdapterImpl {
@Override
public void notifyChanged(Notification notification) {
- if(notification.isTouch()) {
+ if (notification.isTouch()) {
return;
}
- if(notification.getFeature() == NotationPackage.eINSTANCE.getView_Element()) {
- if(notification.getNewValue() == null) {
+ if (notification.getFeature() == NotationPackage.eINSTANCE.getView_Element()) {
+ if (notification.getNewValue() == null) {
elementAdapter.notationElementDisposed();
} else {
elementAdapter.semanticElementChanged();
@@ -49,12 +49,12 @@ public class StyleListener extends AdapterImpl {
return;
}
- if(notification.getNotifier() == elementAdapter.getNotationElement()) {
+ if (notification.getNotifier() == elementAdapter.getNotationElement()) {
elementAdapter.notationPropertyChanged();
return;
}
- if(notification.getNotifier() == elementAdapter.getSemanticElement()) {
+ if (notification.getNotifier() == elementAdapter.getSemanticElement()) {
elementAdapter.semanticPropertyChanged();
return;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicy.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicy.java
index 7d3c3968ed5..dc50d7ca152 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicy.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicy.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -33,7 +33,7 @@ import org.w3c.dom.Element;
/**
* An EditPolicy to handle events on EditParts
- *
+ *
* @author Camille Letavernier
* @see StatefulView
*/
@@ -42,12 +42,12 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
public static final String ROLE = "EVENT_LISTENER";
public EventListenerEditPolicy() {
- //Nothing
+ // Nothing
}
/**
* Does nothing by default.
- *
+ *
* @see org.eclipse.gef.EditPolicy#activate()
*/
@Override
@@ -59,7 +59,7 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
/**
* Does nothing by default.
- *
+ *
* @see org.eclipse.gef.EditPolicy#deactivate()
*/
@Override
@@ -70,32 +70,32 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
}
- //Event support
+ // Event support
private final Set<String> state = new HashSet<String>();
private void removeState(String... states) {
Set<String> statesToRemove = new HashSet<String>();
- for(String state : states) {
+ for (String state : states) {
statesToRemove.add(state);
}
this.state.removeAll(statesToRemove);
StatefulView view = getDomElement();
- if(view != null) {
+ if (view != null) {
view.removeStates(statesToRemove);
}
}
private void addState(String... states) {
Set<String> newStates = new HashSet<String>();
- for(String state : states) {
+ for (String state : states) {
newStates.add(state);
}
this.state.addAll(newStates);
StatefulView view = getDomElement();
- if(view != null) {
+ if (view != null) {
view.addStates(newStates);
}
}
@@ -103,56 +103,56 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
private StatefulView getDomElement() {
EventListenerEditPolicy primaryEditPolicy = getPrimaryEditPolicy();
- if(primaryEditPolicy == this) {
+ if (primaryEditPolicy == this) {
View view = getSemanticView();
- if(view.getDiagram() instanceof CSSDiagram) {
- Element domElement = ((CSSDiagram)view.getDiagram()).getEngine().getElement(view);
- if(domElement instanceof StatefulView) {
- return (StatefulView)domElement;
+ if (view.getDiagram() instanceof CSSDiagram) {
+ Element domElement = ((CSSDiagram) view.getDiagram()).getEngine().getElement(view);
+ if (domElement instanceof StatefulView) {
+ return (StatefulView) domElement;
}
}
- } else if(primaryEditPolicy != null) {
+ } else if (primaryEditPolicy != null) {
return primaryEditPolicy.getDomElement();
}
return null;
}
protected View getSemanticView() {
- return (View)getHost().getModel();
+ return (View) getHost().getModel();
}
private EventListenerEditPolicy getPrimaryEditPolicy() {
EditPart current = getHost();
EditPart parent = current.getParent();
- while(parent != null && semanticCompareEditParts(parent, getHost())) {
+ while (parent != null && semanticCompareEditParts(parent, getHost())) {
current = parent;
parent = parent.getParent();
}
- return (EventListenerEditPolicy)current.getEditPolicy(ROLE);
+ return (EventListenerEditPolicy) current.getEditPolicy(ROLE);
}
private boolean semanticCompareEditParts(EditPart one, EditPart other) {
- if(one.getModel() instanceof View && other.getModel() instanceof View) {
- View view1 = (View)one.getModel();
- View view2 = (View)other.getModel();
+ if (one.getModel() instanceof View && other.getModel() instanceof View) {
+ View view1 = (View) one.getModel();
+ View view2 = (View) other.getModel();
return view1 != null && view2 != null && view1.getElement() == view2.getElement();
}
return false;
}
- //The state is the union of all children states (e.g. if my compartment is hovered, then I am hovered)
- //Only children edit parts related to the same semantic element are taken into account
- //e.g. if a Class' property is hovered, the Class is *not* hovered
+ // The state is the union of all children states (e.g. if my compartment is hovered, then I am hovered)
+ // Only children edit parts related to the same semantic element are taken into account
+ // e.g. if a Class' property is hovered, the Class is *not* hovered
public Set<String> getState() {
Set<String> state = this.state;
Collection<EditPart> childEditParts = getChildEditParts();
- for(EditPart editPart : childEditParts) {
+ for (EditPart editPart : childEditParts) {
EventListenerEditPolicy childEditPolicy = getEditPolicy(editPart);
- if(childEditPolicy != null) {
+ if (childEditPolicy != null) {
Set<String> childState = childEditPolicy.getState();
state.addAll(childState);
}
@@ -162,52 +162,58 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
}
private EventListenerEditPolicy getEditPolicy(EditPart editPart) {
- return (EventListenerEditPolicy)editPart.getEditPolicy(ROLE);
+ return (EventListenerEditPolicy) editPart.getEditPolicy(ROLE);
}
private Collection<EditPart> getChildEditParts() {
List<EditPart> result = new LinkedList<EditPart>();
- for(Object editPart : getHost().getChildren()) {
- if(semanticCompareEditParts(getHost(), (EditPart)editPart)) {
- result.add((EditPart)editPart);
+ for (Object editPart : getHost().getChildren()) {
+ if (semanticCompareEditParts(getHost(), (EditPart) editPart)) {
+ result.add((EditPart) editPart);
}
}
return result;
}
- //Helper method: casts the host edit part to the right type.
+ // Helper method: casts the host edit part to the right type.
@Override
public GraphicalEditPart getHost() {
- return (GraphicalEditPart)super.getHost();
+ return (GraphicalEditPart) super.getHost();
}
/*
* Events support
*/
+ @Override
public void selectedStateChanged(EditPart editpart) {
- if((editpart.getSelected() & (EditPart.SELECTED_PRIMARY | EditPart.SELECTED)) != 0) {
+ if ((editpart.getSelected() & (EditPart.SELECTED_PRIMARY | EditPart.SELECTED)) != 0) {
addState(StatefulView.ACTIVE, StatefulView.FOCUS);
} else {
removeState(StatefulView.ACTIVE, StatefulView.FOCUS);
}
}
+ @Override
public void focusGained(FocusEvent fe) {
addState(StatefulView.FOCUS);
}
+ @Override
public void focusLost(FocusEvent fe) {
removeState(StatefulView.FOCUS);
}
+ @Override
public void mouseEntered(MouseEvent me) {
addState(StatefulView.HOVER);
}
+ @Override
public void mouseExited(MouseEvent me) {
removeState(StatefulView.HOVER);
}
+ @Override
public void mouseHover(MouseEvent me) {
addState(StatefulView.HOVER);
}
@@ -217,28 +223,34 @@ public class EventListenerEditPolicy extends AbstractEditPolicy implements EditP
* Ignored events
*/
+ @Override
public void mouseMoved(MouseEvent me) {
- //Ignore
+ // Ignore
}
+ @Override
public void mouseDragged(MouseEvent me) {
- //Ignore
+ // Ignore
}
+ @Override
public void childAdded(EditPart child, int index) {
- //Ignore
+ // Ignore
}
+ @Override
public void partActivated(EditPart editpart) {
- //Ignore
+ // Ignore
}
+ @Override
public void partDeactivated(EditPart editpart) {
- //Ignore
+ // Ignore
}
+ @Override
public void removingChild(EditPart child, int index) {
- //Ignore
+ // Ignore
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
index df9b7059a02..040b02fe35b 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/EventListenerEditPolicyProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -24,22 +24,23 @@ import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
/**
* An a provide which installs EventListenerEditPolicy on EditPart which support CSS Styling
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
-//TODO: Currently this provider is not plugged. Performance improvements are required
+// TODO: Currently this provider is not plugged. Performance improvements are required
public class EventListenerEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+ @Override
public boolean provides(IOperation operation) {
- CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
- if(!(editPart instanceof GraphicalEditPart)) {
+ if (!(editPart instanceof GraphicalEditPart)) {
return false;
}
EditingDomain domain = EMFHelper.resolveEditingDomain(editPart);
- if(domain == null) {
+ if (domain == null) {
return false;
}
@@ -47,6 +48,7 @@ public class EventListenerEditPolicyProvider extends AbstractProvider implements
return CSSHelper.isCSSSupported(resourceSet);
}
+ @Override
public void createEditPolicies(EditPart editPart) {
editPart.installEditPolicy(EventListenerEditPolicy.ROLE, new EventListenerEditPolicy());
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicy.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicy.java
index c5afb444a40..15da297ef86 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicy.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicy.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - refactor for non-workspace abstraction of problem markers (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.editpolicies;
@@ -38,7 +38,7 @@ import org.w3c.dom.Element;
/**
* An EditPolicy to handle marker events on semantic element associated with EditParts
- *
+ *
*/
public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements EditPolicy, EditPartListener {
@@ -50,13 +50,13 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
protected CssMarkerEventManagerService markerEventManagerService;
public MarkerEventListenerEditPolicy() {
- //Nothing
+ // Nothing
}
/**
* Register this edit policy with the marker event manager service.
* When an edit policy has to be notified, this must be done through this marker event manager service.
- *
+ *
* @see org.eclipse.gef.EditPolicy#activate()
*/
@Override
@@ -65,7 +65,7 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
ServicesRegistry servicesRegistry = ServiceUtilsForEditPart.getInstance().getServiceRegistry(getHost());
markerEventManagerService = servicesRegistry.getService(CssMarkerEventManagerService.class);
- if(markerEventManagerService != null) {
+ if (markerEventManagerService != null) {
markerEventManagerService.registerEditPolicy(this);
}
@@ -78,12 +78,12 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
/**
* Unregister this edit policy from the marker event manager service
- *
+ *
* @see org.eclipse.gef.EditPolicy#deactivate()
*/
@Override
public void deactivate() {
- if(markerEventManagerService != null) {
+ if (markerEventManagerService != null) {
markerEventManagerService.unregisterEditPolicy(this);
}
getHost().removeEditPartListener(this);
@@ -91,117 +91,122 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
}
protected View getSemanticView() {
- return (View)getHost().getModel();
+ return (View) getHost().getModel();
}
/**
* Updates the css state of the element associated with this edit policy
- *
+ *
* @param state
- * The css states to be added or removed from the current state
+ * The css states to be added or removed from the current state
* @param addedOrRemoved
- * Indicates wheter states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
- * IMarkerEventListener.MARKER_REMOVED)
+ * Indicates wheter states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
+ * IMarkerEventListener.MARKER_REMOVED)
*/
public void updateState(Set<String> state, int addedOrRemoved) {
MarkerEventListenerEditPolicy primaryEditPolicy = getPrimaryEditPolicy();
- if(primaryEditPolicy == this) {
+ if (primaryEditPolicy == this) {
View view = getSemanticView();
- if(view.getDiagram() instanceof CSSDiagram) {
- Element domElement = ((CSSDiagram)view.getDiagram()).getEngine().getElement(view);
- if(domElement instanceof StatefulView) {
- if(addedOrRemoved == IMarkerEventListener.MARKER_ADDED) {
- ((StatefulView)domElement).addStates(state);
+ if (view.getDiagram() instanceof CSSDiagram) {
+ Element domElement = ((CSSDiagram) view.getDiagram()).getEngine().getElement(view);
+ if (domElement instanceof StatefulView) {
+ if (addedOrRemoved == IMarkerEventListener.MARKER_ADDED) {
+ ((StatefulView) domElement).addStates(state);
} else {
- ((StatefulView)domElement).removeStates(state);
+ ((StatefulView) domElement).removeStates(state);
}
}
}
- } else if(primaryEditPolicy != null) {
+ } else if (primaryEditPolicy != null) {
primaryEditPolicy.updateState(state, addedOrRemoved);
}
}
/**
* Returns the primary edit policy
- *
+ *
* @return THe primary edit policy
*/
private MarkerEventListenerEditPolicy getPrimaryEditPolicy() {
EditPart current = getHost();
EditPart parent = current.getParent();
- while(parent != null && semanticCompareEditParts(parent, getHost())) {
+ while (parent != null && semanticCompareEditParts(parent, getHost())) {
current = parent;
parent = parent.getParent();
}
- return (MarkerEventListenerEditPolicy)current.getEditPolicy(ROLE);
+ return (MarkerEventListenerEditPolicy) current.getEditPolicy(ROLE);
}
/**
* Compares semantically the two given edit parts
- *
+ *
* @param one
- * The first edit part to be compared
+ * The first edit part to be compared
* @param other
- * The second edit part to be compared
+ * The second edit part to be compared
* @return True if the two edit parts refer to the same model element, false otherwise
*/
private boolean semanticCompareEditParts(EditPart one, EditPart other) {
- if(one.getModel() instanceof View && other.getModel() instanceof View) {
- View view1 = (View)one.getModel();
- View view2 = (View)other.getModel();
+ if (one.getModel() instanceof View && other.getModel() instanceof View) {
+ View view1 = (View) one.getModel();
+ View view2 = (View) other.getModel();
return view1 != null && view2 != null && view1.getElement() == view2.getElement();
}
return false;
}
- //Helper method: casts the host edit part to the right type.
+ // Helper method: casts the host edit part to the right type.
@Override
public GraphicalEditPart getHost() {
- return (GraphicalEditPart)super.getHost();
+ return (GraphicalEditPart) super.getHost();
}
/*
* Events support
*/
+ @Override
public void selectedStateChanged(EditPart editpart) {
- //Ignore
+ // Ignore
}
/*
* Ignored events
*/
+ @Override
public void childAdded(EditPart child, int index) {
- //Ignore
+ // Ignore
}
+ @Override
public void partActivated(EditPart editpart) {
- //Ignore
+ // Ignore
}
+ @Override
public void partDeactivated(EditPart editpart) {
- //Ignore
+ // Ignore
}
+ @Override
public void removingChild(EditPart child, int index) {
- //Ignore
+ // Ignore
}
/**
* Notifies this edit policy about a marker change
- *
+ *
* @param marker
- * The actual marker
+ * The actual marker
* @param addedOrRemoved
- * Indicates whether states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
- * IMarkerEventListener.MARKER_REMOVED)
+ * Indicates whether states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
+ * IMarkerEventListener.MARKER_REMOVED)
*/
public void notifyMarkerChange(IPapyrusMarker marker, int addedOrRemoved) {
String cssName = this.getPseudoSelector(marker);
- if(cssName != null && !"".equals(cssName)) {
+ if (cssName != null && !"".equals(cssName)) {
Set<String> state = new HashSet<String>();
state.add(cssName);
updateState(state, addedOrRemoved);
@@ -210,22 +215,22 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
/**
* Notifies this edit policy about multiple marker changes
- *
+ *
* @param markers
- * The actual markers
+ * The actual markers
* @param addedOrRemoved
- * Indicates whether states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
- * IMarkerEventListener.MARKER_REMOVED)
+ * Indicates whether states have to be added or removed (Possible values are IMarkerEventListener.MARKER_ADDED and
+ * IMarkerEventListener.MARKER_REMOVED)
*/
public void notifyMarkerChange(IPapyrusMarker[] markers, int addedOrRemoved) {
- if(markers.length == 0) {
+ if (markers.length == 0) {
return;
}
String cssName = "";
Set<String> state = new HashSet<String>();
- for(int i = 0; i < markers.length; i++) {
+ for (int i = 0; i < markers.length; i++) {
cssName = this.getPseudoSelector(markers[i]);
- if(cssName != null && !cssName.equals("")) {
+ if (cssName != null && !cssName.equals("")) {
state.add(cssName);
}
}
@@ -248,20 +253,20 @@ public class MarkerEventListenerEditPolicy extends AbstractEditPolicy implements
/**
* Convenience method returning the pseudo selector associated with a marker, using the MarkerToPseudoSelectorMappingService
- *
+ *
* @param marker
- * The marker for which
+ * The marker for which
* @return the pseudo selector associated with the given marker
*/
protected String getPseudoSelector(IPapyrusMarker marker) {
try {
- if(!marker.exists()) {
+ if (!marker.exists()) {
// Tries to retrieve it from the local map
String pseudoSelector = this.markerStringToMarkerPseudoSelector.get(marker.toString());
return pseudoSelector == null ? "" : pseudoSelector;
}
- if(this.markerToPseudoSelectorMappingService == null) {
+ if (this.markerToPseudoSelectorMappingService == null) {
return "";
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
index e03312299eb..f0b93f67921 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/editpolicies/MarkerEventListenerEditPolicyProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
@@ -25,19 +25,20 @@ import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
/**
* An edit policy provider for MarkerEvenListenerEditPolicy
- *
+ *
*/
public class MarkerEventListenerEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
+ @Override
public boolean provides(IOperation operation) {
- CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
+ CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation;
EditPart editPart = epOperation.getEditPart();
- if(!(editPart instanceof GraphicalEditPart)) {
+ if (!(editPart instanceof GraphicalEditPart)) {
return false;
}
EditingDomain domain = EMFHelper.resolveEditingDomain(editPart);
- if(domain == null) {
+ if (domain == null) {
return false;
}
@@ -45,6 +46,7 @@ public class MarkerEventListenerEditPolicyProvider extends AbstractProvider impl
return CSSHelper.isCSSSupported(resourceSet);
}
+ @Override
public void createEditPolicies(EditPart editPart) {
editPart.installEditPolicy(MarkerEventListenerEditPolicy.ROLE, new MarkerEventListenerEditPolicy());
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java
index afc1f8103a8..ffd02b307f8 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/BaseCSSEngine.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -25,11 +25,11 @@ import org.w3c.dom.Element;
/**
* The base CSS Engine. It contains the default stylesheet, which will be applied
* in all cases (With the lowest priority).
- *
+ *
* It should not be used directly.
- *
+ *
* @author Camille Letavernier
- *
+ *
* @see DiagramCSSEngine
*/
@SuppressWarnings("restriction")
@@ -52,12 +52,13 @@ public class BaseCSSEngine extends ExtendedCSSEngineImpl implements IRefreshHand
/**
* @see org.eclipse.papyrus.infra.gmfdiag.common.handler.IRefreshHandlerPart#refresh(org.eclipse.ui.IEditorPart)
*/
+ @Override
public void refresh(IEditorPart editorPart) {
// Resets this engine, regardless of the current editor
this.reset();
}
- //Unsupported operations. The BaseCSSEngine should never be used directly.
+ // Unsupported operations. The BaseCSSEngine should never be used directly.
@Override
public Element getElement(Object node) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
index 0ce237f7b86..51f21838aff 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/DiagramCSSEngine.java
@@ -44,9 +44,9 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
* Builds a DiagramCSSEngine for a given CSSDiagram
*
* @param parent
- * The diagram's parent CSSEngine. Its stylesheets will be inherited
+ * The diagram's parent CSSEngine. Its stylesheets will be inherited
* @param diagram
- * This engine's diagram
+ * This engine's diagram
*/
public DiagramCSSEngine(ExtendedCSSEngine parent, CSSDiagram diagram) {
super(parent);
@@ -58,8 +58,8 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
@Override
protected void reloadStyleSheets() {
styleSheets.clear();
- for(StyleSheet styleSheet : diagram.getStyleSheets()) {
- //Do not call super#addStyleSheet(styleSheet) to avoid a StackOverFlow
+ for (StyleSheet styleSheet : diagram.getStyleSheets()) {
+ // Do not call super#addStyleSheet(styleSheet) to avoid a StackOverFlow
styleSheets.add(styleSheet);
}
}
@@ -67,7 +67,7 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
@Override
protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
String path = styleSheet.getPath();
- if(path.startsWith("/")) { //Either plug-in or workspace
+ if (path.startsWith("/")) { // Either plug-in or workspace
path = "platform:/resource" + path;
URL url = new URL(path);
try {
@@ -77,7 +77,7 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
}
} else {
URI uri = URI.createURI(styleSheet.getPath());
- if(uri.isRelative()) {
+ if (uri.isRelative()) {
uri = uri.resolve(diagram.eResource().getURI());
}
@@ -96,42 +96,42 @@ public class DiagramCSSEngine extends ExtendedCSSEngineImpl implements IChangeLi
public EObject getNativeWidget(Object element) {
element = super.getNativeWidget(element);
- if(element == null) {
+ if (element == null) {
return null;
}
- if(!(element instanceof EObject)) {
+ if (!(element instanceof EObject)) {
throw new IllegalArgumentException("Unknown element : " + element);
}
- return (EObject)element; //GMFElement
+ return (EObject) element; // GMFElement
}
@Override
public void handleChange(ChangeEvent event) {
resetCache();
DiagramHelper.setNeedsRefresh();
- DiagramHelper.refreshDiagrams(); //FIXME: Should be contextual. We should only refresh the editor(s) containing this Diagram
+ DiagramHelper.refreshDiagrams(); // FIXME: Should be contextual. We should only refresh the editor(s) containing this Diagram
}
@Override
public Element getElement(Object node) {
- if(node == null) {
+ if (node == null) {
return null;
}
EObject notationElement = getNativeWidget(node);
View canonicalNotationElement = CSSDOMSemanticElementHelper.findPrimaryView(notationElement);
- //Orphaned view
- if(canonicalNotationElement.getDiagram() == null) {
+ // Orphaned view
+ if (canonicalNotationElement.getDiagram() == null) {
return null;
}
- //A View and a Compartment associated to the same Semantic Element
- //must have the same XML Element. They share the same children.
- //This is required to map the Semantic model (Used by the CSS selectors)
- //to the Notation model (Used by the CSS properties)
+ // A View and a Compartment associated to the same Semantic Element
+ // must have the same XML Element. They share the same children.
+ // This is required to map the Semantic model (Used by the CSS selectors)
+ // to the Notation model (Used by the CSS properties)
return super.getElement(canonicalNotationElement);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ElementProviderWrapper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ElementProviderWrapper.java
index 02e646efec5..3b10e110137 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ElementProviderWrapper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ElementProviderWrapper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -27,7 +27,7 @@ import org.w3c.dom.Element;
/**
* Provides an Element for a GMF Notation object.
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -43,12 +43,13 @@ public class ElementProviderWrapper implements IElementProvider {
/**
* {@inheritDoc}
- *
+ *
* @param element
- * A GMF View
+ * A GMF View
* @param engine
- * An ExtendedCSSEngine
+ * An ExtendedCSSEngine
*/
+ @Override
public Element getElement(Object element, CSSEngine engine) {
return delegate.getElement(element, engine);
}
@@ -57,13 +58,13 @@ public class ElementProviderWrapper implements IElementProvider {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT);
- //Ordered Factories (Map of Lists to allow equalities)
+ // Ordered Factories (Map of Lists to allow equalities)
SortedMap<Integer, List<ICSSElementProviderFactory>> sortedFactories = new TreeMap<Integer, List<ICSSElementProviderFactory>>();
- for(IConfigurationElement e : config) {
+ for (IConfigurationElement e : config) {
try {
final int order = Integer.parseInt(e.getAttribute("order")); //$NON-NLS-1$
- final ICSSElementProviderFactory factory = (ICSSElementProviderFactory)e.createExecutableExtension("factory"); //$NON-NLS-1$
+ final ICSSElementProviderFactory factory = (ICSSElementProviderFactory) e.createExecutableExtension("factory"); //$NON-NLS-1$
getFactories(sortedFactories, order).add(factory);
} catch (Exception ex) {
@@ -71,9 +72,9 @@ public class ElementProviderWrapper implements IElementProvider {
}
}
- //SortedMap to List
+ // SortedMap to List
List<ICSSElementProviderFactory> factories = new LinkedList<ICSSElementProviderFactory>();
- for(List<ICSSElementProviderFactory> factoriesEntry : sortedFactories.values()) {
+ for (List<ICSSElementProviderFactory> factoriesEntry : sortedFactories.values()) {
factories.addAll(factoriesEntry);
}
@@ -81,15 +82,15 @@ public class ElementProviderWrapper implements IElementProvider {
}
private List<ICSSElementProviderFactory> getFactories(Map<Integer, List<ICSSElementProviderFactory>> sortedFactories, int order) {
- if(!sortedFactories.containsKey(order)) {
+ if (!sortedFactories.containsKey(order)) {
sortedFactories.put(order, new LinkedList<ICSSElementProviderFactory>());
}
return sortedFactories.get(order);
}
private IElementProvider getElementProviderFor(CSSDiagram diagram) {
- for(ICSSElementProviderFactory providerFactory : getCSSElementProviders()) {
- if(providerFactory.isProviderFor(diagram)) {
+ for (ICSSElementProviderFactory providerFactory : getCSSElementProviders()) {
+ if (providerFactory.isProviderFor(diagram)) {
return providerFactory.createProvider(diagram);
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java
index 8c522bb169f..25036b6f4e3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngine.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.w3c.dom.css.CSSValue;
/**
* An extended, lazy version of a CSSEngine
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -27,14 +27,14 @@ public interface ExtendedCSSEngine extends LazyCSSEngine, CSSEngine {
/**
* Adds a listener to be notified each time a StyleSheet has changed
- *
+ *
* @param listener
*/
public void addStyleSheetChangeListener(StyleSheetChangeListener listener);
/**
* Removes a StyleSheetChangeListener
- *
+ *
* @param listener
*/
public void removeStyleSheetChangedListener(StyleSheetChangeListener listener);
@@ -47,35 +47,37 @@ public interface ExtendedCSSEngine extends LazyCSSEngine, CSSEngine {
/**
* {@inheritDoc}
- *
+ *
* This method never throws an Exception
*/
+ @Override
public Object convert(CSSValue cssValue, Object toType, Object context);
/**
* {@inheritDoc}
- *
+ *
* Should be called when the StyleSheets have changed
*/
+ @Override
public void reset();
/**
* Resets the CSS cache
- *
+ *
* Should be called when the semantic model has changed.
*/
public void resetCache();
/**
* Notifies a change from the given Element
- *
+ *
* @param element
*/
public void notifyChange(Element element);
/**
* Notifies the Engine that the given widget has been disposed
- *
+ *
* @param nativeWidget
*/
public void handleDispose(Object nativeWidget);
@@ -83,5 +85,6 @@ public interface ExtendedCSSEngine extends LazyCSSEngine, CSSEngine {
/**
* {@inheritDoc}
*/
+ @Override
public Element getElement(Object node);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
index 463ddf47f6a..a2f1e69c764 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ExtendedCSSEngineImpl.java
@@ -56,7 +56,7 @@ import org.w3c.dom.stylesheets.StyleSheetList;
*
* @author Camille Letavernier
*/
-//TODO : Listen on stylesheet modifications
+// TODO : Listen on stylesheet modifications
@SuppressWarnings("restriction")
public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements ExtendedCSSEngine, StyleSheetChangeListener {
@@ -99,7 +99,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
}
private void init(ExtendedCSSEngine parent) {
- if(parent != null) {
+ if (parent != null) {
parent.addStyleSheetChangeListener(this);
}
viewCSS = new ExtendedViewCSSImpl(this);
@@ -119,13 +119,13 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
@Override
public String retrieveCSSProperty(Object widget, String property, String pseudo) {
Element element;
- if(widget instanceof Element) {
- element = (Element)widget;
+ if (widget instanceof Element) {
+ element = (Element) widget;
} else {
element = getElement(widget);
}
CSSValue value = retrievePropertyValue(element, property);
- if(value == null) {
+ if (value == null) {
return null;
}
return value.getCssText();
@@ -136,7 +136,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
*/
@Override
public CSSValue retrievePropertyValue(Object node, String property) {
- if(node == null || property == null) {
+ if (node == null || property == null) {
return null;
}
@@ -151,10 +151,10 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
private CSSStyleDeclaration getStyleDeclaration(Object node, String pseudo) {
Element element = getElement(node);
- if(element == null) {
+ if (element == null) {
return new CSSStyleDeclarationImpl(null);
}
- if(!declarationsCache.containsKey(element)) {
+ if (!declarationsCache.containsKey(element)) {
declarationsCache.put(element, getViewCSS().getComputedStyle(element, pseudo));
}
return declarationsCache.get(element);
@@ -177,11 +177,11 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
* not added dynamically.
*/
protected void reloadStyleSheets() {
- //Do nothing
+ // Do nothing
}
- //FIXME : Determine precisely the lifecycle of the cache
- //When is it built ; when is it cleaned
+ // FIXME : Determine precisely the lifecycle of the cache
+ // When is it built ; when is it cleaned
/**
* {@inheritDoc}
*/
@@ -196,19 +196,19 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
*/
protected void parseStyleSheets() {
reloadStyleSheets();
- for(URL styleSheet : styleSheetURLs) {
+ for (URL styleSheet : styleSheetURLs) {
try {
parseStyleSheet(styleSheet.openStream());
} catch (IOException ex) {
handleExceptions(ex);
}
}
- for(StyleSheet styleSheet : styleSheets) {
+ for (StyleSheet styleSheet : styleSheets) {
try {
- if(styleSheet instanceof EmbeddedStyleSheet) {
- parseStyleSheet((EmbeddedStyleSheet)styleSheet);
- } else if(styleSheet instanceof StyleSheetReference) {
- parseStyleSheet((StyleSheetReference)styleSheet);
+ if (styleSheet instanceof EmbeddedStyleSheet) {
+ parseStyleSheet((EmbeddedStyleSheet) styleSheet);
+ } else if (styleSheet instanceof StyleSheetReference) {
+ parseStyleSheet((StyleSheetReference) styleSheet);
}
} catch (IOException ex) {
handleExceptions(ex);
@@ -225,7 +225,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
String path = styleSheet.getPath();
- if(path.startsWith("/")) {
+ if (path.startsWith("/")) {
path = "platform:/resource" + path;
}
@@ -235,10 +235,10 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
@Override
public CSSParser makeCSSParser() {
- //TODO : Extended parser (CSSX)
- //if(isExtended) {
- // return makeExtendedCSSParser();
- //}
+ // TODO : Extended parser (CSSX)
+ // if(isExtended) {
+ // return makeExtendedCSSParser();
+ // }
// Create CSS Parser
ICSSParserFactory factory = CSSParserFactory.newInstance();
@@ -272,7 +272,7 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
* {@inheritDoc}
*/
private void fireStyleSheetChanged() {
- for(StyleSheetChangeListener listener : styleSheetListeners) {
+ for (StyleSheetChangeListener listener : styleSheetListeners) {
listener.styleSheetChanged(this);
}
}
@@ -298,11 +298,11 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
*/
@Override
public ExtendedStyleSheetList getAllStylesheets() {
- if(styleSheetsList == null) {
+ if (styleSheetsList == null) {
parseStyleSheets();
styleSheetsList = new ExtendedStyleSheetList();
- if(parent != null) {
- styleSheetsList.addAll((StyleSheetList)parent.getAllStylesheets());
+ if (parent != null) {
+ styleSheetsList.addAll((StyleSheetList) parent.getAllStylesheets());
}
styleSheetsList.addAll(getDocumentCSS().getStyleSheets());
}
@@ -318,16 +318,16 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
try {
return super.convert(value, toType, context);
} catch (Exception ex) {
- //Activator.log.warn("Unsupported CSS value: " + value.getCssText() + ". Trying to convert it...");
- return convert(value, toType); //FIXME: Sometimes, the conversion is not supported by the AbstractCSSEngine
+ // Activator.log.warn("Unsupported CSS value: " + value.getCssText() + ". Trying to convert it...");
+ return convert(value, toType); // FIXME: Sometimes, the conversion is not supported by the AbstractCSSEngine
}
}
- //Smaller implementation of convert(). Doesn't rely on cache nor any kind of registry
- //Call this method when the super implementation fails (UnsupportedOperationException...)
+ // Smaller implementation of convert(). Doesn't rely on cache nor any kind of registry
+ // Call this method when the super implementation fails (UnsupportedOperationException...)
protected Object convert(CSSValue value, Object toType) {
ICSSValueConverter converter = getCSSValueConverter(toType);
- if(converter != null) {
+ if (converter != null) {
try {
return converter.convert(value, this, null);
} catch (Exception ex) {
@@ -343,11 +343,11 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
@Override
public void dispose() {
styleSheetListeners.clear();
- if(parent != null) {
+ if (parent != null) {
parent.removeStyleSheetChangedListener(this);
}
- getElementsContext(); //FIXME: Avoid a NullPointerException in super.dispose()...
+ getElementsContext(); // FIXME: Avoid a NullPointerException in super.dispose()...
super.dispose();
}
@@ -360,16 +360,16 @@ public abstract class ExtendedCSSEngineImpl extends AbstractCSSEngine implements
*/
@Override
public void notifyChange(Element elementAdapter) {
- resetCache(); //TODO: We should only refresh a subset of the cache
+ resetCache(); // TODO: We should only refresh a subset of the cache
- //FIXME: It seems the refresh can create a deadlock in some cases
+ // FIXME: It seems the refresh can create a deadlock in some cases
DiagramHelper.setNeedsRefresh();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- DiagramHelper.refreshDiagrams(); //TODO: Contextual refresh
+ DiagramHelper.refreshDiagrams(); // TODO: Contextual refresh
}
});
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFElementProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFElementProvider.java
index 8584cbbaf59..92f8771ee35 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFElementProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFElementProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.w3c.dom.Element;
/**
* Provides an Element for a GMF Notation object.
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -27,23 +27,24 @@ public class GMFElementProvider implements IElementProvider {
/**
* {@inheritDoc}
- *
+ *
* @param element
- * A GMF View
+ * A GMF View
* @param engine
- * An ExtendedCSSEngine
+ * An ExtendedCSSEngine
*/
+ @Override
public Element getElement(Object element, CSSEngine engine) {
- if(!(element instanceof View)) {
+ if (!(element instanceof View)) {
throw new IllegalArgumentException("Unknown element : " + element);
}
- if(!(engine instanceof ExtendedCSSEngine)) {
+ if (!(engine instanceof ExtendedCSSEngine)) {
throw new IllegalArgumentException("Invalid CSS Engine : " + engine);
}
- return new GMFElementAdapter((View)element, (ExtendedCSSEngine)engine);
+ return new GMFElementAdapter((View) element, (ExtendedCSSEngine) engine);
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFErrorHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFErrorHandler.java
index 48aaa6ed2d5..2ab4408337a 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFErrorHandler.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/GMFErrorHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -16,7 +16,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
/**
* A CSSErrorHandler which forwards exceptions to the Papyrus log
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -24,9 +24,10 @@ public class GMFErrorHandler implements CSSErrorHandler {
/**
* {@inheritDoc}
- *
+ *
* Forwards the exception to the Papyrus log
*/
+ @Override
public void error(Exception ex) {
Activator.log.error("CSS Error", ex); //$NON-NLS-1$
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ICSSElementProviderFactory.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ICSSElementProviderFactory.java
index 2656ef38071..6ad8bf102ed 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ICSSElementProviderFactory.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ICSSElementProviderFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/LazyCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/LazyCSSEngine.java
index 441674f1b39..2ab3e4e95b4 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/LazyCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/LazyCSSEngine.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -16,17 +16,17 @@ import org.w3c.dom.css.CSSValue;
/**
* An interface for Lazy CSS Engine
- *
+ *
* The Engine doesn't modify an Element. Instead, for an element, it returns the
* value of the required property.
- *
+ *
* @author Camille Letavernier
*/
public interface LazyCSSEngine {
/**
* Lazily retrieves a property's value on the selected node
- *
+ *
* @param node
* @param property
* @return
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java
index de95d45f224..714b337633a 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ModelCSSEngine.java
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 429422
* Mickael ADAM (ALL4TEC) mickael.adam@ALL4TEC.net - bug 429642
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.engine;
@@ -51,12 +51,14 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
/** A adapter for the model styleSheet. */
Adapter adapter = new AdapterImpl() {
+ @Override
public void notifyChanged(Notification notification) {
ModelCSSEngine.this.reset();
DiagramHelper.setNeedsRefresh();
Display.getDefault().asyncExec(new Runnable() {
+ @Override
public void run() {
DiagramHelper.refreshDiagrams();
}
@@ -77,14 +79,14 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
/**
* Initialize the adapter attached to model styleSheet.
- *
+ *
*/
public void initAdapter() {
- for(EObject eObject : model.getContents()) {
- if(eObject instanceof ModelStyleSheets) {
- ModelStyleSheets styleSheets = (ModelStyleSheets)eObject;
+ for (EObject eObject : model.getContents()) {
+ if (eObject instanceof ModelStyleSheets) {
+ ModelStyleSheets styleSheets = (ModelStyleSheets) eObject;
styleSheets.eAdapters().add(adapter);
- for(StyleSheet styleSheet : styleSheets.getStylesheets()) {
+ for (StyleSheet styleSheet : styleSheets.getStylesheets()) {
styleSheet.eAdapters().add(adapter);
}
}
@@ -94,8 +96,8 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
private static ExtendedCSSEngine getParentCSSEngine(Resource resource) {
ExtendedCSSEngine result;
- if(resource instanceof CSSNotationResource) {
- result = ((CSSNotationResource)resource).getProjectEngine();
+ if (resource instanceof CSSNotationResource) {
+ result = ((CSSNotationResource) resource).getProjectEngine();
} else {
result = ProjectCSSEngine.createEngine(resource);
}
@@ -106,10 +108,10 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
@Override
protected void reloadStyleSheets() {
this.styleSheets.clear();
- for(EObject eObject : model.getContents()) {
- if(eObject instanceof ModelStyleSheets) {
- ModelStyleSheets styleSheets = (ModelStyleSheets)eObject;
- for(StyleSheet styleSheet : styleSheets.getStylesheets()) {
+ for (EObject eObject : model.getContents()) {
+ if (eObject instanceof ModelStyleSheets) {
+ ModelStyleSheets styleSheets = (ModelStyleSheets) eObject;
+ for (StyleSheet styleSheet : styleSheets.getStylesheets()) {
this.styleSheets.add(styleSheet);
}
}
@@ -119,7 +121,7 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
@Override
protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
String path = styleSheet.getPath();
- if(path.startsWith("/")) { //Either plug-in or workspace
+ if (path.startsWith("/")) { // Either plug-in or workspace
path = "platform:/resource" + path;
URL url = new URL(path);
try {
@@ -138,11 +140,11 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
@Override
public void dispose() {
- for(EObject eObject : model.getContents()) {
- if(eObject instanceof ModelStyleSheets) {
- ModelStyleSheets styleSheets = (ModelStyleSheets)eObject;
+ for (EObject eObject : model.getContents()) {
+ if (eObject instanceof ModelStyleSheets) {
+ ModelStyleSheets styleSheets = (ModelStyleSheets) eObject;
styleSheets.eAdapters().remove(adapter);
- for(StyleSheet styleSheet : styleSheets.getStylesheets()) {
+ for (StyleSheet styleSheet : styleSheets.getStylesheets()) {
styleSheet.eAdapters().remove(adapter);
}
}
@@ -150,7 +152,7 @@ public class ModelCSSEngine extends ExtendedCSSEngineImpl {
super.dispose();
}
- //Unsupported operations. The ModelCSSEngine should not be used directly.
+ // Unsupported operations. The ModelCSSEngine should not be used directly.
@Override
public Element getElement(Object node) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ProjectCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ProjectCSSEngine.java
index 872d14c1dba..12b48f61792 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ProjectCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/ProjectCSSEngine.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013, 2014 CEA LIST 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
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 429422
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.engine;
@@ -39,28 +39,31 @@ import org.eclipse.swt.widgets.Display;
/**
* A CSS Engine for the current Eclipse Project
- *
+ *
* Note: Some models are not necessarily stored in a Project (e.g. CDO Models)
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
private IResourceChangeListener resourceListener = new IResourceChangeListener() {
+ @Override
public void resourceChanged(IResourceChangeEvent event) {
- if(project != null) {
+ if (project != null) {
try {
- if(event != null && event.getDelta() != null) {
+ if (event != null && event.getDelta() != null) {
event.getDelta().accept(new IResourceDeltaVisitor() {
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
- if(delta.getResource().equals(stylesheetPreferences)) {
+ if (delta.getResource().equals(stylesheetPreferences)) {
ProjectCSSEngine.this.reset();
DiagramHelper.setNeedsRefresh();
Display.getDefault().asyncExec(new Runnable() {
+ @Override
public void run() {
DiagramHelper.refreshDiagrams();
}
@@ -84,7 +87,7 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
/**
* The file name of the EMF Model containing the {@link StyleSheet}s.
* It will be stored in the project's preferences scope (Typically the .settings folder)
- *
+ *
* @see {@link ProjectScope}
*/
public static String PROJECT_STYLESHEETS = "stylesheets.xmi"; //$NON-NLS-1$
@@ -104,7 +107,7 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
super(WorkspaceCSSEngine.instance);
URI resourceURI = modelResource.getURI();
- if(resourceURI.isPlatformResource()) {
+ if (resourceURI.isPlatformResource()) {
String platformString = resourceURI.toPlatformString(true);
try {
IPath workspacePath = new Path(platformString);
@@ -123,7 +126,7 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
super(WorkspaceCSSEngine.instance);
this.project = project;
-
+
try {
IPath preferencesAbsolutePath = new ProjectScope(project).getLocation().append(PROJECT_STYLESHEETS);
IPath projectRelativePath = preferencesAbsolutePath.makeRelativeTo(project.getLocation());
@@ -133,20 +136,20 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
Activator.log.error(ex);
}
}
-
+
/**
* Creates the project-scoped CSS engine for the project containing the specified {@code modelResource}, if such
* project actually exists.
- *
+ *
* @param modelResource
- * a model resource
+ * a model resource
* @return the containing project's CSS engine, or {@code null} if the containing project does not exist
*/
public static ProjectCSSEngine createEngine(Resource modelResource) {
ProjectCSSEngine result = null;
-
+
URI resourceURI = modelResource.getURI();
- if(resourceURI.isPlatformResource()) {
+ if (resourceURI.isPlatformResource()) {
String platformString = resourceURI.toPlatformString(true);
try {
IPath workspacePath = new Path(platformString);
@@ -155,11 +158,11 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
result = new ProjectCSSEngine(project);
}
} catch (Exception ex) {
- // It's OK. We'll return a null result because it wouldn't be a valid CSS engine
+ // It's OK. We'll return a null result because it wouldn't be a valid CSS engine
Activator.log.error(ex);
}
}
-
+
return result;
}
@@ -172,11 +175,11 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
@Override
protected void reloadStyleSheets() {
styleSheets.clear();
- if(project == null || !project.exists() || !project.isOpen()) {
+ if (project == null || !project.exists() || !project.isOpen()) {
return;
}
- if(stylesheetPreferences == null || !stylesheetPreferences.exists()) {
+ if (stylesheetPreferences == null || !stylesheetPreferences.exists()) {
return;
}
@@ -187,10 +190,10 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
ResourceSet resourceSet = new ResourceSetImpl();
try {
Resource stylesheetsResource = resourceSet.getResource(workspaceURI, true);
- for(EObject rootElement : stylesheetsResource.getContents()) {
- if(rootElement instanceof StyleSheet) {
- //Do not call super#addStyleSheet(styleSheet) to avoid a StackOverFlow
- styleSheets.add((StyleSheet)rootElement);
+ for (EObject rootElement : stylesheetsResource.getContents()) {
+ if (rootElement instanceof StyleSheet) {
+ // Do not call super#addStyleSheet(styleSheet) to avoid a StackOverFlow
+ styleSheets.add((StyleSheet) rootElement);
}
}
} catch (Exception ex) {
@@ -202,14 +205,14 @@ public class ProjectCSSEngine extends ExtendedCSSEngineImpl {
@Override
protected void parseStyleSheet(StyleSheetReference styleSheet) throws IOException {
String path = styleSheet.getPath();
- if(path.startsWith("/")) { //$NON-NLS-1$
+ if (path.startsWith("/")) { //$NON-NLS-1$
super.parseStyleSheet(styleSheet);
} else {
- //Parse relative paths from the Project
- if(project != null && project.exists() && project.isOpen()) {
+ // Parse relative paths from the Project
+ if (project != null && project.exists() && project.isOpen()) {
IFile file = project.getFile(path);
- if(file.exists()) {
+ if (file.exists()) {
try {
parseStyleSheet(file.getContents());
} catch (CoreException ex) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
index c0c64096067..d8dbb7c4992 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/WorkspaceCSSEngine.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -28,13 +28,13 @@ import org.w3c.dom.Element;
/**
* A Singleton CSSEngine, handling the CSS stylesheets applied to the whole
* workspace.
- *
+ *
* This Engine is a child of the BaseCSSEngine.
- *
+ *
* It should not be used directly.
- *
+ *
* @author Camille Letavernier
- *
+ *
* @see DiagramCSSEngine
*/
@SuppressWarnings("restriction")
@@ -50,16 +50,16 @@ public class WorkspaceCSSEngine extends ExtendedCSSEngineImpl {
protected void reloadStyleSheets() {
styleSheetURLs.clear();
styleSheets.clear();
- for(StyleSheet styleSheet : ThemeManager.instance.getWorkspaceStyleSheets()) {
+ for (StyleSheet styleSheet : ThemeManager.instance.getWorkspaceStyleSheets()) {
- if(styleSheet instanceof StyleSheetReference) {
- IFile iFile = FileUtil.getIFile(((StyleSheetReference)styleSheet).getPath());
- if(iFile != null) {
+ if (styleSheet instanceof StyleSheetReference) {
+ IFile iFile = FileUtil.getIFile(((StyleSheetReference) styleSheet).getPath());
+ if (iFile != null) {
styleSheets.add(styleSheet);
} else {
try {
- URL styleSheetURL = new URL(((StyleSheetReference)styleSheet).getPath());
+ URL styleSheetURL = new URL(((StyleSheetReference) styleSheet).getPath());
styleSheetURLs.add(styleSheetURL);
} catch (MalformedURLException e) {
Activator.log.error(e);
@@ -73,7 +73,7 @@ public class WorkspaceCSSEngine extends ExtendedCSSEngineImpl {
}
}
- //Unsupported operations. The WorkspaceCSSEngine should never be used directly.
+ // Unsupported operations. The WorkspaceCSSEngine should never be used directly.
@Override
public Element getElement(Object node) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/CSSComputedStyleImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/CSSComputedStyleImpl.java
index a9852b884e2..59dfd184cc7 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/CSSComputedStyleImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/CSSComputedStyleImpl.java
@@ -27,7 +27,7 @@ import org.w3c.dom.css.CSSStyleDeclaration;
* styles coming from Condition Selector (ex : Label#MyId) and other selectors
* (ex : Label).
*/
-//Copied from org.eclipse.e4.ui.css.core.impl.dom.CSSComputedStyleImpl
+// Copied from org.eclipse.e4.ui.css.core.impl.dom.CSSComputedStyleImpl
@SuppressWarnings({ "serial", "restriction" })
public class CSSComputedStyleImpl extends CSSStyleDeclarationImpl implements CSSStyleDeclaration {
@@ -40,15 +40,15 @@ public class CSSComputedStyleImpl extends CSSStyleDeclarationImpl implements CSS
// only once after reading the stylesheet(s).
Collections.sort(this.styleRules, StyleWrapper.COMPARATOR);
Iterator<StyleWrapper> iterator = this.styleRules.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
StyleWrapper styleWrapper = iterator.next();
- addCSSPropertyList(((CSSStyleDeclarationImpl)styleWrapper.style).getCSSPropertyList());
+ addCSSPropertyList(((CSSStyleDeclarationImpl) styleWrapper.style).getCSSPropertyList());
}
}
private void addCSSPropertyList(CSSPropertyList properties) {
int length = properties.getLength();
- for(int i = 0; i < length; i++) {
+ for (int i = 0; i < length; i++) {
CSSProperty property = properties.item(i);
super.removeProperty(property.getName());
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java
index 408f11ad366..f01cb9a2422 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/ExtendedViewCSSImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -45,30 +45,31 @@ public class ExtendedViewCSSImpl implements ViewCSS {
/**
* {@inheritDoc}
- *
+ *
* Implementation based on {@link ViewCSSImpl#getComputedStyle(Element, String)}.
* The base implementations returns the first CSSStyleDeclaration.
- *
+ *
* When a StyleDeclaration is found in a StyleSheet, it is added to a list of declarations.
* Then, these declarations are merged
*/
+ @Override
public CSSStyleDeclaration getComputedStyle(Element elt, String pseudo) {
ExtendedStyleSheetList styleSheetList = engine.getAllStylesheets();
List<StyleWrapper> declarations = new ArrayList<StyleWrapper>();
- //Stylesheets
- for(StyleSheet styleSheet : styleSheetList) {
- List<StyleWrapper> styleWrappers = getStyleWrappers((CSSStyleSheet)styleSheet, elt, pseudo, declarations.size());
+ // Stylesheets
+ for (StyleSheet styleSheet : styleSheetList) {
+ List<StyleWrapper> styleWrappers = getStyleWrappers((CSSStyleSheet) styleSheet, elt, pseudo, declarations.size());
declarations.addAll(styleWrappers);
}
- //Local styles
- String localStyles = ((CSSStylableElement)elt).getCSSStyle();
- if(localStyles != null) {
+ // Local styles
+ String localStyles = ((CSSStylableElement) elt).getCSSStyle();
+ if (localStyles != null) {
StyleWrapper wrapper = getStyleWrapper(localStyles);
- if(wrapper != null) {
+ if (wrapper != null) {
declarations.add(wrapper);
}
}
@@ -90,27 +91,27 @@ public class ExtendedViewCSSImpl implements ViewCSS {
/**
* Implementation based on {@link ViewCSSImpl#getComputedStyle(CSSStyleSheet, Element, String)}
- *
+ *
* Returns the StyleWrappers instead of a StyleDeclaration
*/
private List<StyleWrapper> getStyleWrappers(CSSStyleSheet styleSheet, Element elt, String pseudoElt, int position) {
List<StyleWrapper> styleDeclarations = new ArrayList<StyleWrapper>();
CSSRuleList ruleList = styleSheet.getCssRules();
int length = ruleList.getLength();
- for(int i = 0; i < length; i++) {
+ for (int i = 0; i < length; i++) {
CSSRule rule = ruleList.item(i);
- if(rule.getType() == CSSRule.STYLE_RULE) {
- CSSStyleRule styleRule = (CSSStyleRule)rule;
- if(rule instanceof ExtendedCSSRule) {
- ExtendedCSSRule r = (ExtendedCSSRule)rule;
+ if (rule.getType() == CSSRule.STYLE_RULE) {
+ CSSStyleRule styleRule = (CSSStyleRule) rule;
+ if (rule instanceof ExtendedCSSRule) {
+ ExtendedCSSRule r = (ExtendedCSSRule) rule;
SelectorList selectorList = r.getSelectorList();
// Loop for SelectorList
int l = selectorList.getLength();
- for(int j = 0; j < l; j++) {
+ for (int j = 0; j < l; j++) {
Selector selector = selectorList.item(j);
- if(selector instanceof ExtendedSelector) {
- ExtendedSelector extendedSelector = (ExtendedSelector)selector;
- if(extendedSelector.match(elt, pseudoElt)) {
+ if (selector instanceof ExtendedSelector) {
+ ExtendedSelector extendedSelector = (ExtendedSelector) selector;
+ if (extendedSelector.match(elt, pseudoElt)) {
CSSStyleDeclaration style = styleRule.getStyle();
int specificity = extendedSelector.getSpecificity();
StyleWrapper wrapper = new StyleWrapper(style, specificity, position++);
@@ -133,10 +134,11 @@ public class ExtendedViewCSSImpl implements ViewCSS {
/**
* {@inheritDoc}
- *
+ *
* Unsupported
* TODO : Do we need an implementation ?
*/
+ @Override
public DocumentView getDocument() {
return null;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/StyleWrapper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/StyleWrapper.java
index b443f5bf561..7fd646de3b3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/StyleWrapper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/engine/enginecopy/StyleWrapper.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (c) 2009 EclipseSource 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,
+ * 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:
@@ -18,20 +18,21 @@ import org.w3c.dom.css.CSSStyleDeclaration;
* together with all the information needed to calculate a matching selector's
* precedence.
*/
-//Copied from org.eclipse.e4.ui.css.core.impl.dom.StyleWrapper
+// Copied from org.eclipse.e4.ui.css.core.impl.dom.StyleWrapper
final class StyleWrapper {
private static class StyleWrapperComparator implements Comparator<StyleWrapper> {
+ @Override
public int compare(final StyleWrapper wrapper1, final StyleWrapper wrapper2) {
int result = 0;
- if(wrapper1.specificity > wrapper2.specificity) {
+ if (wrapper1.specificity > wrapper2.specificity) {
result = 1;
- } else if(wrapper1.specificity < wrapper2.specificity) {
+ } else if (wrapper1.specificity < wrapper2.specificity) {
result = -1;
- } else if(wrapper1.position > wrapper2.position) {
+ } else if (wrapper1.position > wrapper2.position) {
result = 1;
- } else if(wrapper1.position < wrapper2.position) {
+ } else if (wrapper1.position < wrapper2.position) {
result = -1;
}
return result;
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java
index 2cbfb1c521e..8f2835b3c5c 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/handler/ResetStyleHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -25,36 +25,37 @@ import org.eclipse.papyrus.infra.gmfdiag.css.helper.ResetStyleHelper;
/**
* This handler resets all the local appearance to their default value
* for a set of GMF Views.
- *
+ *
* @author Camille Letavernier
- *
+ *
* @deprecated Not used. Use ResetStyleHelper instead
*/
@Deprecated
public class ResetStyleHandler extends AbstractHandler {
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection;
try {
- //FIXME: Use ServiceUtilsForHandlers
- //FIXME: This method is sometimes called manually with a null ExecutionEvent. It won't work with ServiceUtilsForHandlers
+ // FIXME: Use ServiceUtilsForHandlers
+ // FIXME: This method is sometimes called manually with a null ExecutionEvent. It won't work with ServiceUtilsForHandlers
IMultiDiagramEditor editor = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry().getService(IMultiDiagramEditor.class);
selection = editor.getEditorSite().getSelectionProvider().getSelection();
} catch (ServiceException ex) {
throw new ExecutionException(ex.getMessage(), ex);
}
- // selection = HandlerUtil.getCurrentSelection(event);
- if(selection == null || selection.isEmpty()) {
+ // selection = HandlerUtil.getCurrentSelection(event);
+ if (selection == null || selection.isEmpty()) {
return null;
}
- if(!(selection instanceof IStructuredSelection)) {
+ if (!(selection instanceof IStructuredSelection)) {
return null;
}
- IStructuredSelection sSelection = (IStructuredSelection)selection;
+ IStructuredSelection sSelection = (IStructuredSelection) selection;
ResetStyleHelper.resetStyle(sSelection);
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSDOMSemanticElementHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSDOMSemanticElementHelper.java
index f138f720b93..e5d02d52191 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSDOMSemanticElementHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSDOMSemanticElementHelper.java
@@ -43,42 +43,42 @@ public class CSSDOMSemanticElementHelper {
* @return
*/
public static EObject findSemanticElement(EObject notationElement) {
- if(notationElement == null) {
+ if (notationElement == null) {
return null;
}
- //Add diagrams to the DOM model
- if(notationElement instanceof Diagram) {
+ // Add diagrams to the DOM model
+ if (notationElement instanceof Diagram) {
return notationElement;
}
- //Add compartments to the DOM model
- if(notationElement instanceof BasicCompartment) {
+ // Add compartments to the DOM model
+ if (notationElement instanceof BasicCompartment) {
return notationElement;
}
- //Add floating labels to the DOM model
- if(isFloatingLabel(notationElement)) {
+ // Add floating labels to the DOM model
+ if (isFloatingLabel(notationElement)) {
return notationElement;
}
- //Copied from the generic Semantic Element Helper
- if(notationElement instanceof View) {
- View view = (View)notationElement;
+ // Copied from the generic Semantic Element Helper
+ if (notationElement instanceof View) {
+ View view = (View) notationElement;
EObject semanticElement = view.getElement();
- if(semanticElement != null) {
+ if (semanticElement != null) {
return semanticElement;
}
- //The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
- //e.g. : Links in UML
+ // The graphical element isn't related to a Semantic Element. The view becomes the semantic element.
+ // e.g. : Links in UML
return view;
}
EObject currentElement = notationElement.eContainer();
- while(currentElement != null) {
- if(currentElement instanceof View) {
+ while (currentElement != null) {
+ if (currentElement instanceof View) {
return findSemanticElement(currentElement);
}
currentElement = currentElement.eContainer();
@@ -86,16 +86,16 @@ public class CSSDOMSemanticElementHelper {
/*
* Remove the warning to avoid flooding the error log.
- *
+ *
* This may happen in the following cases:
- *
+ *
* - The element is at the root of the Notation model and is not a Diagram (Which may happen in corrupted models,
* or (maybe) non-Papyrus notation models, but shouldn't have a major impact)
* - The element is contained in an EMF ChangeDescription (e.g. Create + Undo creation)
- *
+ *
* See Bug 430534
*/
- //Activator.log.warn("Cannot find a valid source for " + notationElement);
+ // Activator.log.warn("Cannot find a valid source for " + notationElement);
return notationElement;
}
@@ -122,23 +122,23 @@ public class CSSDOMSemanticElementHelper {
public static View findTopView(EObject notationElement) {
EObject semanticElement = findSemanticElement(notationElement);
- if(semanticElement == notationElement) {
- return (View)notationElement;
+ if (semanticElement == notationElement) {
+ return (View) notationElement;
}
EObject lastNotationElement = notationElement;
- while(notationElement != null) {
+ while (notationElement != null) {
notationElement = notationElement.eContainer();
- if(findSemanticElement(notationElement) != semanticElement) {
- return (View)lastNotationElement;
+ if (findSemanticElement(notationElement) != semanticElement) {
+ return (View) lastNotationElement;
}
- if(notationElement != null) {
+ if (notationElement != null) {
lastNotationElement = notationElement;
}
}
- return (View)lastNotationElement;
+ return (View) lastNotationElement;
}
/**
@@ -149,22 +149,22 @@ public class CSSDOMSemanticElementHelper {
* True if this is a Floating Label
*/
public static boolean isFloatingLabel(EObject notationElement) {
- if(!(notationElement instanceof DecorationNode)) {
+ if (!(notationElement instanceof DecorationNode)) {
return false;
}
- DecorationNode node = (DecorationNode)notationElement;
+ DecorationNode node = (DecorationNode) notationElement;
- if(node instanceof BasicCompartment) {
+ if (node instanceof BasicCompartment) {
return false;
}
- if(node.eContainer() instanceof Connector) {
+ if (node.eContainer() instanceof Connector) {
return true;
}
- if(node.eContainer() instanceof Shape) {
- if(node.getLayoutConstraint() != null) {
+ if (node.eContainer() instanceof Shape) {
+ if (node.getLayoutConstraint() != null) {
return true;
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSHelper.java
index 32f9cfbb29b..4b623104ef3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/CSSHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -17,18 +17,18 @@ import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResourceFactory
/**
* A Helper for CSS features
- *
+ *
* @author Camille Letavernier
*/
public class CSSHelper {
/**
* Makes the given resourceSet compatible with the ExtendedCSSEngines.
- *
+ *
* This method should be called before loading resources from this resource set.
- *
+ *
* @param resourceSet
- * The resource set on which the CSS Support will be installed
+ * The resource set on which the CSS Support will be installed
*/
public static void installCSSSupport(ResourceSet resourceSet) {
CSSNotationResourceFactory factory = new CSSNotationResourceFactory();
@@ -37,14 +37,14 @@ public class CSSHelper {
/**
* Tests whether the given resourceSet supports the CSS Styling
- *
+ *
* @param resourceSet
* @return
- *
+ *
* @see #installCSSSupport(ResourceSet)
*/
public static boolean isCSSSupported(ResourceSet resourceSet) {
- if(resourceSet == null) {
+ if (resourceSet == null) {
return false;
}
return resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().get(NotationModel.NOTATION_FILE_EXTENSION) instanceof CSSNotationResourceFactory;
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/GradientHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/GradientHelper.java
index a33e54905b2..76777d976dd 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/GradientHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/GradientHelper.java
@@ -48,38 +48,38 @@ public class GradientHelper {
*/
public static final String GRADIENT_HORIZONTAL = "horizontal";
- //Type 1 :
- //gradientColor:#ABCDEF;
- //gradientStyle:vertical;
-
- //Type 2 :
- //(gradient:#FEDCBA #ABCDEF horizontal;) //Currently not supported, as diagrams usually seek for #fillColor()
- //gradient:#ABCDEF horizontal;
- //gradient:#ABCDEF
- //gradient:horizontal
-
- //TODO: The Engine should provide a method to handle complex composite properties.
- //The base CSS Engine provides such a feature. However, it is not powerful enough.
+ // Type 1 :
+ // gradientColor:#ABCDEF;
+ // gradientStyle:vertical;
+
+ // Type 2 :
+ // (gradient:#FEDCBA #ABCDEF horizontal;) //Currently not supported, as diagrams usually seek for #fillColor()
+ // gradient:#ABCDEF horizontal;
+ // gradient:#ABCDEF
+ // gradient:horizontal
+
+ // TODO: The Engine should provide a method to handle complex composite properties.
+ // The base CSS Engine provides such a feature. However, it is not powerful enough.
/**
* Returns a GradientData from the CSS "gradient", "gradientColor" and/or
* "gradientStyle" properties
*
* @param engine
- * The engine used to retrieve the gradient
+ * The engine used to retrieve the gradient
* @param node
- * The semantic node for which the gradient should be retrieved
- * (Probably a GMF View, FillStyle...)
+ * The semantic node for which the gradient should be retrieved
+ * (Probably a GMF View, FillStyle...)
* @return
* The computed GradientData, or the default GMF GradientData
* if the stylesheet doesn't specify a Gradient
*/
public static GradientData computeGradient(ExtendedCSSEngine engine, Object node) {
- //Type 1
+ // Type 1
CSSValue gradientColor = engine.retrievePropertyValue(node, "gradientColor");
CSSValue gradientStyle = engine.retrievePropertyValue(node, "gradientStyle");
- if(gradientColor != null || gradientStyle != null) {
- int color1 = (Integer)engine.convert(gradientColor, ColorToGMFConverter.GMFColor, null);
+ if (gradientColor != null || gradientStyle != null) {
+ int color1 = (Integer) engine.convert(gradientColor, ColorToGMFConverter.GMFColor, null);
int style = getGradientStyle(gradientStyle.getCssText());
GradientData gradientData = new GradientData();
@@ -88,13 +88,13 @@ public class GradientHelper {
return gradientData;
}
- //Type 2
+ // Type 2
CSSValue gradient = engine.retrievePropertyValue(node, "gradient");
- if(gradient != null) {
+ if (gradient != null) {
String gradientString = gradient.getCssText();
- if(StringHelper.equals(gradientString, "none")) {
+ if (StringHelper.equals(gradientString, "none")) {
return null;
}
@@ -103,8 +103,8 @@ public class GradientHelper {
return new GradientData(gradientValues[0], gradientValues[1], gradientValues[2]);
}
- //Default
- return (GradientData)NotationPackage.eINSTANCE.getFillStyle_Gradient().getDefaultValue();
+ // Default
+ return (GradientData) NotationPackage.eINSTANCE.getFillStyle_Gradient().getDefaultValue();
}
/** [color1, color2, style] */
@@ -114,21 +114,21 @@ public class GradientHelper {
String[] values = ParserHelper.parseValues(engine, gradient);
- if(values.length == 3) {
+ if (values.length == 3) {
color1 = values[0];
color2 = values[1];
style = values[2];
- } else if(values.length == 2) {
+ } else if (values.length == 2) {
color1 = values[0];
String value = values[1];
- if(isGradientStyle(value)) {
+ if (isGradientStyle(value)) {
style = value;
} else {
color2 = value;
}
- } else if(values.length == 1) {
+ } else if (values.length == 1) {
String value = values[0];
- if(isGradientStyle(value)) {
+ if (isGradientStyle(value)) {
style = value;
} else {
color1 = value;
@@ -144,14 +144,14 @@ public class GradientHelper {
CSSValue cssColor1, cssColor2;
try {
- if(sColor1 != null) {
+ if (sColor1 != null) {
cssColor1 = engine.parsePropertyValue(sColor1);
- color1 = (Integer)engine.convert(cssColor1, ColorToGMFConverter.GMFColor, null);
+ color1 = (Integer) engine.convert(cssColor1, ColorToGMFConverter.GMFColor, null);
}
- if(sColor2 != null) {
+ if (sColor2 != null) {
cssColor2 = engine.parsePropertyValue(sColor2);
- color2 = (Integer)engine.convert(cssColor2, ColorToGMFConverter.GMFColor, null); //Unused
+ color2 = (Integer) engine.convert(cssColor2, ColorToGMFConverter.GMFColor, null); // Unused
}
style = getGradientStyle(sStyle);
@@ -159,7 +159,7 @@ public class GradientHelper {
engine.handleExceptions(ex);
}
- return new int[]{ color1, color2, style };
+ return new int[] { color1, color2, style };
}
private static boolean isGradientStyle(String value) {
@@ -167,13 +167,13 @@ public class GradientHelper {
}
private static int getGradientStyle(String gradientStyle) {
- if(StringHelper.equals(GRADIENT_VERTICAL, gradientStyle)) {
+ if (StringHelper.equals(GRADIENT_VERTICAL, gradientStyle)) {
return GradientStyle.VERTICAL;
- } else if(StringHelper.equals(GRADIENT_HORIZONTAL, gradientStyle)) {
+ } else if (StringHelper.equals(GRADIENT_HORIZONTAL, gradientStyle)) {
return GradientStyle.HORIZONTAL;
}
- //Default value
+ // Default value
return new GradientData().getGradientStyle();
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/LabelDisplayHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/LabelDisplayHelper.java
index ddfc5761b28..f57985613e1 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/LabelDisplayHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/LabelDisplayHelper.java
@@ -5,16 +5,16 @@ import org.w3c.dom.css.CSSValue;
public class LabelDisplayHelper {
- //visibility derive name type multiplicity
- // public static final String VISIBILITY = "visibility";
- // public static final String DERIVE = "derive";
- // public static final String NAME = "name";
- //
- // public static final String TYPE = "type";
- // public static final String MULTI = "multiplicity";
+ // visibility derive name type multiplicity
+ // public static final String VISIBILITY = "visibility";
+ // public static final String DERIVE = "derive";
+ // public static final String NAME = "name";
+ //
+ // public static final String TYPE = "type";
+ // public static final String MULTI = "multiplicity";
public static String[] convertLabelDisplay(ExtendedCSSEngine engine, CSSValue value) {
- if(value == null) {
+ if (value == null) {
return new String[0];
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ParserHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ParserHelper.java
index e2e65cee761..5f4e0d9f6b0 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ParserHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ParserHelper.java
@@ -20,7 +20,7 @@ import org.w3c.dom.css.CSSValueList;
/**
* A Helper for parsing CSS property values.
- *
+ *
* @author Camille Letavernier
*/
@SuppressWarnings("restriction")
@@ -29,31 +29,31 @@ public class ParserHelper {
/**
* Parses a list of CSS Values, and returns them as an Array of Strings
* Used for multivalued CSS values (Space-separated)
- *
+ *
* @param engine
- * The engine used to parse the values
+ * The engine used to parse the values
* @param value
- * The raw CSSValue to parse
+ * The raw CSSValue to parse
* @return
* An Array containing each parsed value
*/
public static String[] parseValues(CSSEngine engine, CSSValue cssValue) {
- if(cssValue instanceof CSSValueList) {
- CSSValueList list = (CSSValueList)cssValue;
+ if (cssValue instanceof CSSValueList) {
+ CSSValueList list = (CSSValueList) cssValue;
return toArray(list);
}
- return new String[]{ cssValue.getCssText() };
+ return new String[] { cssValue.getCssText() };
}
/**
* Parses a list of CSS Values, and returns them as an Array of Strings
* Used for multivalued CSS values (Space-separated)
- *
+ *
* @param engine
- * The engine used to parse the values
+ * The engine used to parse the values
* @param value
- * The raw value to parse
+ * The raw value to parse
* @return
* An Array containing each parsed value
* @deprecated Does not properly support quoted strings (e.g. firstValue "second value")
@@ -68,26 +68,26 @@ public class ParserHelper {
return new String[0];
}
- if(cssValue instanceof CSSValueList) {
- CSSValueList list = (CSSValueList)cssValue;
+ if (cssValue instanceof CSSValueList) {
+ CSSValueList list = (CSSValueList) cssValue;
return toArray(list);
}
- return new String[]{ cssValue.getCssText() };
+ return new String[] { cssValue.getCssText() };
}
/**
* Converts a CSSValueList to an Array of Strings
- *
+ *
* @param valueList
- * The CSSValueList to convert
+ * The CSSValueList to convert
* @return
* An Array of Strings containing the CSSValues, in their raw form
* (CSS Text form)
*/
public static String[] toArray(CSSValueList valueList) {
String[] result = new String[valueList.getLength()];
- for(int i = 0; i < result.length; i++) {
+ for (int i = 0; i < result.length; i++) {
result[i] = valueList.item(i).getCssText();
}
return result;
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ResetStyleHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ResetStyleHelper.java
index 4f0634b12e9..a4040196c74 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ResetStyleHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/ResetStyleHelper.java
@@ -16,7 +16,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.command.ResetStyleCommand;
public class ResetStyleHelper {
public static void resetStyle(IStructuredSelection selection) {
- if(selection == null || selection.isEmpty()) {
+ if (selection == null || selection.isEmpty()) {
return;
}
@@ -28,7 +28,7 @@ public class ResetStyleHelper {
}
public static void resetStyle(Collection<?> selection) {
- if(selection == null) {
+ if (selection == null) {
return;
}
@@ -38,7 +38,7 @@ public class ResetStyleHelper {
}
public static void resetStyle(TransactionalEditingDomain domain, Iterator<?> iterator) {
- if(domain == null || iterator == null || !iterator.hasNext()) {
+ if (domain == null || iterator == null || !iterator.hasNext()) {
return;
}
@@ -47,16 +47,16 @@ public class ResetStyleHelper {
}
private static TransactionalEditingDomain getEditingDomain(Iterator<?> iterator) {
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
Object selectedItem = iterator.next();
View view = NotationHelper.findView(selectedItem);
- if(view == null) {
+ if (view == null) {
continue;
}
EditingDomain editingDomain = EMFHelper.resolveEditingDomain(view);
- if(editingDomain instanceof TransactionalEditingDomain) {
- return (TransactionalEditingDomain)editingDomain;
+ if (editingDomain instanceof TransactionalEditingDomain) {
+ return (TransactionalEditingDomain) editingDomain;
}
break;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/StringHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/StringHelper.java
index 653e8966fae..3d0b5851166 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/StringHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/StringHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -13,25 +13,25 @@ package org.eclipse.papyrus.infra.gmfdiag.css.helper;
/**
* A Helper class for Java Strings
- *
+ *
* @author Camille Letavernier
*/
public class StringHelper {
/**
* Compares two strings. Case insensitive. The Strings are trimmed.
- *
+ *
* Null strings already return false (Even for equals(null, null))
- *
+ *
* @param s1
- * The first String to compare
+ * The first String to compare
* @param s2
- * The second String to compare
+ * The second String to compare
* @return
* True if the strings are non-null and equal (After being trimmed)
*/
public static boolean equals(String s1, String s2) {
- if(s1 == null || s2 == null) {
+ if (s1 == null || s2 == null) {
return false;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java
index c0cb7199cbb..ad40b3c9c58 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/helper/WorkspaceThemesHelper.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2014 CEA LIST.
- *
+ *
* 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
@@ -39,7 +39,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.WorkspaceThemes;
/**
* Helper to define a theme from CSS style sheet file.
- *
+ *
* @author gpascual
*
*/
@@ -58,7 +58,7 @@ public class WorkspaceThemesHelper {
* <p>
* FIXME User could select several CSS files to create a theme
* <P>
- *
+ *
* @param file
*/
public Theme defineCSSStyleSheetFilesAsTheme(IStructuredSelection selection) {
@@ -67,10 +67,10 @@ public class WorkspaceThemesHelper {
// Extract file from selection
Iterator<?> selectionIterator = selection.iterator();
- while(selectionIterator.hasNext()) {
+ while (selectionIterator.hasNext()) {
Object next = selectionIterator.next();
- if(next instanceof IFile) {
- selectedCSSFilesList.add((IFile)next);
+ if (next instanceof IFile) {
+ selectedCSSFilesList.add((IFile) next);
}
}
@@ -84,11 +84,11 @@ public class WorkspaceThemesHelper {
/**
* Method to persist deleted and edited theme in workspace preference file.
- *
+ *
* @param editedThemesArray
- * Array of edited themes to persist
+ * Array of edited themes to persist
* @param deletedThemesArray
- * Array of deleted theme to persist
+ * Array of deleted theme to persist
*/
public void saveWorkspaceThemesPreferenceResource(Theme[] editedThemesArray, Theme[] deletedThemesArray) {
@@ -96,18 +96,18 @@ public class WorkspaceThemesHelper {
Resource currentThemefile = findThemeFile();
WorkspaceThemes workspaceThemes = getWorspaceThemesRoot(currentThemefile);
- // Handle edited themes
- for(Theme editedTheme : editedThemesArray) {
+ // Handle edited themes
+ for (Theme editedTheme : editedThemesArray) {
boolean updateResult = updateWorkspaceTheme(editedTheme, workspaceThemes);
- // If update haven't done, theme must be added
- if(!updateResult) {
+ // If update haven't done, theme must be added
+ if (!updateResult) {
workspaceThemes.getThemes().add(editedTheme);
}
}
// Handle deleted themes
- for(Theme deletedTheme : deletedThemesArray) {
+ for (Theme deletedTheme : deletedThemesArray) {
removeWorkspaceTheme(deletedTheme, workspaceThemes);
}
@@ -118,11 +118,11 @@ public class WorkspaceThemesHelper {
/**
* Method to delete a theme in workspace theme.
- *
+ *
* @param deletedTheme
- * Theme to delete
+ * Theme to delete
* @param workspaceThemes
- * Current workspace themes
+ * Current workspace themes
*/
private void removeWorkspaceTheme(Theme deletedTheme, WorkspaceThemes workspaceThemes) {
// Search resource value of edited theme
@@ -130,12 +130,12 @@ public class WorkspaceThemesHelper {
Theme themeId = null;
boolean found = false;
- while(currentThemesIterator.hasNext() && !found) {
+ while (currentThemesIterator.hasNext() && !found) {
themeId = currentThemesIterator.next();
found = themeId.getId().equals(deletedTheme.getId());
}
- if(found) {
+ if (found) {
// Replace in resource the current value with the edited one and save resource
EcoreUtil.remove(workspaceThemes, StylesheetsPackage.eINSTANCE.getWorkspaceThemes_Themes(), themeId);
}
@@ -146,9 +146,9 @@ public class WorkspaceThemesHelper {
/**
* Replace in current workspace themes resource theme with the edited value.
- *
+ *
* @param editedTheme
- * New theme value
+ * New theme value
*/
public void saveWorkspaceThemesPreferenceResource(Theme editedTheme) {
// Get current resource of workspace theme preferences
@@ -161,13 +161,13 @@ public class WorkspaceThemesHelper {
}
/**
- *
+ *
* Update in current workspace themes resource the theme with the edited one.
- *
+ *
* @param editedTheme
- * Theme with new value
+ * Theme with new value
* @param workspaceThemes
- * workspace themes
+ * workspace themes
*/
private boolean updateWorkspaceTheme(Theme editedTheme, WorkspaceThemes workspaceThemes) {
// Search resource value of edited theme
@@ -175,12 +175,12 @@ public class WorkspaceThemesHelper {
Theme themeId = null;
boolean found = false;
- while(currentThemesIterator.hasNext() && !found) {
+ while (currentThemesIterator.hasNext() && !found) {
themeId = currentThemesIterator.next();
found = themeId.getId().equals(editedTheme.getId());
}
- if(found) {
+ if (found) {
// Replace in resource the current value with the edited one and save resource
EcoreUtil.replace(workspaceThemes, StylesheetsPackage.eINSTANCE.getWorkspaceThemes_Themes(), themeId, editedTheme);
}
@@ -190,13 +190,13 @@ public class WorkspaceThemesHelper {
/**
* Save style sheets EMF Resource.
- *
+ *
* @param styleSheetsResource
- *
+ *
*/
private void saveResource(Resource styleSheetsResource) {
// Save theme preference file
- if(styleSheetsResource != null) {
+ if (styleSheetsResource != null) {
try {
Map<String, Object> options = new HashMap<String, Object>();
options.put(XMIResource.XMI_ID, Boolean.TRUE);
@@ -210,21 +210,21 @@ public class WorkspaceThemesHelper {
/**
* Save theme in workspace preferences.
- *
+ *
* @param theme
- * Theme to save
+ * Theme to save
*/
public void saveNewThemeWorkspacePreference(Theme theme) {
Resource themeFile = theme.eResource();
- if(themeFile == null) {
+ if (themeFile == null) {
themeFile = findThemeFile();
}
// Get workspace themes
WorkspaceThemes workspaceThemes = getWorspaceThemesRoot(themeFile);
- // Add created theme
+ // Add created theme
workspaceThemes.getThemes().add(theme);
saveResource(themeFile);
@@ -233,7 +233,7 @@ public class WorkspaceThemesHelper {
/**
* Created a style sheets theme from project selection.
- *
+ *
* @param selectedCSSFilesList
* @return
*/
@@ -245,9 +245,9 @@ public class WorkspaceThemesHelper {
// Create new theme
Theme newTheme = styleSheetsFactory.createTheme();
- for(IFile cssFile : selectedCSSFilesList) {
+ for (IFile cssFile : selectedCSSFilesList) {
- //Style sheets to add in theme
+ // Style sheets to add in theme
StyleSheetReference styleSheetsReference = styleSheetsFactory.createStyleSheetReference();
styleSheetsReference.setPath(cssFile.getFullPath().toString());
newTheme.getStylesheets().add(styleSheetsReference);
@@ -257,7 +257,7 @@ public class WorkspaceThemesHelper {
/**
* Look for theme workspace preferences file.
- *
+ *
* @return Created resource if it don't exist, otherwise loaded
*/
private Resource findThemeFile() {
@@ -271,7 +271,7 @@ public class WorkspaceThemesHelper {
ResourceSet resourceSet = new ResourceSetImpl();
Resource resource = null;
- if(themeFilePath.toFile().exists()) {
+ if (themeFilePath.toFile().exists()) {
resource = resourceSet.getResource(resolvedURI, true);
} else {
resource = resourceSet.createResource(resolvedURI);
@@ -282,7 +282,7 @@ public class WorkspaceThemesHelper {
/**
* Build path to access preference file.
- *
+ *
* @return Path to theme.xmi file in workspace preference directory
*/
public IPath getThemeWorkspacePreferenceFilePath() {
@@ -296,17 +296,17 @@ public class WorkspaceThemesHelper {
/**
* Get root element of an workspace themes resource.
- *
+ *
* @param workspaceThemesResource
- * The resource to inspect
+ * The resource to inspect
* @return The existing root of type {@link WorkspaceThemes}, otherwise create and add to resource
*/
private WorkspaceThemes getWorspaceThemesRoot(Resource workspaceThemesResource) {
- //Verify if root element exit
- WorkspaceThemes workspaceThemesRoot = (WorkspaceThemes)EcoreUtil.getObjectByType(workspaceThemesResource.getContents(), StylesheetsPackage.Literals.WORKSPACE_THEMES);
+ // Verify if root element exit
+ WorkspaceThemes workspaceThemesRoot = (WorkspaceThemes) EcoreUtil.getObjectByType(workspaceThemesResource.getContents(), StylesheetsPackage.Literals.WORKSPACE_THEMES);
- if(workspaceThemesRoot == null) {
+ if (workspaceThemesRoot == null) {
// Create a root element if there is not
workspaceThemesRoot = StylesheetsFactory.eINSTANCE.createWorkspaceThemes();
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/listener/StyleSheetChangeListener.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/listener/StyleSheetChangeListener.java
index afd20c7b3b2..5bc886067cc 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/listener/StyleSheetChangeListener.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/listener/StyleSheetChangeListener.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -15,16 +15,16 @@ import org.eclipse.papyrus.infra.gmfdiag.css.engine.ExtendedCSSEngine;
/**
* An interface for listening changes on a CSSEngine's stylesheets.
- *
+ *
* @author Camille Letavernier
*/
public interface StyleSheetChangeListener {
/**
* Notifies this listener that a stylesheet has changed on the CSSEngine
- *
+ *
* @param owner
- * The CSSEngine on which a stylesheet change has occured
+ * The CSSEngine on which a stylesheet change has occured
*/
public void styleSheetChanged(ExtendedCSSEngine owner);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedCSSRuleList.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedCSSRuleList.java
index 05332e56751..5e469b57680 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedCSSRuleList.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedCSSRuleList.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.w3c.dom.css.CSSRuleList;
/**
* More usable implementation for CSSRuleList
- *
+ *
* @author Camille Letavernier
*/
public class ExtendedCSSRuleList extends LinkedList<CSSRule> implements CSSRuleList {
@@ -35,12 +35,12 @@ public class ExtendedCSSRuleList extends LinkedList<CSSRule> implements CSSRuleL
/**
* Builds an ExtendedCSSRuleList by making a copy of a CSSRuleList
- *
+ *
* @param listToCopy
- * The CSSRuleList to copy
+ * The CSSRuleList to copy
*/
public ExtendedCSSRuleList(CSSRuleList listToCopy) {
- for(int i = 0; i < listToCopy.getLength(); i++) {
+ for (int i = 0; i < listToCopy.getLength(); i++) {
add(listToCopy.item(i));
}
}
@@ -48,18 +48,20 @@ public class ExtendedCSSRuleList extends LinkedList<CSSRule> implements CSSRuleL
/**
* Builds an ExtendedCSSRuleList by making a copy of a Collection of
* CSSRules
- *
+ *
* @param listToCopy
- * The list of CSSRule to copy
+ * The list of CSSRule to copy
*/
public ExtendedCSSRuleList(Collection<? extends CSSRule> listToCopy) {
super(listToCopy);
}
+ @Override
public int getLength() {
return size();
}
+ @Override
public CSSRule item(int index) {
return get(index);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedSelectorList.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedSelectorList.java
index 6ac2a957c64..61fff174f28 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedSelectorList.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedSelectorList.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.w3c.css.sac.SelectorList;
/**
* More usable implementation for SelectorList
- *
+ *
* @author Camille Letavernier
*/
public class ExtendedSelectorList extends LinkedList<Selector> implements SelectorList {
@@ -31,7 +31,7 @@ public class ExtendedSelectorList extends LinkedList<Selector> implements Select
}
public ExtendedSelectorList(SelectorList listToCopy) {
- for(int i = 0; i < listToCopy.getLength(); i++) {
+ for (int i = 0; i < listToCopy.getLength(); i++) {
add(listToCopy.item(i));
}
}
@@ -40,10 +40,12 @@ public class ExtendedSelectorList extends LinkedList<Selector> implements Select
super(listToCopy);
}
+ @Override
public int getLength() {
return size();
}
+ @Override
public Selector item(int index) {
return get(index);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java
index 64ec16cf0e2..c96f85abecb 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/lists/ExtendedStyleSheetList.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.w3c.dom.stylesheets.StyleSheetList;
/**
* More usable implementation for StyleSheetList
- *
+ *
* @author Camille Letavernier
*/
public class ExtendedStyleSheetList extends LinkedList<StyleSheet> implements StyleSheetList {
@@ -38,16 +38,18 @@ public class ExtendedStyleSheetList extends LinkedList<StyleSheet> implements St
super(listToCopy);
}
+ @Override
public int getLength() {
return size();
}
+ @Override
public StyleSheet item(int index) {
return get(index);
}
public void addAll(StyleSheetList styleSheets) {
- for(int i = 0; i < styleSheets.getLength(); i++) {
+ for (int i = 0; i < styleSheets.getLength(); i++) {
add(styleSheets.item(i));
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java
index 942d9baebcb..f6637b4fb76 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSAnnotations.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.infra.gmfdiag.css.notation;
/**
* Contains constants for the CSS-specific annotations
- *
+ *
* @author Camille Letavernier
*/
public interface CSSAnnotations {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java
index d60b24308b5..9d1b5106384 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagram.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,22 +19,22 @@ import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
/**
* A GMF Diagram with CSS Support
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public interface CSSDiagram extends Diagram {
/**
* Returns the list of stylesheets directly owned by this diagram
- *
+ *
* @return
*/
public List<StyleSheet> getStyleSheets();
/**
* Returns the CSS Engine associated to this diagram
- *
+ *
* @return
*/
public ExtendedCSSEngine getEngine();
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
index 62f2a628285..6693edb7c1c 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSDiagramImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2013 CEA LIST.
- *
+ *
* 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
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - support adapter instead of custom resource impl for CSS (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.notation;
@@ -36,7 +36,7 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
/**
* Default implementation for CSSDiagram
- *
+ *
* @author Camille letavernier
*/
@SuppressWarnings("restriction")
@@ -46,8 +46,9 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
private Adapter disposeListener;
+ @Override
public ExtendedCSSEngine getEngine() {
- if(engine == null) {
+ if (engine == null) {
engine = new DiagramCSSEngine(getModelEngine(), this);
eResource().eAdapters().add(disposeListener = new DiagramDisposeListener());
}
@@ -55,10 +56,10 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
}
private void disposeEngine(Object notifier) {
- if(engine != null) {
+ if (engine != null) {
engine.dispose();
engine = null;
- ((Resource)notifier).eAdapters().remove(disposeListener);
+ ((Resource) notifier).eAdapters().remove(disposeListener);
}
}
@@ -66,22 +67,23 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
return CSSNotationResource.getEngine(eResource());
}
+ @Override
public List<StyleSheet> getStyleSheets() {
List<StyleSheet> result = new LinkedList<StyleSheet>();
- for(Object styleObject : getStyles()) {
- if(styleObject instanceof NamedStyle) {
+ for (Object styleObject : getStyles()) {
+ if (styleObject instanceof NamedStyle) {
- NamedStyle style = (NamedStyle)styleObject;
+ NamedStyle style = (NamedStyle) styleObject;
- if(CSSStyles.CSS_DIAGRAM_STYLESHEETS_KEY.equals(style.getName())) {
- if(style instanceof EObjectListValueStyle) {
+ if (CSSStyles.CSS_DIAGRAM_STYLESHEETS_KEY.equals(style.getName())) {
+ if (style instanceof EObjectListValueStyle) {
- EObjectListValueStyle stylesheetsStyle = (EObjectListValueStyle)style;
+ EObjectListValueStyle stylesheetsStyle = (EObjectListValueStyle) style;
- for(Object eObjectValue : stylesheetsStyle.getEObjectListValue()) {
- if(eObjectValue instanceof StyleSheet) {
- result.add((StyleSheet)eObjectValue);
+ for (Object eObjectValue : stylesheetsStyle.getEObjectListValue()) {
+ if (eObjectValue instanceof StyleSheet) {
+ result.add((StyleSheet) eObjectValue);
}
}
}
@@ -90,8 +92,9 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
}
StyleSheet s = getViewpointDefinedStylesheet();
- if (s != null)
+ if (s != null) {
result.add(s);
+ }
return result;
}
@@ -118,15 +121,15 @@ public class CSSDiagramImpl extends DiagramImpl implements CSSDiagram {
@Override
public void notifyChanged(Notification notification) {
- switch(notification.getEventType()) {
+ switch (notification.getEventType()) {
case Notification.REMOVE:
- if(notification.getOldValue() == CSSDiagramImpl.this) {
+ if (notification.getOldValue() == CSSDiagramImpl.this) {
disposeEngine(notification.getNotifier());
}
break;
case Notification.REMOVE_MANY:
- for(Object object : (Collection<?>)notification.getOldValue()) {
- if(object == CSSDiagramImpl.this) {
+ for (Object object : (Collection<?>) notification.getOldValue()) {
+ if (object == CSSDiagramImpl.this) {
disposeEngine(notification.getNotifier());
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSStyles.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSStyles.java
index 0e2754c549b..13f9b027f68 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSStyles.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/CSSStyles.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -17,7 +17,7 @@ import java.util.Set;
/**
* Constants for the CSS-specific properties
- *
+ *
* @author Camille Letavernier
*/
public interface CSSStyles {
@@ -48,10 +48,10 @@ public interface CSSStyles {
/**
* The list of reserved CSS Keywords used in GMF NamedStyle
- *
+ *
* Note: In general, all values prefixed with css* are potentially reserved for the CSS Engine
*/
- public static final Set<String> RESERVED_KEYWORDS = new HashSet<String>(Arrays.asList(new String[]{
+ public static final Set<String> RESERVED_KEYWORDS = new HashSet<String>(Arrays.asList(new String[] {
CSS_GMF_ID_KEY,
CSS_GMF_CLASS_KEY,
CSS_GMF_STYLE_KEY,
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java
index 99ef9912f8b..c6713fe8be4 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/ForceValueHelper.java
@@ -46,26 +46,26 @@ import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource;
*
* @author Camille Letavernier
*/
-//FIXME: The default behavior when undoing a setValue() is set(previous),
-//which may result in set(null) or set(default), instead of unset()
-//Thus, undoing a modification on a View may result in unexpected behavior
-//(e.g., GMF default appearance instead of CSS style)
-//Workaround: Use the "reset style" button to retrieve the correct CSS style
+// FIXME: The default behavior when undoing a setValue() is set(previous),
+// which may result in set(null) or set(default), instead of unset()
+// Thus, undoing a modification on a View may result in unexpected behavior
+// (e.g., GMF default appearance instead of CSS style)
+// Workaround: Use the "reset style" button to retrieve the correct CSS style
public class ForceValueHelper {
public static void setValue(View view, EStructuralFeature feature, Object value) {
- if(!isCSSView(view)) {
- //Do not contaminate non-Papyrus models
+ if (!isCSSView(view)) {
+ // Do not contaminate non-Papyrus models
return;
}
- //Adds the annotation which indicates that the value has been forced, if needed
+ // Adds the annotation which indicates that the value has been forced, if needed
- if(equals(value, feature.getDefaultValue())) {
- // System.out.println("Forcing default value for " + view);
+ if (equals(value, feature.getDefaultValue())) {
+ // System.out.println("Forcing default value for " + view);
String annotationKey = feature.getName();
EAnnotation eAnnotation = view.getEAnnotation(CSSAnnotations.CSS_FORCE_VALUE);
- if(eAnnotation == null) {
+ if (eAnnotation == null) {
eAnnotation = EcorePackage.eINSTANCE.getEcoreFactory().createEAnnotation();
eAnnotation.setEModelElement(view);
eAnnotation.setSource(CSSAnnotations.CSS_FORCE_VALUE);
@@ -77,37 +77,37 @@ public class ForceValueHelper {
}
private static boolean isCSSView(View view) {
- //Bug 435478: In some (invalid) cases, the view can be outside a diagram.
- //In this case, we cannot use the CSS support. We should exclude the views
- //which are not associated to a diagram
+ // Bug 435478: In some (invalid) cases, the view can be outside a diagram.
+ // In this case, we cannot use the CSS support. We should exclude the views
+ // which are not associated to a diagram
return view != null && view.getDiagram() != null && CSSNotationResource.isCSSEnabled(view.eResource());
}
private static boolean equals(Object value1, Object value2) {
- if(value1 == null) {
+ if (value1 == null) {
return value2 == null;
}
return value1.equals(value2);
}
public static void unsetValue(View view, EStructuralFeature feature) {
- if(feature == null) {
+ if (feature == null) {
return;
}
- if(!isCSSView(view)) {
- //Do not contaminate non-Papyrus models
+ if (!isCSSView(view)) {
+ // Do not contaminate non-Papyrus models
return;
}
- //Remove the annotation which forces the value, if needed
+ // Remove the annotation which forces the value, if needed
String annotationKey = feature.getName();
EAnnotation eAnnotation = view.getEAnnotation(CSSAnnotations.CSS_FORCE_VALUE);
- if(eAnnotation != null) {
+ if (eAnnotation != null) {
EMap<String, String> details = eAnnotation.getDetails();
details.remove(annotationKey);
- if(details.isEmpty()) {
+ if (details.isEmpty()) {
view.getEAnnotations().remove(eAnnotation);
}
}
@@ -118,16 +118,16 @@ public class ForceValueHelper {
}
public static boolean isSet(View annotationContext, EObject style, EStructuralFeature feature, Object value) {
- if(!isCSSView(annotationContext)) {
- //Do not contaminate non-Papyrus models
+ if (!isCSSView(annotationContext)) {
+ // Do not contaminate non-Papyrus models
return true;
}
- // return false;
+ // return false;
- if(equals(value, feature.getDefaultValue())) {
+ if (equals(value, feature.getDefaultValue())) {
EAnnotation eAnnotation = annotationContext.getEAnnotation(CSSAnnotations.CSS_FORCE_VALUE);
- if(eAnnotation == null) {
+ if (eAnnotation == null) {
return false;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/StatefulView.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/StatefulView.java
index 5dd8e02af4c..2bf4120be65 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/StatefulView.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/notation/StatefulView.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -15,9 +15,9 @@ import java.util.Set;
/**
* An Interface to represent the current event-based state(s) of a View (e.g. Selection, Focus, ...)
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public interface StatefulView {
@@ -29,23 +29,23 @@ public interface StatefulView {
/**
* Changes the current state of the View, by merging the current state the states given in parameter
- *
+ *
* @param states
- * The states to be merged with the current state
+ * The states to be merged with the current state
*/
public void addStates(Set<String> states);
/**
* Changes the current state of the View, by removing from the current state the states given in parameter
- *
+ *
* @param states
- * The states to be removed from the current state
+ * The states to be removed from the current state
*/
public void removeStates(Set<String> states);
/**
* Returns the current list of active states for this element
- *
+ *
* @return
*/
public Set<String> getStates();
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
index 45e320fa97c..ad274b3032b 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferenceInitializer.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -19,7 +19,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
/**
* Theme preference initializer.
- *
+ *
* @author gpascual
*
*/
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferences.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferences.java
index c60b7bb3607..27026016547 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferences.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/preferences/ThemePreferences.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -13,7 +13,7 @@ package org.eclipse.papyrus.infra.gmfdiag.css.preferences;
/**
* Interface for Theme Preferences constants
- *
+ *
* @author Camille Letavernier
*/
public interface ThemePreferences {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
index 65665b1fd15..491a3681b70 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSAppearanceProvider.java
@@ -25,24 +25,24 @@ public class CSSAppearanceProvider extends AnnotationStyleProvider {
@Override
public boolean showElementIcon(EModelElement modelElement) {
- if(modelElement instanceof CustomStyle) {
- return ((CustomStyle)modelElement).showElementIcon();
+ if (modelElement instanceof CustomStyle) {
+ return ((CustomStyle) modelElement).showElementIcon();
}
return super.showElementIcon(modelElement);
}
@Override
public int getQualifiedNameDepth(EModelElement modelElement) {
- if(modelElement instanceof CustomStyle) {
- return ((CustomStyle)modelElement).getQualifiedNameDepth();
+ if (modelElement instanceof CustomStyle) {
+ return ((CustomStyle) modelElement).getQualifiedNameDepth();
}
return super.getQualifiedNameDepth(modelElement);
}
@Override
public boolean showShadow(EModelElement modelElement) {
- if(modelElement instanceof CustomStyle) {
- return ((CustomStyle)modelElement).showShadow();
+ if (modelElement instanceof CustomStyle) {
+ return ((CustomStyle) modelElement).showShadow();
}
return super.showShadow(modelElement);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSClassContentProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSClassContentProvider.java
index bcca3ea0809..ecd7d1e95ed 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSClassContentProvider.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSClassContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -37,11 +37,11 @@ import org.w3c.dom.css.CSSStyleSheet;
* A ContentProvider which retrieves the available CSS Classes to be applied
* on the selected element. The classes are retrieved from the current css
* engine's stylesheets.
- *
+ *
* The resulting classes are sorted alphabetically.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
@SuppressWarnings("restriction")
public class CSSClassContentProvider extends AbstractStaticContentProvider {
@@ -51,38 +51,39 @@ public class CSSClassContentProvider extends AbstractStaticContentProvider {
private ExtendedCSSEngine engine;
/**
- *
+ *
* @param elementName
- * The localName of the element (Typically, the semantic metaclass name or diagram type)
+ * The localName of the element (Typically, the semantic metaclass name or diagram type)
* @param engine
- * The stylesheets of this CSS Engine will be used to retrieve compatible CSS Classes
+ * The stylesheets of this CSS Engine will be used to retrieve compatible CSS Classes
*/
public CSSClassContentProvider(String elementName, ExtendedCSSEngine engine) {
this.elementName = elementName;
this.engine = engine;
}
+ @Override
public Object[] getElements() {
return getAvailableClasses().toArray();
}
/**
* Returns a sorted collection of CSS Classes compatible with the element
- *
+ *
* @return
*/
public Collection<String> getAvailableClasses() {
Set<String> result = new TreeSet<String>(Collator.getInstance());
- for(org.w3c.dom.stylesheets.StyleSheet stylesheet : engine.getAllStylesheets()) {
- if(stylesheet instanceof CSSStyleSheet) {
- CSSStyleSheet cssStylesheet = (CSSStyleSheet)stylesheet;
- for(int i = 0; i < cssStylesheet.getCssRules().getLength(); i++) {
+ for (org.w3c.dom.stylesheets.StyleSheet stylesheet : engine.getAllStylesheets()) {
+ if (stylesheet instanceof CSSStyleSheet) {
+ CSSStyleSheet cssStylesheet = (CSSStyleSheet) stylesheet;
+ for (int i = 0; i < cssStylesheet.getCssRules().getLength(); i++) {
CSSRule cssRule = cssStylesheet.getCssRules().item(i);
- if(cssRule instanceof CSSStyleRuleImpl) {
- CSSStyleRuleImpl rule = (CSSStyleRuleImpl)cssRule;
+ if (cssRule instanceof CSSStyleRuleImpl) {
+ CSSStyleRuleImpl rule = (CSSStyleRuleImpl) cssRule;
- for(int j = 0; j < rule.getSelectorList().getLength(); j++) {
+ for (int j = 0; j < rule.getSelectorList().getLength(); j++) {
Selector selector = rule.getSelectorList().item(j);
result.addAll(findClassesFromSelector(selector));
@@ -97,14 +98,14 @@ public class CSSClassContentProvider extends AbstractStaticContentProvider {
private List<String> findClassesFromSelector(Selector selector) {
List<String> result = new LinkedList<String>();
- if(selector instanceof ConditionalSelector) {
- result.addAll(findClassesFromSelector((ConditionalSelector)selector));
- } else if(selector instanceof DescendantSelector) { //A B | A > B
- result.addAll(findClassesFromSelector(((DescendantSelector)selector).getSimpleSelector()));
- result.addAll(findClassesFromSelector(((DescendantSelector)selector).getAncestorSelector()));
- } else if(selector instanceof SiblingSelector) { //A + B
- result.addAll(findClassesFromSelector(((SiblingSelector)selector).getSelector()));
- result.addAll(findClassesFromSelector(((SiblingSelector)selector).getSiblingSelector()));
+ if (selector instanceof ConditionalSelector) {
+ result.addAll(findClassesFromSelector((ConditionalSelector) selector));
+ } else if (selector instanceof DescendantSelector) { // A B | A > B
+ result.addAll(findClassesFromSelector(((DescendantSelector) selector).getSimpleSelector()));
+ result.addAll(findClassesFromSelector(((DescendantSelector) selector).getAncestorSelector()));
+ } else if (selector instanceof SiblingSelector) { // A + B
+ result.addAll(findClassesFromSelector(((SiblingSelector) selector).getSelector()));
+ result.addAll(findClassesFromSelector(((SiblingSelector) selector).getSiblingSelector()));
}
return result;
}
@@ -114,10 +115,10 @@ public class CSSClassContentProvider extends AbstractStaticContentProvider {
Selector simpleSelector = selector.getSimpleSelector();
- if(simpleSelector instanceof ElementSelector) {
- ElementSelector elementSelector = (ElementSelector)simpleSelector;
+ if (simpleSelector instanceof ElementSelector) {
+ ElementSelector elementSelector = (ElementSelector) simpleSelector;
String localName = elementSelector.getLocalName();
- if("*".equals(localName) || "*".equals(elementName) || elementName.equals(localName) || localName == null) {
+ if ("*".equals(localName) || "*".equals(elementName) || elementName.equals(localName) || localName == null) {
Condition condition = selector.getCondition();
result.addAll(findClassesFromCondition(condition));
}
@@ -127,10 +128,10 @@ public class CSSClassContentProvider extends AbstractStaticContentProvider {
}
private List<String> findClassesFromCondition(Condition condition) {
- if(condition instanceof CSSClassConditionImpl) {
- return Collections.singletonList(((CSSClassConditionImpl)condition).getValue());
- } else if(condition instanceof CombinatorCondition) {
- CombinatorCondition combinatorCondition = (CombinatorCondition)condition;
+ if (condition instanceof CSSClassConditionImpl) {
+ return Collections.singletonList(((CSSClassConditionImpl) condition).getValue());
+ } else if (condition instanceof CombinatorCondition) {
+ CombinatorCondition combinatorCondition = (CombinatorCondition) condition;
List<String> result = new LinkedList<String>();
result.addAll(findClassesFromCondition(combinatorCondition.getFirstCondition()));
result.addAll(findClassesFromCondition(combinatorCondition.getSecondCondition()));
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
index eccccb2e6c4..65c174c750f 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSCustomStyleDelegate.java
@@ -27,7 +27,7 @@ import org.w3c.dom.css.CSSValue;
*
* @author Camille Letavernier
*/
-//FIXME: Use constants for the CSS Properties elementIcon, qualifiedNameDepth and shadow
+// FIXME: Use constants for the CSS Properties elementIcon, qualifiedNameDepth and shadow
@SuppressWarnings("restriction")
public class CSSCustomStyleDelegate implements CustomStyle {
@@ -51,9 +51,9 @@ public class CSSCustomStyleDelegate implements CustomStyle {
* Constructor
*
* @param view
- * The GMF view on which the custom style is applied
+ * The GMF view on which the custom style is applied
* @param engine
- * The CSS engine used to handle the custom properties
+ * The CSS engine used to handle the custom properties
*/
public CSSCustomStyleDelegate(View view, ExtendedCSSEngine engine) {
this.view = CSSDOMSemanticElementHelper.findPrimaryView(view);
@@ -64,36 +64,36 @@ public class CSSCustomStyleDelegate implements CustomStyle {
@Override
public boolean showElementIcon() {
EAnnotation displayNameLabelIcon = view.getEAnnotation(VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON);
- if(displayNameLabelIcon != null) {
+ if (displayNameLabelIcon != null) {
return provider.showElementIcon(view);
}
CSSValue cssValue = engine.retrievePropertyValue(element, "elementIcon");
- if(cssValue == null) {
+ if (cssValue == null) {
return false;
}
- return (Boolean)engine.convert(cssValue, Boolean.class, null);
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
}
@Override
public int getQualifiedNameDepth() {
EAnnotation qualifiedNameAnnotation = view.getEAnnotation(VisualInformationPapyrusConstants.QUALIFIED_NAME);
- if(qualifiedNameAnnotation != null) {
+ if (qualifiedNameAnnotation != null) {
return provider.getQualifiedNameDepth(view);
}
CSSValue cssValue = engine.retrievePropertyValue(element, "qualifiedNameDepth");
- if(cssValue == null) {
+ if (cssValue == null) {
return NONE_VALUE;
}
String cssText = cssValue.getCssText();
- if(StringHelper.equals(FULL, cssText)) {
+ if (StringHelper.equals(FULL, cssText)) {
return FULL_VALUE;
}
- if(StringHelper.equals(NONE, cssText)) {
+ if (StringHelper.equals(NONE, cssText)) {
return NONE_VALUE;
}
@@ -110,15 +110,15 @@ public class CSSCustomStyleDelegate implements CustomStyle {
public boolean showShadow() {
EAnnotation shadowAnnotation = view.getEAnnotation(VisualInformationPapyrusConstants.SHADOWFIGURE);
- if(shadowAnnotation != null) {
+ if (shadowAnnotation != null) {
return provider.showShadow(view);
}
CSSValue cssValue = engine.retrievePropertyValue(element, "shadow");
- if(cssValue == null) {
+ if (cssValue == null) {
return false;
}
- return (Boolean)engine.convert(cssValue, Boolean.class, null);
+ return (Boolean) engine.convert(cssValue, Boolean.class, null);
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java
index 37fe06312dd..7e6d0ba86d1 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/provider/CSSThemeInitializer.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2013 CEA LIST.
- *
+ *
* 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
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - support adapter instead of custom resource impl for CSS (CDO)
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.provider;
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.resource.CSSNotationResource;
/**
* A class to skip the PreferenceInitializer when the CSS support is enabled.
- *
+ *
* @author Camille Letavernier
*/
public class CSSThemeInitializer implements IThemeInitializer {
@@ -29,11 +29,12 @@ public class CSSThemeInitializer implements IThemeInitializer {
/**
* Return false when the CSS support is enabled
*/
+ @Override
public boolean usePreferenceInitializer(View view) {
- //Sometimes, the view is created before its diagram is attached to its resource
- //This happens in diagrams which are initialized with a root element (Activity, Sequence, StateMachine, IBD, ...)
- //In this case, it is better to test the CSSDiagram than the resource (As there is no resource yet)
- if(view.getDiagram() != null) {
+ // Sometimes, the view is created before its diagram is attached to its resource
+ // This happens in diagrams which are initialized with a root element (Activity, Sequence, StateMachine, IBD, ...)
+ // In this case, it is better to test the CSSDiagram than the resource (As there is no resource yet)
+ if (view.getDiagram() != null) {
return !(view.getDiagram() instanceof CSSDiagram);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationModel.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationModel.java
index 298e8f5e767..ad8e8450a9e 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationModel.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationModel.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java
index e8bb042d184..d45ad709675 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResource.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2014 CEA LIST 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
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - support adapter instead of custom resource impl (CDO)
* Christian W. Damus (CEA) - bug 429422
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.resource;
@@ -32,9 +32,9 @@ import org.eclipse.papyrus.infra.gmfdiag.css.engine.ProjectCSSEngine;
/**
* A GMF Resource with CSS support
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
@SuppressWarnings("restriction")
public class CSSNotationResource extends GMFResource {
@@ -50,7 +50,7 @@ public class CSSNotationResource extends GMFResource {
}
public ExtendedCSSEngine getModelEngine() {
- if(modelEngine == null) {
+ if (modelEngine == null) {
// Create a CSSEngine and listen to modifications on the
// resourceSet,
// to know when this resource is disposed
@@ -61,7 +61,7 @@ public class CSSNotationResource extends GMFResource {
}
public ExtendedCSSEngine getProjectEngine() {
- if(projectEngine == null) {
+ if (projectEngine == null) {
projectEngine = ProjectCSSEngine.createEngine(this);
}
@@ -71,23 +71,23 @@ public class CSSNotationResource extends GMFResource {
public static ExtendedCSSEngine getEngine(Resource resource) {
ExtendedCSSEngine result = null;
- if(resource instanceof CSSNotationResource) {
- result = ((CSSNotationResource)resource).getModelEngine();
- } else if("notation".equals(resource.getURI().fileExtension())) {
- CSSNotationResourceAdapter adapter = (CSSNotationResourceAdapter)EcoreUtil.getExistingAdapter(resource, ExtendedCSSEngine.class);
+ if (resource instanceof CSSNotationResource) {
+ result = ((CSSNotationResource) resource).getModelEngine();
+ } else if ("notation".equals(resource.getURI().fileExtension())) {
+ CSSNotationResourceAdapter adapter = (CSSNotationResourceAdapter) EcoreUtil.getExistingAdapter(resource, ExtendedCSSEngine.class);
- if(adapter == null) {
+ if (adapter == null) {
// is the resource set a ModelSet that has the CSS notation
// model associated?
ResourceSet resourceSet = resource.getResourceSet();
- if((resourceSet instanceof ModelSet) && (((ModelSet)resourceSet).getModel(NotationModel.MODEL_ID) instanceof CSSNotationModel)) {
+ if ((resourceSet instanceof ModelSet) && (((ModelSet) resourceSet).getModel(NotationModel.MODEL_ID) instanceof CSSNotationModel)) {
adapter = new CSSNotationResourceAdapter();
resource.eAdapters().add(adapter);
}
}
- if(adapter != null) {
+ if (adapter != null) {
result = adapter.getEngine();
}
}
@@ -98,24 +98,24 @@ public class CSSNotationResource extends GMFResource {
public static boolean isCSSEnabled(Resource resource) {
// while a resource is loading, we don't want to poke its CSS style
// annotations
- return (resource != null) && !((Resource.Internal)resource).isLoading() && (getEngine(resource) != null);
+ return (resource != null) && !((Resource.Internal) resource).isLoading() && (getEngine(resource) != null);
}
/**
* Dispose the CSS Engine and stops listening on the ResourceSet
- *
+ *
* @param notifier
*/
private void disposeEngine(Object notifier) {
// notifier is the owning resourceSet
- if(modelEngine != null) {
+ if (modelEngine != null) {
modelEngine.dispose();
modelEngine = null;
// Stop listening on the resourceSet
- ((ResourceSet)notifier).eAdapters().remove(disposeListener);
+ ((ResourceSet) notifier).eAdapters().remove(disposeListener);
}
- if(projectEngine != null) {
+ if (projectEngine != null) {
projectEngine.dispose();
projectEngine = null;
}
@@ -128,16 +128,16 @@ public class CSSNotationResource extends GMFResource {
// If this resource is removed from the resourceSet, dispose the
// CSSEngine
// and stop listening on the resourceSet
- switch(notification.getEventType()) {
+ switch (notification.getEventType()) {
case Notification.REMOVE_MANY:
- for(Object oldValue : (Collection<?>)notification.getOldValue()) {
- if(oldValue == CSSNotationResource.this) {
+ for (Object oldValue : (Collection<?>) notification.getOldValue()) {
+ if (oldValue == CSSNotationResource.this) {
disposeEngine(notification.getNotifier());
}
}
break;
case Notification.REMOVE:
- if(notification.getOldValue() == CSSNotationResource.this) {
+ if (notification.getOldValue() == CSSNotationResource.this) {
disposeEngine(notification.getNotifier());
}
break;
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceAdapter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceAdapter.java
index f39c475d83d..76343b54845 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceAdapter.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceAdapter.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012, 2013 CEA LIST.
- *
+ *
* 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
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.engine.ModelCSSEngine;
/**
* An adapter that adds CSS support to arbitrary resource implementations. It is an
* alternative to the use of {@link CSSNotationResource}.
- *
+ *
* @see CSSNotationResource
*/
@SuppressWarnings("restriction")
@@ -29,9 +29,9 @@ public class CSSNotationResourceAdapter extends AdapterImpl {
private ExtendedCSSEngine engine;
public ExtendedCSSEngine getEngine() {
- if(engine == null) {
- //Create a CSSEngine and listen to modifications on the resourceSet,
- //to know when this resource is disposed
+ if (engine == null) {
+ // Create a CSSEngine and listen to modifications on the resourceSet,
+ // to know when this resource is disposed
engine = new ModelCSSEngine(getResource());
}
@@ -40,28 +40,28 @@ public class CSSNotationResourceAdapter extends AdapterImpl {
/**
* Dispose the CSS Engine and stops listening on the ResourceSet
- *
+ *
* @param notifier
*/
private void disposeEngine() {
- //notifier is the owning resourceSet
- if(engine != null) {
+ // notifier is the owning resourceSet
+ if (engine != null) {
engine.dispose();
engine = null;
}
}
Resource getResource() {
- return (Resource)getTarget();
+ return (Resource) getTarget();
}
@Override
public void notifyChanged(Notification notification) {
Object notifier = notification.getNotifier();
- if((notifier == getResource()) && (notification.getFeatureID(Resource.class) == Resource.RESOURCE__RESOURCE_SET) && (notification.getNewValue() == null)) {
- //If this resource is removed from the resourceSet, dispose the CSSEngine
- //and stop listening on the resourceSet
+ if ((notifier == getResource()) && (notification.getFeatureID(Resource.class) == Resource.RESOURCE__RESOURCE_SET) && (notification.getNewValue() == null)) {
+ // If this resource is removed from the resourceSet, dispose the CSSEngine
+ // and stop listening on the resourceSet
disposeEngine();
}
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceFactory.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceFactory.java
index 525b87b98c4..8955ac7d908 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceFactory.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/resource/CSSNotationResourceFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -20,9 +20,9 @@ import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
/**
* A GMFResourceFactory which installs CSS Support on the produced
* NotationResources.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
@SuppressWarnings("restriction")
public class CSSNotationResourceFactory extends GMFResourceFactory {
@@ -35,7 +35,7 @@ public class CSSNotationResourceFactory extends GMFResourceFactory {
resource.getDefaultLoadOptions().putAll(GMFResourceFactory.getDefaultLoadOptions());
resource.getDefaultSaveOptions().putAll(GMFResourceFactory.getDefaultSaveOptions());
- if(!resource.getEncoding().equals(EMFCoreConstants.XMI_ENCODING)) {
+ if (!resource.getEncoding().equals(EMFCoreConstants.XMI_ENCODING)) {
resource.setEncoding(EMFCoreConstants.XMI_ENCODING);
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/CssMarkerEventManagerService.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/CssMarkerEventManagerService.java
index 4d2e06a03a6..900a406eb97 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/CssMarkerEventManagerService.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/CssMarkerEventManagerService.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013, 2014 CEA LIST 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
@@ -11,7 +11,7 @@
* Christian W. Damus (CEA) - gracefully handle resources not in the workspace (CDO)
* Christian W. Damus (CEA) - refactor for non-workspace abstraction of problem markers (CDO)
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.service;
@@ -47,38 +47,41 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
protected MarkersMonitorService monitorService;
+ @Override
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
this.servicesRegistry = servicesRegistry;
this.eObjectURIToEditPolicies = new HashMap<String, List<MarkerEventListenerEditPolicy>>();
this.monitorService = servicesRegistry.getService(MarkersMonitorService.class);
}
+ @Override
public void startService() throws ServiceException {
// Nothing specific to be done
}
+ @Override
public void disposeService() throws ServiceException {
// Nothing specific to be done
}
/**
* Registers a MarkerEventListenerEditPolicy with this CssMarkerEventManagerService
- *
+ *
* @param editPolicy
- * The edit policy to be registered with this CssMarkerEventManagerService
+ * The edit policy to be registered with this CssMarkerEventManagerService
*/
public void registerEditPolicy(MarkerEventListenerEditPolicy editPolicy) {
Assert.isTrue(editPolicy.getHost().getModel() instanceof View);
- if(editPolicy.getHost().getModel() instanceof View) {
- EObject semanticElement = ((View)editPolicy.getHost().getModel()).getElement();
- if(semanticElement != null) {
+ if (editPolicy.getHost().getModel() instanceof View) {
+ EObject semanticElement = ((View) editPolicy.getHost().getModel()).getElement();
+ if (semanticElement != null) {
String semanticElementURI = EcoreUtil.getURI(semanticElement).toString();
List<MarkerEventListenerEditPolicy> correspondingGraphicalEditPolicies = eObjectURIToEditPolicies.get(semanticElementURI);
- if(correspondingGraphicalEditPolicies == null) {
+ if (correspondingGraphicalEditPolicies == null) {
correspondingGraphicalEditPolicies = new ArrayList<MarkerEventListenerEditPolicy>();
correspondingGraphicalEditPolicies.add(editPolicy);
} else {
- if(!correspondingGraphicalEditPolicies.contains(editPolicy)) {
+ if (!correspondingGraphicalEditPolicies.contains(editPolicy)) {
correspondingGraphicalEditPolicies.add(editPolicy);
}
}
@@ -86,16 +89,16 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
// retrieves all markers associated with the resource of the semanticElement, and pass these markers for notification
Resource resource = semanticElement.eResource();
- if(resource != null) {
+ if (resource != null) {
try {
Collection<? extends IPapyrusMarker> allPapyrusMarkers = monitorService.getMarkers(resource, "org.eclipse.papyrus.modelmarker", true);
List<IPapyrusMarker> listOfMarkersForSemanticElement = new ArrayList<IPapyrusMarker>();
- for(IPapyrusMarker next : allPapyrusMarkers) {
+ for (IPapyrusMarker next : allPapyrusMarkers) {
URI cddSemanticElementURI = getURI(next);
- if(cddSemanticElementURI == null) {
+ if (cddSemanticElementURI == null) {
return;
}
- if(cddSemanticElementURI.toString().equals(semanticElementURI)) {
+ if (cddSemanticElementURI.toString().equals(semanticElementURI)) {
listOfMarkersForSemanticElement.add(next);
}
}
@@ -111,20 +114,20 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
/**
* Unregisters the given MarkerEventListenerEditPolicy from this CssMarkerEventManagerService
- *
+ *
* @param editPolicy
- * The edit policy to be unregistered from this CssMarkerEventManagerService
+ * The edit policy to be unregistered from this CssMarkerEventManagerService
*/
public void unregisterEditPolicy(MarkerEventListenerEditPolicy editPolicy) {
Assert.isTrue(editPolicy.getHost().getModel() instanceof View);
- if(editPolicy.getHost().getModel() instanceof View) {
- EObject semanticElement = ((View)editPolicy.getHost().getModel()).getElement();
- if(semanticElement != null) {
+ if (editPolicy.getHost().getModel() instanceof View) {
+ EObject semanticElement = ((View) editPolicy.getHost().getModel()).getElement();
+ if (semanticElement != null) {
String semanticElementURI = EcoreUtil.getURI(semanticElement).toString();
List<MarkerEventListenerEditPolicy> correspondingGraphicalEditParts = eObjectURIToEditPolicies.get(semanticElementURI);
- if(correspondingGraphicalEditParts != null) {
+ if (correspondingGraphicalEditParts != null) {
correspondingGraphicalEditParts.remove(editPolicy);
- if(correspondingGraphicalEditParts.isEmpty()) {
+ if (correspondingGraphicalEditParts.isEmpty()) {
eObjectURIToEditPolicies.remove(semanticElementURI);
} else {
eObjectURIToEditPolicies.put(semanticElementURI, correspondingGraphicalEditParts);
@@ -140,12 +143,13 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
* @see org.eclipse.papyrus.infra.services.markerlistener.IMarkerEventListener#notifyMarkerChange(org.eclipse.emf.ecore.EObject,
* org.eclipse.core.resources.IMarker, int)
*/
+ @Override
public void notifyMarkerChange(EObject semanticElement, IPapyrusMarker marker, int markerState) {
- if(semanticElement != null) {
+ if (semanticElement != null) {
String semanticElementURI = EcoreUtil.getURI(semanticElement).toString();
List<MarkerEventListenerEditPolicy> correspondingGraphicalEditParts = eObjectURIToEditPolicies.get(semanticElementURI);
- if(correspondingGraphicalEditParts != null) {
- for(MarkerEventListenerEditPolicy editPart : correspondingGraphicalEditParts) {
+ if (correspondingGraphicalEditParts != null) {
+ for (MarkerEventListenerEditPolicy editPart : correspondingGraphicalEditParts) {
editPart.notifyMarkerChange(marker, markerState);
}
}
@@ -155,11 +159,11 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
/**
* Convenience method returning the EObject of a given marker (provided that it is a marker with a URI)
- *
+ *
* @param marker
- * The marker from which eObject has to be retrieved
+ * The marker from which eObject has to be retrieved
* @return The EObject associated with the given marker
- *
+ *
* @deprecated Use the {@link #getEObjectOfMarker(IPapyrusMarker, ResourceSet)} method, which does not create a new resource set and leak
* it forever in the UML {@code CacheAdapter}. If the JVM has assertions enabled for this package, then this method will throw an
* assertion error
@@ -169,7 +173,7 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
assert false : "the getEObjectOfMarker(IPapyrusMarker, ResourceSet) API should be used"; //$NON-NLS-1$
URI uriOfMarker = getURI(marker);
- if(uriOfMarker != null) {
+ if (uriOfMarker != null) {
ResourceSet resourceSet = new ResourceSetImpl();
Activator.log.warn("Created a new resourceSet to load a marker's target object in " + Activator.log.getCallerMethod()); //$NON-NLS-1$
return getEObjectOfMarker(marker, resourceSet);
@@ -179,24 +183,24 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
/**
* Convenience method returning the EObject of a given marker (provided that it is a marker with a URI)
- *
+ *
* @param marker
- * The marker from which eObject has to be retrieved
+ * The marker from which eObject has to be retrieved
* @param resourceSet
- * the resource set in which to load the marker's target object. Must not be {@code null}
- *
+ * the resource set in which to load the marker's target object. Must not be {@code null}
+ *
* @return The EObject associated with the given marker
- *
+ *
* @throws NullPointerException
- * if the {@code resourceSet} is {@code null}
+ * if the {@code resourceSet} is {@code null}
*/
public static EObject getEObjectOfMarker(IPapyrusMarker marker, ResourceSet resourceSet) {
- if(resourceSet == null) {
+ if (resourceSet == null) {
throw new NullPointerException("resourceSet"); //$NON-NLS-1$
}
URI uriOfMarker = getURI(marker);
- if(uriOfMarker != null) {
+ if (uriOfMarker != null) {
try {
return resourceSet.getEObject(uriOfMarker, true);
} catch (Exception e) {
@@ -209,14 +213,14 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
/**
* Convenience method returning the URI corresponding to the value of the EValidator.URI_ATTRIBUTE of a marker
- *
+ *
* @param marker
- * The marker from which the URI corresponding to the value its EValidator.URI_ATTRIBUTE has to be constructed
+ * The marker from which the URI corresponding to the value its EValidator.URI_ATTRIBUTE has to be constructed
* @return The URI corresponding to the value of the EValidator.URI_ATTRIBUTE of the given marker
*/
public static URI getURI(IPapyrusMarker marker) {
String uriOfMarkerStr = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- if(uriOfMarkerStr != null) {
+ if (uriOfMarkerStr != null) {
return URI.createURI(uriOfMarkerStr);
}
return null;
@@ -227,6 +231,7 @@ public class CssMarkerEventManagerService implements IMarkerEventListener {
*
* @see org.eclipse.papyrus.infra.services.markerlistener.IMarkerEventListener#isNotifiedOnInitialMarkerCheck()
*/
+ @Override
public boolean isNotifiedOnInitialMarkerCheck() {
return false;
}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/MarkerToPseudoSelectorMappingService.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/MarkerToPseudoSelectorMappingService.java
index ea5a64ef485..ad4d9151715 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/MarkerToPseudoSelectorMappingService.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/service/MarkerToPseudoSelectorMappingService.java
@@ -17,7 +17,7 @@ import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
* This pseudo selector is interpreted by the Papyrus CSS Engine, so that a particular CSS style can applied in the case where a marker is applied.
* Pseudo selectors are associated with marker kinds by contributing to extension point
* org.eclipse.papyrus.infra.gmfdiag.css.markertopseudoselectormappingprovider
- *
+ *
*/
public class MarkerToPseudoSelectorMappingService implements IService {
@@ -34,9 +34,10 @@ public class MarkerToPseudoSelectorMappingService implements IService {
/**
* Initializes the markerToPseudoSelectorMap by retrieving all contributors to the "Marker To Pseudo Selectors Mapping Provider" extension point,
* and merging all the mappings they define
- *
+ *
* @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
*/
+ @Override
public void init(ServicesRegistry servicesRegistry) throws ServiceException {
this.servicesRegistry = servicesRegistry;
this.markerToPseudoSelectorMap = this.getRegisteredMarkerToPseudoSelectorsMappingProviders();
@@ -47,6 +48,7 @@ public class MarkerToPseudoSelectorMappingService implements IService {
*
* @see org.eclipse.papyrus.infra.core.services.IService#startService()
*/
+ @Override
public void startService() throws ServiceException {
// nothing to be done
}
@@ -56,15 +58,16 @@ public class MarkerToPseudoSelectorMappingService implements IService {
*
* @see org.eclipse.papyrus.infra.core.services.IService#disposeService()
*/
+ @Override
public void disposeService() throws ServiceException {
// nothing to be done
}
/**
* Return the pseudo selectors for the given marker kind
- *
+ *
* @param markerKind
- * The marker kind for which the corresponding pseudo selector has to be retrieved
+ * The marker kind for which the corresponding pseudo selector has to be retrieved
* @return
*/
public String getPseudoSelector(String markerKind) {
@@ -76,7 +79,7 @@ public class MarkerToPseudoSelectorMappingService implements IService {
* Utility methods which collects all the contributors to the "Marker To Pseudo Selectors Mapping Provider" extension point, and return the merge
* of all the mappings they define.
* In the case where multiple pseudo selectors are defined for a single marker kind, only one pseudo selector is kept (this is not deterministic).
- *
+ *
* @return The merge of all the mappings defined by contributors to the "Marker To Pseudo Selectors Mapping Provider" extension point
* @see org.eclipse.papyrus.infra.core.services.IService#init(org.eclipse.papyrus.infra.core.services.ServicesRegistry)
*/
@@ -84,14 +87,15 @@ public class MarkerToPseudoSelectorMappingService implements IService {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] config = registry.getConfigurationElementsFor(IMarkerToPseudoSelectorMappingProvider.MARKER_TO_PSEUDO_SELECTOR_MAPPING_PROVIDER_EXTENSION_POINT_ID);
Map<String, String> providers = new HashMap<String, String>();
- for(int i = 0; i < config.length; i++) {
+ for (int i = 0; i < config.length; i++) {
IMarkerToPseudoSelectorMappingProvider provider;
try {
- provider = (IMarkerToPseudoSelectorMappingProvider)config[i].createExecutableExtension("class");
+ provider = (IMarkerToPseudoSelectorMappingProvider) config[i].createExecutableExtension("class");
Map<String, String> mappings = provider.getMappings();
- for(String markerKind : mappings.keySet()) {
- if(providers.containsKey(markerKind))
+ for (String markerKind : mappings.keySet()) {
+ if (providers.containsKey(markerKind)) {
Activator.log.warn("Multiple pseudo selectors registered for " + markerKind);
+ }
providers.put(markerKind, mappings.get(markerKind));
}
} catch (CoreException e) {
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
index db41bcc1bb2..df98b341ae3 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/theme/ThemeManager.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2014 CEA LIST.
- *
+ *
* 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
@@ -80,7 +80,7 @@ public class ThemeManager {
* Default constructor.
*/
private ThemeManager() {
- //Singleton
+ // Singleton
}
/**
@@ -102,7 +102,7 @@ public class ThemeManager {
*/
public List<StyleSheet> getWorkspaceStyleSheets() {
Theme current = findCurrentTheme();
- if(current == null) {
+ if (current == null) {
return Collections.emptyList();
}
return current.getStylesheets();
@@ -118,12 +118,12 @@ public class ThemeManager {
public Theme getTheme(String themeId) {
Theme registeredTheme = null;
- if(getAllThemes().containsKey(themeId)) {
+ if (getAllThemes().containsKey(themeId)) {
registeredTheme = getAllThemes().get(themeId);
}
// Bug 434956 : Patch to ensure that one theme is returned.
- if(registeredTheme == null) {
+ if (registeredTheme == null) {
registeredTheme = EmptyTheme.instance;
}
@@ -143,18 +143,18 @@ public class ThemeManager {
public void refreshThemes() {
// Handle added themes
- for(Theme addedTheme : temporaryThemesList) {
+ for (Theme addedTheme : temporaryThemesList) {
String key = addedTheme.getId();
- if(!allThemes.containsKey(key)) {
+ if (!allThemes.containsKey(key)) {
allThemes.put(key, addedTheme);
}
}
// Handle deleted themes
- for(Theme deletedTheme : deletedThemesList) {
+ for (Theme deletedTheme : deletedThemesList) {
String key = deletedTheme.getId();
- if(allThemes.containsKey(key)) {
+ if (allThemes.containsKey(key)) {
allThemes.remove(key);
}
}
@@ -178,10 +178,10 @@ public class ThemeManager {
/**
* Add a temporary theme.
- *
+ *
* @param temporaryTheme
- * Theme to add in workspace themes preference
- *
+ * Theme to add in workspace themes preference
+ *
*/
public void addTemporaryTheme(Theme temporaryTheme) {
temporaryThemesList.add(temporaryTheme);
@@ -189,14 +189,14 @@ public class ThemeManager {
/**
* Delete theme from preferences.
- *
+ *
* @param theme
- * Theme to delete
+ * Theme to delete
*/
public void delete(Theme theme) {
// If theme is temporary don't maintain in associated list
- if(temporaryThemesList.contains(theme)) {
+ if (temporaryThemesList.contains(theme)) {
temporaryThemesList.remove(theme);
} else {
// Else store in a list to be able to cancel
@@ -206,9 +206,9 @@ public class ThemeManager {
/**
* Get icon from a theme. Icon can register with plugin URI or file URI.
- *
+ *
* @param theme
- * Theme which can have an icon
+ * Theme which can have an icon
* @return Loaded image, otherwise <code>null</code>
*/
public Image getThemeIcon(Theme theme) {
@@ -216,18 +216,18 @@ public class ThemeManager {
String iconPath = theme.getIcon();
- if(iconPath != null) {
+ if (iconPath != null) {
// First : looking for theme in contribution
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
icon = handleThemeDefinition(theme, config);
- // Second : Try to load image from its path
- if(icon == null) {
+ // Second : Try to load image from its path
+ if (icon == null) {
- // Test path to icon
+ // Test path to icon
IPath path = new Path(iconPath);
- if(path.toFile().exists()) {
+ if (path.toFile().exists()) {
icon = new Image(PlatformUI.getWorkbench().getDisplay(), iconPath);
}
@@ -239,7 +239,7 @@ public class ThemeManager {
/**
* Return only workspace themes preference.
- *
+ *
* @return Workspace themes preference (instance of {@link WorkspaceThemes}) if it exist, otherwise <code>null</code>
*/
public WorkspaceThemes getWorkspaceThemesPreferences() {
@@ -250,7 +250,7 @@ public class ThemeManager {
IPath path = workspaceThemesHelper.getThemeWorkspacePreferenceFilePath();
// If file exist, themes can load
- if(path.toFile().exists()) {
+ if (path.toFile().exists()) {
// Resolve URI
URI fileURI = CommonPlugin.resolve(URI.createFileURI(path.toOSString()));
@@ -261,7 +261,7 @@ public class ThemeManager {
// Get workspace theme
- workspaceThemes = (WorkspaceThemes)EcoreUtil.getObjectByType(resource.getContents(), StylesheetsPackage.eINSTANCE.getWorkspaceThemes());
+ workspaceThemes = (WorkspaceThemes) EcoreUtil.getObjectByType(resource.getContents(), StylesheetsPackage.eINSTANCE.getWorkspaceThemes());
}
return workspaceThemes;
@@ -270,9 +270,9 @@ public class ThemeManager {
/**
* Know if theme is editable. Only themes of workspace or temporary can be edited.
- *
+ *
* @param id
- * Id of theme to check
+ * Id of theme to check
* @return <code>true</code> if theme can be edited, otherwise <code>false<code>
*/
public boolean isEditable(String id) {
@@ -282,11 +282,11 @@ public class ThemeManager {
// Check if theme is in persisted workspace themes
WorkspaceThemes workspacePreference = getWorkspaceThemesPreferences();
- if(workspacePreference != null && !isEditable) {
+ if (workspacePreference != null && !isEditable) {
- //Check if theme comes from workspace preferences
+ // Check if theme comes from workspace preferences
Iterator<Theme> themesIterator = workspacePreference.getThemes().iterator();
- while(themesIterator.hasNext() && !isEditable) {
+ while (themesIterator.hasNext() && !isEditable) {
isEditable = id.equals(themesIterator.next().getId());
}
@@ -314,8 +314,8 @@ public class ThemeManager {
private Theme[] getEditableThemes() {
List<Theme> editableThemeList = new ArrayList<Theme>();
- for(Theme theme : allThemes.values()) {
- if(isEditable(theme.getId())) {
+ for (Theme theme : allThemes.values()) {
+ if (isEditable(theme.getId())) {
editableThemeList.add(theme);
}
}
@@ -324,29 +324,29 @@ public class ThemeManager {
/**
* Look for corresponding theme in theme definition contribution and load its image.
- *
+ *
* @param theme
- * Theme to find in all contribution
+ * Theme to find in all contribution
* @param config
- * Configuration of all theme contribution
+ * Configuration of all theme contribution
* @return Loaded image if theme is came from contribution, otherwise <code>null</code>
*/
private Image handleThemeDefinition(Theme theme, IConfigurationElement[] config) {
Image icon = null;
- for(IConfigurationElement themeContribution : config) {
+ for (IConfigurationElement themeContribution : config) {
// Verify that contribution is a theme definition
- if(!themeContribution.getName().equals("themeDefinition")) {
+ if (!themeContribution.getName().equals("themeDefinition")) {
continue;
}
- // Get label and Id of definition to compare to parameter
+ // Get label and Id of definition to compare to parameter
String themeId = themeContribution.getAttribute("id");
String themeLabel = themeContribution.getAttribute("label");
- if(themeId != null && themeId.equals(theme.getId()) && themeLabel != null && themeLabel.equals(theme.getLabel())) {
- //FIXME: Use the Papyrus Image service when it is available
+ if (themeId != null && themeId.equals(theme.getId()) && themeLabel != null && themeLabel.equals(theme.getLabel())) {
+ // FIXME: Use the Papyrus Image service when it is available
icon = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(themeContribution.getContributor().getName(), theme.getIcon());
}
}
@@ -355,8 +355,8 @@ public class ThemeManager {
}
private Map<String, Theme> getAllThemes() {
- if(allThemes == null) {
- allThemes = new LinkedHashMap<String, Theme>(); //Keep the themes ordered, to avoid nondeterministic behavior
+ if (allThemes == null) {
+ allThemes = new LinkedHashMap<String, Theme>(); // Keep the themes ordered, to avoid nondeterministic behavior
allThemes.put(EmptyTheme.instance.getId(), EmptyTheme.instance);
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
@@ -366,9 +366,9 @@ public class ThemeManager {
loadTemporaryThemes();
// Remove deleted themes
- for(Theme theme : deletedThemesList) {
+ for (Theme theme : deletedThemesList) {
String themeId = theme.getId();
- if(allThemes.containsKey(themeId)) {
+ if (allThemes.containsKey(themeId)) {
allThemes.remove(themeId);
}
}
@@ -381,24 +381,24 @@ public class ThemeManager {
* Load theme definitions.
*
* @param config
- * configuration of all contribution definition
+ * configuration of all contribution definition
*/
private void loadThemeDefinitions(IConfigurationElement[] config) {
// For all theme definitions
- for(IConfigurationElement themeConfig : config) {
+ for (IConfigurationElement themeConfig : config) {
- if(!themeConfig.getName().equals("themeDefinition")) {
+ if (!themeConfig.getName().equals("themeDefinition")) {
continue;
}
final String themeId = themeConfig.getAttribute("id");
- if(themeId == null) {
+ if (themeId == null) {
Activator.log.warn("Cannot define a CSS Theme with an empty id (Contributed by " + themeConfig.getContributor() + ")");
continue;
}
- //Create theme
+ // Create theme
Theme theme = StylesheetsFactory.eINSTANCE.createTheme();
theme.setId(themeId);
@@ -406,7 +406,7 @@ public class ThemeManager {
theme.setLabel(themeLabel);
String themeIcon = themeConfig.getAttribute("icon");
- if(themeIcon != null) {
+ if (themeIcon != null) {
theme.setIcon(themeIcon);
@@ -420,18 +420,18 @@ public class ThemeManager {
* Load theme contributions.
*
* @param config
- * configuration of all contribution definition
+ * configuration of all contribution definition
*/
private void loadThemeContributions(IConfigurationElement[] config) {
- for(IConfigurationElement themeConfig : config) {
+ for (IConfigurationElement themeConfig : config) {
- // Verify that
- if(!themeConfig.getName().equals("themeContribution")) {
+ // Verify that
+ if (!themeConfig.getName().equals("themeContribution")) {
continue;
}
final String themeId = themeConfig.getAttribute("id");
- if(themeId == null || !allThemes.containsKey(themeId)) {
+ if (themeId == null || !allThemes.containsKey(themeId)) {
Activator.log.warn("Cannot contribute to an undefined theme: " + themeId);
continue;
}
@@ -439,7 +439,7 @@ public class ThemeManager {
Theme theme = allThemes.get(themeId);
IConfigurationElement[] stylesheets = themeConfig.getChildren("stylesheet");
- for(IConfigurationElement stylesheetConfig : stylesheets) {
+ for (IConfigurationElement stylesheetConfig : stylesheets) {
String path = stylesheetConfig.getAttribute("stylesheetPath");
try {
URL url = new URL("platform:/plugin/" + themeConfig.getContributor().getName() + "/" + path);
@@ -461,11 +461,11 @@ public class ThemeManager {
WorkspaceThemes workspaceThemes = getWorkspaceThemesPreferences();
// If file exist, themes can load
- if(workspaceThemes != null) {
+ if (workspaceThemes != null) {
// Add each themme to current list
- for(Theme theme : workspaceThemes.getThemes()) {
+ for (Theme theme : workspaceThemes.getThemes()) {
allThemes.put(theme.getId(), theme);
}
@@ -476,7 +476,7 @@ public class ThemeManager {
* Add temporary themes in current themes list.
*/
private void loadTemporaryThemes() {
- for(Theme theme : temporaryThemesList) {
+ for (Theme theme : temporaryThemesList) {
allThemes.put(theme.getId(), theme);
}
@@ -485,22 +485,22 @@ public class ThemeManager {
private Theme findCurrentTheme() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- if(store.contains(ThemePreferences.CURRENT_THEME)) {
+ if (store.contains(ThemePreferences.CURRENT_THEME)) {
String themeId = store.getString(ThemePreferences.CURRENT_THEME);
return getTheme(themeId);
}
- //The theme has not been defined: return the first one, and store it
+ // The theme has not been defined: return the first one, and store it
List<Theme> sortedThemes = new ArrayList<Theme>(getAllThemes().values());
- if(sortedThemes.size() < 2) {
+ if (sortedThemes.size() < 2) {
return EmptyTheme.instance;
}
- //Index 0 is EmptyTheme ; we return the first non-empty theme
+ // Index 0 is EmptyTheme ; we return the first non-empty theme
Theme theme = sortedThemes.get(1);
store.setValue(ThemePreferences.CURRENT_THEME, theme.getId());
try {
- ((IPersistentPreferenceStore)store).save();
+ ((IPersistentPreferenceStore) store).save();
} catch (IOException e) {
Activator.log.error(e);
}
@@ -531,10 +531,10 @@ public class ThemeManager {
@Override
public int compare(Theme o1, Theme o2) {
- if(o1 == EmptyTheme.instance) {
+ if (o1 == EmptyTheme.instance) {
return -1;
}
- if(o2 == EmptyTheme.instance) {
+ if (o2 == EmptyTheme.instance) {
return 1;
}

Back to the top