Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgoubet2019-11-05 07:49:43 -0500
committerlgoubet2019-11-05 09:57:04 -0500
commitd0cdd0e6d718d05e169aef63107d68f1c6c310f0 (patch)
tree0c03a7af9b85b35e9d5d72b9744e9875f43b47fc
parent80863539cb8f61fd75f6f973e5d6cb27bb71d2df (diff)
downloadorg.eclipse.emf.compare-d0cdd0e6d718d05e169aef63107d68f1c6c310f0.tar.gz
org.eclipse.emf.compare-d0cdd0e6d718d05e169aef63107d68f1c6c310f0.tar.xz
org.eclipse.emf.compare-d0cdd0e6d718d05e169aef63107d68f1c6c310f0.zip
Potential NPE when switching files in the compare dialogHEAD3.3.9M3master
This would happen when switching from a model file to a textual file while having the property content merge viewer showing. Change-Id: Id756a9c135db9849ac073ecb32cfd55bbb29474f
-rw-r--r--org.eclipse.emf.compare-parent/pom.xml1
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyItem.java17
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/RootPropertyItem.java5
3 files changed, 16 insertions, 7 deletions
diff --git a/org.eclipse.emf.compare-parent/pom.xml b/org.eclipse.emf.compare-parent/pom.xml
index b344279ba..0b2fe136c 100644
--- a/org.eclipse.emf.compare-parent/pom.xml
+++ b/org.eclipse.emf.compare-parent/pom.xml
@@ -137,6 +137,7 @@
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
+ <version>${tycho-version}</version>
<configuration>
<includePackedArtifacts>true</includePackedArtifacts>
<resolver>p2</resolver>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyItem.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyItem.java
index 49f99b553..bed8e34d4 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyItem.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyItem.java
@@ -107,11 +107,20 @@ abstract class PropertyItem extends ItemProvider implements ITableItemLabelProvi
*/
public static PropertyItem createPropertyItem(final EMFCompareConfiguration configuration,
final Object object, final MergeViewerSide side) {
- final AdapterFactoryItemDelegator itemDelegator = new AdapterFactoryItemDelegator(
- configuration.getAdapterFactory());
+ PropertyItem rootItem;
+ List<IItemPropertyDescriptor> propertyDescriptors;
+ if (configuration.getAdapterFactory() != null) {
+ final AdapterFactoryItemDelegator itemDelegator = new AdapterFactoryItemDelegator(
+ configuration.getAdapterFactory());
- PropertyItem rootItem = new RootPropertyItem(configuration, itemDelegator, object, side);
- List<IItemPropertyDescriptor> propertyDescriptors = getPropertyDescriptors(object, itemDelegator);
+ rootItem = new RootPropertyItem(configuration, itemDelegator.getImage(object),
+ itemDelegator.getText(object), object, side);
+ propertyDescriptors = getPropertyDescriptors(object, itemDelegator);
+ } else {
+ // We're currently disposing of the property content merge viewer
+ rootItem = new RootPropertyItem(configuration, null, "", object, side); //$NON-NLS-1$
+ propertyDescriptors = null;
+ }
populateRootPropertyItem(rootItem, propertyDescriptors, object, configuration, side);
return rootItem;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/RootPropertyItem.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/RootPropertyItem.java
index fc30618b3..ebd078044 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/RootPropertyItem.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/RootPropertyItem.java
@@ -12,15 +12,14 @@ package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.property;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.rcp.ui.mergeviewer.IMergeViewer.MergeViewerSide;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
class RootPropertyItem extends PropertyItem {
private Object object;
- RootPropertyItem(EMFCompareConfiguration configuration, IItemLabelProvider itemLabelProvider,
+ RootPropertyItem(EMFCompareConfiguration configuration, Object objectImage, String objectText,
Object object, MergeViewerSide side) {
- super(configuration, itemLabelProvider.getImage(object), itemLabelProvider.getText(object), side);
+ super(configuration, objectImage, objectText, side);
this.object = object;
}

Back to the top