Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Constant2018-08-14 15:38:37 -0400
committerOlivier Constant2018-08-28 07:53:43 -0400
commitc145da9b6519feec764dadda4cac015404cc14cb (patch)
tree5816bc4ba3b82b1577910b95d582bfd7ff770d84
parentf236216d3784a69ca61b4c8ba20449552b337417 (diff)
downloadorg.eclipse.emf.diffmerge.core-c145da9b6519feec764dadda4cac015404cc14cb.tar.gz
org.eclipse.emf.diffmerge.core-c145da9b6519feec764dadda4cac015404cc14cb.tar.xz
org.eclipse.emf.diffmerge.core-c145da9b6519feec764dadda4cac015404cc14cb.zip
Bug 538341 - Support observable viewer-specific properties
"Technical labels" property fully supported with UserProperties Change-Id: I3d75b449ecd2c50f5ba33999a792fc939de7c782 Signed-off-by: Olivier Constant <olivier.constant@thalesgroup.com>
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/IUserPropertyOwner.java98
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/UserProperty.java184
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/AbstractComparisonViewer.java91
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ComparisonViewer.java39
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/DefaultUserProperties.java32
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EMFDiffNode.java173
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EnhancedFeaturesViewer.java59
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/FeaturesViewer.java64
-rw-r--r--plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ValuesViewer.java17
9 files changed, 619 insertions, 138 deletions
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/IUserPropertyOwner.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/IUserPropertyOwner.java
new file mode 100644
index 00000000..c44f4375
--- /dev/null
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/IUserPropertyOwner.java
@@ -0,0 +1,98 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2018 Thales Global Services S.A.S.
+ * 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:
+ * Thales Global Services S.A.S. - initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.emf.diffmerge.ui.util;
+
+import java.util.Collection;
+
+import org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.jface.util.IPropertyChangeListener;
+
+
+/**
+ * An object that carries user properties.
+ * @see UserProperty
+ * @author Olivier Constant
+ */
+public interface IUserPropertyOwner extends IDisposable {
+
+ /**
+ * Add the given property change listener to the user property of the given ID
+ * @param id_p a non-null user property ID
+ * @param listener_p a non-null listener
+ * @return whether the operation succeeded, i.e., the user property was found
+ */
+ boolean addUserPropertyChangeListener(Identifier<?> id_p, IPropertyChangeListener listener_p);
+
+ /**
+ * Add a user property of the given identifier with the given initial value
+ * @param id_p a non-null user property identifier
+ * @return whether the operation succeeded, i.e., no user property with the given
+ * ID was already present
+ */
+ <T> boolean addUserProperty(Identifier<T> id_p, T initialValue_p);
+
+ /**
+ * Return the user properties carried by this object
+ * @return a non-null, potentially empty, unmodifiable collection
+ */
+ Collection<Identifier<?>> getUserProperties();
+
+ /**
+ * Return the value of the user property of the given ID, if any
+ * @param <T> the type of the user property
+ * @param id_p a non-null user property identifier
+ * @return a potentially null object
+ */
+ <T> T getUserPropertyValue(Identifier<T> id_p);
+
+ /**
+ * Return whether a user property of the given identifier is present
+ * @param id_p a non-null user property identifier
+ */
+ boolean hasUserProperty(Identifier<?> id_p);
+
+ /**
+ * Remove the user property of the given identifier if present
+ * @param id_p a non-null user property identifier
+ * @return whether the operation succeeded, i.e., a user property with the given
+ * ID was present
+ */
+ boolean removeUserProperty(Identifier<?> id_p);
+
+ /**
+ * Remove the given property change listener from the user property of the given ID
+ * @param id_p a non-null user property ID
+ * @param listener_p a non-null listener
+ * @return whether the operation succeeded, i.e., the user property was found
+ */
+ boolean removeUserPropertyChangeListener(Identifier<?> id_p, IPropertyChangeListener listener_p);
+
+ /**
+ * Remove the given property change listener from all user properties
+ * @param listener_p a non-null listener
+ */
+ void removeUserPropertyChangeListener(IPropertyChangeListener listener_p);
+
+ /**
+ * Set the value of the user property of the given ID, if any
+ * @param <T> the type of the user property
+ * @param id_p a non-null user property identifier
+ * @param newValue_p a non-null object
+ * @return whether the operation succeeded, i.e., the property was found
+ */
+ <T> boolean setUserPropertyValue(Identifier<T> id_p, T newValue_p);
+
+}
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/UserProperty.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/UserProperty.java
new file mode 100644
index 00000000..c7707c70
--- /dev/null
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/util/UserProperty.java
@@ -0,0 +1,184 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2018 Thales Global Services S.A.S.
+ * 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:
+ * Thales Global Services S.A.S. - initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.emf.diffmerge.ui.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.compare.IPropertyChangeNotifier;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+
+/**
+ * An editable, observable, identified property that has a non-null value.
+ * Designed to be used in a UI.
+ * @param <T> the type of the property
+ * @author Olivier Constant
+ */
+public class UserProperty<T> implements IPropertyChangeNotifier,
+IDisposable {
+
+ /**
+ * An identifier for a property. It associates a name and a type.
+ * @param <T> the type of the property
+ */
+ public static class Identifier<T> {
+ /** The non-null name of the property */
+ private final String _propertyName;
+ /**
+ * Default constructor
+ */
+ public Identifier() {
+ this(EcoreUtil.generateUUID());
+ }
+ /**
+ * Constructor
+ * @param propertyName_p the unique name of the property
+ */
+ public Identifier(String propertyName_p) {
+ _propertyName = propertyName_p;
+ }
+ /**
+ * Create and return a user property with this ID
+ * @param initialValue_p a non-null object
+ * @return a non-null user property
+ */
+ public UserProperty<T> createProperty(T initialValue_p) {
+ return new UserProperty<T>(this, initialValue_p);
+ }
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj_p) {
+ boolean result = false;
+ if (obj_p instanceof Identifier<?>) {
+ String peerPropertyName = ((Identifier<?>)obj_p).getPropertyName();
+ result = getPropertyName().equals(peerPropertyName);
+ }
+ return result;
+ }
+ /**
+ * Return the unique name of the property
+ * @return a non-null string
+ */
+ public String getPropertyName() {
+ return _propertyName;
+ }
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return _propertyName.hashCode();
+ }
+ /**
+ * Return whether the given event corresponds to a change on a property that has this ID
+ * @param event_p a non-null event
+ */
+ public boolean matches(PropertyChangeEvent event_p) {
+ return getPropertyName().equals(event_p.getProperty());
+ }
+ }
+
+
+ /** The non-null unique ID of the property */
+ private final Identifier<T> _id;
+
+ /** The value of the property */
+ private T _value;
+
+ /** The non-null set of property change listeners */
+ private final Set<IPropertyChangeListener> _changeListeners;
+
+
+ /**
+ * Constructor
+ * @param initialValue_p a non-null object
+ */
+ protected UserProperty(Identifier<T> id_p, T initialValue_p) {
+ assert initialValue_p != null;
+ _id = id_p;
+ _value = initialValue_p;
+ _changeListeners = new HashSet<IPropertyChangeListener>(1);
+ }
+
+ /**
+ * @see org.eclipse.compare.IPropertyChangeNotifier#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void addPropertyChangeListener(IPropertyChangeListener listener_p) {
+ _changeListeners.add(listener_p);
+ }
+
+ /**
+ * @see org.eclipse.emf.edit.provider.IDisposable#dispose()
+ */
+ public void dispose() {
+ _value = null;
+ _changeListeners.clear();
+ }
+
+ /**
+ * Notify listeners that the value of the property has changed
+ * @param oldValue_p the value of the property prior to the change
+ */
+ protected void firePropertyChangeEvent(T oldValue_p) {
+ PropertyChangeEvent event = new PropertyChangeEvent(
+ this, getID().getPropertyName(), oldValue_p, getValue());
+ for (IPropertyChangeListener listener : _changeListeners) {
+ listener.propertyChange(event);
+ }
+ }
+
+ /**
+ * Return the ID of the property
+ * @return a non-null ID
+ */
+ public Identifier<T> getID() {
+ return _id;
+ }
+
+ /**
+ * Return the value of the property
+ * @return a non-null object
+ */
+ public T getValue() {
+ return _value;
+ }
+
+ /**
+ * @see org.eclipse.compare.IPropertyChangeNotifier#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public void removePropertyChangeListener(IPropertyChangeListener listener_p) {
+ _changeListeners.remove(listener_p);
+ }
+
+ /**
+ * Set the value of the property
+ * @param newValue_p a non-null object
+ */
+ public void setValue(T newValue_p) {
+ assert newValue_p != null;
+ T oldValue = getValue();
+ if (!oldValue.equals(newValue_p)) {
+ _value = newValue_p;
+ firePropertyChangeEvent(oldValue);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/AbstractComparisonViewer.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/AbstractComparisonViewer.java
index 6f7d14bc..b07dda4b 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/AbstractComparisonViewer.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/AbstractComparisonViewer.java
@@ -149,44 +149,6 @@ implements IFlushable, IPropertyChangeNotifier, ICompareInputChangeListener, IAd
}
/**
- * Set up the selection provider
- */
- protected void setupSelectionProvider() {
- final IWorkbenchSite site = getSite();
- if (site != null) {
- _selectionBridgeToOutside = new SelectionBridge() {
- /**
- * @see org.eclipse.emf.diffmerge.ui.viewers.SelectionBridge#notifyListeners()
- */
- @Override
- protected void notifyListeners() {
- if (_isExternallySynced) {
- super.notifyListeners();
- }
- }
- };
- getMultiViewerSelectionProvider().addSelectionChangedListener(_selectionBridgeToOutside);
- site.setSelectionProvider(_selectionBridgeToOutside);
- // Eclipse 4.x compatibility layer workaround: selection changed event propagation
- ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
- /**
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event_p) {
- // Force propagation to selection listeners through the selection service
- IWorkbenchWindow window = site.getWorkbenchWindow();
- if (window != null && !window.getWorkbench().isClosing()) {
- ISelectionService service = window.getSelectionService();
- if (service instanceof ISelectionChangedListener)
- ((ISelectionChangedListener)service).selectionChanged(event_p);
- }
- }
- };
- _selectionBridgeToOutside.addSelectionChangedListener(selectionChangedListener);
- }
- }
-
- /**
* @see org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener#compareInputChanged(org.eclipse.compare.structuremergeviewer.ICompareInput)
*/
public void compareInputChanged(final ICompareInput source_p) {
@@ -603,8 +565,9 @@ implements IFlushable, IPropertyChangeNotifier, ICompareInputChangeListener, IAd
*/
@Override
protected void inputChanged(Object input_p, Object oldInput_p) {
- if (oldInput_p instanceof ICompareInput)
+ if (oldInput_p instanceof ICompareInput) {
((ICompareInput)oldInput_p).removeCompareInputChangeListener(this);
+ }
if (_undoAction != null) {
_undoAction.setEditingDomain(getEditingDomain());
_undoAction.update();
@@ -613,10 +576,12 @@ implements IFlushable, IPropertyChangeNotifier, ICompareInputChangeListener, IAd
_redoAction.setEditingDomain(getEditingDomain());
_redoAction.update();
}
- if (_actionBars != null)
+ if (_actionBars != null) {
_actionBars.updateActionBars();
+ }
if (input_p instanceof EMFDiffNode) {
EMFDiffNode node = (EMFDiffNode)input_p;
+ registerUserProperties(node);
registerCategories(node);
node.updateDifferenceNumbers();
node.getCategoryManager().setDefaultConfiguration();
@@ -680,6 +645,14 @@ implements IFlushable, IPropertyChangeNotifier, ICompareInputChangeListener, IAd
}
/**
+ * Register the user properties this viewer supports in the given input
+ * @param input_p a non-null viewer input supporting user properties
+ */
+ protected void registerUserProperties(EMFDiffNode input_p) {
+ // Override for specific user properties
+ }
+
+/**
* @see org.eclipse.compare.IPropertyChangeNotifier#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
*/
public void removePropertyChangeListener(IPropertyChangeListener listener_p) {
@@ -710,6 +683,44 @@ implements IFlushable, IPropertyChangeNotifier, ICompareInputChangeListener, IAd
}
/**
+ * Set up the selection provider
+ */
+ protected void setupSelectionProvider() {
+ final IWorkbenchSite site = getSite();
+ if (site != null) {
+ _selectionBridgeToOutside = new SelectionBridge() {
+ /**
+ * @see org.eclipse.emf.diffmerge.ui.viewers.SelectionBridge#notifyListeners()
+ */
+ @Override
+ protected void notifyListeners() {
+ if (_isExternallySynced) {
+ super.notifyListeners();
+ }
+ }
+ };
+ getMultiViewerSelectionProvider().addSelectionChangedListener(_selectionBridgeToOutside);
+ site.setSelectionProvider(_selectionBridgeToOutside);
+ // Eclipse 4.x compatibility layer workaround: selection changed event propagation
+ ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
+ /**
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event_p) {
+ // Force propagation to selection listeners through the selection service
+ IWorkbenchWindow window = site.getWorkbenchWindow();
+ if (window != null && !window.getWorkbench().isClosing()) {
+ ISelectionService service = window.getSelectionService();
+ if (service instanceof ISelectionChangedListener)
+ ((ISelectionChangedListener)service).selectionChanged(event_p);
+ }
+ }
+ };
+ _selectionBridgeToOutside.addSelectionChangedListener(selectionChangedListener);
+ }
+ }
+
+ /**
* Set up the undo/redo mechanism
*/
protected void setupUndoRedo() {
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ComparisonViewer.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ComparisonViewer.java
index 0b6fe7e4..46361bad 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ComparisonViewer.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ComparisonViewer.java
@@ -24,6 +24,7 @@ import static org.eclipse.emf.diffmerge.ui.util.UIUtil.itemGetSelection;
import static org.eclipse.emf.diffmerge.ui.util.UIUtil.itemSetSelection;
import static org.eclipse.emf.diffmerge.ui.util.UIUtil.itemSetText;
import static org.eclipse.emf.diffmerge.ui.util.UIUtil.itemSetToolTipText;
+import static org.eclipse.emf.diffmerge.ui.viewers.DefaultUserProperties.TECHNICAL_LABELS;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -70,8 +71,8 @@ import org.eclipse.emf.diffmerge.ui.setup.ComparisonSetupManager;
import org.eclipse.emf.diffmerge.ui.setup.EMFDiffMergeEditorInput;
import org.eclipse.emf.diffmerge.ui.specification.IComparisonMethod;
import org.eclipse.emf.diffmerge.ui.specification.IModelScopeDefinition;
-import org.eclipse.emf.diffmerge.ui.util.DiffDelegatingLabelProvider;
import org.eclipse.emf.diffmerge.ui.util.DelegatingLabelProvider;
+import org.eclipse.emf.diffmerge.ui.util.DiffDelegatingLabelProvider;
import org.eclipse.emf.diffmerge.ui.util.DifferenceKind;
import org.eclipse.emf.diffmerge.ui.util.IDiffLabelDecorator;
import org.eclipse.emf.diffmerge.ui.util.InconsistencyDialog;
@@ -1212,19 +1213,23 @@ public class ComparisonViewer extends AbstractComparisonViewer {
* @return result a potentially null item
*/
protected Item createItemUseTechnicalRepresentation(Menu context_p) {
- final MenuItem result = new MenuItem(context_p, SWT.CHECK);
- result.setText(Messages.ComparisonViewer_UseTechnicalRepresentation);
- result.setToolTipText(Messages.ComparisonViewer_UseTechnicalRepresentationTooltip);
- result.addSelectionListener(new SelectionAdapter() {
- /**
- * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- @Override
- public void widgetSelected(SelectionEvent e_p) {
- _viewerFeatures.getInnerViewer().setTechnical(result.getSelection()); //TODO change this
+ final MenuItem result = new MenuItem(context_p, SWT.CHECK);
+ result.setText(Messages.ComparisonViewer_UseTechnicalRepresentation);
+ result.setToolTipText(Messages.ComparisonViewer_UseTechnicalRepresentationTooltip);
+ result.addSelectionListener(new SelectionAdapter() {
+ /**
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e_p) {
+ EMFDiffNode node = getInput();
+ if (node != null) {
+ boolean newValue = result.getSelection();
+ node.setUserPropertyValue(DefaultUserProperties.TECHNICAL_LABELS, Boolean.valueOf(newValue));
}
- });
- return result;
+ }
+ });
+ return result;
}
/**
@@ -2329,6 +2334,14 @@ public class ComparisonViewer extends AbstractComparisonViewer {
}
/**
+ * @see org.eclipse.emf.diffmerge.ui.viewers.AbstractComparisonViewer#registerUserProperties(org.eclipse.emf.diffmerge.ui.viewers.EMFDiffNode)
+ */
+ @Override
+ protected void registerUserProperties(EMFDiffNode input_p) {
+ input_p.addUserProperty(TECHNICAL_LABELS, Boolean.FALSE);
+ }
+
+ /**
* Restart the comparison via a GUI
*/
protected void restart() {
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/DefaultUserProperties.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/DefaultUserProperties.java
new file mode 100644
index 00000000..b9c644ff
--- /dev/null
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/DefaultUserProperties.java
@@ -0,0 +1,32 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2018 Thales Global Services S.A.S.
+ * 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:
+ * Thales Global Services S.A.S. - initial API and implementation
+ *
+ * </copyright>
+ */
+package org.eclipse.emf.diffmerge.ui.viewers;
+
+import org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier;
+
+
+/**
+ * Identifiers for the UI properties supported by the default comparison viewer.
+ * @see ComparisonViewer
+ * @author Olivier Constant
+ */
+@SuppressWarnings("nls")
+public interface DefaultUserProperties {
+
+ /** Whether to use technical (vs. simplified) labels to represent,
+ * in particular, meta elements */
+ Identifier<Boolean> TECHNICAL_LABELS = new Identifier<Boolean>("PROPERTY_TECHNICAL_LABELS");
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EMFDiffNode.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EMFDiffNode.java
index 48bbd1ad..0a4ca832 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EMFDiffNode.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EMFDiffNode.java
@@ -16,10 +16,11 @@
package org.eclipse.emf.diffmerge.ui.viewers;
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
-import java.util.Set;
+import java.util.Map;
-import org.eclipse.compare.IPropertyChangeNotifier;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.core.commands.operations.IOperationHistory;
@@ -37,17 +38,18 @@ import org.eclipse.emf.diffmerge.ui.diffuidata.impl.UIComparisonImpl;
import org.eclipse.emf.diffmerge.ui.setup.ModelScopeTypedElement;
import org.eclipse.emf.diffmerge.ui.specification.IComparisonMethod;
import org.eclipse.emf.diffmerge.ui.util.CompositeUndoContext;
+import org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner;
+import org.eclipse.emf.diffmerge.ui.util.UserProperty;
+import org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.IWorkspaceCommandStack;
import org.eclipse.emf.workspace.ResourceUndoContext;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IEditorInput;
@@ -55,11 +57,8 @@ import org.eclipse.ui.IEditorInput;
* An ICompareInput that wraps a model comparison.
* @author Olivier Constant
*/
-public class EMFDiffNode extends DiffNode implements IDisposable, IEditingDomainProvider,
-IPropertyChangeNotifier {
-
- /** The name of the "use technical labels" property */
- public static final String PROPERTY_TECHNICAL_LABELS = "PROPERTY_TECHNICAL_LABELS"; //$NON-NLS-1$
+public class EMFDiffNode extends DiffNode implements IEditingDomainProvider,
+IUserPropertyOwner {
/** The resource manager */
private final ComparisonResourceManager _resourceManager;
@@ -73,9 +72,6 @@ IPropertyChangeNotifier {
/** The optional listener that reacts to changes on the editing domain */
protected IOperationHistoryListener _domainChangeListener;
- /** The non-null set of property change listeners */
- private final Set<IPropertyChangeListener> _changeListeners;
-
/** The optional associated editor input */
private IEditorInput _editorInput;
@@ -97,10 +93,6 @@ IPropertyChangeNotifier {
/** Whether to use custom labels for differences */
private boolean _useCustomLabels;
- /** Whether to use technical (vs. simplified) labels to represent,
- * in particular, meta elements */
- private boolean _useTechicalLabels;
-
/** Whether the left model is editable */
private boolean _isTargetEditable;
@@ -143,6 +135,9 @@ IPropertyChangeNotifier {
/** The default value for "show merge impact" property as proposed to the user when merging */
private boolean _defaultShowMergeImpact;
+ /** The user properties carried */
+ protected final Map<Identifier<?>, UserProperty<?>> _userProperties;
+
/**
* Constructor
@@ -201,7 +196,6 @@ IPropertyChangeNotifier {
_categoryManager = new CategoryManager(this);
_useCustomIcons = true;
_useCustomLabels = false;
- _useTechicalLabels = false;
_isTargetEditionPossible = (leftRole_p == Role.TARGET)? isLeftEditionPossible_p:
isRightEditionPossible_p;
_isReferenceEditionPossible = (leftRole_p == Role.TARGET)? isRightEditionPossible_p:
@@ -219,14 +213,34 @@ IPropertyChangeNotifier {
_defaultCoverChildren = true;
_defaultIncrementalMode = false;
_domainChangeListener = (domain_p == null)? null: createDomainListener(domain_p);
- _changeListeners = new HashSet<IPropertyChangeListener>(1);
+ _userProperties = new HashMap<UserProperty.Identifier<?>, UserProperty<?>>();
}
/**
- * @see org.eclipse.compare.IPropertyChangeNotifier#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#addUserProperty(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier, java.lang.Object)
*/
- public void addPropertyChangeListener(IPropertyChangeListener listener_p) {
- _changeListeners.add(listener_p);
+ public <T> boolean addUserProperty(Identifier<T> id_p, T initialValue_p) {
+ boolean result = false;
+ if (!hasUserProperty(id_p)) {
+ UserProperty<T> prop = id_p.createProperty(initialValue_p);
+ _userProperties.put(id_p, prop);
+ result = true;
+ }
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#addUserPropertyChangeListener(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier, org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public boolean addUserPropertyChangeListener(Identifier<?> id_p,
+ IPropertyChangeListener listener_p) {
+ boolean result = false;
+ UserProperty<?> prop = getUserProperty(id_p);
+ if (prop != null) {
+ prop.addPropertyChangeListener(listener_p);
+ result = true;
+ }
+ return result;
}
/**
@@ -275,7 +289,14 @@ IPropertyChangeNotifier {
* @see org.eclipse.emf.edit.provider.IDisposable#dispose()
*/
public void dispose() {
+ // Resource manager
_resourceManager.dispose();
+ // User properties
+ for (UserProperty<?> prop : _userProperties.values()) {
+ prop.dispose();
+ }
+ _userProperties.clear();
+ // Command stack
EditingDomain domain = getEditingDomain();
if (domain != null && _domainChangeListener != null) {
IOperationHistory opHistory =
@@ -283,21 +304,8 @@ IPropertyChangeNotifier {
opHistory.removeOperationHistoryListener(_domainChangeListener);
_domainChangeListener = null;
}
+ // Input
_editorInput = null;
- _changeListeners.clear();
- }
-
- /**
- * Notify listeners of a property change event
- * @param propertyName_p the non-null name of the property
- * @param newValue_p the potentially null, new value of the property
- */
- protected void firePropertyChangeEvent(String propertyName_p, Object newValue_p) {
- PropertyChangeEvent event = new PropertyChangeEvent(
- this, propertyName_p, null, newValue_p);
- for (IPropertyChangeListener listener : _changeListeners) {
- listener.propertyChange(event);
- }
}
/**
@@ -418,6 +426,36 @@ IPropertyChangeNotifier {
}
/**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#getUserProperties()
+ */
+ public Collection<Identifier<?>> getUserProperties() {
+ return Collections.unmodifiableCollection(_userProperties.keySet());
+ }
+
+ /**
+ * Return the user property of the given ID
+ * @param <T> the type of the user property
+ * @param id_p a non-null user property ID
+ * @return a potentially null user property
+ */
+ @SuppressWarnings("unchecked")
+ protected <T> UserProperty<T> getUserProperty(Identifier<T> id_p) {
+ return (UserProperty<T>)_userProperties.get(id_p); // OK by construction of the map
+ }
+
+ /**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#getUserPropertyValue(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier)
+ */
+ public <T> T getUserPropertyValue(Identifier<T> id_p) {
+ T result = null;
+ UserProperty<T> prop = getUserProperty(id_p);
+ if (prop != null) {
+ result = prop.getValue();
+ }
+ return result;
+ }
+
+ /**
* @see org.eclipse.compare.structuremergeviewer.DiffContainer#hasChildren()
*/
@Override
@@ -441,6 +479,13 @@ IPropertyChangeNotifier {
}
/**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#hasUserProperty(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier)
+ */
+ public boolean hasUserProperty(Identifier<?> id_p) {
+ return getUserProperty(id_p) != null;
+ }
+
+ /**
* Return whether the given structural feature must be considered as a containment
* @param feature_p a potentially null feature
*/
@@ -565,10 +610,34 @@ IPropertyChangeNotifier {
}
/**
- * @see org.eclipse.compare.IPropertyChangeNotifier#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#removeUserProperty(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier)
+ */
+ public boolean removeUserProperty(Identifier<?> id_p) {
+ Object prop = _userProperties.remove(id_p);
+ return prop != null;
+ }
+
+ /**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#removeUserPropertyChangeListener(org.eclipse.emf.diffmerge.ui.util.UserProperty.Identifier, org.eclipse.jface.util.IPropertyChangeListener)
+ */
+ public boolean removeUserPropertyChangeListener(Identifier<?> id_p,
+ IPropertyChangeListener listener_p) {
+ boolean result = false;
+ UserProperty<?> prop = getUserProperty(id_p);
+ if (prop != null) {
+ prop.removePropertyChangeListener(listener_p);
+ result = true;
+ }
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.emf.diffmerge.ui.util.IUserPropertyOwner#removeUserPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
*/
- public void removePropertyChangeListener(IPropertyChangeListener listener_p) {
- _changeListeners.remove(listener_p);
+ public void removeUserPropertyChangeListener(IPropertyChangeListener listener_p) {
+ for (UserProperty<?> prop : _userProperties.values()) {
+ prop.removePropertyChangeListener(listener_p);
+ }
}
/**
@@ -721,13 +790,21 @@ IPropertyChangeNotifier {
}
/**
- * Set whether viewers must use technical (vs. simplified) labels to represent,
- * in particular, meta elements
- * @param useTechicalLabels_p whether techical labels must be used
+ * Set the value of the user property of the given ID, if any
+ * @param <T> the type of the user property
+ * @param id_p a non-null user property identifier
+ * @param newValue_p a non-null object
+ * @return whether the operation succeeded
*/
- public void setUseTechicalLabels(boolean useTechicalLabels_p) {
- _useTechicalLabels = useTechicalLabels_p;
- firePropertyChangeEvent(PROPERTY_TECHNICAL_LABELS, Boolean.valueOf(useTechicalLabels_p));
+ public <T> boolean setUserPropertyValue(Identifier<T> id_p, T newValue_p) {
+ assert newValue_p != null;
+ boolean result = false;
+ UserProperty<T> property = getUserProperty(id_p);
+ if (property != null) {
+ property.setValue(newValue_p);
+ result = true;
+ }
+ return result;
}
/**
@@ -752,12 +829,4 @@ IPropertyChangeNotifier {
return _useCustomLabels;
}
- /**
- * Return whether viewers must use technical (vs. simplified) labels to represent,
- * in particular, meta elements
- */
- public boolean usesTechicalLabels() {
- return _useTechicalLabels;
- }
-
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EnhancedFeaturesViewer.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EnhancedFeaturesViewer.java
index c44a8420..eb87278d 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EnhancedFeaturesViewer.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/EnhancedFeaturesViewer.java
@@ -14,12 +14,17 @@
*/
package org.eclipse.emf.diffmerge.ui.viewers;
+import static org.eclipse.emf.diffmerge.ui.viewers.DefaultUserProperties.TECHNICAL_LABELS;
+
import org.eclipse.emf.diffmerge.api.IMatch;
import org.eclipse.emf.diffmerge.api.Role;
import org.eclipse.emf.diffmerge.ui.Messages;
import org.eclipse.emf.diffmerge.ui.util.UIUtil;
import org.eclipse.emf.diffmerge.ui.viewers.FeaturesViewer.FeaturesInput;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -32,12 +37,17 @@ import org.eclipse.swt.widgets.Label;
*/
public class EnhancedFeaturesViewer extends HeaderViewer<FeaturesViewer> {
+ /** A listener to changes on properties of the input */
+ protected final IPropertyChangeListener _inputPropertyChangeListener;
+
+
/**
* Constructor
* @param parent_p a non-null composite
*/
public EnhancedFeaturesViewer(Composite parent_p) {
super();
+ _inputPropertyChangeListener = createInputPropertyChangeListener();
createControls(parent_p);
}
@@ -58,6 +68,23 @@ public class EnhancedFeaturesViewer extends HeaderViewer<FeaturesViewer> {
}
/**
+ * Create and return a listener to changes on properties of the input
+ * @return a non-null object
+ */
+ protected IPropertyChangeListener createInputPropertyChangeListener() {
+ return new IPropertyChangeListener() {
+ /**
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event_p) {
+ if (TECHNICAL_LABELS.matches(event_p)) {
+ updateTextLabel();
+ }
+ }
+ };
+ }
+
+ /**
* @see org.eclipse.emf.diffmerge.ui.viewers.HeaderViewer#createTextLabel(org.eclipse.swt.widgets.Composite)
*/
@Override
@@ -75,8 +102,15 @@ public class EnhancedFeaturesViewer extends HeaderViewer<FeaturesViewer> {
*/
protected String getContextualText(FeaturesInput input_p) {
EObject element = getDrivingElement(input_p);
- String formattedTypeText = input_p.getContext().usesTechicalLabels()?
- element.eClass().getName(): UIUtil.getFormattedTypeText(element);
+ boolean useTechnicalLabels = input_p.getContext().getUserPropertyValue(
+ DefaultUserProperties.TECHNICAL_LABELS).booleanValue();
+ String formattedTypeText;
+ if (useTechnicalLabels) {
+ EClass type = element.eClass();
+ formattedTypeText = type.getEPackage().getName() + '.' + type.getName();
+ } else {
+ formattedTypeText = UIUtil.getFormattedTypeText(element);
+ }
String result = String.format(
Messages.EnhancedFeaturesViewer_DetailsWithSelection, formattedTypeText);
return result;
@@ -117,18 +151,33 @@ public class EnhancedFeaturesViewer extends HeaderViewer<FeaturesViewer> {
*/
@Override
protected void inputChanged(Object input_p, Object oldInput_p) {
+ super.inputChanged(input_p, oldInput_p);
+ if (oldInput_p instanceof FeaturesInput) {
+ ((FeaturesInput)oldInput_p).getContext().removeUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
+ }
+ if (input_p instanceof FeaturesInput) {
+ ((FeaturesInput)input_p).getContext().addUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
+ }
+ updateTextLabel();
+ }
+
+ /**
+ * Update the header text according to the current input
+ */
+ protected void updateTextLabel() {
Label textLabel = getTextLabel();
if (textLabel != null && !textLabel.isDisposed()) {
+ FeaturesInput input = getInput();
String newText;
- if (input_p instanceof FeaturesInput) {
- FeaturesInput input = (FeaturesInput)input_p;
+ if (input != null) {
newText = getContextualText(input);
} else {
newText = getDefaultText();
}
textLabel.setText(newText);
}
- super.inputChanged(input_p, oldInput_p);
}
}
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/FeaturesViewer.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/FeaturesViewer.java
index b075df0f..ef4ada00 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/FeaturesViewer.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/FeaturesViewer.java
@@ -15,6 +15,8 @@
*/
package org.eclipse.emf.diffmerge.ui.viewers;
+import static org.eclipse.emf.diffmerge.ui.viewers.DefaultUserProperties.TECHNICAL_LABELS;
+
import java.util.ArrayList;
import java.util.List;
@@ -29,6 +31,8 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -102,6 +106,9 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
/** Whether all features must be shown, including those with no difference */
private boolean _showAllFeatures;
+ /** A listener to changes on properties of the input */
+ protected final IPropertyChangeListener _inputPropertyChangeListener;
+
/**
* Constructor
@@ -121,11 +128,29 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
setContentProvider(new ContentProvider());
setLabelProvider(new LabelProvider());
_showAllFeatures = false;
+ _inputPropertyChangeListener = createInputPropertyChangeListener();
getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
setComparator(new ViewerComparator());
}
/**
+ * Create and return a listener to changes on properties of the input
+ * @return a non-null object
+ */
+ protected IPropertyChangeListener createInputPropertyChangeListener() {
+ return new IPropertyChangeListener() {
+ /**
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event_p) {
+ if (TECHNICAL_LABELS.matches(event_p)) {
+ refresh(true);
+ }
+ }
+ };
+ }
+
+ /**
* Return the first 'match and feature' to show for the given input, if any
* @param input_p a potentially null input object
* @return the first match and feature to show, or null if none
@@ -152,6 +177,22 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
}
/**
+ * @see org.eclipse.jface.viewers.AbstractTableViewer#inputChanged(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ protected void inputChanged(Object input_p, Object oldInput_p) {
+ if (oldInput_p instanceof FeaturesInput) {
+ ((FeaturesInput)oldInput_p).getContext().removeUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
+ }
+ if (input_p instanceof FeaturesInput) {
+ ((FeaturesInput)input_p).getContext().addUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
+ }
+ super.inputChanged(input_p, oldInput_p);
+ }
+
+ /**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceRelatedViewer#isDifferenceAgnostic()
*/
public boolean isDifferenceAgnostic() {
@@ -167,13 +208,6 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
}
/**
- * Return whether a technical, more precise but less user-friendly representation is being used
- */
- public boolean isTechnical() {
- return getInput() != null? getInput().getContext().usesTechicalLabels(): false;
- }
-
- /**
* @see org.eclipse.emf.diffmerge.ui.viewers.IDifferenceRelatedViewer#setDifferenceAgnostic(boolean)
*/
public void setDifferenceAgnostic(boolean agnostic_p) {
@@ -183,19 +217,6 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
}
}
- /**
- * Set whether a technical, more precise but less user-friendly representation must be used
- */
- public void setTechnical(boolean technical_p) {
- if (technical_p != isTechnical()) {
- FeaturesInput input = getInput();
- if (input != null) {
- input.getContext().setUseTechicalLabels(technical_p);
- refresh(true);
- }
- }
- }
-
/**
* The content provider for this viewer.
@@ -293,7 +314,8 @@ public class FeaturesViewer extends TableViewer implements IDifferenceRelatedVie
*/
@Override
protected boolean isTextTechnicalForMeta() {
- return isTechnical();
+ return getInput() == null? false:
+ getInput().getContext().getUserPropertyValue(TECHNICAL_LABELS).booleanValue();
}
}
diff --git a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ValuesViewer.java b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ValuesViewer.java
index 5d417308..139b7ac6 100644
--- a/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ValuesViewer.java
+++ b/plugins/org.eclipse.emf.diffmerge.ui/src/org/eclipse/emf/diffmerge/ui/viewers/ValuesViewer.java
@@ -29,6 +29,8 @@ import org.eclipse.emf.diffmerge.api.diff.IValuePresence;
import org.eclipse.emf.diffmerge.ui.EMFDiffMergeUIPlugin;
import org.eclipse.emf.diffmerge.ui.diffuidata.MatchAndFeature;
import org.eclipse.emf.diffmerge.ui.util.DiffDelegatingLabelProvider;
+import static org.eclipse.emf.diffmerge.ui.viewers.DefaultUserProperties.TECHNICAL_LABELS;
+
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -158,13 +160,13 @@ IDifferenceRelatedViewer {
* Create and return a listener to changes on properties of the input
* @return a non-null object
*/
- protected IPropertyChangeListener createInputPropertyChangeListener() { //TODO do the same on (Enhanced)FeaturesViewer
+ protected IPropertyChangeListener createInputPropertyChangeListener() {
return new IPropertyChangeListener() {
/**
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event_p) {
- if (EMFDiffNode.PROPERTY_TECHNICAL_LABELS.equals(event_p.getProperty())) {
+ if (TECHNICAL_LABELS.matches(event_p)) {
refresh(true);
}
}
@@ -202,12 +204,12 @@ IDifferenceRelatedViewer {
@Override
protected void inputChanged(Object input_p, Object oldInput_p) {
if (oldInput_p instanceof ValuesInput) {
- ((ValuesInput)oldInput_p).getContext().removePropertyChangeListener(
- _inputPropertyChangeListener);
+ ((ValuesInput)oldInput_p).getContext().removeUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
}
if (input_p instanceof ValuesInput) {
- ((ValuesInput)input_p).getContext().addPropertyChangeListener(
- _inputPropertyChangeListener);
+ ((ValuesInput)input_p).getContext().addUserPropertyChangeListener(
+ TECHNICAL_LABELS, _inputPropertyChangeListener);
}
super.inputChanged(input_p, oldInput_p);
}
@@ -385,7 +387,8 @@ IDifferenceRelatedViewer {
*/
@Override
protected boolean isTextTechnicalForMeta() {
- return getInput() != null? getInput().getContext().usesTechicalLabels(): false;
+ return getInput() == null? false:
+ getInput().getContext().getUserPropertyValue(TECHNICAL_LABELS).booleanValue();
}
}

Back to the top