Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/color/DefaultColorStyleDescription.java')
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/color/DefaultColorStyleDescription.java202
1 files changed, 202 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/color/DefaultColorStyleDescription.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/color/DefaultColorStyleDescription.java
new file mode 100644
index 0000000000..c25221028a
--- /dev/null
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/color/DefaultColorStyleDescription.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.business.internal.color;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.sirius.description.style.BasicLabelStyleDescription;
+import org.eclipse.sirius.description.style.BeginLabelStyleDescription;
+import org.eclipse.sirius.description.style.BorderedStyleDescription;
+import org.eclipse.sirius.description.style.BundledImageDescription;
+import org.eclipse.sirius.description.style.CenterLabelStyleDescription;
+import org.eclipse.sirius.description.style.DotDescription;
+import org.eclipse.sirius.description.style.EdgeStyleDescription;
+import org.eclipse.sirius.description.style.EllipseNodeDescription;
+import org.eclipse.sirius.description.style.EndLabelStyleDescription;
+import org.eclipse.sirius.description.style.FlatContainerStyleDescription;
+import org.eclipse.sirius.description.style.GaugeSectionDescription;
+import org.eclipse.sirius.description.style.LabelStyleDescription;
+import org.eclipse.sirius.description.style.LozengeNodeDescription;
+import org.eclipse.sirius.description.style.NoteDescription;
+import org.eclipse.sirius.description.style.ShapeContainerStyleDescription;
+import org.eclipse.sirius.description.style.SquareDescription;
+import org.eclipse.sirius.description.style.util.StyleSwitch;
+import org.eclipse.sirius.tools.api.ui.color.EnvironmentSystemColorFactory;
+
+/**
+ * Class responsible for setting default color values on style descriptions.
+ *
+ * @author cbrun
+ *
+ */
+public class DefaultColorStyleDescription extends StyleSwitch<EObject> {
+
+ private static final String BLACK = "black";
+
+ private static final String GRAY = "gray";
+
+ /**
+ * Set the default color descriptions on the given EObject.
+ *
+ * @param theEObject
+ * the object to update.
+ */
+ public void setDefaultColors(final EObject theEObject) {
+ doSwitch(theEObject);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseBorderedStyleDescription(final BorderedStyleDescription object) {
+ object.setBorderColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseBorderedStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseLabelStyleDescription(final LabelStyleDescription object) {
+ object.setLabelColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseLabelStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseBasicLabelStyleDescription(BasicLabelStyleDescription object) {
+ object.setLabelColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseBasicLabelStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseBeginLabelStyleDescription(BeginLabelStyleDescription object) {
+ object.setLabelColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseBeginLabelStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseCenterLabelStyleDescription(CenterLabelStyleDescription object) {
+ object.setLabelColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseCenterLabelStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseEndLabelStyleDescription(EndLabelStyleDescription object) {
+ object.setLabelColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseEndLabelStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseSquareDescription(final SquareDescription object) {
+ object.setColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY));
+ return super.caseSquareDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseBundledImageDescription(final BundledImageDescription object) {
+ object.setColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ return super.caseBundledImageDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseNoteDescription(final NoteDescription object) {
+ object.setColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription("yellow"));
+ return super.caseNoteDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseDotDescription(final DotDescription object) {
+ object.setBackgroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY));
+ return super.caseDotDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseFlatContainerStyleDescription(final FlatContainerStyleDescription object) {
+ object.setForegroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription("light_gray"));
+ object.setBackgroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription("white"));
+ return super.caseFlatContainerStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseShapeContainerStyleDescription(final ShapeContainerStyleDescription object) {
+ object.setBackgroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription("light_gray"));
+ return super.caseShapeContainerStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseEdgeStyleDescription(final EdgeStyleDescription object) {
+ object.setStrokeColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY));
+ return super.caseEdgeStyleDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseGaugeSectionDescription(final GaugeSectionDescription object) {
+ object.setBackgroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(BLACK));
+ object.setForegroundColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription("green"));
+ return super.caseGaugeSectionDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseEllipseNodeDescription(final EllipseNodeDescription object) {
+ object.setColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY));
+ return super.caseEllipseNodeDescription(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public EObject caseLozengeNodeDescription(final LozengeNodeDescription object) {
+ object.setColor(EnvironmentSystemColorFactory.getDefault().getSystemColorDescription(GRAY));
+ return super.caseLozengeNodeDescription(object);
+ }
+
+}

Back to the top