org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer

## Class MirrorUtil

- java.lang.Object
- - org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.MirrorUtil

    public class MirrorUtil
    extends Object

A utility class to handle the common functionality of mirroring the content merge viewer sides, i.e., swapping the left and right viewer. The mirroring functionality was introduced in Eclipse Compare v3.7 and therefore needs to be handled reflectively to avoid backwards compatibility issues.

### Field Summary

Fields
`static String` `CONFIG_MIRRORED` Mirrored: Compare configuration property key.
`static String` `PREF_MIRRORED` Mirrored: Compare preference store key.
`static String` `SWITCH_LEFT_RIGHT_ACTION` Mirrored: Name of the 'Switch Left and Right' action field in `ContentMergeViewer`.

### Constructor Summary

Constructors
Constructor and Description
`MirrorUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static org.eclipse.jface.action.Action` `getAction(org.eclipse.compare.contentmergeviewer.ContentMergeViewer contentMergeViewer)` Reflectively returns the action for switching the left and right side of the viewer.
`static boolean` `isMirrored(org.eclipse.compare.CompareConfiguration compareConfiguration)` Evaluates whether the left and right side of the viewer should be mirrored.
`static boolean` `isMirroredPreference(String preferenceProperty)` Returns true if the given property is used to store the mirrored value in the preference store, false otherwise.
`static boolean` `isMirroredProperty(String configProperty)` Returns true if the given property is used to store the mirrored value in the compare configuration, false otherwise.
`static org.eclipse.jface.action.Action` `removeFromToolBar(org.eclipse.compare.contentmergeviewer.ContentMergeViewer contentMergeViewer, org.eclipse.jface.action.ToolBarManager toolBarManager)` Removes the action for switching the left and right side of the viewer from the toolbar, if it is available.
`static void` `setMirrored(EMFCompareConfiguration compareConfiguration, boolean mirrored)` Sets the mirrored property for the given compare configuration.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### CONFIG_MIRRORED

    public static final String CONFIG_MIRRORED

Mirrored: Compare configuration property key.

See Also:
  Constant Field Values

#### PREF_MIRRORED

    public static final String PREF_MIRRORED

Mirrored: Compare preference store key.

See Also:
  Constant Field Values

#### SWITCH_LEFT_RIGHT_ACTION

    public static final String SWITCH_LEFT_RIGHT_ACTION

Mirrored: Name of the 'Switch Left and Right' action field in `ContentMergeViewer`.

See Also:
  Constant Field Values

### Constructor Detail

#### MirrorUtil

    public MirrorUtil()

### Method Detail

#### getAction

    public static org.eclipse.jface.action.Action getAction(org.eclipse.compare.contentmergeviewer.ContentMergeViewer contentMergeViewer)

Reflectively returns the action for switching the left and right side of the viewer. The returned action may be null, if it is not available or cannot be retrieved.

Parameters:
  `contentMergeViewer` - content merge viewer
Returns:
  switch left and right action or null

#### removeFromToolBar

    public static org.eclipse.jface.action.Action removeFromToolBar(org.eclipse.compare.contentmergeviewer.ContentMergeViewer contentMergeViewer,
                                                                    org.eclipse.jface.action.ToolBarManager toolBarManager)

Removes the action for switching the left and right side of the viewer from the toolbar, if it is available.

Parameters:
  `contentMergeViewer` - content merge viewer
  `toolBarManager` - tool bar manager of the content merge viewer
Returns:
  the removed action or null, if the action was not available
See Also:
  `getAction(ContentMergeViewer)`

#### isMirrored

    public static boolean isMirrored(org.eclipse.compare.CompareConfiguration compareConfiguration)

Evaluates whether the left and right side of the viewer should be mirrored.

Parameters:
  `compareConfiguration` - compare configuration holding the mirrored property
Returns:
  true if the left and right side of the viewer should be mirrored. Default is false.

#### setMirrored

    public static void setMirrored(EMFCompareConfiguration compareConfiguration,
                                   boolean mirrored)

Sets the mirrored property for the given compare configuration.

Parameters:
  `compareConfiguration` - compare configuration holding the mirrored property
  `mirrored` - true if the left and right side of the viewer should be mirrored, false otherwise.

#### isMirroredProperty

    public static boolean isMirroredProperty(String configProperty)

Returns true if the given property is used to store the mirrored value in the compare configuration, false otherwise.

Parameters:
  `configProperty` - compare configuration property
Returns:
  true if the given property is the mirrored property, false otherwise

#### isMirroredPreference

    public static boolean isMirroredPreference(String preferenceProperty)

Returns true if the given property is used to store the mirrored value in the preference store, false otherwise.

Parameters:
  `preferenceProperty` - preference property
Returns:
  true if the given property is the mirrored property, false otherwise