Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-10-08 04:48:58 -0400
committerMikaël Barbero2013-10-11 10:22:27 -0400
commitc791695c06779333eefdea940f0a24e062b06411 (patch)
treeb57afa418b1a0cfdfc4bf4c60e1b252a7179e289 /plugins/org.eclipse.emf.compare.ide.ui/src
parent32b6ced8ccc35abf5e37f180aadf985002fca645 (diff)
downloadorg.eclipse.emf.compare-c791695c06779333eefdea940f0a24e062b06411.tar.gz
org.eclipse.emf.compare-c791695c06779333eefdea940f0a24e062b06411.tar.xz
org.eclipse.emf.compare-c791695c06779333eefdea940f0a24e062b06411.zip
Enhanced EMFCompareConfiguration
- Define a listener interface on it with simpler API. - Create a forwarding compare configuration class (decorator pattern) to let wrap existing CompareConfiguration class and implement interfaces like IEMFCompareConfiguration. Change-Id: I7e2d1c377c32e175480e1b11d680a30748c742c7
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java374
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/ForwardingCompareConfiguration.java230
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java67
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java11
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerCreator.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java72
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java23
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerCreator.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java33
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerContentProvider.java22
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerCreator.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/CompareConfigurationExtension.java32
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/EMFCompareColor.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/AbstractEMFCompareEditorInput.java16
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonEditorInput.java6
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonScopeEditorInput.java7
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java3
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java15
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java49
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java134
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewerCreator.java3
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java8
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java14
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java18
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java19
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java19
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java4
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java9
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java30
42 files changed, 776 insertions, 562 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
index dd5aeb6f1..ef5da4b93 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/EMFCompareConfiguration.java
@@ -11,19 +11,23 @@
package org.eclipse.emf.compare.ide.ui.internal.configuration;
import static com.google.common.base.Predicates.alwaysFalse;
-import static com.google.common.collect.Sets.newLinkedHashSet;
+import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
-import java.util.Collection;
+import java.util.List;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfigurationChangeListener;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.ecore.EObject;
@@ -31,215 +35,283 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
/**
- * A wrapping compare configuration.
- *
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
-public class EMFCompareConfiguration implements IEMFCompareConfiguration, IPropertyChangeListener {
+public class EMFCompareConfiguration extends ForwardingCompareConfiguration implements IEMFCompareConfiguration {
- /** The compare configuration. */
- private final CompareConfiguration compareConfiguration;
+ private static final String COMPARE_RESULT = EMFCompareIDEUIPlugin.PLUGIN_ID + ".COMPARE_RESULT"; //$NON-NLS-1$
- /** The active group provider. */
- private IDifferenceGroupProvider selectedDifferenceGroupProvider;
+ private static final String COMPARATOR = EMFCompareIDEUIPlugin.PLUGIN_ID + ".COMPARATOR"; //$NON-NLS-1$
- /** The list of active filters. */
- private Set<IDifferenceFilter> selectedDifferenceFilters;
+ private static final String EDITING_DOMAIN = EMFCompareIDEUIPlugin.PLUGIN_ID + ".EDITING_DOMAIN"; //$NON-NLS-1$
- /** The aggregated viewer predicate. */
- private Predicate<? super EObject> aggregatedViewerPredicate;
+ private static final String ADAPTER_FACTORY = EMFCompareIDEUIPlugin.PLUGIN_ID + ".ADAPTER_FACTORY"; //$NON-NLS-1$
- /** The editing domain. */
- private ICompareEditingDomain editingDomain;
+ private static final String SELECTED_DIFFERENCE_FILTERS = EMFCompareIDEUIPlugin.PLUGIN_ID
+ + ".SELECTED_DIFFERENCE_FILTERS"; //$NON-NLS-1$
- /** The comparison. */
- private Comparison comparison;
+ private static final Set<IDifferenceFilter> SELECTED_DIFFERENCE_FILTERS__DEFAULT_VALUE = ImmutableSet
+ .of();
- /** The adapter factory. */
- private AdapterFactory adapterFactory;
+ private static final String AGGREGATED_VIEWER_PREDICATE = EMFCompareIDEUIPlugin.PLUGIN_ID
+ + ".AGGREGATED_VIEWER_PREDICATE"; //$NON-NLS-1$
- /**
- * Creates a new object wrapping the given {@link CompareConfiguration}.
- *
- * @param cc
- * the {@link CompareConfiguration} to wrap.
- */
- public EMFCompareConfiguration(CompareConfiguration cc) {
- this.compareConfiguration = cc;
+ private static final Predicate<? super EObject> AGGREGATED_VIEWER_PREDICATE__DEFAULT_VALUE = alwaysFalse();
+
+ private static final String SELECTED_DIFFERENCE_GROUP_PROVIDER = EMFCompareIDEUIPlugin.PLUGIN_ID
+ + ".SELECTED_DIFFERENCE_GROUP_PROVIDER"; //$NON-NLS-1$
+
+ private static final IDifferenceGroupProvider SELECTED_DIFFERENCE_GROUP_PROVIDER__DEFAULT_VALUE = IDifferenceGroupProvider.EMPTY;
+
+ private static final String PREVIEW_MERGE_MODE = EMFCompareIDEUIPlugin.PLUGIN_ID + ".PREVIEW_MERGE_MODE"; //$NON-NLS-1$
- editingDomainChange(null, (ICompareEditingDomain)cc.getProperty(EMFCompareConstants.EDITING_DOMAIN));
- selectedDifferenceGroupProviderChange(null, (IDifferenceGroupProvider)cc
- .getProperty(EMFCompareConstants.SELECTED_GROUP));
- selectedDifferenceFiltersChange(null, (Set<IDifferenceFilter>)cc
- .getProperty(EMFCompareConstants.SELECTED_FILTERS));
- aggregatedViewerPredicateChange(null, (Predicate<? super EObject>)cc
- .getProperty(EMFCompareConstants.AGGREGATED_VIEWER_PREDICATE));
- adapterFactoryChange(null, (AdapterFactory)cc
- .getProperty(EMFCompareConstants.COMPOSED_ADAPTER_FACTORY));
- comparisonChange(null, (Comparison)cc.getProperty(EMFCompareConstants.COMPARE_RESULT));
+ private static final Boolean PREVIEW_MERGE_MODE__DEFAULT_VALUE = Boolean.FALSE;
- compareConfiguration.addPropertyChangeListener(this);
+ private final List<IEMFCompareConfigurationChangeListener> listeners;
+
+ private final PropertyChangeListener propertyChangeListener;
+
+ private final CompareConfiguration compareConfiguration;
+
+ public EMFCompareConfiguration(CompareConfiguration compareConfiguration) {
+ this.compareConfiguration = compareConfiguration;
+ setDefaultValues();
+ listeners = new CopyOnWriteArrayList<IEMFCompareConfigurationChangeListener>();
+ propertyChangeListener = new PropertyChangeListener();
+ compareConfiguration.addPropertyChangeListener(propertyChangeListener);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#getEditingDomain()
- */
- public ICompareEditingDomain getEditingDomain() {
- return editingDomain;
+ public void setDefaultValues() {
+ if (compareConfiguration.getProperty(AGGREGATED_VIEWER_PREDICATE) == null) {
+ compareConfiguration.setProperty(AGGREGATED_VIEWER_PREDICATE,
+ AGGREGATED_VIEWER_PREDICATE__DEFAULT_VALUE);
+ }
+
+ if (compareConfiguration.getProperty(SELECTED_DIFFERENCE_FILTERS) == null) {
+ compareConfiguration.setProperty(SELECTED_DIFFERENCE_FILTERS,
+ SELECTED_DIFFERENCE_FILTERS__DEFAULT_VALUE);
+ }
+
+ if (compareConfiguration.getProperty(SELECTED_DIFFERENCE_GROUP_PROVIDER) == null) {
+ compareConfiguration.setProperty(SELECTED_DIFFERENCE_GROUP_PROVIDER,
+ SELECTED_DIFFERENCE_GROUP_PROVIDER__DEFAULT_VALUE);
+ }
+
+ compareConfiguration.setProperty(PREVIEW_MERGE_MODE, PREVIEW_MERGE_MODE__DEFAULT_VALUE);
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#getSelectedGroup()
+ * @see org.eclipse.emf.compare.ide.ui.internal.configuration.ForwardingCompareConfiguration#delegate()
*/
- public IDifferenceGroupProvider getSelectedGroup() {
- return selectedDifferenceGroupProvider;
+ @Override
+ protected CompareConfiguration delegate() {
+ return compareConfiguration;
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#getSelectedFilters()
+ * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#dispose()
*/
- public Collection<IDifferenceFilter> getSelectedFilters() {
- return selectedDifferenceFilters;
+ @Override
+ public void dispose() {
+ super.dispose();
+ compareConfiguration.removePropertyChangeListener(propertyChangeListener);
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#getAggregatedPredicate()
+ * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#addChangeListener(org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfigurationChangeListener)
*/
- public Predicate<? super EObject> getAggregatedPredicate() {
- return aggregatedViewerPredicate;
+ public void addChangeListener(IEMFCompareConfigurationChangeListener listener) {
+ listeners.add(listener);
}
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#getComparison()
+ * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#removeChangeListener(org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfigurationChangeListener)
*/
- public Comparison getComparison() {
- return comparison;
+ public void removeChangeListener(IEMFCompareConfigurationChangeListener listener) {
+ listeners.remove(listener);
}
- /**
- * @param property
- */
- public void adapterFactoryChange(AdapterFactory oldValue, AdapterFactory newValue) {
- adapterFactory = newValue;
+ public Comparison getComparison() {
+ return (Comparison)getProperty(COMPARE_RESULT);
}
- public AdapterFactory getAdapterFactory() {
- return adapterFactory;
+ public void setComparison(Comparison comparison) {
+ setProperty(COMPARE_RESULT, comparison);
}
- /**
- * @param property
- */
- public void aggregatedViewerPredicateChange(Predicate<? super EObject> oldValue,
- Predicate<? super EObject> newValue) {
- if (newValue != null) {
- aggregatedViewerPredicate = newValue;
- } else {
- aggregatedViewerPredicate = alwaysFalse();
- }
+ public EMFCompare getComparator() {
+ return (EMFCompare)getProperty(COMPARATOR);
+ }
+ public void setComparator(EMFCompare comparator) {
+ setProperty(COMPARATOR, comparator);
}
- /**
- * @param object
- * @param property
- */
- public void selectedDifferenceFiltersChange(Set<IDifferenceFilter> oldValue,
- Set<IDifferenceFilter> newValue) {
- if (newValue != null) {
- this.selectedDifferenceFilters = newValue;
- } else {
- this.selectedDifferenceFilters = newLinkedHashSet();
- }
+ public ICompareEditingDomain getEditingDomain() {
+ return (ICompareEditingDomain)getProperty(EDITING_DOMAIN);
}
- /**
- * @param object
- * @param property
- */
- public void selectedDifferenceGroupProviderChange(IDifferenceGroupProvider oldValue,
- IDifferenceGroupProvider newValue) {
- if (newValue != null) {
- selectedDifferenceGroupProvider = newValue;
- } else {
- selectedDifferenceGroupProvider = IDifferenceGroupProvider.EMPTY;
- }
+ public void setEditingDomain(ICompareEditingDomain editingDomain) {
+ setProperty(EDITING_DOMAIN, editingDomain);
}
- /**
- * @param oldValue
- * @param newValue
- */
- public void editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue) {
- editingDomain = newValue;
+ @SuppressWarnings("unchecked")
+ public Set<IDifferenceFilter> getSelectedDifferenceFilters() {
+ return (Set<IDifferenceFilter>)getProperty(SELECTED_DIFFERENCE_FILTERS);
}
- /**
- * @param object
- * @param property
- */
- public void comparisonChange(Comparison oldValue, Comparison newValue) {
- comparison = newValue;
+ public void setSelectedDifferenceFilters(Set<IDifferenceFilter> differenceFilters) {
+ Preconditions.checkNotNull(differenceFilters);
+ setProperty(SELECTED_DIFFERENCE_FILTERS, differenceFilters);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
@SuppressWarnings("unchecked")
- public void propertyChange(PropertyChangeEvent event) {
- if (EMFCompareConstants.EDITING_DOMAIN.equals(event.getProperty())) {
- ICompareEditingDomain oldValue = (ICompareEditingDomain)event.getOldValue();
- ICompareEditingDomain newValue = (ICompareEditingDomain)event.getNewValue();
- editingDomainChange(oldValue, newValue);
- } else if (EMFCompareConstants.SELECTED_GROUP.equals(event.getProperty())) {
- IDifferenceGroupProvider oldValue = (IDifferenceGroupProvider)event.getOldValue();
- IDifferenceGroupProvider newValue = (IDifferenceGroupProvider)event.getNewValue();
- selectedDifferenceGroupProviderChange(oldValue, newValue);
- } else if (EMFCompareConstants.SELECTED_FILTERS.equals(event.getProperty())) {
- Set<IDifferenceFilter> oldValue = (Set<IDifferenceFilter>)event.getOldValue();
- Set<IDifferenceFilter> newValue = (Set<IDifferenceFilter>)event.getNewValue();
- selectedDifferenceFiltersChange(oldValue, newValue);
- } else if (EMFCompareConstants.AGGREGATED_VIEWER_PREDICATE.equals(event.getProperty())) {
- Predicate<? super EObject> oldValue = (Predicate<? super EObject>)event.getOldValue();
- Predicate<? super EObject> newValue = (Predicate<? super EObject>)event.getNewValue();
- aggregatedViewerPredicateChange(oldValue, newValue);
- } else if (EMFCompareConstants.COMPARE_RESULT.equals(event.getProperty())) {
- Comparison oldValue = (Comparison)event.getOldValue();
- Comparison newValue = (Comparison)event.getNewValue();
- comparisonChange(oldValue, newValue);
- } else if (EMFCompareConstants.COMPOSED_ADAPTER_FACTORY.equals(event.getProperty())) {
+ public Predicate<? super EObject> getAggregatedViewerPredicate() {
+ return (Predicate<? super EObject>)getProperty(AGGREGATED_VIEWER_PREDICATE);
+ }
+
+ public void setAggregatedViewerPredicate(Predicate<? super EObject> predicate) {
+ Preconditions.checkNotNull(predicate);
+ setProperty(AGGREGATED_VIEWER_PREDICATE, predicate);
+ }
+
+ public IDifferenceGroupProvider getSelectedDifferenceGroupProvider() {
+ return (IDifferenceGroupProvider)getProperty(SELECTED_DIFFERENCE_GROUP_PROVIDER);
+ }
+
+ public void setSelectedDifferenceGroupProvider(IDifferenceGroupProvider groupProvider) {
+ Preconditions.checkNotNull(groupProvider);
+ setProperty(SELECTED_DIFFERENCE_GROUP_PROVIDER, groupProvider);
+ }
+
+ public boolean getPreviewMergeMode() {
+ return ((Boolean)getProperty(PREVIEW_MERGE_MODE)).booleanValue();
+ }
+
+ public void setPreviewMergeMode(boolean previewMergeMode) {
+ setProperty(PREVIEW_MERGE_MODE, Boolean.valueOf(previewMergeMode));
+ }
+
+ public AdapterFactory getAdapterFactory() {
+ return (AdapterFactory)getProperty(ADAPTER_FACTORY);
+ }
+
+ public void setAdapterFactory(AdapterFactory adapterFactory) {
+ setProperty(ADAPTER_FACTORY, adapterFactory);
+ }
+
+ public boolean getBooleanProperty(String key, boolean dflt) {
+ final boolean ret;
+ Object value = getProperty(key);
+ if (value instanceof Boolean) {
+ ret = ((Boolean)value).booleanValue();
+ } else {
+ ret = dflt;
+ }
+ return ret;
+ }
+
+ private class PropertyChangeListener implements IPropertyChangeListener {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if (EDITING_DOMAIN.equals(property)) {
+ handleEditingDomainChange(event);
+ } else if (SELECTED_DIFFERENCE_GROUP_PROVIDER.equals(property)) {
+ handleSelectedDifferenceGroupProviderChanger(event);
+ } else if (SELECTED_DIFFERENCE_FILTERS.equals(property)) {
+ handleSelectedDifferenceFiltersChange(event);
+ } else if (AGGREGATED_VIEWER_PREDICATE.equals(property)) {
+ handleAggregatedViewerPredicateChange(event);
+ } else if (COMPARE_RESULT.equals(property)) {
+ handleComparisonChange(event);
+ } else if (ADAPTER_FACTORY.equals(property)) {
+ handleAdapterFactoryChange(event);
+ } else if (COMPARATOR.equals(property)) {
+ handleComparatorChange(event);
+ } else if (PREVIEW_MERGE_MODE.equals(property)) {
+ handlePreviewMergeModeChange(event);
+ }
+ }
+
+ protected void handleAdapterFactoryChange(PropertyChangeEvent event) {
AdapterFactory oldValue = (AdapterFactory)event.getOldValue();
AdapterFactory newValue = (AdapterFactory)event.getNewValue();
- adapterFactoryChange(oldValue, newValue);
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.adapterFactoryChange(oldValue, newValue);
+ }
}
- }
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration#dispose()
- */
- public void dispose() {
- compareConfiguration.removePropertyChangeListener(this);
+ protected void handleComparisonChange(PropertyChangeEvent event) {
+ Comparison oldValue = (Comparison)event.getOldValue();
+ Comparison newValue = (Comparison)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.comparisonChange(oldValue, newValue);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void handleAggregatedViewerPredicateChange(PropertyChangeEvent event) {
+ Predicate<? super EObject> oldValue = (Predicate<? super EObject>)event.getOldValue();
+ Predicate<? super EObject> newValue = (Predicate<? super EObject>)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.aggregatedViewerPredicateChange(oldValue, newValue);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void handleSelectedDifferenceFiltersChange(PropertyChangeEvent event) {
+ Set<IDifferenceFilter> oldValue = (Set<IDifferenceFilter>)event.getOldValue();
+ Set<IDifferenceFilter> newValue = (Set<IDifferenceFilter>)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.selectedDifferenceFiltersChange(oldValue, newValue);
+ }
+ }
+
+ protected void handleSelectedDifferenceGroupProviderChanger(PropertyChangeEvent event) {
+ IDifferenceGroupProvider oldValue = (IDifferenceGroupProvider)event.getOldValue();
+ IDifferenceGroupProvider newValue = (IDifferenceGroupProvider)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.selectedDifferenceGroupProviderChange(oldValue, newValue);
+ }
+ }
- editingDomainChange(editingDomain, null);
- selectedDifferenceGroupProviderChange(selectedDifferenceGroupProvider, null);
- selectedDifferenceFiltersChange(selectedDifferenceFilters, null);
- aggregatedViewerPredicateChange(aggregatedViewerPredicate, null);
- adapterFactoryChange(adapterFactory, null);
- comparisonChange(comparison, null);
+ protected void handleEditingDomainChange(PropertyChangeEvent event) {
+ ICompareEditingDomain oldValue = (ICompareEditingDomain)event.getOldValue();
+ ICompareEditingDomain newValue = (ICompareEditingDomain)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.editingDomainChange(oldValue, newValue);
+ }
+ }
+ protected void handleComparatorChange(PropertyChangeEvent event) {
+ EMFCompare oldValue = (EMFCompare)event.getOldValue();
+ EMFCompare newValue = (EMFCompare)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.comparatorChange(oldValue, newValue);
+ }
+ }
+
+ protected void handlePreviewMergeModeChange(PropertyChangeEvent event) {
+ Boolean oldValue = (Boolean)event.getOldValue();
+ Boolean newValue = (Boolean)event.getNewValue();
+ for (IEMFCompareConfigurationChangeListener listener : listeners) {
+ listener.previewMergeModeChange(oldValue.booleanValue(), newValue.booleanValue());
+ }
+ }
}
+
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/ForwardingCompareConfiguration.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/ForwardingCompareConfiguration.java
new file mode 100644
index 000000000..6af47a891
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/configuration/ForwardingCompareConfiguration.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.emf.compare.ide.ui.internal.configuration;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.ICompareContainer;
+import org.eclipse.compare.ICompareInputLabelProvider;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+public abstract class ForwardingCompareConfiguration extends CompareConfiguration {
+
+ private final ListenerList fListeners;
+
+ private final IPropertyChangeListener delegateProperyChangeListener;
+
+ public ForwardingCompareConfiguration() {
+ fListeners = new ListenerList();
+
+ // we have to listen to the delegate to avoid leaking the delegate through event.getSource in fired
+ // events.
+ delegateProperyChangeListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ fireChange(event.getProperty(), event.getOldValue(), event.getNewValue());
+ }
+ };
+ }
+
+ protected abstract CompareConfiguration delegate();
+
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ return delegate().getPreferenceStore();
+ }
+
+ @Override
+ public Image getImage(int kind) {
+ return delegate().getImage(kind);
+ }
+
+ @Override
+ public Image getImage(Image base, int kind) {
+ return delegate().getImage(base, kind);
+ }
+
+ @Override
+ public void dispose() {
+ delegate().removePropertyChangeListener(delegateProperyChangeListener);
+ delegate().dispose();
+ }
+
+ @Override
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.add(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ fListeners.remove(listener);
+ }
+
+ /**
+ * Fires a <code>PropertyChangeEvent</code> to registered listeners.
+ *
+ * @param propertyName
+ * the name of the property that has changed
+ * @param oldValue
+ * the property's old value
+ * @param newValue
+ * the property's new value
+ */
+ protected final void fireChange(String propertyName, Object oldValue, Object newValue) {
+ PropertyChangeEvent event = null;
+ Object[] listeners = fListeners.getListeners();
+ if (listeners != null) {
+ for (int i = 0; i < listeners.length; i++) {
+ IPropertyChangeListener l = (IPropertyChangeListener)listeners[i];
+ if (event == null) {
+ event = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
+ }
+ l.propertyChange(event);
+ }
+ }
+ }
+
+ @Override
+ public void setProperty(String key, Object newValue) {
+ if (delegate() == null) {
+ // ignore the set of properties from super <init> as we are always delegating to #delegate().
+ } else {
+ delegate().setProperty(key, newValue);
+ }
+ }
+
+ @Override
+ public Object getProperty(String key) {
+ return delegate().getProperty(key);
+ }
+
+ @Override
+ public void setAncestorLabel(String label) {
+ delegate().setAncestorLabel(label);
+ }
+
+ @Override
+ public String getAncestorLabel(Object element) {
+ return delegate().getAncestorLabel(element);
+ }
+
+ @Override
+ public void setAncestorImage(Image image) {
+ delegate().setAncestorImage(image);
+ }
+
+ @Override
+ public Image getAncestorImage(Object element) {
+ return delegate().getAncestorImage(element);
+ }
+
+ @Override
+ public void setLeftEditable(boolean editable) {
+ delegate().setLeftEditable(editable);
+ }
+
+ @Override
+ public boolean isLeftEditable() {
+ return delegate().isLeftEditable();
+ }
+
+ @Override
+ public void setLeftLabel(String label) {
+ delegate().setLeftLabel(label);
+ }
+
+ @Override
+ public String getLeftLabel(Object element) {
+ return delegate().getLeftLabel(element);
+ }
+
+ @Override
+ public void setLeftImage(Image image) {
+ delegate().setLeftImage(image);
+ }
+
+ @Override
+ public Image getLeftImage(Object element) {
+ return delegate().getLeftImage(element);
+ }
+
+ @Override
+ public void setRightEditable(boolean editable) {
+ delegate().setRightEditable(editable);
+ }
+
+ @Override
+ public boolean isRightEditable() {
+ return delegate().isRightEditable();
+ }
+
+ @Override
+ public void setRightLabel(String label) {
+ delegate().setRightLabel(label);
+ }
+
+ @Override
+ public String getRightLabel(Object element) {
+ return delegate().getRightLabel(element);
+ }
+
+ @Override
+ public void setRightImage(Image image) {
+ delegate().setRightImage(image);
+ }
+
+ @Override
+ public Image getRightImage(Object element) {
+ return delegate().getRightImage(element);
+ }
+
+ @Override
+ public ICompareContainer getContainer() {
+ return delegate().getContainer();
+ }
+
+ @Override
+ public void setContainer(ICompareContainer container) {
+ delegate().setContainer(container);
+ }
+
+ @Override
+ public ICompareInputLabelProvider getLabelProvider() {
+ return delegate().getLabelProvider();
+ }
+
+ @Override
+ public void setLabelProvider(ICompareInput input, ICompareInputLabelProvider labelProvider) {
+ delegate().setLabelProvider(input, labelProvider);
+ }
+
+ @Override
+ public void setDefaultLabelProvider(ICompareInputLabelProvider labelProvider) {
+ delegate().setDefaultLabelProvider(labelProvider);
+ }
+
+ @Override
+ public void setChangeIgnored(int kind, boolean ignored) {
+ delegate().setChangeIgnored(kind, ignored);
+ }
+
+ @Override
+ public boolean isChangeIgnored(int kind) {
+ return delegate().isChangeIgnored(kind);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
index 0f4b4ba5f..3a9a9ec6f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
@@ -23,7 +23,6 @@ import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
import org.eclipse.compare.internal.CompareHandlerService;
import org.eclipse.core.runtime.IAdaptable;
@@ -42,7 +41,7 @@ import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoActio
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction;
import org.eclipse.emf.compare.ide.ui.internal.util.SWTUtil;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfiguration;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.EMFCompareConfigurationChangeListener;
import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.ICompareAccessor;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.ICompareColor;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer;
@@ -89,14 +88,7 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
- private final class EMFCompareContentMergerViewerConfiguration extends EMFCompareConfiguration {
-
- /**
- * @param cc
- */
- private EMFCompareContentMergerViewerConfiguration(CompareConfiguration cc) {
- super(cc);
- }
+ private final class EMFCompareContentMergerViewerConfigurationListener extends EMFCompareConfigurationChangeListener {
/**
* {@inheritDoc}
@@ -106,7 +98,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
public void editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue) {
- super.editingDomainChange(oldValue, newValue);
if (newValue != oldValue) {
if (oldValue != null) {
oldValue.getCommandStack().removeCommandStackListener(EMFCompareContentMergeViewer.this);
@@ -135,7 +126,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
@Override
public void aggregatedViewerPredicateChange(Predicate<? super EObject> oldValue,
Predicate<? super EObject> newValue) {
- super.aggregatedViewerPredicateChange(oldValue, newValue);
if (oldValue != newValue) {
redrawCenterControl();
}
@@ -150,7 +140,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
@Override
public void selectedDifferenceFiltersChange(Set<IDifferenceFilter> oldValue,
Set<IDifferenceFilter> newValue) {
- super.selectedDifferenceFiltersChange(oldValue, newValue);
if (oldValue != newValue) {
redrawCenterControl();
}
@@ -165,7 +154,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
@Override
public void selectedDifferenceGroupProviderChange(IDifferenceGroupProvider oldValue,
IDifferenceGroupProvider newValue) {
- super.selectedDifferenceGroupProviderChange(oldValue, newValue);
if (oldValue != newValue) {
redrawCenterControl();
}
@@ -179,7 +167,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
public void adapterFactoryChange(AdapterFactory oldValue, AdapterFactory newValue) {
- super.adapterFactoryChange(oldValue, newValue);
if (oldValue != null) {
fAdapterFactoryContentProvider.dispose();
}
@@ -212,20 +199,27 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
private RedoAction redoAction;
- private final IEMFCompareConfiguration emfCompareConfiguration;
-
private AdapterFactoryContentProvider fAdapterFactoryContentProvider;
+ private final EMFCompareContentMergerViewerConfigurationListener configurationListener;
+
/**
* @param style
* @param bundle
* @param cc
*/
- protected EMFCompareContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc) {
+ protected EMFCompareContentMergeViewer(int style, ResourceBundle bundle, EMFCompareConfiguration cc) {
super(style, bundle, cc);
fDynamicObject = new DynamicObject(this);
- emfCompareConfiguration = new EMFCompareContentMergerViewerConfiguration(cc);
+
+ if (getCompareConfiguration().getAdapterFactory() != null) {
+ fAdapterFactoryContentProvider = new AdapterFactoryContentProvider(getCompareConfiguration()
+ .getAdapterFactory());
+ }
+
+ configurationListener = new EMFCompareContentMergerViewerConfigurationListener();
+ getCompareConfiguration().addChangeListener(configurationListener);
}
/**
@@ -333,10 +327,9 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
if (redoAction != null) {
redoAction.update();
}
- if (getEMFCompareConfiguration().getEditingDomain() != null) {
- setLeftDirty(getEMFCompareConfiguration().getEditingDomain().getCommandStack().isLeftSaveNeeded());
- setRightDirty(getEMFCompareConfiguration().getEditingDomain().getCommandStack()
- .isRightSaveNeeded());
+ if (getCompareConfiguration().getEditingDomain() != null) {
+ setLeftDirty(getCompareConfiguration().getEditingDomain().getCommandStack().isLeftSaveNeeded());
+ setRightDirty(getCompareConfiguration().getEditingDomain().getCommandStack().isRightSaveNeeded());
}
SWTUtil.safeAsyncExec(new Runnable() {
@@ -347,13 +340,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
}
/**
- * @return the emfCompareConfiguration
- */
- protected final IEMFCompareConfiguration getEMFCompareConfiguration() {
- return emfCompareConfiguration;
- }
-
- /**
* {@inheritDoc}
*
* @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer#copy(boolean)
@@ -362,8 +348,8 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
protected void copy(final boolean leftToRight) {
final List<Diff> differences;
- if (getEMFCompareConfiguration().getComparison().isThreeWay()) {
- differences = ImmutableList.copyOf(filter(getEMFCompareConfiguration().getComparison()
+ if (getCompareConfiguration().getComparison().isThreeWay()) {
+ differences = ImmutableList.copyOf(filter(getCompareConfiguration().getComparison()
.getDifferences(), new Predicate<Diff>() {
public boolean apply(Diff diff) {
final boolean unresolved = diff.getState() == DifferenceState.UNRESOLVED;
@@ -375,15 +361,15 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
}
}));
} else {
- differences = ImmutableList.copyOf(filter(getEMFCompareConfiguration().getComparison()
+ differences = ImmutableList.copyOf(filter(getCompareConfiguration().getComparison()
.getDifferences(), EMFComparePredicates.hasState(DifferenceState.UNRESOLVED)));
}
if (differences.size() > 0) {
- final Command copyCommand = getEMFCompareConfiguration().getEditingDomain().createCopyCommand(
+ final Command copyCommand = getCompareConfiguration().getEditingDomain().createCopyCommand(
differences, leftToRight, EMFCompareRCPPlugin.getDefault().getMergerRegistry());
- getEMFCompareConfiguration().getEditingDomain().getCommandStack().execute(copyCommand);
+ getCompareConfiguration().getEditingDomain().getCommandStack().execute(copyCommand);
refresh();
}
}
@@ -655,7 +641,7 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
protected void handleDispose(DisposeEvent event) {
- getEMFCompareConfiguration().dispose();
+ getCompareConfiguration().removeChangeListener(configurationListener);
super.handleDispose(event);
}
@@ -665,4 +651,13 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer#getCompareConfiguration()
+ */
+ @Override
+ protected EMFCompareConfiguration getCompareConfiguration() {
+ return (EMFCompareConfiguration)super.getCompareConfiguration();
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
index b405aa2c0..701f65233 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewer.java
@@ -17,8 +17,8 @@ import com.google.common.collect.Iterables;
import java.util.ResourceBundle;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.ICompareAccessor;
@@ -77,7 +77,7 @@ public class TableContentMergeViewer extends EMFCompareContentMergeViewer {
*
* @see TableContentMergeViewer
*/
- protected TableContentMergeViewer(Composite parent, CompareConfiguration config) {
+ protected TableContentMergeViewer(Composite parent, EMFCompareConfiguration config) {
super(SWT.NONE, ResourceBundle.getBundle(BUNDLE_NAME), config);
fAdapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
.getAdapterFactoryRegistry());
@@ -147,7 +147,7 @@ public class TableContentMergeViewer extends EMFCompareContentMergeViewer {
*/
@Override
protected AbstractMergeViewer createMergeViewer(Composite parent, final MergeViewerSide side) {
- TableMergeViewer ret = new TableMergeViewer(parent, side, this, getEMFCompareConfiguration());
+ TableMergeViewer ret = new TableMergeViewer(parent, side, this, getCompareConfiguration());
ret.getStructuredViewer().getTable().getVerticalBar().setVisible(false);
ret.setContentProvider(new ArrayContentProvider() {
@@ -277,8 +277,9 @@ public class TableContentMergeViewer extends EMFCompareContentMergeViewer {
final Diff leftDiff = ((IMergeViewerItem)leftItem.getData()).getDiff();
boolean doPaint = true;
if (leftDiff != null) {
- if (MergeViewerUtil.isVisibleInMergeViewer(leftDiff, getEMFCompareConfiguration()
- .getSelectedGroup(), getEMFCompareConfiguration().getAggregatedPredicate())) {
+ if (MergeViewerUtil.isVisibleInMergeViewer(leftDiff, getCompareConfiguration()
+ .getSelectedDifferenceGroupProvider(), getCompareConfiguration()
+ .getAggregatedViewerPredicate())) {
TableItem rightItem = findRightTableItemFromLeftDiff(rightItems, leftDiff, leftData);
if (rightItem != null) {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
index 576d7f59d..666222cf6 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -14,15 +14,13 @@ import static org.eclipse.emf.compare.ide.utils.ResourceUtil.saveAllResources;
import com.google.common.collect.ImmutableMap;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.AccessorAdapter;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -34,7 +32,7 @@ import org.eclipse.swt.graphics.Image;
*/
public class TableContentMergeViewerContentProvider implements IMergeViewerContentProvider {
- private CompareConfiguration fCompareConfiguration;
+ private EMFCompareConfiguration fCompareConfiguration;
private String fAncestorError;
@@ -42,7 +40,7 @@ public class TableContentMergeViewerContentProvider implements IMergeViewerConte
private String fRightError;
- public TableContentMergeViewerContentProvider(CompareConfiguration cc) {
+ public TableContentMergeViewerContentProvider(EMFCompareConfiguration cc) {
fCompareConfiguration = cc;
}
@@ -130,7 +128,7 @@ public class TableContentMergeViewerContentProvider implements IMergeViewerConte
}
public void saveLeftContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject leftEObject = null;
for (Match match : matches) {
leftEObject = match.getLeft();
@@ -184,7 +182,7 @@ public class TableContentMergeViewerContentProvider implements IMergeViewerConte
}
public void saveRightContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject rightEObject = null;
for (Match match : matches) {
rightEObject = match.getRight();
@@ -201,13 +199,4 @@ public class TableContentMergeViewerContentProvider implements IMergeViewerConte
}
}
}
-
- /**
- * Returns the comparison object.
- *
- * @return the comparison.
- */
- public Comparison getComparison() {
- return (Comparison)fCompareConfiguration.getProperty(EMFCompareConstants.COMPARE_RESULT);
- }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerCreator.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerCreator.java
index d29538197..474cfbe78 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerCreator.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/table/TableContentMergeViewerCreator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -12,6 +12,7 @@ package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.table;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.IViewerCreator;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
@@ -34,7 +35,7 @@ public class TableContentMergeViewerCreator implements IViewerCreator {
* org.eclipse.compare.CompareConfiguration)
*/
public Viewer createViewer(Composite parent, CompareConfiguration config) {
- return new TableContentMergeViewer(parent, config);
+ return new TableContentMergeViewer(parent, new EMFCompareConfiguration(config));
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
index 0f105d5c0..13cceb182 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
@@ -25,7 +25,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareNavigator;
import org.eclipse.compare.ICompareNavigator;
import org.eclipse.compare.IStreamContentAccessor;
@@ -39,7 +38,6 @@ import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.compare.AttributeChange;
-import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
@@ -48,12 +46,13 @@ import org.eclipse.emf.compare.command.ICompareCommandStack;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.DynamicObject;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoAction;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.CompareInputAdapter;
import org.eclipse.emf.compare.ide.ui.internal.util.SWTUtil;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.EMFCompareConfigurationChangeListener;
import org.eclipse.emf.compare.utils.IEqualityHelper;
import org.eclipse.emf.compare.utils.ReferenceUtil;
import org.eclipse.emf.ecore.EAttribute;
@@ -66,8 +65,6 @@ import org.eclipse.emf.edit.command.ChangeCommand;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.FocusEvent;
@@ -80,7 +77,7 @@ import org.eclipse.ui.actions.ActionFactory;
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
-public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPropertyChangeListener, CommandStackListener {
+public class EMFCompareTextMergeViewer extends TextMergeViewer implements CommandStackListener {
private static final String BUNDLE_NAME = EMFCompareTextMergeViewer.class.getName();
@@ -94,26 +91,30 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
private final ScheduledExecutorService fExecutorService;
+ private final ConfigurationChangeListener configurationChangeListener;
+
+ private class ConfigurationChangeListener extends EMFCompareConfigurationChangeListener {
+ @Override
+ public void editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue) {
+ EMFCompareTextMergeViewer.this.editingDomainChange(oldValue, newValue);
+ }
+ }
+
/**
* @param parent
* @param configuration
*/
- public EMFCompareTextMergeViewer(Composite parent, CompareConfiguration configuration) {
+ public EMFCompareTextMergeViewer(Composite parent, EMFCompareConfiguration configuration) {
super(parent, configuration);
setContentProvider(new EMFCompareTextMergeViewerContentProvider(configuration));
fExecutorService = Executors.newSingleThreadScheduledExecutor();
fDelayedExecutor = new DelayedExecutor(fExecutorService);
- editingDomainChange(null, getEditingDomain());
- configuration.addPropertyChangeListener(this);
- }
+ editingDomainChange(null, configuration.getEditingDomain());
- public void propertyChange(PropertyChangeEvent event) {
- if (EMFCompareConstants.EDITING_DOMAIN.equals(event.getProperty())) {
- editingDomainChange((ICompareEditingDomain)event.getOldValue(), (ICompareEditingDomain)event
- .getNewValue());
- }
+ configurationChangeListener = new ConfigurationChangeListener();
+ configuration.addChangeListener(configurationChangeListener);
}
/**
@@ -163,8 +164,9 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
if (fRedoAction != null) {
fRedoAction.update();
}
- if (getEditingDomain() != null) {
- ICompareCommandStack commandStack = getEditingDomain().getCommandStack();
+ if (getCompareConfiguration().getEditingDomain() != null) {
+ ICompareCommandStack commandStack = getCompareConfiguration().getEditingDomain()
+ .getCommandStack();
setLeftDirty(commandStack.isLeftSaveNeeded());
setRightDirty(commandStack.isRightSaveNeeded());
}
@@ -180,7 +182,8 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
public void run() {
String leftValueFromWidget = getContents(true, Charsets.UTF_8.name());
String rightValueFromWidget = getContents(false, Charsets.UTF_8.name());
- IEqualityHelper equalityHelper = getComparison().getEqualityHelper();
+ IEqualityHelper equalityHelper = getCompareConfiguration().getComparison()
+ .getEqualityHelper();
if (!equalityHelper.matchingAttributeValues(leftValueFromModel, leftValueFromWidget)
|| !equalityHelper.matchingAttributeValues(rightValueFromModel, rightValueFromWidget)) {
// only refresh if values are different to avoid select-all of the text.
@@ -209,18 +212,13 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
}
/**
- * @return the fEditingDomain
- */
- protected final ICompareEditingDomain getEditingDomain() {
- return (ICompareEditingDomain)getCompareConfiguration().getProperty(
- EMFCompareConstants.EDITING_DOMAIN);
- }
-
- /**
- * @return the fComparison
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer#getCompareConfiguration()
*/
- protected final Comparison getComparison() {
- return (Comparison)getCompareConfiguration().getProperty(EMFCompareConstants.COMPARE_RESULT);
+ @Override
+ protected EMFCompareConfiguration getCompareConfiguration() {
+ return (EMFCompareConfiguration)super.getCompareConfiguration();
}
/**
@@ -254,9 +252,9 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
final boolean oldAndNewEquals = equalityHelper.matchingAttributeValues(newValue, oldValue);
if (eObject != null && !oldAndNewEquals && getCompareConfiguration().isLeftEditable()) {
// Save the change on left side
- getEditingDomain().getCommandStack().execute(
- new UpdateModelAndRejectDiffCommand(getEditingDomain().getChangeRecorder(), eObject,
- eAttribute, newValue, diff, isLeft));
+ getCompareConfiguration().getEditingDomain().getCommandStack().execute(
+ new UpdateModelAndRejectDiffCommand(getCompareConfiguration().getEditingDomain()
+ .getChangeRecorder(), eObject, eAttribute, newValue, diff, isLeft));
}
}
@@ -395,9 +393,9 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
@Override
protected void createToolItems(ToolBarManager toolBarManager) {
super.createToolItems(toolBarManager);
-
- fRedoAction = new RedoAction(getEditingDomain());
- fUndoAction = new UndoAction(getEditingDomain());
+
+ fRedoAction = new RedoAction(getCompareConfiguration().getEditingDomain());
+ fUndoAction = new UndoAction(getCompareConfiguration().getEditingDomain());
getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), fUndoAction);
getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), fRedoAction);
@@ -458,9 +456,9 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPrope
}
fExecutorService.shutdown();
- getCompareConfiguration().removePropertyChangeListener(this);
+ getCompareConfiguration().removeChangeListener(configurationChangeListener);
- editingDomainChange(getEditingDomain(), null);
+ editingDomainChange(getCompareConfiguration().getEditingDomain(), null);
super.handleDispose(event);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
index 15474ef83..ec046e752 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -14,14 +14,12 @@ import static org.eclipse.emf.compare.ide.utils.ResourceUtil.saveAllResources;
import com.google.common.collect.ImmutableMap;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -33,7 +31,7 @@ import org.eclipse.swt.graphics.Image;
*/
public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerContentProvider {
- private CompareConfiguration fCompareConfiguration;
+ private EMFCompareConfiguration fCompareConfiguration;
private String fAncestorError;
@@ -41,7 +39,7 @@ public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerCon
private String fRightError;
- public EMFCompareTextMergeViewerContentProvider(CompareConfiguration cc) {
+ public EMFCompareTextMergeViewerContentProvider(EMFCompareConfiguration cc) {
fCompareConfiguration = cc;
}
@@ -130,7 +128,7 @@ public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerCon
}
public void saveLeftContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject leftEObject = null;
for (Match match : matches) {
leftEObject = match.getLeft();
@@ -184,7 +182,7 @@ public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerCon
}
public void saveRightContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject rightEObject = null;
for (Match match : matches) {
rightEObject = match.getRight();
@@ -201,13 +199,4 @@ public class EMFCompareTextMergeViewerContentProvider implements IMergeViewerCon
}
}
}
-
- /**
- * Returns the comparison object.
- *
- * @return the comparison.
- */
- public Comparison getComparison() {
- return (Comparison)fCompareConfiguration.getProperty(EMFCompareConstants.COMPARE_RESULT);
- }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerCreator.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerCreator.java
index 58e862b2d..4d827a2ed 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerCreator.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewerCreator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -12,6 +12,7 @@ package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.text;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.IViewerCreator;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
@@ -27,7 +28,7 @@ public class EMFCompareTextMergeViewerCreator implements IViewerCreator {
* org.eclipse.compare.CompareConfiguration)
*/
public Viewer createViewer(Composite parent, CompareConfiguration config) {
- return new EMFCompareTextMergeViewer(parent, config);
+ return new EMFCompareTextMergeViewer(parent, new EMFCompareConfiguration(config));
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
index 8af40406b..ac5eb93ca 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewer.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.ReferenceChange;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.ICompareAccessor;
@@ -107,7 +108,7 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
* @param config
* the {@link CompareConfiguration}
*/
- public TreeContentMergeViewer(Composite parent, CompareConfiguration config) {
+ public TreeContentMergeViewer(Composite parent, EMFCompareConfiguration config) {
super(SWT.NONE, ResourceBundle.getBundle(BUNDLE_NAME), config);
fAdapterFactory = new ComposedAdapterFactory(EMFCompareRCPPlugin.getDefault()
@@ -182,7 +183,7 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
@Override
protected AbstractMergeViewer createMergeViewer(final Composite parent, final MergeViewerSide side) {
final TreeMergeViewer mergeTreeViewer = new TreeMergeViewer(parent, side, this,
- getEMFCompareConfiguration());
+ getCompareConfiguration());
IContentProvider contentProvider = new AdapterFactoryContentProvider(fAdapterFactory) {
/**
* {@inheritDoc}
@@ -206,8 +207,8 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
public Object[] getChildren(Object object) {
if (object instanceof IMergeViewerItem.Container) {
IMergeViewerItem[] children = ((IMergeViewerItem.Container)object).getChildren(
- getEMFCompareConfiguration().getSelectedGroup(), getEMFCompareConfiguration()
- .getAggregatedPredicate());
+ getCompareConfiguration().getSelectedDifferenceGroupProvider(),
+ getCompareConfiguration().getAggregatedViewerPredicate());
return children;
}
@@ -222,8 +223,9 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
@Override
public boolean hasChildren(Object object) {
if (object instanceof IMergeViewerItem.Container) {
- return ((IMergeViewerItem.Container)object).hasChildren(getEMFCompareConfiguration()
- .getSelectedGroup(), getEMFCompareConfiguration().getAggregatedPredicate());
+ return ((IMergeViewerItem.Container)object).hasChildren(getCompareConfiguration()
+ .getSelectedDifferenceGroupProvider(), getCompareConfiguration()
+ .getAggregatedViewerPredicate());
}
return super.hasChildren(object);
}
@@ -351,8 +353,9 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
IMergeViewerItem leftData = (IMergeViewerItem)leftItem.getData();
final Diff leftDiff = leftData.getDiff();
if (leftDiff != null) {
- if (MergeViewerUtil.isVisibleInMergeViewer(leftDiff, getEMFCompareConfiguration()
- .getSelectedGroup(), getEMFCompareConfiguration().getAggregatedPredicate())) {
+ if (MergeViewerUtil.isVisibleInMergeViewer(leftDiff, getCompareConfiguration()
+ .getSelectedDifferenceGroupProvider(), getCompareConfiguration()
+ .getAggregatedViewerPredicate())) {
TreeItem rightItem = findRightTreeItemFromLeftDiff(rightItems, leftDiff, leftData);
if (rightItem != null) {
@@ -517,29 +520,29 @@ public class TreeContentMergeViewer extends EMFCompareContentMergeViewer {
}
if (parent instanceof EObject) {
- Match match = getEMFCompareConfiguration().getComparison().getMatch((EObject)parent);
+ Match match = getCompareConfiguration().getComparison().getMatch((EObject)parent);
if (match != null) {
for (ReferenceChange referenceChange : filter(filter(match.getDifferences(),
ReferenceChange.class), EMFComparePredicates.ofKind(DifferenceKind.MOVE))) {
if (getLeftMergeViewer() == mergeTreeViewer) {
- EObject eContainer = getEMFCompareConfiguration().getComparison().getMatch(
+ EObject eContainer = getCompareConfiguration().getComparison().getMatch(
referenceChange.getValue()).getRight().eContainer(); // XXX: use
// itemProvider.getParent().
- Match match2 = getEMFCompareConfiguration().getComparison().getMatch(eContainer);
+ Match match2 = getCompareConfiguration().getComparison().getMatch(eContainer);
if (match2.getLeft() != parent) {
IMergeViewerItem.Container container = new MergeViewerItem.Container(
- getEMFCompareConfiguration().getComparison(), null, match2,
+ getCompareConfiguration().getComparison(), null, match2,
MergeViewerSide.RIGHT, fAdapterFactory);
toBeExpanded.add(container);
}
} else if (getRightMergeViewer() == mergeTreeViewer) {
- EObject eContainer = getEMFCompareConfiguration().getComparison().getMatch(
+ EObject eContainer = getCompareConfiguration().getComparison().getMatch(
referenceChange.getValue()).getLeft().eContainer(); // XXX: use
// itemProvider.getParent().
- Match match2 = getEMFCompareConfiguration().getComparison().getMatch(eContainer);
+ Match match2 = getCompareConfiguration().getComparison().getMatch(eContainer);
if (match2.getRight() != parent) {
IMergeViewerItem.Container container = new MergeViewerItem.Container(
- getEMFCompareConfiguration().getComparison(), null, match2,
+ getCompareConfiguration().getComparison(), null, match2,
MergeViewerSide.LEFT, fAdapterFactory);
toBeExpanded.add(container);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerContentProvider.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerContentProvider.java
index 74f5ab403..0f41dc702 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerContentProvider.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -19,10 +19,9 @@ import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Match;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.accessor.AccessorAdapter;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -43,7 +42,7 @@ public class TreeContentMergeViewerContentProvider implements IMergeViewerConten
/**
* The stored {@link CompareConfiguration} to delegates most methods of this object.
*/
- private final CompareConfiguration fCompareConfiguration;
+ private final EMFCompareConfiguration fCompareConfiguration;
/**
* Creates a new {@link TreeContentMergeViewerContentProvider} and stored the given
@@ -55,7 +54,7 @@ public class TreeContentMergeViewerContentProvider implements IMergeViewerConten
* @param comparison
* the comparison that is to be displayed by this viewer.
*/
- public TreeContentMergeViewerContentProvider(CompareConfiguration cc) {
+ public TreeContentMergeViewerContentProvider(EMFCompareConfiguration cc) {
this.fCompareConfiguration = cc;
}
@@ -166,7 +165,7 @@ public class TreeContentMergeViewerContentProvider implements IMergeViewerConten
* byte[])
*/
public void saveLeftContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject leftEObject = null;
for (Match match : matches) {
leftEObject = match.getLeft();
@@ -229,7 +228,7 @@ public class TreeContentMergeViewerContentProvider implements IMergeViewerConten
* byte[])
*/
public void saveRightContent(Object element, byte[] bytes) {
- EList<Match> matches = getComparison().getMatches();
+ EList<Match> matches = fCompareConfiguration.getComparison().getMatches();
EObject rightEObject = null;
for (Match match : matches) {
rightEObject = match.getRight();
@@ -246,13 +245,4 @@ public class TreeContentMergeViewerContentProvider implements IMergeViewerConten
}
}
}
-
- /**
- * Returns the comparison object.
- *
- * @return the comparison.
- */
- public Comparison getComparison() {
- return (Comparison)fCompareConfiguration.getProperty(EMFCompareConstants.COMPARE_RESULT);
- }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerCreator.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerCreator.java
index b775f0eac..2064c1c0d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerCreator.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/tree/TreeContentMergeViewerCreator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -12,6 +12,7 @@ package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.tree;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.IViewerCreator;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
@@ -34,7 +35,7 @@ public class TreeContentMergeViewerCreator implements IViewerCreator {
* org.eclipse.compare.CompareConfiguration)
*/
public Viewer createViewer(Composite parent, CompareConfiguration config) {
- return new TreeContentMergeViewer(parent, config);
+ return new TreeContentMergeViewer(parent, new EMFCompareConfiguration(config));
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/CompareConfigurationExtension.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/CompareConfigurationExtension.java
deleted file mode 100644
index 8ec5ebbfa..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/CompareConfigurationExtension.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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.emf.compare.ide.ui.internal.contentmergeviewer.util;
-
-import org.eclipse.compare.CompareConfiguration;
-
-/**
- * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
- */
-public final class CompareConfigurationExtension {
-
- private CompareConfigurationExtension() {
- }
-
- public static boolean getBoolean(CompareConfiguration cc, String key, boolean dflt) {
- if (cc != null) {
- Object value = cc.getProperty(key);
- if (value instanceof Boolean) {
- return ((Boolean)value).booleanValue();
- }
- }
- return dflt;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/EMFCompareColor.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/EMFCompareColor.java
index b2df42f99..77da896f9 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/EMFCompareColor.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/util/EMFCompareColor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util;
-import static org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.CompareConfigurationExtension.getBoolean;
-
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.CompareColorImpl;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -29,8 +28,8 @@ public class EMFCompareColor extends CompareColorImpl {
private final CompareConfiguration fCompareConfiguration;
public EMFCompareColor(ContentMergeViewer contentMergeViewer, IPreferenceStore preferenceStore,
- CompareConfiguration compareConfiguration) {
- super(contentMergeViewer.getControl().getDisplay(), getBoolean(compareConfiguration,
+ EMFCompareConfiguration compareConfiguration) {
+ super(contentMergeViewer.getControl().getDisplay(), compareConfiguration.getBooleanProperty(
"LEFT_IS_LOCAL", false), preferenceStore); //$NON-NLS-1$
this.fCompareConfigurationChangeListener = new IPropertyChangeListener() {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/AbstractEMFCompareEditorInput.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/AbstractEMFCompareEditorInput.java
index d8504397c..39e353fa2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/AbstractEMFCompareEditorInput.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/AbstractEMFCompareEditorInput.java
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.command.ICompareCommandStack;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
/**
* Abstract subclass of {@link CompareEditorInput} to be use to open CompareEditor with results of EMF
@@ -48,7 +48,7 @@ public abstract class AbstractEMFCompareEditorInput extends CompareEditorInput {
* @throws NullPointerException
* if {@code editingDomain} or {@code adapterFactory} is null.
*/
- public AbstractEMFCompareEditorInput(CompareConfiguration configuration,
+ public AbstractEMFCompareEditorInput(EMFCompareConfiguration configuration,
ICompareEditingDomain editingDomain, AdapterFactory adapterFactory) {
super(configuration);
this.editingDomain = checkNotNull(editingDomain);
@@ -97,11 +97,21 @@ public abstract class AbstractEMFCompareEditorInput extends CompareEditorInput {
@Override
protected final Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, editingDomain);
+ getCompareConfiguration().setEditingDomain(editingDomain);
return doPrepareInput(monitor);
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.CompareEditorInput#getCompareConfiguration()
+ */
+ @Override
+ public EMFCompareConfiguration getCompareConfiguration() {
+ return (EMFCompareConfiguration)super.getCompareConfiguration();
+ }
+
+ /**
* Runs the compare operation and returns the compare result. If <code>null</code> is returned no
* differences were found and no compare editor needs to be opened. Progress should be reported to the
* given progress monitor. A request to cancel the operation should be honored and acknowledged by
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonEditorInput.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonEditorInput.java
index cabe50ae9..b6527ef7f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonEditorInput.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Obeo.
+ * Copyright (c) 2012, 2013 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
@@ -12,12 +12,12 @@ package org.eclipse.emf.compare.ide.ui.internal.editor;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
@@ -29,7 +29,7 @@ public class ComparisonEditorInput extends AbstractEMFCompareEditorInput {
/**
* @param configuration
*/
- public ComparisonEditorInput(CompareConfiguration configuration, Comparison comparison,
+ public ComparisonEditorInput(EMFCompareConfiguration configuration, Comparison comparison,
ICompareEditingDomain editingDomain, AdapterFactory adapterFactory) {
super(configuration, editingDomain, adapterFactory);
this.comparison = comparison;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonScopeEditorInput.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonScopeEditorInput.java
index 1579d3cd3..282f51632 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonScopeEditorInput.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/editor/ComparisonScopeEditorInput.java
@@ -12,12 +12,11 @@ package org.eclipse.emf.compare.ide.ui.internal.editor;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.scope.IComparisonScope;
/**
@@ -35,7 +34,7 @@ public class ComparisonScopeEditorInput extends AbstractEMFCompareEditorInput {
/**
* @param configuration
*/
- public ComparisonScopeEditorInput(CompareConfiguration configuration,
+ public ComparisonScopeEditorInput(EMFCompareConfiguration configuration,
ICompareEditingDomain editingDomain, AdapterFactory adapterFactory, EMFCompare comparator,
IComparisonScope scope) {
super(configuration, editingDomain, adapterFactory);
@@ -51,7 +50,7 @@ public class ComparisonScopeEditorInput extends AbstractEMFCompareEditorInput {
@Override
protected Object doPrepareInput(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
- getCompareConfiguration().setProperty(EMFCompareConstants.COMPARATOR, comparator);
+ getCompareConfiguration().setComparator(comparator);
return new ComparisonScopeInput(scope, getAdapterFactory());
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
index 1a96d5ec9..11e81c5be 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/handler/AbstractCompareHandler.java
@@ -27,6 +27,7 @@ import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.Match;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.editor.ComparisonScopeEditorInput;
import org.eclipse.emf.compare.match.DefaultComparisonFactory;
import org.eclipse.emf.compare.match.DefaultEqualityHelperFactory;
@@ -57,7 +58,7 @@ public abstract class AbstractCompareHandler extends AbstractHandler {
ICompareEditingDomain editingDomain = createEMFCompareEditingDomain(part, left, right, origin);
- final CompareConfiguration configuration = new CompareConfiguration();
+ final EMFCompareConfiguration configuration = new EMFCompareConfiguration(new CompareConfiguration());
IMatchEngine.Factory eObjectMatchEngineFactory = new MatchEObjectEngineFactory();
eObjectMatchEngineFactory.setRanking(Integer.MAX_VALUE);
final IMatchEngine.Factory.Registry matchEngineFactoryRegistry = EMFCompareRCPPlugin.getDefault()
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
index 40f1d284b..0edae5128 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
@@ -28,11 +28,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilter;
@@ -122,7 +122,7 @@ public class EMFCompareDiffTreeRuler extends Canvas {
private Cursor lastCursor;
/** The configuration for this control. */
- private CompareConfiguration fConfiguration;
+ private EMFCompareConfiguration fConfiguration;
/** The selected diff in the Treeviewer associated with this Treeruler. */
private Diff selectedDiff;
@@ -142,7 +142,7 @@ public class EMFCompareDiffTreeRuler extends Canvas {
* the configuration for this control.
*/
EMFCompareDiffTreeRuler(Composite parent, int style, int width, TreeViewer treeViewer,
- CompareConfiguration config) {
+ EMFCompareConfiguration config) {
super(parent, style);
fWidth = width;
fTreeViewer = treeViewer;
@@ -240,11 +240,7 @@ public class EMFCompareDiffTreeRuler extends Canvas {
public void computeConsequences() {
clearAllData();
if (selectedDiff != null) {
- Boolean leftToRight = (Boolean)fConfiguration.getProperty(EMFCompareConstants.MERGE_WAY);
- boolean ltr = false;
- if (leftToRight == null || leftToRight.booleanValue()) {
- ltr = true;
- }
+ boolean ltr = fConfiguration.getPreviewMergeMode();
boolean leftEditable = fConfiguration.isLeftEditable();
boolean rightEditable = fConfiguration.isRightEditable();
@@ -338,8 +334,7 @@ public class EMFCompareDiffTreeRuler extends Canvas {
*/
private void handlePaintEvent(PaintEvent e) {
annotationsData.clear();
- Predicate<? super EObject> predicate = (Predicate<? super EObject>)fConfiguration
- .getProperty(EMFCompareConstants.AGGREGATED_VIEWER_PREDICATE);
+ Predicate<? super EObject> predicate = fConfiguration.getAggregatedViewerPredicate();
Collection<? extends Diff> filteredRequires = filteredDiffs(requires, predicate);
Collection<? extends Diff> filteredUnmergeables = filteredDiffs(unmergeables, predicate);
for (Diff diff : filteredRequires) {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
index 0e1c17077..1492cf570 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
@@ -44,6 +44,7 @@ import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptAllChangesAction;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptChangeAction;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.CollapseAllModelAction;
@@ -163,7 +164,7 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
* @param configuration
*/
public EMFCompareDiffTreeViewer(Composite parent, final AdapterFactory adapterFactory,
- CompareConfiguration configuration) {
+ EMFCompareConfiguration configuration) {
super(parent, configuration);
this.adapterFactory = adapterFactory;
@@ -465,13 +466,9 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
@SuppressWarnings("unchecked")
@Subscribe
public void recordFilterSelectionChange(IDifferenceFilterSelectionChangeEvent event) {
- final Object property = getCompareConfiguration().getProperty(EMFCompareConstants.SELECTED_FILTERS);
- final Collection<IDifferenceFilter> selectedFilters;
- if (property == null) {
- selectedFilters = newLinkedHashSet();
- } else {
- selectedFilters = newLinkedHashSet((Collection<IDifferenceFilter>)property);
- }
+ final Set<IDifferenceFilter> property = getCompareConfiguration().getSelectedDifferenceFilters();
+
+ final Set<IDifferenceFilter> selectedFilters = newLinkedHashSet(property);
switch (event.getAction()) {
case SELECTED:
selectedFilters.add(event.getFilter());
@@ -483,9 +480,8 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
throw new IllegalStateException();
}
- getCompareConfiguration().setProperty(EMFCompareConstants.SELECTED_FILTERS, selectedFilters);
- getCompareConfiguration().setProperty(EMFCompareConstants.AGGREGATED_VIEWER_PREDICATE,
- event.getAggregatedPredicate());
+ getCompareConfiguration().setSelectedDifferenceFilters(ImmutableSet.copyOf(selectedFilters));
+ getCompareConfiguration().setAggregatedViewerPredicate(event.getAggregatedPredicate());
refreshTitle();
}
@@ -499,20 +495,11 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
eAdapters.remove(oldDifferenceGroupProvider);
}
eAdapters.add(differenceGroupProvider);
- getCompareConfiguration().setProperty(EMFCompareConstants.SELECTED_GROUP, differenceGroupProvider);
+ getCompareConfiguration().setSelectedDifferenceGroupProvider(differenceGroupProvider);
refreshTitle();
}
- public void configurationPropertyChanged() {
- getControl().redraw();
- if (toolbarManager != null) {
- for (IContributionItem item : toolbarManager.getItems()) {
- item.update();
- }
- }
- }
-
/**
* {@inheritDoc}
*
@@ -622,8 +609,7 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
if (fParent != null) {
ITreeContentProvider contentProvider = (ITreeContentProvider)getContentProvider();
int displayedDiff = getMatchCount(contentProvider, contentProvider.getElements(getRoot()));
- Comparison comparison = (Comparison)getCompareConfiguration().getProperty(
- EMFCompareConstants.COMPARE_RESULT);
+ Comparison comparison = getCompareConfiguration().getComparison();
int computedDiff = comparison.getDifferences().size();
int filteredDiff = computedDiff - displayedDiff;
fParent.setTitleArgument(computedDiff + " differences – " + filteredDiff
@@ -911,12 +897,7 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
EObject dataItem = ((TreeNode)targetItem).getData();
final Set<Diff> unmergeables;
final Set<Diff> requires;
- Boolean leftToRight = (Boolean)getCompareConfiguration().getProperty(
- EMFCompareConstants.MERGE_WAY);
- boolean ltr = false;
- if (leftToRight == null || leftToRight.booleanValue()) {
- ltr = true;
- }
+ boolean ltr = getCompareConfiguration().getPreviewMergeMode();
boolean leftEditable = getCompareConfiguration().isLeftEditable();
boolean rightEditable = getCompareConfiguration().isRightEditable();
Diff selectedDiff = (Diff)selectionData;
@@ -969,4 +950,14 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
g.setBackground(color);
g.fillRectangle(areaBounds.x, itemBounds.y, areaBounds.width, itemBounds.height);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.structuremergeviewer.DiffTreeViewer#getCompareConfiguration()
+ */
+ @Override
+ public EMFCompareConfiguration getCompareConfiguration() {
+ return (EMFCompareConfiguration)super.getCompareConfiguration();
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index 0e0e7f63f..2e45a4226 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -12,6 +12,8 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
import static com.google.common.collect.Iterables.getFirst;
+import com.google.common.base.Predicate;
+
import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -36,11 +38,8 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.ui.dialogs.DiagnosticDialog;
import org.eclipse.emf.common.util.BasicMonitor;
-import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.EMFCompare;
import org.eclipse.emf.compare.Match;
@@ -48,6 +47,7 @@ import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.domain.impl.EMFCompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoAction;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction;
import org.eclipse.emf.compare.ide.ui.internal.editor.ComparisonScopeInput;
@@ -62,22 +62,20 @@ import org.eclipse.emf.compare.ide.ui.logical.IModelResolver;
import org.eclipse.emf.compare.ide.ui.logical.IStorageProviderAccessor;
import org.eclipse.emf.compare.internal.utils.ComparisonUtil;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.EMFCompareConfigurationChangeListener;
+import org.eclipse.emf.compare.rcp.ui.internal.configuration.IEMFCompareConfigurationChangeListener;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.provider.TreeItemProviderAdapterFactorySpec;
import org.eclipse.emf.compare.scope.IComparisonScope;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.tree.TreeFactory;
import org.eclipse.emf.edit.tree.TreeNode;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -103,6 +101,31 @@ import org.eclipse.ui.actions.ActionFactory;
*/
public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implements CommandStackListener {
+ /**
+ * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
+ */
+ private final class EMFCompareStructureMergeViewerConfigurationChangeListener extends EMFCompareConfigurationChangeListener {
+ @Override
+ public void previewMergeModeChange(Boolean oldValue, Boolean newValue) {
+ treeRuler.computeConsequences();
+ treeRuler.redraw();
+ }
+
+ @Override
+ public void selectedDifferenceGroupProviderChange(IDifferenceGroupProvider oldValue,
+ IDifferenceGroupProvider newValue) {
+ treeRuler.computeConsequences();
+ treeRuler.redraw();
+ }
+
+ @Override
+ public void aggregatedViewerPredicateChange(Predicate<? super EObject> oldValue,
+ Predicate<? super EObject> newValue) {
+ treeRuler.computeConsequences();
+ treeRuler.redraw();
+ }
+ }
+
/** The width of the tree ruler. */
private static final int TREE_RULER_WIDTH = 17;
@@ -118,7 +141,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
private ITreeViewerListener fWrappedTreeListener;
/** The compare configuration property change listener. */
- private IPropertyChangeListener fCompareConfigurationPropertyChangeListener;
+ private IEMFCompareConfigurationChangeListener fCompareConfigurationPropertyChangeListener;
/** The tree viewer. */
private EMFCompareDiffTreeViewer diffTreeViewer;
@@ -146,8 +169,12 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
* @param config
* a compare configuration the newly created viewer might want to use.
*/
- public EMFCompareStructureMergeViewer(Composite parent, CompareConfiguration config) {
+ public EMFCompareStructureMergeViewer(Composite parent, EMFCompareConfiguration config) {
super(parent, config);
+
+ fCompareConfigurationPropertyChangeListener = new EMFCompareStructureMergeViewerConfigurationChangeListener();
+ getCompareConfiguration().addChangeListener(fCompareConfigurationPropertyChangeListener);
+
inputChangedTask.setPriority(Job.LONG);
}
@@ -168,7 +195,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
fAdapterFactory.addAdapterFactory(new TreeItemProviderAdapterFactorySpec());
fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
- config.setProperty(EMFCompareConstants.COMPOSED_ADAPTER_FACTORY, fAdapterFactory);
+ getCompareConfiguration().setAdapterFactory(fAdapterFactory);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
@@ -178,7 +205,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
control.setLayout(layout);
control.setLayoutData(data);
- diffTreeViewer = new EMFCompareDiffTreeViewer(control, fAdapterFactory, config);
+ diffTreeViewer = new EMFCompareDiffTreeViewer(control, fAdapterFactory, getCompareConfiguration());
setViewer(diffTreeViewer);
control.setData(INavigatable.NAVIGATOR_PROPERTY, diffTreeViewer.getControl().getData(
INavigatable.NAVIGATOR_PROPERTY));
@@ -188,7 +215,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
layoutData.widthHint = TREE_RULER_WIDTH;
layoutData.minimumWidth = TREE_RULER_WIDTH;
treeRuler = new EMFCompareDiffTreeRuler(control, SWT.NONE, layoutData.widthHint, diffTreeViewer,
- config);
+ getCompareConfiguration());
treeRuler.setLayoutData(layoutData);
fCompareInputChangeListener = new ICompareInputChangeListener() {
@@ -209,25 +236,6 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
};
diffTreeViewer.addTreeListener(fWrappedTreeListener);
- fCompareConfigurationPropertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (EMFCompareConstants.MERGE_WAY.equals(event.getProperty()) && event.getNewValue() != null) {
- diffTreeViewer.configurationPropertyChanged();
- treeRuler.computeConsequences();
- treeRuler.redraw();
- } else if (EMFCompareConstants.SELECTED_FILTERS.equals(event.getProperty())
- && event.getNewValue() != null) {
- treeRuler.computeConsequences();
- treeRuler.redraw();
- } else if (EMFCompareConstants.SELECTED_GROUP.equals(event.getProperty())
- && event.getNewValue() != null) {
- treeRuler.computeConsequences();
- treeRuler.redraw();
- }
- }
- };
- getCompareConfiguration().addPropertyChangeListener(fCompareConfigurationPropertyChangeListener);
-
fHandlerService = CompareHandlerService.createFor(getCompareConfiguration().getContainer(),
diffTreeViewer.getControl().getShell());
@@ -281,7 +289,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
if (fHandlerService != null) {
fHandlerService.dispose();
}
- getCompareConfiguration().removePropertyChangeListener(fCompareConfigurationPropertyChangeListener);
+ getCompareConfiguration().removeChangeListener(fCompareConfigurationPropertyChangeListener);
diffTreeViewer.removeTreeListener(fWrappedTreeListener);
Object input = getInput();
if (input instanceof ICompareInput) {
@@ -322,9 +330,8 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
// org.eclipse.compare.CompareEditorInput#getElement(ISelection))
Object first = getFirst(affectedObjects, null);
if (first instanceof EObject) {
- Notifier notifier = ((Adapter)diffTreeViewer.getRoot()).getTarget();
- IDifferenceGroupProvider groupProvider = (IDifferenceGroupProvider)EcoreUtil
- .getExistingAdapter(notifier, IDifferenceGroupProvider.class);
+ IDifferenceGroupProvider groupProvider = getCompareConfiguration()
+ .getSelectedDifferenceGroupProvider();
Iterable<TreeNode> treeNodes = groupProvider.getTreeNodes((EObject)first);
TreeNode treeNode = getFirst(treeNodes, null);
if (treeNode != null) {
@@ -363,28 +370,24 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
compareInputChanged((ICompareInput)null, new NullProgressMonitor());
return;
}
- CompareConfiguration cc = getCompareConfiguration();
// The compare configuration is nulled when the viewer is disposed
- if (cc != null) {
+ if (getCompareConfiguration() != null) {
inputChangedTask.schedule();
}
}
void compareInputChanged(CompareInputAdapter input, IProgressMonitor monitor) {
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)getCompareConfiguration().getProperty(
- EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = getCompareConfiguration().getEditingDomain();
editingDomain.getCommandStack().addCommandStackListener(this);
compareInputChanged(null, (Comparison)input.getComparisonObject());
}
void compareInputChanged(ComparisonScopeInput input, IProgressMonitor monitor) {
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)getCompareConfiguration().getProperty(
- EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = getCompareConfiguration().getEditingDomain();
editingDomain.getCommandStack().addCommandStackListener(this);
- EMFCompare comparator = (EMFCompare)getCompareConfiguration().getProperty(
- EMFCompareConstants.COMPARATOR);
+ EMFCompare comparator = getCompareConfiguration().getComparator();
IComparisonScope comparisonScope = input.getComparisonScope();
Comparison comparison = comparator.compare(comparisonScope, BasicMonitor.toMonitor(monitor));
@@ -396,9 +399,9 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
void compareInputChanged(final IComparisonScope scope, final Comparison comparison) {
if (!getControl().isDisposed()) { // guard against disposal
- IDifferenceGroupProvider selectedGroup = (IDifferenceGroupProvider)getCompareConfiguration()
- .getProperty(EMFCompareConstants.SELECTED_GROUP);
- TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
+ IDifferenceGroupProvider selectedGroup = getCompareConfiguration()
+ .getSelectedDifferenceGroupProvider();
+ final TreeNode treeNode = TreeFactory.eINSTANCE.createTreeNode();
treeNode.setData(comparison);
if (selectedGroup == null) {
selectedGroup = diffTreeViewer.getDefaultGroupProvider();
@@ -406,7 +409,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
treeNode.eAdapters().add(selectedGroup);
diffTreeViewer.setRoot(fAdapterFactory.adapt(treeNode, ICompareInput.class));
- getCompareConfiguration().setProperty(EMFCompareConstants.COMPARE_RESULT, comparison);
+ getCompareConfiguration().setComparison(comparison);
SWTUtil.safeAsyncExec(new Runnable() {
public void run() {
@@ -423,8 +426,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
}
});
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)getCompareConfiguration()
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = getCompareConfiguration().getEditingDomain();
undoAction = new UndoAction(editingDomain);
redoAction = new RedoAction(editingDomain);
@@ -481,8 +483,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
final ResourceSet originResourceSet = (ResourceSet)scope.getOrigin();
if (getCompareConfiguration() != null) {
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)getCompareConfiguration()
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = getCompareConfiguration().getEditingDomain();
if (editingDomain != null) {
editingDomain.getCommandStack().removeCommandStackListener(this);
if (editingDomain instanceof IDisposable) {
@@ -493,7 +494,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
editingDomain = EMFCompareEditingDomain.create(leftResourceSet, rightResourceSet,
originResourceSet);
editingDomain.getCommandStack().addCommandStackListener(this);
- getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, editingDomain);
+ getCompareConfiguration().setEditingDomain(editingDomain);
}
compareInputChanged(scope, compareResult);
@@ -503,9 +504,8 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
ResourceSet rightResourceSet = null;
ResourceSet originResourceSet = null;
- if (diffTreeViewer.getRoot() != null) {
- Comparison comparison = (Comparison)((CompareInputAdapter)diffTreeViewer.getRoot())
- .getComparisonObject();
+ if (getCompareConfiguration().getComparison() != null) {
+ Comparison comparison = getCompareConfiguration().getComparison();
Iterator<Match> matchIt = comparison.getMatches().iterator();
if (comparison.isThreeWay()) {
while (matchIt.hasNext()
@@ -534,11 +534,10 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
}
}
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)getCompareConfiguration()
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = getCompareConfiguration().getEditingDomain();
if (editingDomain != null) {
editingDomain.getCommandStack().removeCommandStackListener(this);
- getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, null);
+ getCompareConfiguration().setEditingDomain(null);
if (editingDomain instanceof IDisposable) {
((IDisposable)editingDomain).dispose();
}
@@ -552,12 +551,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
}
if (getCompareConfiguration() != null) {
- getCompareConfiguration().setProperty(EMFCompareConstants.COMPARE_RESULT, null);
- getCompareConfiguration().setProperty(EMFCompareConstants.SELECTED_FILTERS, null);
- getCompareConfiguration().setProperty(EMFCompareConstants.AGGREGATED_VIEWER_PREDICATE, null);
- getCompareConfiguration().setProperty(EMFCompareConstants.SELECTED_GROUP, null);
- getCompareConfiguration().setProperty(EMFCompareConstants.MERGE_WAY, null);
- getCompareConfiguration().setProperty(EMFCompareConstants.SMV_SELECTION, null);
+ getCompareConfiguration().dispose();
}
diffTreeViewer.setRoot(null);
}
@@ -568,7 +562,7 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
SWTUtil.safeAsyncExec(new Runnable() {
public void run() {
DiagnosticDialog.open(getControl().getShell(), "Comparison report", //$NON-NLS-1$
- "Some issues were detected.", (Diagnostic)comparison.getDiagnostic()); //$NON-NLS-1$
+ "Some issues were detected.", comparison.getDiagnostic()); //$NON-NLS-1$
}
});
}
@@ -672,4 +666,14 @@ public class EMFCompareStructureMergeViewer extends AbstractViewerWrapper implem
}
return null;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.AbstractViewerWrapper#getCompareConfiguration()
+ */
+ @Override
+ public EMFCompareConfiguration getCompareConfiguration() {
+ return (EMFCompareConfiguration)super.getCompareConfiguration();
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewerCreator.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewerCreator.java
index 9c8b99dfa..2e6ea6717 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewerCreator.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewerCreator.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.IViewerCreator;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
@@ -27,7 +28,7 @@ public class EMFCompareStructureMergeViewerCreator implements IViewerCreator {
* org.eclipse.compare.CompareConfiguration)
*/
public Viewer createViewer(Composite parent, CompareConfiguration config) {
- return new EMFCompareStructureMergeViewer(parent, config);
+ return new EMFCompareStructureMergeViewer(parent, new EMFCompareConfiguration(config));
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
index d2173a84f..d64b7e2a9 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
@@ -39,7 +40,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public abstract class AbstractAcceptRejectAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private final EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -47,7 +48,7 @@ public abstract class AbstractAcceptRejectAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public AbstractAcceptRejectAction(CompareConfiguration configuration) {
+ public AbstractAcceptRejectAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
}
@@ -138,8 +139,7 @@ public abstract class AbstractAcceptRejectAction extends Action {
*/
private void changeStateFromUnresolvedToMerged(Diff diffToChangeState, boolean leftToRight) {
if (diffToChangeState != null) {
- ICompareEditingDomain compareEditingDomain = (ICompareEditingDomain)configuration
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain compareEditingDomain = configuration.getEditingDomain();
Command changeStateCommand = new AcceptRejectChangeCommand(compareEditingDomain
.getChangeRecorder(), diffToChangeState, leftToRight, configuration);
compareEditingDomain.getCommandStack().execute(changeStateCommand);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java
index 1d9db230c..4bec403c0 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java
@@ -27,9 +27,9 @@ import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.utils.EMFComparePredicates;
import org.eclipse.emf.ecore.change.util.ChangeRecorder;
import org.eclipse.emf.edit.command.ChangeCommand;
@@ -44,7 +44,7 @@ import org.eclipse.jface.action.Action;
public abstract class AbstractAcceptRejectAllAction extends Action {
/** The compare configuration object used to get the compare model. */
- protected CompareConfiguration configuration;
+ protected EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -52,7 +52,7 @@ public abstract class AbstractAcceptRejectAllAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public AbstractAcceptRejectAllAction(CompareConfiguration configuration) {
+ public AbstractAcceptRejectAllAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
}
@@ -93,7 +93,7 @@ public abstract class AbstractAcceptRejectAllAction extends Action {
*/
private void manageChanges(final boolean leftToRight) {
final List<Diff> differences;
- Comparison comparison = (Comparison)configuration.getProperty(EMFCompareConstants.COMPARE_RESULT);
+ Comparison comparison = configuration.getComparison();
if (comparison.isThreeWay()) {
differences = ImmutableList.copyOf(filter(comparison.getDifferences(), new Predicate<Diff>() {
public boolean apply(Diff diff) {
@@ -112,8 +112,7 @@ public abstract class AbstractAcceptRejectAllAction extends Action {
if (differences.size() > 0) {
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)configuration
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = configuration.getEditingDomain();
AcceptRejectAllChangesCompoundCommand compoundCommand = new AcceptRejectAllChangesCompoundCommand(
leftToRight);
@@ -150,8 +149,7 @@ public abstract class AbstractAcceptRejectAllAction extends Action {
protected Command createChangeStateFromUnresolvedToMergedCommand(Diff diffToChangeState,
boolean leftToRight) {
if (diffToChangeState != null) {
- ICompareEditingDomain compareEditingDomain = (ICompareEditingDomain)configuration
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain compareEditingDomain = configuration.getEditingDomain();
Command changeStateCommand = new AcceptRejectAllChangesCommand(compareEditingDomain
.getChangeRecorder(), diffToChangeState, leftToRight, configuration);
return changeStateCommand;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
index d3697eebf..75cc3e851 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
@@ -14,6 +14,7 @@ import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.ecore.EObject;
@@ -31,7 +32,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
public abstract class AbstractMergeAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -39,7 +40,7 @@ public abstract class AbstractMergeAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public AbstractMergeAction(CompareConfiguration configuration) {
+ public AbstractMergeAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
}
@@ -95,7 +96,7 @@ public abstract class AbstractMergeAction extends Action {
*
* @return the configuration
*/
- public CompareConfiguration getConfiguration() {
+ public EMFCompareConfiguration getConfiguration() {
return configuration;
}
@@ -105,7 +106,7 @@ public abstract class AbstractMergeAction extends Action {
* @param configuration
* the configuration to set
*/
- public void setConfiguration(CompareConfiguration configuration) {
+ public void setConfiguration(EMFCompareConfiguration configuration) {
this.configuration = configuration;
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java
index fabec2b16..20bcc4afb 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
/**
@@ -23,7 +23,7 @@ import org.eclipse.jface.action.Action;
public abstract class AbstractMergeAllAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -31,7 +31,7 @@ public abstract class AbstractMergeAllAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public AbstractMergeAllAction(CompareConfiguration configuration) {
+ public AbstractMergeAllAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
}
@@ -50,21 +50,11 @@ public abstract class AbstractMergeAllAction extends Action {
*
* @return the configuration
*/
- public CompareConfiguration getConfiguration() {
+ public EMFCompareConfiguration getConfiguration() {
return configuration;
}
/**
- * Set the compare configuration object.
- *
- * @param configuration
- * the configuration to set
- */
- public void setConfiguration(CompareConfiguration configuration) {
- this.configuration = configuration;
- }
-
- /**
* Copy all non-conflicting differences.
*/
protected abstract void copyAllDiffs();
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java
index 4377cf41c..b846fe851 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java
@@ -12,11 +12,11 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -34,7 +34,7 @@ public class AcceptAllChangesAction extends AbstractAcceptRejectAllAction {
* @param configuration
* The compare configuration object.
*/
- public AcceptAllChangesAction(CompareConfiguration configuration) {
+ public AcceptAllChangesAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("accept.all.changes.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
index 6febad73b..a6cfc67e9 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
@@ -12,11 +12,11 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -33,7 +33,7 @@ public class AcceptChangeAction extends AbstractAcceptRejectAction {
* @param configuration
* The compare configuration object.
*/
- public AcceptChangeAction(CompareConfiguration configuration) {
+ public AcceptChangeAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("accept.change.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
index 4b80e1cb7..b9cf3dff2 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -27,7 +26,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownAcceptAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -35,7 +34,7 @@ public class DropDownAcceptAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public DropDownAcceptAction(CompareConfiguration configuration) {
+ public DropDownAcceptAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -49,6 +48,6 @@ public class DropDownAcceptAction extends Action {
*/
@Override
public void run() {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
+ configuration.setPreviewMergeMode(true);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
index ee940c5e5..3f757d7b6 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@@ -30,7 +29,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreator {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/** The menu associated with this action. */
private Menu fMenu;
@@ -47,7 +46,7 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
* @param configuration
* The compare configuration object.
*/
- public DropDownAcceptRejectMenuAction(final CompareConfiguration configuration) {
+ public DropDownAcceptRejectMenuAction(final EMFCompareConfiguration configuration) {
this.configuration = configuration;
setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -79,11 +78,11 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
*/
@Override
public void run() {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ boolean mergeWay = configuration.getPreviewMergeMode();
boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
- if (mergeWay == null || mergeWay.booleanValue()) {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ if (mergeWay) {
+ configuration.setPreviewMergeMode(false);
if (leftEditableOnly) {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
@@ -94,7 +93,7 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
}
} else {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
+ configuration.setPreviewMergeMode(true);
if (leftEditableOnly) {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
@@ -162,10 +161,10 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
* Update the icon and tooltip of the dropdown menu.
*/
protected void updateMenu() {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ boolean mergeWay = configuration.getPreviewMergeMode();
boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
- if (mergeWay == null || mergeWay.booleanValue()) {
+ if (mergeWay) {
if (leftEditableOnly) {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
index 1e0ac157a..ab3114ba3 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -27,7 +26,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownLeftToRightAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -35,7 +34,7 @@ public class DropDownLeftToRightAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public DropDownLeftToRightAction(CompareConfiguration configuration) {
+ public DropDownLeftToRightAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setText(EMFCompareIDEUIMessages.getString("dropdown.left.to.right.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -49,6 +48,6 @@ public class DropDownLeftToRightAction extends Action {
*/
@Override
public void run() {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
+ configuration.setPreviewMergeMode(true);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
index 47bc3fa19..5d512c732 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@@ -29,7 +28,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownMergeMenuAction extends Action implements IMenuCreator {
/** The compare configuration object. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/** The menu associated with this action. */
private Menu fMenu;
@@ -46,7 +45,7 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
* @param configuration
* The compare configuration object.
*/
- public DropDownMergeMenuAction(CompareConfiguration configuration) {
+ public DropDownMergeMenuAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -78,13 +77,13 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
*/
@Override
public void run() {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- if (mergeWay == null || mergeWay.booleanValue()) {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ boolean mergeWay = configuration.getPreviewMergeMode();
+ if (mergeWay) {
+ configuration.setPreviewMergeMode(false);
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
} else {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
+ configuration.setPreviewMergeMode(true);
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
}
@@ -145,8 +144,8 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
* Update the icon and tooltip of the dropdown menu.
*/
protected void updateMenu() {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- if (mergeWay == null || mergeWay.booleanValue()) {
+ boolean mergeWay = configuration.getPreviewMergeMode();
+ if (mergeWay) {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
} else {
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
index 3bab0879f..5125fa74f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -27,7 +26,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownRejectAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -35,7 +34,7 @@ public class DropDownRejectAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public DropDownRejectAction(CompareConfiguration configuration) {
+ public DropDownRejectAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -49,6 +48,6 @@ public class DropDownRejectAction extends Action {
*/
@Override
public void run() {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ configuration.setPreviewMergeMode(false);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
index 34c26d8f0..0ea3b7196 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -27,7 +26,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownRightToLeftAction extends Action {
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -35,7 +34,7 @@ public class DropDownRightToLeftAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public DropDownRightToLeftAction(CompareConfiguration configuration) {
+ public DropDownRightToLeftAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setText(EMFCompareIDEUIMessages.getString("dropdown.right.to.left.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -49,6 +48,6 @@ public class DropDownRightToLeftAction extends Action {
*/
@Override
public void run() {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ configuration.setPreviewMergeMode(false);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java
index c0199d1e0..6adc12582 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -31,7 +31,7 @@ public class MergeAllToLeftAction extends AbstractMergeAllAction {
* @param configuration
* The compare configuration object.
*/
- public MergeAllToLeftAction(CompareConfiguration configuration) {
+ public MergeAllToLeftAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.all.to.left.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java
index 43f6abc87..a76146e19 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -31,7 +31,7 @@ public class MergeAllToRightAction extends AbstractMergeAllAction {
* @param configuration
* The compare configuration object.
*/
- public MergeAllToRightAction(CompareConfiguration configuration) {
+ public MergeAllToRightAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.all.to.right.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
index 88c019882..7bf867d56 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -32,7 +32,7 @@ public class MergeToLeftAction extends AbstractMergeAction {
* @param configuration
* The compare configuration object.
*/
- public MergeToLeftAction(CompareConfiguration configuration) {
+ public MergeToLeftAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.to.left.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
index 711bfb81a..15c188fd0 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -32,7 +32,7 @@ public class MergeToRightAction extends AbstractMergeAction {
* @param configuration
* The compare configuration object.
*/
- public MergeToRightAction(CompareConfiguration configuration) {
+ public MergeToRightAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.to.right.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java
index 6ba0f7b09..3aa2567aa 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java
@@ -12,11 +12,11 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -34,7 +34,7 @@ public class RejectAllChangesAction extends AbstractAcceptRejectAllAction {
* @param configuration
* The compare configuration object.
*/
- public RejectAllChangesAction(CompareConfiguration configuration) {
+ public RejectAllChangesAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("reject.all.changes.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
index 5185caacb..5d7259e60 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
@@ -12,11 +12,11 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -33,7 +33,7 @@ public class RejectChangeAction extends AbstractAcceptRejectAction {
* @param configuration
* The compare configuration object.
*/
- public RejectChangeAction(CompareConfiguration configuration) {
+ public RejectChangeAction(EMFCompareConfiguration configuration) {
super(configuration);
setToolTipText(EMFCompareIDEUIMessages.getString("reject.change.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
index 732dbf6f7..0e7400326 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
@@ -18,14 +18,13 @@ import java.io.File;
import java.io.IOException;
import java.io.NotSerializableException;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
@@ -52,7 +51,7 @@ public class SaveComparisonModelAction extends Action {
private static final ImmutableList<String> DIALOG_BUTTON_LABELS = ImmutableList.of("Replace", "Cancel");
/** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
+ private EMFCompareConfiguration configuration;
/**
* Constructor.
@@ -60,7 +59,7 @@ public class SaveComparisonModelAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public SaveComparisonModelAction(CompareConfiguration configuration) {
+ public SaveComparisonModelAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setToolTipText(EMFCompareIDEUIMessages.getString("save.model.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
@@ -114,7 +113,7 @@ public class SaveComparisonModelAction extends Action {
* the result {@link File}.
*/
private void saveComparison(File file) {
- Comparison comparison = (Comparison)configuration.getProperty(EMFCompareConstants.COMPARE_RESULT);
+ Comparison comparison = configuration.getComparison();
Resource resource = new XMIResourceImpl(URI.createFileURI(file.getAbsolutePath()));
Copier copier = new Copier(false);
EObject comparisonCopy = copier.copy(comparison);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
index bb1e80602..5edf93992 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
@@ -17,8 +17,8 @@ import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
+import java.util.Set;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareNavigator;
@@ -32,11 +32,11 @@ import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
+import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.internal.merge.DiffMergeDataAdapter;
import org.eclipse.emf.compare.internal.merge.IDiffMergeData;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilter;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl.CascadingDifferencesFilter;
import org.eclipse.emf.compare.utils.EMFComparePredicates;
@@ -64,15 +64,11 @@ public final class EMFCompareUIActionUtil {
* the compare configuration object.
* @return true, if the cascading differences filter is active, false otherwise.
*/
- public static boolean isCascadingDifferencesFilterActive(CompareConfiguration configuration) {
- Object property = configuration.getProperty(EMFCompareConstants.SELECTED_FILTERS);
- final Collection<IDifferenceFilter> selectedFilters;
- if (property instanceof Collection<?>) {
- selectedFilters = (Collection<IDifferenceFilter>)property;
- for (IDifferenceFilter iDifferenceFilter : selectedFilters) {
- if (iDifferenceFilter instanceof CascadingDifferencesFilter) {
- return true;
- }
+ public static boolean isCascadingDifferencesFilterActive(EMFCompareConfiguration configuration) {
+ Set<IDifferenceFilter> selectedFilters = configuration.getSelectedDifferenceFilters();
+ for (IDifferenceFilter iDifferenceFilter : selectedFilters) {
+ if (iDifferenceFilter instanceof CascadingDifferencesFilter) {
+ return true;
}
}
return false;
@@ -88,7 +84,7 @@ public final class EMFCompareUIActionUtil {
* @param configuration
* the compare configuration object.
*/
- public static void copyDiff(Diff diffToCopy, boolean leftToRight, CompareConfiguration configuration) {
+ public static void copyDiff(Diff diffToCopy, boolean leftToRight, EMFCompareConfiguration configuration) {
if (diffToCopy != null) {
List<Diff> diffsToCopy = new ArrayList<Diff>();
diffsToCopy.add(diffToCopy);
@@ -110,8 +106,7 @@ public final class EMFCompareUIActionUtil {
addMergeDataForConflictedDiffs(diffToCopy, leftToRight, configuration);
// Execute merge
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)configuration
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = configuration.getEditingDomain();
Command copyCommand = editingDomain.createCopyCommand(diffsToCopy, leftToRight,
EMFCompareRCPPlugin.getDefault().getMergerRegistry());
editingDomain.getCommandStack().execute(copyCommand);
@@ -154,9 +149,9 @@ public final class EMFCompareUIActionUtil {
* @param configuration
* the compare configuration object.
*/
- public static void copyAllDiffs(final boolean leftToRight, CompareConfiguration configuration) {
+ public static void copyAllDiffs(final boolean leftToRight, EMFCompareConfiguration configuration) {
final List<Diff> differences;
- Comparison comparison = (Comparison)configuration.getProperty(EMFCompareConstants.COMPARE_RESULT);
+ Comparison comparison = configuration.getComparison();
if (comparison.isThreeWay()) {
differences = ImmutableList.copyOf(filter(comparison.getDifferences(), new Predicate<Diff>() {
public boolean apply(Diff diff) {
@@ -178,8 +173,7 @@ public final class EMFCompareUIActionUtil {
EMFCompareUIActionUtil.setMergeDataForDiff(diff, leftToRight, configuration.isLeftEditable(),
configuration.isRightEditable());
}
- ICompareEditingDomain editingDomain = (ICompareEditingDomain)configuration
- .getProperty(EMFCompareConstants.EDITING_DOMAIN);
+ ICompareEditingDomain editingDomain = configuration.getEditingDomain();
final Command copyCommand = editingDomain.createCopyCommand(differences, leftToRight,
EMFCompareRCPPlugin.getDefault().getMergerRegistry());

Back to the top