[582106] Have reset style button disabled once clicked on edge

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=582106
Change-Id: I0650cde66d1e46f7bf0f4b4256a3d9bf319bee8f
Signed-off-by: Samuel Darracq <samuel.darracq@obeo.fr>
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/FontFormatUpdater.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/FontFormatUpdater.java
index bef140c..0d516a2 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/FontFormatUpdater.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/FontFormatUpdater.java
@@ -47,8 +47,8 @@
 import org.eclipse.sirius.viewpoint.ViewpointPackage;
 
 /**
- * This class update the notation and viewpoint models font style attributes
- * when it receives a notification about a Node font style changes.
+ * This class update the notation and viewpoint models font style attributes when it receives a notification about a
+ * Node font style changes.
  * 
  * Make sure to attach and detach the updater to the editing domain.
  * 
@@ -70,7 +70,7 @@
      * Default constructor.
      * 
      * @param domain
-     *            the current editing domain.
+     *                   the current editing domain.
      */
     public FontFormatUpdater(final TransactionalEditingDomain domain) {
         super(FEATURES_TO_REFACTOR_FILTER);
@@ -115,24 +115,7 @@
                 Style style = dDiagramElement.getStyle();
                 if (isViewFontStylePropertiesDifferentOfGMFOne(style, fontStyle, features)) {
                     Set<String> featureNames = getFeatureNames(features);
-                    if (style instanceof EdgeStyle) {
-                        EdgeStyle edgeStyle = (EdgeStyle) style;
-                        if (edgeStyle.getBeginLabelStyle() != null) {
-                            featureNames.addAll(edgeStyle.getBeginLabelStyle().getCustomFeatures());
-                            Command addCustomFeaturesCmd = SetCommand.create(getTarget(), edgeStyle.getBeginLabelStyle(), ViewpointPackage.Literals.CUSTOMIZABLE__CUSTOM_FEATURES, featureNames);
-                            cc.append(addCustomFeaturesCmd);
-                        }
-                        if (edgeStyle.getCenterLabelStyle() != null) {
-                            featureNames.addAll(edgeStyle.getCenterLabelStyle().getCustomFeatures());
-                            Command addCustomFeaturesCmd = SetCommand.create(getTarget(), edgeStyle.getCenterLabelStyle(), ViewpointPackage.Literals.CUSTOMIZABLE__CUSTOM_FEATURES, featureNames);
-                            cc.append(addCustomFeaturesCmd);
-                        }
-                        if (edgeStyle.getEndLabelStyle() != null) {
-                            featureNames.addAll(edgeStyle.getEndLabelStyle().getCustomFeatures());
-                            Command addCustomFeaturesCmd = SetCommand.create(getTarget(), edgeStyle.getEndLabelStyle(), ViewpointPackage.Literals.CUSTOMIZABLE__CUSTOM_FEATURES, featureNames);
-                            cc.append(addCustomFeaturesCmd);
-                        }
-                    } else {
+                    if (!(style instanceof EdgeStyle)) {
                         featureNames.addAll(style.getCustomFeatures());
                         Command addCustomFeaturesCmd = SetCommand.create(getTarget(), style, ViewpointPackage.Literals.CUSTOMIZABLE__CUSTOM_FEATURES, featureNames);
                         cc.append(addCustomFeaturesCmd);
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ResetStylePropertiesToDefaultValuesActionTests.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ResetStylePropertiesToDefaultValuesActionTests.java
index 9c5a749..1c737ff 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ResetStylePropertiesToDefaultValuesActionTests.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ResetStylePropertiesToDefaultValuesActionTests.java
@@ -235,6 +235,9 @@
         edgeStyleImpl = (EdgeStyleImpl) ((DRepresentationElement) ((Node) (editPart.getModel())).getElement()).getStyle();
         // Verify that colors are back to the inital ones
         TestCase.assertTrue(colors.equals(extractLabelColors(edgeStyleImpl)));
+        // Check that the "Reset style properties to default values" button is
+        // disabled
+        getResetStylePropertiesToDefaultValuesButton(true, false);
     }
 
     private List<Integer> extractLabelColors(EdgeStyleImpl edgeImpl) {