Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmallet2017-12-21 11:31:21 +0000
committerPierre-Charles David2018-01-31 14:53:26 +0000
commit3688e7576d3b1f1cf492ed59a4f0f6ae701b2e55 (patch)
tree16bc15350fc64814030385bcc04b0711ff8bbe84
parent8e2dccede576215216a8295095cb2160885916b1 (diff)
downloadorg.eclipse.sirius-6.0.0M5.tar.gz
org.eclipse.sirius-6.0.0M5.tar.xz
org.eclipse.sirius-6.0.0M5.zip
[525533] Add support for diagram background colorv6.0.0M5
- modification of diagram MM to add background color reference on the diagram description; - generation of MM and properties; - modification of diagram editPart to display color in background during diagram creation or refresh; - addition of test. Bug: 525533 Change-Id: Id174303442dc8a5ad1c5795856eacdd40fdc1f23 Signed-off-by: jmallet <jessy.mallet@obeo.fr> Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/plugin.properties3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/DDiagramEditPart.java82
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/BackgroundUpdater.java101
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/GMFDiagramUpdater.java6
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/part/SiriusDiagramGraphicalViewer.java98
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java16
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java16
-rw-r--r--plugins/org.eclipse.sirius.diagram/model/diagram.ecore5
-rw-r--r--plugins/org.eclipse.sirius.diagram/model/diagram.genmodel3
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/DiagramPackage.java18
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java46
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DiagramDescription.java31
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java16
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramDescriptionImpl.java70
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramImportDescriptionImpl.java74
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html6
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile1
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html7
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile2
-rw-r--r--plugins/org.eclipse.sirius.editor.diagram/plugin.xml8
-rw-r--r--plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/filters/description/diagramdescription/DiagramDescriptionBackgroundColorFilter.java44
-rw-r--r--plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/description/diagramdescription/DiagramDescriptionBackgroundColorPropertySection.java138
-rw-r--r--plugins/org.eclipse.sirius.editor/plugin.xml1
-rw-r--r--plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/AbstractColorReferenceTestCase.java7
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java4
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/design/EntitiesDiagramBackgroundTests.java228
26 files changed, 944 insertions, 87 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
index 5177eb87c6..e0a1ebc0b0 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
@@ -1263,3 +1263,6 @@ _UI_NodeStyleDescription_forbiddenSides_description = Authorized sides on the pa
_UI_DDiagram_activatedTransientLayers_feature = Activated Transient Layers
_UI_DDiagramElement_transientDecorations_feature = Transient Decorations
_UI_DDiagram_isInShowingMode_feature = Is In Showing Mode
+_UI_DiagramDescription_backgroundColor_feature = Background Color
+_UI_BackgroundPropertyCategory = Background
+_UI_DiagramDescription_backgroundColor_description = Color of the diagram background, white if unset.
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/DDiagramEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/DDiagramEditPart.java
index 9938ee0f98..7e013c8a74 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/DDiagramEditPart.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/DDiagramEditPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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,13 +10,18 @@
*******************************************************************************/
package org.eclipse.sirius.diagram.ui.internal.edit.parts;
+import org.eclipse.draw2d.IFigure;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.SnapToHelper;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.sirius.business.api.color.AbstractColorUpdater;
+import org.eclipse.sirius.business.api.color.RGBValuesProvider;
import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.DSemanticDiagram;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDDiagramEditPart;
import org.eclipse.sirius.diagram.ui.graphical.edit.policies.AirXYLayoutEditPolicy;
import org.eclipse.sirius.diagram.ui.graphical.edit.policies.ContainerCreationEditPolicy;
@@ -32,8 +37,12 @@ import org.eclipse.sirius.diagram.ui.internal.edit.policies.DDiagramItemSemantic
import org.eclipse.sirius.diagram.ui.provider.Messages;
import org.eclipse.sirius.diagram.ui.tools.api.policy.CompoundEditPolicy;
import org.eclipse.sirius.diagram.ui.tools.api.requests.RequestConstants;
+import org.eclipse.sirius.diagram.ui.tools.internal.part.SiriusDiagramGraphicalViewer;
import org.eclipse.sirius.diagram.ui.tools.internal.ruler.SiriusSnapToHelperUtil;
import org.eclipse.sirius.tools.api.command.SiriusCommand;
+import org.eclipse.sirius.viewpoint.RGBValues;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
+import org.eclipse.swt.graphics.Color;
/**
* @was-generated
@@ -49,11 +58,8 @@ public class DDiagramEditPart extends AbstractDDiagramEditPart {
* @was-generated
*/
public static final int VISUAL_ID = 1000;
-
- @Override
- protected void refreshBackgroundColor() {
- super.refreshBackgroundColor();
- };
+
+ private static final RGBValues WHITE = RGBValues.create(255, 255, 255);
/**
* @was-generated
@@ -98,6 +104,19 @@ public class DDiagramEditPart extends AbstractDDiagramEditPart {
super.deactivate();
}
+ @Override
+ protected IFigure createFigure() {
+ IFigure fig = super.createFigure();
+ configureBackground(fig);
+ return fig;
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ configureBackground(getFigure());
+ }
+
/**
* Deactivates the Layouting Mode of the {@link DDiagram} (if needed).
*/
@@ -143,11 +162,9 @@ public class DDiagramEditPart extends AbstractDDiagramEditPart {
* @param editingDomain
* the editing domain
* @param diagram
- * the {@link DDiagram} on witch the layouting mode should be
- * switched
+ * the {@link DDiagram} on witch the layouting mode should be switched
* @param layoutingModeShouldBeEnabled
- * indicates whether the layouting mode should be enabled or
- * disabled
+ * indicates whether the layouting mode should be enabled or disabled
*/
public SetLayoutingModeCommand(TransactionalEditingDomain editingDomain, DDiagram diagram, boolean layoutingModeShouldBeEnabled) {
super(editingDomain, Messages.SetLayoutingModeCommand_deactivateLabel);
@@ -158,12 +175,6 @@ public class DDiagramEditPart extends AbstractDDiagramEditPart {
}
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tools.api.command.SiriusCommand#doExecute()
- */
@Override
protected void doExecute() {
this.diagram.setIsInLayoutingMode(layoutingModeShouldBeEnabled);
@@ -178,4 +189,43 @@ public class DDiagramEditPart extends AbstractDDiagramEditPart {
}
return super.getAdapter(key);
}
+
+ /**
+ * Configure the background of a given figure by using color defined on semantic diagram description.
+ *
+ * @param fig
+ * figure with the background to configure
+ */
+ public synchronized void configureBackground(IFigure fig) {
+ if (resolveDDiagram().some() && fig != null) {
+ DSemanticDiagram dSemanticDiagram = (DSemanticDiagram) this.resolveDDiagram().get();
+ ColorDescription colorDesc = dSemanticDiagram.getDescription().getBackgroundColor();
+ RGBValues rgb = WHITE;
+ if (colorDesc != null) {
+ rgb = new AbstractColorUpdater().getRGBValuesFromColorDescription(dSemanticDiagram.getTarget(), colorDesc);
+ }
+
+ Color previousColor = fig.getBackgroundColor();
+ if (!sameColor(previousColor, rgb)) {
+ SiriusDiagramGraphicalViewer viewer = (SiriusDiagramGraphicalViewer) this.getViewer();
+ Color backgroundColor;
+ if (WHITE.equals(rgb)) {
+ backgroundColor = null;
+ } else {
+ backgroundColor = new Color(viewer.getControl().getDisplay(), rgb.getRed(), rgb.getGreen(), rgb.getBlue());
+ }
+ fig.setBackgroundColor(backgroundColor);
+ fig.setOpaque(backgroundColor != null);
+ viewer.setBackgroundColor(backgroundColor);
+ }
+ }
+ }
+
+ private boolean sameColor(Color current, RGBValues expected) {
+ if (current == null) {
+ return WHITE.equals(expected);
+ } else {
+ return current.getRed() == expected.getRed() && current.getGreen() == expected.getGreen() && current.getBlue() == expected.getBlue();
+ }
+ }
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/BackgroundUpdater.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/BackgroundUpdater.java
new file mode 100644
index 0000000000..e0c36af010
--- /dev/null
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/BackgroundUpdater.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Obeo.
+ * 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.diagram.ui.internal.refresh.listeners;
+
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.ResourceSetChangeEvent;
+import org.eclipse.emf.transaction.ResourceSetListenerImpl;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.sirius.business.api.session.Session;
+import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.DSemanticDiagram;
+import org.eclipse.sirius.diagram.ui.internal.edit.parts.DDiagramEditPart;
+import org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl;
+import org.eclipse.sirius.ui.business.api.dialect.DialectEditor;
+import org.eclipse.sirius.ui.business.api.session.IEditingSession;
+import org.eclipse.sirius.ui.business.api.session.SessionUIManager;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
+import org.eclipse.sirius.viewpoint.description.ComputedColor;
+import org.eclipse.sirius.viewpoint.description.InterpolatedColor;
+
+/**
+ * A ResourceSet listener to refresh the diagram background if it is defined by Interpolated or computed color.
+ *
+ * @author jmallet
+ */
+public class BackgroundUpdater extends ResourceSetListenerImpl {
+
+ private DDiagram dDiagram;
+
+ private static final NotificationFilter FEATURES_TO_REFACTOR_BACKGROUND = NotificationFilter.NOT_TOUCH;
+
+ /**
+ * Default constructor.
+ *
+ * @param domain
+ * {@link TransactionalEditingDomain}
+ * @param dDiagram
+ * {@link DDiagram}.
+ */
+ public BackgroundUpdater(TransactionalEditingDomain domain, DDiagram dDiagram) {
+ super(FEATURES_TO_REFACTOR_BACKGROUND);
+ domain.addResourceSetListener(this);
+ this.dDiagram = dDiagram;
+ }
+
+ /**
+ * Refresh the background colors of all the opened diagrams from the given session.
+ */
+ public static void refreshDiagramBackgrounds(Session session) {
+ EclipseUIUtil.displayAsyncExec(() -> {
+ IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
+ if (uiSession != null) {
+ for (DialectEditor editor : uiSession.getEditors()) {
+ if (editor instanceof DDiagramEditorImpl) {
+ DiagramEditPart diagramEditPart = ((DDiagramEditorImpl) editor).getDiagramEditPart();
+ ((DDiagramEditPart) diagramEditPart).configureBackground(diagramEditPart.getFigure());
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean isPostcommitOnly() {
+ return true;
+ }
+
+ /**
+ * Forces a refresh of the background color if needed.
+ * <p>
+ * {@inheritDoc}
+ */
+ @Override
+ public void resourceSetChanged(ResourceSetChangeEvent event) {
+ if (dDiagram instanceof DSemanticDiagram) {
+ ColorDescription backgroundColor = ((DSemanticDiagram) dDiagram).getDescription().getBackgroundColor();
+ if (backgroundColor instanceof InterpolatedColor || backgroundColor instanceof ComputedColor) {
+ Session.of(dDiagram).ifPresent(s -> refreshDiagramBackgrounds(s));
+ }
+ }
+ }
+
+ /**
+ * Dispose this listener.
+ */
+ public void dispose() {
+ if (getTarget() != null) {
+ getTarget().removeResourceSetListener(this);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/GMFDiagramUpdater.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/GMFDiagramUpdater.java
index 9ea8e01bdf..5b4cd5ad5e 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/GMFDiagramUpdater.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/GMFDiagramUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 THALES GLOBAL SERVICES.
+ * Copyright (c) 2012, 2018 THALES GLOBAL SERVICES 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
@@ -32,6 +32,8 @@ public class GMFDiagramUpdater {
private GMFBoundsUpdater gmfBoundsUpdater;
+ private BackgroundUpdater backgroundUpdater;
+
private VisibilityUpdater visibilityUpdater;
private DDiagramHiddenElementsUpdater dDiagramHiddenElementsUpdater;
@@ -63,6 +65,7 @@ public class GMFDiagramUpdater {
eventBroker.addLocalTrigger(SessionEventBrokerImpl.asFilter(new FilterListenerScope()), filterListener);
edgeLayoutUpdaterChangeTrigger = new EdgeLayoutUpdaterModelChangeTrigger(session, dDiagram);
gmfBoundsUpdater = new GMFBoundsUpdater(domain, dDiagram);
+ backgroundUpdater = new BackgroundUpdater(domain, dDiagram);
visibilityUpdater = new VisibilityUpdater(domain, dDiagram);
dDiagramHiddenElementsUpdater = new DDiagramHiddenElementsUpdater(domain, dDiagram);
visibilityPropagator = new VisibilityPropagatorAdapter(session, dDiagram);
@@ -78,6 +81,7 @@ public class GMFDiagramUpdater {
notationVisibilityUpdater.dispose();
viewFontChangesRefactorer.dispose();
gmfBoundsUpdater.dispose();
+ backgroundUpdater.dispose();
visibilityUpdater.dispose();
dDiagramHiddenElementsUpdater.dispose();
edgeStyleUpdater.dispose();
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/part/SiriusDiagramGraphicalViewer.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/part/SiriusDiagramGraphicalViewer.java
index cd23318fef..f6ddcff898 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/part/SiriusDiagramGraphicalViewer.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/part/SiriusDiagramGraphicalViewer.java
@@ -40,10 +40,12 @@ import org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalView
import org.eclipse.sirius.diagram.ui.tools.internal.editor.SiriusPaletteToolDropTargetListener;
import org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.policies.ChangeBoundRequestRecorder;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.graphics.Color;
/**
* {@link org.eclipse.gef.GraphicalViewer} used for the {@link org.eclipse.sirius.diagram.DDiagram} modeler.
- *
+ *
* @author mchauvin
*/
@SuppressWarnings("restriction")
@@ -58,63 +60,54 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
private final SemanticElementToEditPartsMap elementToEditPartsMap = new SemanticElementToEditPartsMap();
/**
+ * The background color used for the diagram. Stored here so that we can properly dispose if on close.
+ */
+ private Color backgroundColor;
+
+ /**
* return the viewer's change bound request recorder.
- *
+ *
* @return the viewer's change bound request recorder.
*/
public ChangeBoundRequestRecorder getChangeBoundRequestRecorder() {
return recorder;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer#registerEditPartForSemanticElement(org.eclipse.emf.ecore.EObject,
- * org.eclipse.gef.EditPart)
- */
@Override
public void registerEditPartForSemanticElement(final EObject element, final EditPart ep) {
elementToEditPartsMap.registerEditPartForElement(element, ep);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer#unregisterEditPartForSemanticElement(org.eclipse.emf.ecore.EObject,
- * org.eclipse.gef.EditPart)
- */
@Override
public void unregisterEditPartForSemanticElement(final EObject element, final EditPart ep) {
elementToEditPartsMap.unregisterEditPartForElement(element, ep);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer#unregisterEditPart(org.eclipse.gef.EditPart)
- */
@Override
public void unregisterEditPart(final EditPart ep) {
elementToEditPartsMap.unregisterEditPart(ep);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer#findEditPartsForElement(String,
- * Class)
- */
@Override
public <T extends EditPart> List<T> findEditPartsForElement(final EObject element, final Class<T> editPartClass) {
return elementToEditPartsMap.findEditPartsForElement(element, editPartClass);
}
+ @Override
+ protected void handleDispose(DisposeEvent e) {
+ super.handleDispose(e);
+ if (this.backgroundColor != null) {
+ this.backgroundColor.dispose();
+ this.backgroundColor = null;
+ }
+ }
+
/**
* <code>boolean</code> <code>true</code> if client wishes to disable updates on the figure canvas,
* <code>false</code> indicates normal updates are to take place.
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer#enableUpdates(boolean)
*/
@Override
@@ -126,11 +119,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
}
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer#areUpdatesDisabled()
- */
@Override
public boolean areUpdatesDisabled() {
return getLightweightSystemWithUpdateToggle().getToggleUpdateManager().shouldDisableUpdates();
@@ -139,7 +127,7 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
/**
* Special version of the ToggleUpdateManager normally used in the super-class, with a workaround to avoid infinite
* loops triggered during figure validation.
- *
+ *
* @author ymortier
*/
private static class ToggleUpdateManager extends DeferredUpdateManager {
@@ -175,9 +163,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
return disableUpdates;
}
- /**
- * {@inheritDoc}
- */
@Override
protected void sendUpdateRequest() {
EclipseUIUtil.displayAsyncExec(new UpdateRequest());
@@ -195,9 +180,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
}
}
- /**
- * {@inheritDoc}
- */
@Override
public synchronized void performUpdate() {
if (!shouldDisableUpdates()) {
@@ -205,9 +187,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void performValidation() {
if (!shouldDisableUpdates()) {
@@ -231,7 +210,7 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
/**
* Return the list of figures that are invalids.
- *
+ *
* @return list of invalids figures.
*/
public List getInvalidFigures() {
@@ -249,7 +228,7 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
/**
* Return the value of validating.
- *
+ *
* @return the value of validating.
*/
public boolean getValidating() {
@@ -267,7 +246,7 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
/**
* Define the validating attribute.
- *
+ *
* @param validating
* the new validating value.
*/
@@ -283,9 +262,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void queueWork() {
if (!shouldDisableUpdates()) {
@@ -325,11 +301,6 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
return (LightweightSystemWithUpdateToggle) getLightweightSystem();
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer#createLightweightSystem()
- */
@Override
protected LightweightSystem createLightweightSystem() {
final LightweightSystem lws = new LightweightSystemWithUpdateToggle();
@@ -360,7 +331,7 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
/**
* Returns the EditPart located at the given location which will accept mouse events.
- *
+ *
* @param location
* The mouse location
* @return The EditPart located at the given location which will accept mouse events
@@ -372,8 +343,9 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
part = (EditPart) getVisualPartMap().get(figure);
figure = figure.getParent();
}
- if (part == null)
+ if (part == null) {
return getContents();
+ }
return part;
}
@@ -388,9 +360,23 @@ public class SiriusDiagramGraphicalViewer extends DiagramGraphicalViewer impleme
getToolTipHelperMethod = SWTEventDispatcher.class.getDeclaredMethod("getToolTipHelper"); //$NON-NLS-1$
getToolTipHelperMethod.setAccessible(true);
ToolTipHelper toolTipHelper = (ToolTipHelper) getToolTipHelperMethod.invoke(eventDispatcher);
- toolTipHelper.setHideDelay(TOOLTIP_HIDE_DELAY);
+ toolTipHelper.setHideDelay(SiriusDiagramGraphicalViewer.TOOLTIP_HIDE_DELAY);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
SiriusPlugin.getDefault().error(Messages.SiriusDiagramGraphicalViewer_tooltipDisplayDelay, e);
}
}
+
+ /**
+ * Remember the current background color used by the diagram, so that it can be properly disposed when the viewer is
+ * closed.
+ *
+ * @param color
+ * the background color used by the diagram.
+ */
+ public void setBackgroundColor(Color color) {
+ if (this.backgroundColor != null) {
+ this.backgroundColor.dispose();
+ }
+ this.backgroundColor = color;
+ }
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
index 80385493f2..a98e107633 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -86,6 +86,7 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription
addReusedMappingsPropertyDescriptor(object);
addReusedToolsPropertyDescriptor(object);
addEnablePopupBarsPropertyDescriptor(object);
+ addBackgroundColorPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -395,6 +396,19 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription
}
/**
+ * This adds a property descriptor for the Background Color feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addBackgroundColorPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(
+ createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_DiagramDescription_backgroundColor_feature"), //$NON-NLS-1$
+ getString("_UI_DiagramDescription_backgroundColor_description"), //$NON-NLS-1$
+ org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR, true, false, true, null, getString("_UI_BackgroundPropertyCategory"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!--
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
index 2e917e6631..e4cd4e7805 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -87,6 +87,7 @@ public class DiagramImportDescriptionItemProvider extends DocumentedElementItemP
addReusedMappingsPropertyDescriptor(object);
addReusedToolsPropertyDescriptor(object);
addEnablePopupBarsPropertyDescriptor(object);
+ addBackgroundColorPropertyDescriptor(object);
addImportedDiagramPropertyDescriptor(object);
}
return itemPropertyDescriptors;
@@ -398,6 +399,19 @@ public class DiagramImportDescriptionItemProvider extends DocumentedElementItemP
}
/**
+ * This adds a property descriptor for the Background Color feature. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addBackgroundColorPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(
+ createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_DiagramDescription_backgroundColor_feature"), //$NON-NLS-1$
+ getString("_UI_DiagramDescription_backgroundColor_description"), //$NON-NLS-1$
+ org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR, true, false, true, null, getString("_UI_BackgroundPropertyCategory"), //$NON-NLS-1$
+ null));
+ }
+
+ /**
* This adds a property descriptor for the Imported Diagram feature. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.sirius.diagram/model/diagram.ecore b/plugins/org.eclipse.sirius.diagram/model/diagram.ecore
index 357c82efea..ca65508503 100644
--- a/plugins/org.eclipse.sirius.diagram/model/diagram.ecore
+++ b/plugins/org.eclipse.sirius.diagram/model/diagram.ecore
@@ -1148,6 +1148,11 @@
<details key="documentation" value="Boolean indicating whether or not to show dynamic popup bars with creation tools."/>
</eAnnotations>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="backgroundColor" eType="ecore:EClass ../../org.eclipse.sirius/model/viewpoint.ecore#//description/ColorDescription">
+ <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
+ <details key="documentation" value="Color of the diagram background, white if unset."/>
+ </eAnnotations>
+ </eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DiagramImportDescription" eSuperTypes="../../org.eclipse.sirius/model/viewpoint.ecore#//description/RepresentationImportDescription #//description/DiagramDescription">
<eStructuralFeatures xsi:type="ecore:EReference" name="importedDiagram" eType="#//description/DiagramDescription">
diff --git a/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel b/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel
index 84748e3407..afacea05e5 100644
--- a/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel
+++ b/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel
@@ -383,6 +383,9 @@
propertySortChoices="true" ecoreFeature="ecore:EReference diagram.ecore#//description/DiagramDescription/reusedTools"/>
<genFeatures createChild="false" propertyCategory="General" propertyDescription="If true, creation tools which are visible in the palette will also be available as pop-up toolbars in the diagram itself."
ecoreFeature="ecore:EAttribute diagram.ecore#//description/DiagramDescription/enablePopupBars"/>
+ <genFeatures notify="false" createChild="false" propertyCategory="Background"
+ propertyDescription="Color of the diagram background, white if unset."
+ propertySortChoices="true" ecoreFeature="ecore:EReference diagram.ecore#//description/DiagramDescription/backgroundColor"/>
<genOperations ecoreOperation="diagram.ecore#//description/DiagramDescription/createDiagram"/>
</genClasses>
<genClasses ecoreClass="diagram.ecore#//description/DiagramImportDescription">
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/DiagramPackage.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/DiagramPackage.java
index 116b8e2f52..f2a494797c 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/DiagramPackage.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/DiagramPackage.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -133,6 +133,14 @@ public interface DiagramPackage extends EPackage {
int DDIAGRAM__UI_STATE = ViewpointPackage.DREPRESENTATION__UI_STATE;
/**
+ * The feature id for the '<em><b>Uid</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int DDIAGRAM__UID = ViewpointPackage.DREPRESENTATION__UID;
+
+ /**
* The feature id for the '<em><b>Owned Diagram Elements</b></em>' containment reference list. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
@@ -385,6 +393,14 @@ public interface DiagramPackage extends EPackage {
int DSEMANTIC_DIAGRAM__UI_STATE = DiagramPackage.DDIAGRAM__UI_STATE;
/**
+ * The feature id for the '<em><b>Uid</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int DSEMANTIC_DIAGRAM__UID = DiagramPackage.DDIAGRAM__UID;
+
+ /**
* The feature id for the '<em><b>Owned Diagram Elements</b></em>' containment reference list. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java
index 66401b9aa6..2f458eda25 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -411,13 +411,22 @@ public interface DescriptionPackage extends EPackage {
int DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS = DescriptionPackage.DRAG_AND_DROP_TARGET_DESCRIPTION_FEATURE_COUNT + 34;
/**
+ * The feature id for the '<em><b>Background Color</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DESCRIPTION__BACKGROUND_COLOR = DescriptionPackage.DRAG_AND_DROP_TARGET_DESCRIPTION_FEATURE_COUNT + 35;
+
+ /**
* The number of structural features of the '<em>Diagram Description</em>' class. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
* @ordered
*/
- int DIAGRAM_DESCRIPTION_FEATURE_COUNT = DescriptionPackage.DRAG_AND_DROP_TARGET_DESCRIPTION_FEATURE_COUNT + 35;
+ int DIAGRAM_DESCRIPTION_FEATURE_COUNT = DescriptionPackage.DRAG_AND_DROP_TARGET_DESCRIPTION_FEATURE_COUNT + 36;
/**
* The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.DiagramImportDescriptionImpl
@@ -742,13 +751,22 @@ public interface DescriptionPackage extends EPackage {
int DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 27;
/**
+ * The feature id for the '<em><b>Background Color</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 28;
+
+ /**
* The feature id for the '<em><b>Imported Diagram</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @generated
* @ordered
*/
- int DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 28;
+ int DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 29;
/**
* The number of structural features of the '<em>Diagram Import Description</em>' class. <!-- begin-user-doc -->
@@ -757,7 +775,7 @@ public interface DescriptionPackage extends EPackage {
* @generated
* @ordered
*/
- int DIAGRAM_IMPORT_DESCRIPTION_FEATURE_COUNT = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 29;
+ int DIAGRAM_IMPORT_DESCRIPTION_FEATURE_COUNT = org.eclipse.sirius.viewpoint.description.DescriptionPackage.REPRESENTATION_IMPORT_DESCRIPTION_FEATURE_COUNT + 30;
/**
* The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.DiagramExtensionDescriptionImpl
@@ -3422,6 +3440,18 @@ public interface DescriptionPackage extends EPackage {
EAttribute getDiagramDescription_EnablePopupBars();
/**
+ * Returns the meta object for the reference
+ * '{@link org.eclipse.sirius.diagram.description.DiagramDescription#getBackgroundColor <em>Background Color</em>}'.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the meta object for the reference '<em>Background Color</em>'.
+ * @see org.eclipse.sirius.diagram.description.DiagramDescription#getBackgroundColor()
+ * @see #getDiagramDescription()
+ * @generated
+ */
+ EReference getDiagramDescription_BackgroundColor();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.sirius.diagram.description.DiagramImportDescription
* <em>Diagram Import Description</em>}'. <!-- begin-user-doc --> <!-- end-user-doc -->
*
@@ -4692,6 +4722,14 @@ public interface DescriptionPackage extends EPackage {
EAttribute DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS = DescriptionPackage.eINSTANCE.getDiagramDescription_EnablePopupBars();
/**
+ * The meta object literal for the '<em><b>Background Color</b></em>' reference feature. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EReference DIAGRAM_DESCRIPTION__BACKGROUND_COLOR = DescriptionPackage.eINSTANCE.getDiagramDescription_BackgroundColor();
+
+ /**
* The meta object literal for the
* '{@link org.eclipse.sirius.diagram.description.impl.DiagramImportDescriptionImpl <em>Diagram Import
* Description</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DiagramDescription.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DiagramDescription.java
index 9cf6340631..7d2545c60c 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DiagramDescription.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DiagramDescription.java
@@ -17,6 +17,7 @@ import org.eclipse.sirius.diagram.description.concern.ConcernDescription;
import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.description.filter.FilterDescription;
import org.eclipse.sirius.diagram.description.tool.ToolSection;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
import org.eclipse.sirius.viewpoint.description.PasteTargetDescription;
import org.eclipse.sirius.viewpoint.description.RepresentationDescription;
import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription;
@@ -70,6 +71,8 @@ import org.eclipse.sirius.viewpoint.description.validation.ValidationSet;
* <li>{@link org.eclipse.sirius.diagram.description.DiagramDescription#getReusedTools <em>Reused Tools</em>}</li>
* <li>{@link org.eclipse.sirius.diagram.description.DiagramDescription#isEnablePopupBars <em>Enable Popup
* Bars</em>}</li>
+ * <li>{@link org.eclipse.sirius.diagram.description.DiagramDescription#getBackgroundColor <em>Background
+ * Color</em>}</li>
* </ul>
*
* @see org.eclipse.sirius.diagram.description.DescriptionPackage#getDiagramDescription()
@@ -564,6 +567,34 @@ public interface DiagramDescription extends DragAndDropTargetDescription, Repres
void setEnablePopupBars(boolean value);
/**
+ * Returns the value of the '<em><b>Background Color</b></em>' reference. <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Background Color</em>' reference isn't clear, there really should be more of a
+ * description here...
+ * </p>
+ * <!-- end-user-doc --> <!-- begin-model-doc --> Color of the diagram background, white if unset. <!--
+ * end-model-doc -->
+ *
+ * @return the value of the '<em>Background Color</em>' reference.
+ * @see #setBackgroundColor(ColorDescription)
+ * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getDiagramDescription_BackgroundColor()
+ * @model
+ * @generated
+ */
+ ColorDescription getBackgroundColor();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.sirius.diagram.description.DiagramDescription#getBackgroundColor
+ * <em>Background Color</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Background Color</em>' reference.
+ * @see #getBackgroundColor()
+ * @generated
+ */
+ void setBackgroundColor(ColorDescription value);
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @model
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java
index 8ac5dba89e..35cd651544 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -603,6 +603,16 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP
* @generated
*/
@Override
+ public EReference getDiagramDescription_BackgroundColor() {
+ return (EReference) diagramDescriptionEClass.getEStructuralFeatures().get(26);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
public EClass getDiagramImportDescription() {
return diagramImportDescriptionEClass;
}
@@ -1554,6 +1564,7 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP
createEReference(diagramDescriptionEClass, DescriptionPackage.DIAGRAM_DESCRIPTION__TOOL_SECTION);
createEReference(diagramDescriptionEClass, DescriptionPackage.DIAGRAM_DESCRIPTION__REUSED_TOOLS);
createEAttribute(diagramDescriptionEClass, DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS);
+ createEReference(diagramDescriptionEClass, DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR);
diagramImportDescriptionEClass = createEClass(DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION);
createEReference(diagramImportDescriptionEClass, DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM);
@@ -1838,6 +1849,9 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP
!EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED);
initEAttribute(getDiagramDescription_EnablePopupBars(), theEcorePackage.getEBoolean(), "enablePopupBars", null, 0, 1, DiagramDescription.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$
!EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED);
+ initEReference(getDiagramDescription_BackgroundColor(), theDescriptionPackage_1.getColorDescription(), null, "backgroundColor", null, 0, 1, DiagramDescription.class, //$NON-NLS-1$
+ !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE,
+ EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED);
addEOperation(diagramDescriptionEClass, theDiagramPackage.getDSemanticDiagram(), "createDiagram", 0, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramDescriptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramDescriptionImpl.java
index b78b9b7f82..d85f55a141 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramDescriptionImpl.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramDescriptionImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -38,6 +38,7 @@ import org.eclipse.sirius.diagram.description.concern.ConcernDescription;
import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.description.filter.FilterDescription;
import org.eclipse.sirius.diagram.description.tool.ToolSection;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
import org.eclipse.sirius.viewpoint.description.DocumentedElement;
import org.eclipse.sirius.viewpoint.description.EndUserDocumentedElement;
import org.eclipse.sirius.viewpoint.description.IdentifiedElement;
@@ -117,6 +118,8 @@ import org.eclipse.sirius.viewpoint.description.validation.ValidationSet;
* Tools</em>}</li>
* <li>{@link org.eclipse.sirius.diagram.description.impl.DiagramDescriptionImpl#isEnablePopupBars <em>Enable Popup
* Bars</em>}</li>
+ * <li>{@link org.eclipse.sirius.diagram.description.impl.DiagramDescriptionImpl#getBackgroundColor <em>Background
+ * Color</em>}</li>
* </ul>
*
* @generated
@@ -523,6 +526,16 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
protected boolean enablePopupBars = DiagramDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT;
/**
+ * The cached value of the '{@link #getBackgroundColor() <em>Background Color</em>}' reference. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see #getBackgroundColor()
+ * @generated
+ * @ordered
+ */
+ protected ColorDescription backgroundColor;
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
@@ -1593,6 +1606,48 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
* @generated
*/
@Override
+ public ColorDescription getBackgroundColor() {
+ if (backgroundColor != null && backgroundColor.eIsProxy()) {
+ InternalEObject oldBackgroundColor = (InternalEObject) backgroundColor;
+ backgroundColor = (ColorDescription) eResolveProxy(oldBackgroundColor);
+ if (backgroundColor != oldBackgroundColor) {
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor));
+ }
+ }
+ }
+ return backgroundColor;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ColorDescription basicGetBackgroundColor() {
+ return backgroundColor;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setBackgroundColor(ColorDescription newBackgroundColor) {
+ ColorDescription oldBackgroundColor = backgroundColor;
+ backgroundColor = newBackgroundColor;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
public DSemanticDiagram createDiagram() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
@@ -1737,6 +1792,11 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
return getReusedTools();
case DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS:
return isEnablePopupBars();
+ case DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR:
+ if (resolve) {
+ return getBackgroundColor();
+ }
+ return basicGetBackgroundColor();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -1851,6 +1911,9 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
case DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS:
setEnablePopupBars((Boolean) newValue);
return;
+ case DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR:
+ setBackgroundColor((ColorDescription) newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -1953,6 +2016,9 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
case DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS:
setEnablePopupBars(DiagramDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT);
return;
+ case DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR:
+ setBackgroundColor((ColorDescription) null);
+ return;
}
super.eUnset(featureID);
}
@@ -2036,6 +2102,8 @@ public class DiagramDescriptionImpl extends DragAndDropTargetDescriptionImpl imp
return reusedTools != null && !reusedTools.isEmpty();
case DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS:
return enablePopupBars != DiagramDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT;
+ case DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR:
+ return backgroundColor != null;
}
return super.eIsSet(featureID);
}
diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramImportDescriptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramImportDescriptionImpl.java
index 45b88cc105..d15b09d5a0 100644
--- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramImportDescriptionImpl.java
+++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DiagramImportDescriptionImpl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2007, 2013 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES 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
@@ -41,6 +41,7 @@ import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.description.filter.FilterDescription;
import org.eclipse.sirius.diagram.description.tool.ContainerDropDescription;
import org.eclipse.sirius.diagram.description.tool.ToolSection;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
import org.eclipse.sirius.viewpoint.description.EndUserDocumentedElement;
import org.eclipse.sirius.viewpoint.description.IdentifiedElement;
import org.eclipse.sirius.viewpoint.description.PasteTargetDescription;
@@ -123,6 +124,8 @@ import org.eclipse.sirius.viewpoint.description.validation.ValidationSet;
* Tools</em>}</li>
* <li>{@link org.eclipse.sirius.diagram.description.impl.DiagramImportDescriptionImpl#isEnablePopupBars <em>Enable
* Popup Bars</em>}</li>
+ * <li>{@link org.eclipse.sirius.diagram.description.impl.DiagramImportDescriptionImpl#getBackgroundColor <em>Background
+ * Color</em>}</li>
* <li>{@link org.eclipse.sirius.diagram.description.impl.DiagramImportDescriptionImpl#getImportedDiagram <em>Imported
* Diagram</em>}</li>
* </ul>
@@ -521,6 +524,16 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
protected boolean enablePopupBars = DiagramImportDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT;
/**
+ * The cached value of the '{@link #getBackgroundColor() <em>Background Color</em>}' reference. <!-- begin-user-doc
+ * --> <!-- end-user-doc -->
+ *
+ * @see #getBackgroundColor()
+ * @generated
+ * @ordered
+ */
+ protected ColorDescription backgroundColor;
+
+ /**
* The cached value of the '{@link #getImportedDiagram() <em>Imported Diagram</em>}' reference. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
@@ -1590,6 +1603,48 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
* @generated
*/
@Override
+ public ColorDescription getBackgroundColor() {
+ if (backgroundColor != null && backgroundColor.eIsProxy()) {
+ InternalEObject oldBackgroundColor = (InternalEObject) backgroundColor;
+ backgroundColor = (ColorDescription) eResolveProxy(oldBackgroundColor);
+ if (backgroundColor != oldBackgroundColor) {
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor));
+ }
+ }
+ }
+ return backgroundColor;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ColorDescription basicGetBackgroundColor() {
+ return backgroundColor;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setBackgroundColor(ColorDescription newBackgroundColor) {
+ ColorDescription oldBackgroundColor = backgroundColor;
+ backgroundColor = newBackgroundColor;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR, oldBackgroundColor, backgroundColor));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
public DiagramDescription getImportedDiagram() {
if (importedDiagram != null && importedDiagram.eIsProxy()) {
InternalEObject oldImportedDiagram = (InternalEObject) importedDiagram;
@@ -1776,6 +1831,11 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
return getReusedTools();
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS:
return isEnablePopupBars();
+ case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR:
+ if (resolve) {
+ return getBackgroundColor();
+ }
+ return basicGetBackgroundColor();
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM:
if (resolve) {
return getImportedDiagram();
@@ -1896,6 +1956,9 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS:
setEnablePopupBars((Boolean) newValue);
return;
+ case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR:
+ setBackgroundColor((ColorDescription) newValue);
+ return;
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM:
setImportedDiagram((DiagramDescription) newValue);
return;
@@ -2001,6 +2064,9 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS:
setEnablePopupBars(DiagramImportDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT);
return;
+ case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR:
+ setBackgroundColor((ColorDescription) null);
+ return;
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM:
setImportedDiagram((DiagramDescription) null);
return;
@@ -2088,6 +2154,8 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
return reusedTools != null && !reusedTools.isEmpty();
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS:
return enablePopupBars != DiagramImportDescriptionImpl.ENABLE_POPUP_BARS_EDEFAULT;
+ case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR:
+ return backgroundColor != null;
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__IMPORTED_DIAGRAM:
return importedDiagram != null;
}
@@ -2189,6 +2257,8 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
return DescriptionPackage.DIAGRAM_DESCRIPTION__REUSED_TOOLS;
case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS:
return DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS;
+ case DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR:
+ return DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR;
default:
return -1;
}
@@ -2291,6 +2361,8 @@ public class DiagramImportDescriptionImpl extends DocumentedElementImpl implemen
return DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__REUSED_TOOLS;
case DescriptionPackage.DIAGRAM_DESCRIPTION__ENABLE_POPUP_BARS:
return DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__ENABLE_POPUP_BARS;
+ case DescriptionPackage.DIAGRAM_DESCRIPTION__BACKGROUND_COLOR:
+ return DescriptionPackage.DIAGRAM_IMPORT_DESCRIPTION__BACKGROUND_COLOR;
default:
return -1;
}
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index f7587abb5a..b1c73d8c37 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -140,6 +140,12 @@
<strong>F3</strong> will navigate to the service implementation in a Java editor. See
<a href="specifier/general/Writing_Queries.html#service_navigation">the documentation</a> for more details.
</li>
+ <li><span class="label label-success">Added</span> Specifier can now define a background color for a diagram representation. It is possible by specifying color in the
+ <em>Background</em> property section of the
+ <em>Diagram Description</em>. Pre-defined system colors and colors from the
+ <em>User Color Palette</em> are supported. See
+ <a href="specifier/diagrams/Diagrams.html#diagram_description">the documentation</a> for details.
+ </li>
</ul>
<h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.common">Changes in
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index aa58900e21..59e445619d 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -14,6 +14,7 @@ h3. Specifier-Visible Changes
* <span class="label label-success">Added</span> An action is added in main toolbar to reload the VSM of installed plug-ins that may have changed. Refer to the "specifier documentation":specifier/general/Specifying_Viewpoints.html#reloadVSM for details.
* <span class="label label-success">Added</span> In the VSM editor, when the cursor is inside an interpreted expression at a location which corresponds to a Java service invocation, hitting *F3* will navigate to the service implementation in a Java editor. See "the documentation":specifier/general/Writing_Queries.html#service_navigation for more details.
+* <span class="label label-success">Added</span> Specifier can now define a background color for a diagram representation. It is possible by specifying color in the _Background_ property section of the _Diagram Description_. Pre-defined system colors and colors from the _User Color Palette_ are supported. See "the documentation":specifier/diagrams/Diagrams.html#diagram_description for details.
h3. Developer-Visible Changes
diff --git a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html
index f2786d9de4..a611dcfa3c 100644
--- a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html
+++ b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.html
@@ -185,6 +185,13 @@
<em>Enable Popup Bars</em> flag is set, then when the end-user leaves the mouse pointer still on a diagram (or diagram element) for a small time, a
<em>popup bar</em> will appear with shortcut buttons to all the tools which can be applied in this context. It can be useful to create elements without going to the palette to select tools, but it can also become visually distracting if too many tools are available in the popup bar.
</p>
+ <p>By default, diagrams are displayed with white background. In the
+ <em>Background</em> property section of the
+ <em>Diagram Description</em>, you can add either one of the pre-defined system colors or one which you have defined yourself in a
+ <em>Users Color Palette</em>. See
+ <a href="../general/Colors.html">the general section on colors</a> on colors for more details on dynamic and computed color of the
+ <em>Users Color Palette</em>. Note that when dynamic/computed colors are re-computed because of model change for example, background color is refreshed.
+ </p>
<p>The content of the
<em>Diagram Description</em> is mostly made of
<a href="#graphical_elements">graphical elements mappings</a>, organized in
diff --git a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile
index fa5ba2e4f0..d4cce4d458 100644
--- a/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/specifier/diagrams/Diagrams.textile
@@ -28,6 +28,8 @@ The _Initialization_ and _Show on startup_ flags control whether diagram instanc
If _Enable Popup Bars_ flag is set, then when the end-user leaves the mouse pointer still on a diagram (or diagram element) for a small time, a _popup bar_ will appear with shortcut buttons to all the tools which can be applied in this context. It can be useful to create elements without going to the palette to select tools, but it can also become visually distracting if too many tools are available in the popup bar.
+By default, diagrams are displayed with white background. In the _Background_ property section of the _Diagram Description_, you can add either one of the pre-defined system colors or one which you have defined yourself in a _Users Color Palette_. See "the general section on colors":../general/Colors.html on colors for more details on dynamic and computed color of the _Users Color Palette_. Note that when dynamic/computed colors are re-computed because of model change for example, background color is refreshed.
+
The content of the _Diagram Description_ is mostly made of "graphical elements mappings":#graphical_elements, organized in "layers":#layers, and their associated "tools":#tools. In addition, it can also contain "validation rules":#validation, "filters":#filters and "layout configuration":#layout information.
Note that the _Window Title_ label and _Message_ label are "_Translatable Messages_":../general/Specifying_Viewpoints.html#translatable_messages and can therefore be localized.
diff --git a/plugins/org.eclipse.sirius.editor.diagram/plugin.xml b/plugins/org.eclipse.sirius.editor.diagram/plugin.xml
index b05a4e1381..008be021a9 100644
--- a/plugins/org.eclipse.sirius.editor.diagram/plugin.xml
+++ b/plugins/org.eclipse.sirius.editor.diagram/plugin.xml
@@ -1073,6 +1073,14 @@
<input type="org.eclipse.sirius.diagram.description.DiagramImportDescription"/>
</propertySection>
<propertySection
+ class="org.eclipse.sirius.diagram.editor.properties.sections.description.diagramdescription.DiagramDescriptionBackgroundColorPropertySection"
+ id="description.section.diagramDescription.BackgroundColor"
+ filter="org.eclipse.sirius.diagram.editor.properties.filters.description.diagramdescription.DiagramDescriptionBackgroundColorFilter"
+ afterSection="description.section.diagramDescription.EnablePopupBars"
+ tab="viewpoint.tab.background">
+ <input type="org.eclipse.sirius.diagram.description.DiagramDescription"/>
+ </propertySection>
+ <propertySection
class="org.eclipse.sirius.diagram.editor.properties.sections.description.diagramdescription.DiagramDescriptionEnablePopupBarsPropertySection"
id="description.section.diagramDescription.EnablePopupBars"
filter="org.eclipse.sirius.diagram.editor.properties.filters.description.diagramdescription.DiagramDescriptionEnablePopupBarsFilter"
diff --git a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/filters/description/diagramdescription/DiagramDescriptionBackgroundColorFilter.java b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/filters/description/diagramdescription/DiagramDescriptionBackgroundColorFilter.java
new file mode 100644
index 0000000000..70f33c2c47
--- /dev/null
+++ b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/filters/description/diagramdescription/DiagramDescriptionBackgroundColorFilter.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Obeo.
+ * 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.diagram.editor.properties.filters.description.diagramdescription;
+
+// Start of user code specific imports
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.sirius.diagram.description.DescriptionPackage;
+import org.eclipse.sirius.editor.properties.filters.common.ViewpointPropertyFilter;
+
+// End of user code specific imports
+
+/**
+ * A filter for the backgroundColor property section.
+ */
+public class DiagramDescriptionBackgroundColorFilter extends ViewpointPropertyFilter {
+
+ /**
+ * {@inheritDoc}
+ */
+ protected EStructuralFeature getFeature() {
+ return DescriptionPackage.eINSTANCE.getDiagramDescription_BackgroundColor();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected boolean isRightInputType(Object arg0) {
+ return arg0 instanceof org.eclipse.sirius.diagram.description.DiagramDescription;
+ }
+
+ // Start of user code user methods
+
+ // End of user code user methods
+
+}
diff --git a/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/description/diagramdescription/DiagramDescriptionBackgroundColorPropertySection.java b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/description/diagramdescription/DiagramDescriptionBackgroundColorPropertySection.java
new file mode 100644
index 0000000000..389f43c481
--- /dev/null
+++ b/plugins/org.eclipse.sirius.editor.diagram/src-gen/org/eclipse/sirius/diagram/editor/properties/sections/description/diagramdescription/DiagramDescriptionBackgroundColorPropertySection.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Obeo.
+ * 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.diagram.editor.properties.sections.description.diagramdescription;
+
+// Start of user code imports
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.sirius.diagram.description.DescriptionPackage;
+import org.eclipse.sirius.editor.properties.sections.common.AbstractComboPropertySection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+// End of user code imports
+
+/**
+ * A section for the backgroundColor property of a DiagramDescription object.
+ */
+public class DiagramDescriptionBackgroundColorPropertySection extends AbstractComboPropertySection {
+ /**
+ * @see org.eclipse.sirius.diagram.editor.properties.sections.AbstractComboPropertySection#getDefaultLabelText()
+ */
+ protected String getDefaultLabelText() {
+ return "BackgroundColor"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.sirius.diagram.editor.properties.sections.AbstractComboPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ String labelText;
+ labelText = super.getLabelText() + ":"; //$NON-NLS-1$
+ // Start of user code get label text
+
+ // End of user code get label text
+ return labelText;
+ }
+
+ /**
+ * @see org.eclipse.sirius.diagram.editor.properties.sections.AbstractComboPropertySection#getFeature()
+ */
+ protected EReference getFeature() {
+ return DescriptionPackage.eINSTANCE.getDiagramDescription_BackgroundColor();
+ }
+
+ /**
+ * @see org.eclipse.sirius.diagram.editor.properties.sections.AbstractComboPropertySection#getFeatureValue(int)
+ */
+ protected Object getFeatureValue(int index) {
+ return getFeatureValueAt(index);
+ }
+
+ /**
+ * @see org.eclipse.sirius.diagram.editor.properties.sections.AbstractComboPropertySection#isEqual(int)
+ */
+ protected boolean isEqual(int index) {
+ boolean isEqual = false;
+ if (getFeatureValueAt(index) == null)
+ isEqual = eObject.eGet(getFeature()) == null;
+ else
+ isEqual = getFeatureValueAt(index).equals(eObject.eGet(getFeature()));
+ return isEqual;
+ }
+
+ /**
+ * Returns the value at the specified index in the choice of values for the feature.
+ *
+ * @param index
+ * Index of the value.
+ * @return the value at the specified index in the choice of values.
+ */
+ protected Object getFeatureValueAt(int index) {
+ List<?> values = getChoiceOfValues();
+ if (values.size() < index || values.size() == 0 || index == -1) {
+ return null;
+ }
+ return values.get(index);
+ }
+
+ /**
+ * Fetches the list of available values for the feature.
+ *
+ * @return The list of available values for the feature.
+ */
+ protected List<?> getChoiceOfValues() {
+ List<?> values = Collections.emptyList();
+ List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors();
+ for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) {
+ IItemPropertyDescriptor propertyDescriptor = iterator.next();
+ if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature())
+ values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject));
+ }
+
+ // Start of user code choice of values
+ // End of user code choice of values
+ return values;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
+ combo.setToolTipText("Color of the diagram background, white if unset.");
+
+ CLabel help = getWidgetFactory().createCLabel(composite, "");
+ FormData data = new FormData();
+ data.top = new FormAttachment(combo, 0, SWT.TOP);
+ data.left = new FormAttachment(nameLabel);
+ help.setLayoutData(data);
+ help.setImage(getHelpIcon());
+ help.setToolTipText("Color of the diagram background, white if unset.");
+ // Start of user code create controls
+
+ // End of user code create controls
+ }
+ // Start of user code user operations
+
+ // End of user code user operations
+}
diff --git a/plugins/org.eclipse.sirius.editor/plugin.xml b/plugins/org.eclipse.sirius.editor/plugin.xml
index 1825ed596f..61843889c0 100644
--- a/plugins/org.eclipse.sirius.editor/plugin.xml
+++ b/plugins/org.eclipse.sirius.editor/plugin.xml
@@ -66,6 +66,7 @@
<propertyTab category="default" id="viewpoint.tab.documentation" label="Documentation" afterTab="viewpoint.tab.import"/>
<propertyTab category="default" id="viewpoint.tab.color" label="Color" afterTab="viewpoint.tab.label"/>
<propertyTab category="default" id="viewpoint.tab.behavior" label="Behavior" afterTab="viewpoint.tab.label "/>
+ <propertyTab category="default" id="viewpoint.tab.background" label="Background" afterTab="viewpoint.tab.behavior"/>
<propertyTab category="default" id="viewpoint.tab.metamodels" label="Metamodels" afterTab="viewpoint.tab.behavior"/>
<propertyTab category="default" id="viewpoint.tab.border" label="Border" afterTab="viewpoint.tab.color"/>
<propertyTab category="default" id="viewpoint.tab.advanced" label="Advanced" afterTab="viewpoint.tab.border"/>
diff --git a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/AbstractColorReferenceTestCase.java b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/AbstractColorReferenceTestCase.java
index c706fae40a..f38d06e3f2 100644
--- a/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/AbstractColorReferenceTestCase.java
+++ b/plugins/org.eclipse.sirius.tests.junit.support/src/org/eclipse/sirius/tests/support/api/AbstractColorReferenceTestCase.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2012, 2017 THALES GLOBAL SERVICES
+ * Copyright (c) 2012, 2018 THALES GLOBAL SERVICES 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,6 +11,7 @@
package org.eclipse.sirius.tests.support.api;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
@@ -28,8 +29,6 @@ import com.google.common.collect.Iterables;
import junit.framework.TestCase;
-import junit.framework.TestCase;
-
/**
* Test cardinality and initialization of Color references.
*
@@ -68,6 +67,8 @@ public abstract class AbstractColorReferenceTestCase extends TestCase {
classesWithColorReferences = new LinkedHashSet<>();
Assert.assertNotNull("Base package should not be null.", basePackage);
lookForColorReferences(basePackage);
+ specialColorRefs = Arrays.asList(org.eclipse.sirius.diagram.description.DescriptionPackage.eINSTANCE
+ .getDiagramDescription_BackgroundColor());
}
private void lookForColorReferences(EPackage pkg) {
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
index 235ecf29b1..5068e1af40 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES 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
@@ -150,6 +150,7 @@ import org.eclipse.sirius.tests.unit.diagram.layoutingmode.LayoutingModeOnCustom
import org.eclipse.sirius.tests.unit.diagram.layoutingmode.LayoutingModeOnECoreModelerTest;
import org.eclipse.sirius.tests.unit.diagram.mapping.EdgeMappingCreationDescriptionTests;
import org.eclipse.sirius.tests.unit.diagram.modelaccessor.ModelAccessorTest;
+import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.design.EntitiesDiagramBackgroundTests;
import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.design.EntitiesDiagramContainerList;
import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.design.EntitiesDiagramDeleteFromDiagramTests;
import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.design.EntitiesDiagramDerivedReferenceTests;
@@ -325,6 +326,7 @@ public class AllDiagramPluginsTests {
suite.addTestSuite(EntitiesDiagramSiriussConflictTest.class);
suite.addTestSuite(LayoutingModeOnECoreModelerTest.class);
suite.addTestSuite(LayoutingModeOnCustomModelerTest.class);
+ suite.addTestSuite(EntitiesDiagramBackgroundTests.class);
// end of ecore modeler
suite.addTestSuite(LayersTest.class);
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/design/EntitiesDiagramBackgroundTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/design/EntitiesDiagramBackgroundTests.java
new file mode 100644
index 0000000000..9abb38dee5
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/modeler/ecore/design/EntitiesDiagramBackgroundTests.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Obeo.
+ * 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.tests.unit.diagram.modeler.ecore.design;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.diagram.ui.internal.edit.parts.DDiagramEditPart;
+import org.eclipse.sirius.tests.SiriusTestsPlugin;
+import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase;
+import org.eclipse.sirius.tests.support.api.TestsUtil;
+import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler;
+import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager;
+import org.eclipse.sirius.viewpoint.description.ColorDescription;
+import org.eclipse.sirius.viewpoint.description.ComputedColor;
+import org.eclipse.sirius.viewpoint.description.DescriptionFactory;
+import org.eclipse.sirius.viewpoint.description.FixedColor;
+import org.eclipse.sirius.viewpoint.description.UserFixedColor;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Refresh diagram background color tests for Entities diagram of ecore modeler.
+ *
+ * WARNING: The test assumes the default background color is pure white, but this can actually depend on the current Eclipse theme (e.g. when using the Dark theme);
+ *
+ * @author jmallet
+ */
+public class EntitiesDiagramBackgroundTests extends SiriusDiagramTestCase implements EcoreModeler {
+
+ private static final String SEMANTIC_MODEL_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID
+ + "/data/unit/modelers/ecore/directEdit/testOperation.ecore"; //$NON-NLS-1$
+
+ private static final String REPRESENTATIONS_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID
+ + "/data/unit/modelers/ecore/directEdit/testOperation.aird"; //$NON-NLS-1$
+
+ private DDiagram diagram;
+
+ IEditorPart diagramEditor;
+
+ private DDiagramEditPart dDiagramEditPart;
+
+ /** White color */
+ private final Color WHITE_COLOR = new Color(null, 255, 255, 255);
+
+ /** Green color */
+ private final Color GREEN_COLOR = new Color(null, 0, 255, 0);
+
+ /** Red color */
+ private final Color RED_COLOR = new Color(null, 255, 0, 0);
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ genericSetUp(SEMANTIC_MODEL_PATH, MODELER_PATH, REPRESENTATIONS_PATH);
+ diagram = (DDiagram) getRepresentations(ENTITIES_DESC_NAME).toArray()[0];
+ diagramEditor = DialectUIManager.INSTANCE.openEditor(session, diagram, new NullProgressMonitor());
+ TestsUtil.synchronizationWithUIThread();
+ dDiagramEditPart = getDiagramEditPart();
+
+ // check diagram description has none color defined in background
+ ColorDescription initBackgroundColor = diagram.getDescription().getBackgroundColor();
+ assertNull("None color is set for diagram background.", initBackgroundColor); //$NON-NLS-1$
+ // check background diagram color is white by default
+ checkBackgroundColor(WHITE_COLOR);
+ }
+
+ /**
+ * Tests that when the background color of the diagram description change with fixed color, the background color of the diagram
+ * is also changed.
+ */
+ public void testDiagramBackgroundColorWithFixedColor() {
+ // update background color with red color
+ FixedColor redColor = createFixedColor(RED_COLOR);
+ setDescriptionBackground(redColor);
+ dDiagramEditPart.refresh();
+
+ checkBackgroundColor(RED_COLOR);
+
+ // update background color with green color
+ FixedColor greenColor = createFixedColor(GREEN_COLOR);
+ setDescriptionBackground(greenColor);
+ dDiagramEditPart.refresh();
+
+ checkBackgroundColor(GREEN_COLOR);
+
+ // update background color with white color
+ FixedColor whiteColor = createFixedColor(WHITE_COLOR);
+ setDescriptionBackground(whiteColor);
+ dDiagramEditPart.refresh();
+
+ checkBackgroundColor(WHITE_COLOR);
+ }
+
+ /**
+ * Tests that when the background color of the diagram description change with computedColor, the background color of the diagram
+ * is also changed.
+ * If rootPackage name begins with "Green", the background color should be green.
+ */
+ public void testDiagramBackgroundColorWithComputedColor() {
+ // update background color
+ ComputedColor computedColor = createComputedColor();
+ setDescriptionBackground(computedColor);
+ dDiagramEditPart.refresh();
+
+ checkBackgroundColor(RED_COLOR);
+
+ // change root Package Name
+ EPackage semanticRoot = (EPackage) semanticModel;
+ updatePackageName(semanticRoot, "GreenPackage"); //$NON-NLS-1$
+ dDiagramEditPart.refresh();
+
+ checkBackgroundColor(GREEN_COLOR);
+ }
+
+ /**
+ * Get {@link DDiagramEditPart} from the diagram editor.
+ *
+ * @return {@link DDiagramEditPart} from the diagram editor.
+ */
+ private DDiagramEditPart getDiagramEditPart() {
+ DDiagramEditPart dDiagramEditPart = null;
+ if (diagramEditor instanceof DiagramEditor) {
+ DiagramEditPart diagramEditPart = ((DiagramEditor) diagramEditor).getDiagramEditPart();
+ if (diagramEditPart instanceof DDiagramEditPart) {
+ dDiagramEditPart = (DDiagramEditPart) diagramEditPart;
+ }
+ }
+ return dDiagramEditPart;
+ }
+
+ /**
+ * Update background color of the diagram from a given {@link ColorDescription}.
+ *
+ * @param colorUpdate
+ * the new color to set on the background
+ */
+ private void setDescriptionBackground(final ColorDescription newColor) {
+ session.getTransactionalEditingDomain().getCommandStack()
+ .execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
+ /** {@inheritDoc} */
+ @Override
+ protected void doExecute() {
+ diagram.getDescription().setBackgroundColor(newColor);
+ }
+ });
+ }
+
+ /**
+ * Create fixed color from RGB values.
+ *
+ * @param colorSample
+ * color used to create fixed color
+ * @return fixed color from RGB values.
+ */
+ private FixedColor createFixedColor(Color colorSample) {
+ UserFixedColor color = DescriptionFactory.eINSTANCE.createUserFixedColor();
+ color.setName("myFixedColor"); //$NON-NLS-1$
+ color.setRed(colorSample.getRed());
+ color.setGreen(colorSample.getGreen());
+ color.setBlue(colorSample.getBlue());
+ return color;
+ }
+
+ /**
+ * Create {@link ComputedColor} with color depending on root package name.
+ *
+ * @return the new computed color.
+ */
+ private ComputedColor createComputedColor() {
+ ComputedColor color = DescriptionFactory.eINSTANCE.createComputedColor();
+ color.setName("myComputedColor"); //$NON-NLS-1$
+ color.setRed("aql:if self.name.startsWith('ecore') then 255 else 0 endif"); //$NON-NLS-1$
+ color.setGreen("aql:if self.name.startsWith('Green') then 255 else 0 endif"); //$NON-NLS-1$
+ color.setBlue("aql:if self.name.startsWith('Blue') then 255 else 0 endif"); //$NON-NLS-1$
+ return color;
+ }
+
+ /**
+ * Update the package name of the model with the given name.
+ *
+ * @param myPackage
+ * package to update
+ * @param newName
+ * new name of the package
+ */
+ private void updatePackageName(final EPackage myPackage, final String newName) {
+ Command cmd = new RecordingCommand(session.getTransactionalEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ myPackage.setName(newName);
+ }
+
+ };
+ executeCommand(cmd);
+ }
+
+ /**
+ * Check if the diagram color has been updated.
+ *
+ * @param updateColor
+ * the new color of the diagram background
+ */
+ private void checkBackgroundColor(Color updateColor) {
+ Color backgroundColorEditPart = dDiagramEditPart.getFigure().getBackgroundColor();
+ assertEquals("The diagram background color has not been updated.", updateColor, backgroundColorEditPart); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ DialectUIManager.INSTANCE.closeEditor(diagramEditor, false);
+ TestsUtil.synchronizationWithUIThread();
+ super.tearDown();
+ }
+}

Back to the top