# Diagram Preferences

Many preferences are available for the diagrams. This page will be completed as arises.

- The list of the diagram preferences key is provided by the class `org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper`.
  - This class provides methods to calculate the `String` key for a given preference, represented by an `int` according to the context:
    - all diagrams
    - a specific diagram
    - a specific UML element

The preference values are generally stored in the PreferenceStore provided by `org.eclipse.papyrus.infra.gmfdiag.common.Activator`.

The default value of preferences are generally done by classes extending `org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer` or by a static method in a PreferencePage, like it is done with `org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer`

## Connection Preference

### Connection Bendpoints

- Draw Common Bendpoints:
  - the `int` value is provided by `org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.DRAW_CONNECTION_POINT`
  - the suffix's key is provided by `org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.DRAW_CONNECTION_POINT_CONSTANT`
  - the default value for this preference is `false`.
  - the class `org.eclipse.papyrus.infra.gmfdiag.common.figure.edge.PapyrusEdgeFigure` is in charge to draw the bendpoints through the method `drawCommonbendpoints(Graphics)`, when the preference is set to `true`, but we need to override the method `org.eclipse.papyrus.infra.gmfdiag.common.figure.edge.PapyrusEdgeFigure.getDrawBendpointPreferenceValue()` to get this behavior.
  - The subclass `org.eclipse.papyrus.uml.diagram.common.figure.edge.CommonEdgeFigure` override the previous method to be able to draw the bendpoints according to the preference value.
  - The algorithm used to find the bendpoints to draw is tested by a JUnit test provided by the class `org.eclipse.papyrus.uml.diagram.common.tests.tests.CommonBendpointsTest`.