fixed #38770
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index d7f1e4a..694ae74 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -11,6 +11,14 @@
 <h1>
 Eclipse Platform Build Notes<br>
 Compare</h1>
+Eclipse Build Input June 24th 2003
+
+<h2>
+Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
+
+<h1>
+<hr WIDTH="100%"></h1>
 Eclipse Build Input June 10th 2003
 
 <h2>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 33fd75e..8342461 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -12,8 +12,10 @@
 
 import java.lang.reflect.InvocationTargetException;
 
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.*;
 
+import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.util.*;
 
@@ -32,11 +34,27 @@
  * A CompareEditor takes a ICompareEditorInput as input.
  * Most functionality is delegated to the ICompareEditorInput.
  */
-public class CompareEditor extends EditorPart implements IPropertyChangeListener {
+public class CompareEditor extends EditorPart implements IReusableEditor {
 	
+	/**
+	 * Internal property change listener for handling changes in the editor's input.
+	 */
+	class PropertyChangeListener implements IPropertyChangeListener {
+		/*
+		 * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+		 */
+		public void propertyChange(PropertyChangeEvent event) {
+			CompareEditor.this.propertyChange(event);
+		}
+	};
+
 	public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$
 	
 	private IActionBars fActionBars;
+	/** The editor's property change listener. */
+	private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
+	/** the SWT control */
+	private Control fControl;
 	
 	
 	public CompareEditor() {
@@ -54,18 +72,53 @@
 		if (!(input instanceof CompareEditorInput))
 			throw new PartInitException(Utilities.getString("CompareEditor.invalidInput")); //$NON-NLS-1$
 				
-		CompareEditorInput cei= (CompareEditorInput) input;
-			
 		setSite(site);
 		setInput(input);
+	}
+	
+	public void setInput(IEditorInput input) {
+		try {
+			doSetInput(input);			
+		} catch (CoreException x) {
+			String title= Utilities.getString("CompareEditor.error.setinput.title"); //$NON-NLS-1$
+			String msg= Utilities.getString("CompareEditor.error.setinput.message"); //$NON-NLS-1$
+			ErrorDialog.openError(getSite().getShell(), title, msg, x.getStatus());
+		}				
+	}
+	
+	public void doSetInput(IEditorInput input) throws CoreException {
+	
+		if (!(input instanceof CompareEditorInput)) {
+			IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, Utilities.getString("CompareEditor.invalidInput"), null); //$NON-NLS-1$
+			throw new CoreException(s);
+		}
+
+		IEditorInput oldInput= getEditorInput();
+		if (oldInput instanceof IPropertyChangeNotifier)
+			((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
+			
+		super.setInput(input);
 		
+		CompareEditorInput cei= (CompareEditorInput) input;
+
 		setTitleImage(cei.getTitleImage());
 		setTitle(cei.getTitle());
 				
 		if (input instanceof IPropertyChangeNotifier)
-			((IPropertyChangeNotifier)input).addPropertyChangeListener(this);
+			((IPropertyChangeNotifier)input).addPropertyChangeListener(fPropertyChangeListener);
+			
+		if (oldInput != null) {
+			if (fControl != null && !fControl.isDisposed()) {
+				Point oldSize= fControl.getSize();
+				Composite parent= fControl.getParent();
+				fControl.dispose();
+				createPartControl(parent);
+				if (fControl != null)
+					fControl.setSize(oldSize);
+			}
+		}
 	}
-
+	
 	public IActionBars getActionBars() {
 		return fActionBars;
 	}
@@ -82,8 +135,8 @@
 		
 		IEditorInput input= getEditorInput();
 		if (input instanceof CompareEditorInput) {
-			Control c= ((CompareEditorInput) input).createContents(parent);
-			WorkbenchHelp.setHelp(c, ICompareContextIds.COMPARE_EDITOR);
+			fControl= ((CompareEditorInput) input).createContents(parent);
+			WorkbenchHelp.setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
 		}
 	}
 	
@@ -94,9 +147,11 @@
 	
 		IEditorInput input= getEditorInput();
 		if (input instanceof IPropertyChangeNotifier)
-			((IPropertyChangeNotifier)input).removePropertyChangeListener(this);
+			((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
 								
 		super.dispose();
+		
+		fPropertyChangeListener= null;
 	}
 			
 	/*
diff --git a/bundles/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugin.properties
index bb36436..28dbbc6 100644
--- a/bundles/org.eclipse.compare/plugin.properties
+++ b/bundles/org.eclipse.compare/plugin.properties
@@ -37,7 +37,9 @@
 defaultCompareEditor.name= Default Compare Editor
 CompareEditor.saveError.title= Save Error
 CompareEditor.cantSaveError= Can''t save contents ({0})
-CompareEditor.invalidInput=Invalid Input: Must be CompareEditorInput
+CompareEditor.invalidInput=Invalid input: not a CompareEditorInput
+CompareEditor.error.setinput.title=Problem while opening
+CompareEditor.error.setinput.message=Cannot open input:
 
 #
 # Commands
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index d7f1e4a..694ae74 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -11,6 +11,14 @@
 <h1>
 Eclipse Platform Build Notes<br>
 Compare</h1>
+Eclipse Build Input June 24th 2003
+
+<h2>
+Problem reports fixed</h2>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=38770">#38770</a>: CompareEditor should implement IReusableEditor<br>
+
+<h1>
+<hr WIDTH="100%"></h1>
 Eclipse Build Input June 10th 2003
 
 <h2>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
index 33fd75e..8342461 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditor.java
@@ -12,8 +12,10 @@
 
 import java.lang.reflect.InvocationTargetException;
 
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.*;
 
+import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.util.*;
 
@@ -32,11 +34,27 @@
  * A CompareEditor takes a ICompareEditorInput as input.
  * Most functionality is delegated to the ICompareEditorInput.
  */
-public class CompareEditor extends EditorPart implements IPropertyChangeListener {
+public class CompareEditor extends EditorPart implements IReusableEditor {
 	
+	/**
+	 * Internal property change listener for handling changes in the editor's input.
+	 */
+	class PropertyChangeListener implements IPropertyChangeListener {
+		/*
+		 * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+		 */
+		public void propertyChange(PropertyChangeEvent event) {
+			CompareEditor.this.propertyChange(event);
+		}
+	};
+
 	public final static String CONFIRM_SAVE_PROPERTY= "org.eclipse.compare.internal.CONFIRM_SAVE_PROPERTY"; //$NON-NLS-1$
 	
 	private IActionBars fActionBars;
+	/** The editor's property change listener. */
+	private IPropertyChangeListener fPropertyChangeListener= new PropertyChangeListener();
+	/** the SWT control */
+	private Control fControl;
 	
 	
 	public CompareEditor() {
@@ -54,18 +72,53 @@
 		if (!(input instanceof CompareEditorInput))
 			throw new PartInitException(Utilities.getString("CompareEditor.invalidInput")); //$NON-NLS-1$
 				
-		CompareEditorInput cei= (CompareEditorInput) input;
-			
 		setSite(site);
 		setInput(input);
+	}
+	
+	public void setInput(IEditorInput input) {
+		try {
+			doSetInput(input);			
+		} catch (CoreException x) {
+			String title= Utilities.getString("CompareEditor.error.setinput.title"); //$NON-NLS-1$
+			String msg= Utilities.getString("CompareEditor.error.setinput.message"); //$NON-NLS-1$
+			ErrorDialog.openError(getSite().getShell(), title, msg, x.getStatus());
+		}				
+	}
+	
+	public void doSetInput(IEditorInput input) throws CoreException {
+	
+		if (!(input instanceof CompareEditorInput)) {
+			IStatus s= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, Utilities.getString("CompareEditor.invalidInput"), null); //$NON-NLS-1$
+			throw new CoreException(s);
+		}
+
+		IEditorInput oldInput= getEditorInput();
+		if (oldInput instanceof IPropertyChangeNotifier)
+			((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
+			
+		super.setInput(input);
 		
+		CompareEditorInput cei= (CompareEditorInput) input;
+
 		setTitleImage(cei.getTitleImage());
 		setTitle(cei.getTitle());
 				
 		if (input instanceof IPropertyChangeNotifier)
-			((IPropertyChangeNotifier)input).addPropertyChangeListener(this);
+			((IPropertyChangeNotifier)input).addPropertyChangeListener(fPropertyChangeListener);
+			
+		if (oldInput != null) {
+			if (fControl != null && !fControl.isDisposed()) {
+				Point oldSize= fControl.getSize();
+				Composite parent= fControl.getParent();
+				fControl.dispose();
+				createPartControl(parent);
+				if (fControl != null)
+					fControl.setSize(oldSize);
+			}
+		}
 	}
-
+	
 	public IActionBars getActionBars() {
 		return fActionBars;
 	}
@@ -82,8 +135,8 @@
 		
 		IEditorInput input= getEditorInput();
 		if (input instanceof CompareEditorInput) {
-			Control c= ((CompareEditorInput) input).createContents(parent);
-			WorkbenchHelp.setHelp(c, ICompareContextIds.COMPARE_EDITOR);
+			fControl= ((CompareEditorInput) input).createContents(parent);
+			WorkbenchHelp.setHelp(fControl, ICompareContextIds.COMPARE_EDITOR);
 		}
 	}
 	
@@ -94,9 +147,11 @@
 	
 		IEditorInput input= getEditorInput();
 		if (input instanceof IPropertyChangeNotifier)
-			((IPropertyChangeNotifier)input).removePropertyChangeListener(this);
+			((IPropertyChangeNotifier)input).removePropertyChangeListener(fPropertyChangeListener);
 								
 		super.dispose();
+		
+		fPropertyChangeListener= null;
 	}
 			
 	/*
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
index bb36436..28dbbc6 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
@@ -37,7 +37,9 @@
 defaultCompareEditor.name= Default Compare Editor
 CompareEditor.saveError.title= Save Error
 CompareEditor.cantSaveError= Can''t save contents ({0})
-CompareEditor.invalidInput=Invalid Input: Must be CompareEditorInput
+CompareEditor.invalidInput=Invalid input: not a CompareEditorInput
+CompareEditor.error.setinput.title=Problem while opening
+CompareEditor.error.setinput.message=Cannot open input:
 
 #
 # Commands