aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalgorzata Janczarska2011-11-09 04:58:21 (EST)
committerTomasz Zarna2011-11-09 04:58:21 (EST)
commit77e191005304a575da09fac8c7f2eb01ed8e4ed6 (patch)
tree988d95d33d8e55f2ee02d7f7d3d00620b66da9aa
parentcdb5c15f44856d761e357cbb004a3f6f485029d6 (diff)
downloadeclipse.platform.team-77e191005304a575da09fac8c7f2eb01ed8e4ed6.zip
eclipse.platform.team-77e191005304a575da09fac8c7f2eb01ed8e4ed6.tar.gz
eclipse.platform.team-77e191005304a575da09fac8c7f2eb01ed8e4ed6.tar.bz2
bug 354593: [backport] NPE in CompareEditorInput.setDirty in Eclipse 3.7
[ID-MAMS9]
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java67
2 files changed, 18 insertions, 51 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF
index ae42c02..1b95f28 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.compare; singleton:=true
-Bundle-Version: 3.5.201.qualifier
+Bundle-Version: 3.5.202.qualifier
Bundle-Activator: org.eclipse.compare.internal.CompareUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 0ded697..85a8c5f 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -194,8 +194,8 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
private String fTitle;
private ListenerList fListenerList= new ListenerList();
private CompareNavigator fNavigator;
- private ContentMergeViewer fLeftDirtyViewer = null;
- private ContentMergeViewer fRightDirtyViewer = null;
+ private boolean fLeftDirty = false;
+ private boolean fRightDirty = false;
private IPropertyChangeListener fDirtyStateListener;
boolean fStructureCompareOnSingleClick= true;
@@ -1038,7 +1038,7 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
* @noreference This method is not intended to be referenced by clients.
*/
protected boolean isLeftSaveNeeded() {
- return fLeftDirtyViewer != null;
+ return fLeftDirty;
}
/**
@@ -1048,7 +1048,7 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
* @noreference This method is not intended to be referenced by clients.
*/
protected boolean isRightSaveNeeded() {
- return fRightDirtyViewer != null;
+ return fRightDirty;
}
/**
@@ -1078,18 +1078,9 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
*/
public void setDirty(boolean dirty) {
boolean oldDirty = isSaveNeeded();
- boolean newDirty = dirty;
- if (!newDirty) {
- fLeftDirtyViewer = null;
- fRightDirtyViewer = null;
- } else {
- if (fLeftDirtyViewer == null)
- fLeftDirtyViewer = (ContentMergeViewer) fContentInputPane
- .getViewer();
- if (fRightDirtyViewer == null)
- fRightDirtyViewer = (ContentMergeViewer) fContentInputPane
- .getViewer();
- }
+ fLeftDirty = dirty;
+ fRightDirty = dirty;
+
if (oldDirty != isSaveNeeded()) {
Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded()));
}
@@ -1113,15 +1104,8 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
*/
protected void setLeftDirty(boolean dirty) {
boolean oldDirty = isSaveNeeded();
- boolean newDirty = dirty;
- if (!newDirty) {
- fLeftDirtyViewer = null;
- } else {
- if (fLeftDirtyViewer == null)
- fLeftDirtyViewer = (ContentMergeViewer) fContentInputPane
- .getViewer();
+ fLeftDirty = dirty;
- }
if (oldDirty != isSaveNeeded()) {
Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE,
Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded()));
@@ -1146,14 +1130,8 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
*/
protected void setRightDirty(boolean dirty) {
boolean oldDirty = isSaveNeeded();
- boolean newDirty = dirty;
- if (!newDirty) {
- fRightDirtyViewer = null;
- } else {
- if (fRightDirtyViewer == null)
- fRightDirtyViewer = (ContentMergeViewer) fContentInputPane
- .getViewer();
- }
+ fRightDirty = dirty;
+
if (oldDirty != isSaveNeeded()) {
Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE,
Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded()));
@@ -1175,24 +1153,13 @@ public abstract class CompareEditorInput extends PlatformObject implements IEdit
Assert.isNotNull(source);
boolean oldDirty = isSaveNeeded();
ContentMergeViewer cmv = (ContentMergeViewer) source;
- if (dirty) {
- if (cmv.internalIsLeftDirty()) {
- if (fLeftDirtyViewer == null) {
- fLeftDirtyViewer = cmv;
- }
- }
- if (cmv.internalIsRightDirty()) {
- if (fRightDirtyViewer == null) {
- fRightDirtyViewer = cmv;
- }
- }
- } else {
- if (!cmv.internalIsLeftDirty()) {
- fLeftDirtyViewer = null;
- }
- if (!cmv.internalIsRightDirty()) {
- fRightDirtyViewer = null;
- }
+
+ if (dirty == cmv.internalIsLeftDirty()) {
+ fLeftDirty = cmv.internalIsLeftDirty();
+ }
+
+ if (dirty == cmv.internalIsRightDirty()) {
+ fRightDirty = cmv.internalIsRightDirty();
}
boolean newDirty = isSaveNeeded();
if (DEBUG) {