diff options
author | Michael Valenta | 2007-04-24 15:39:59 +0000 |
---|---|---|
committer | Michael Valenta | 2007-04-24 15:39:59 +0000 |
commit | 7a46abe51d77eba7e0cb7ca8fb4bb5eb07a4ca3d (patch) | |
tree | 83cae64153d288cbc13c1ed1ead8b76d459b176d /bundles/org.eclipse.compare | |
parent | ab3e31107bd4d9c163fd6cd29591a1e86a80e8ef (diff) | |
download | eclipse.platform.team-7a46abe51d77eba7e0cb7ca8fb4bb5eb07a4ca3d.tar.gz eclipse.platform.team-7a46abe51d77eba7e0cb7ca8fb4bb5eb07a4ca3d.tar.xz eclipse.platform.team-7a46abe51d77eba7e0cb7ca8fb4bb5eb07a4ca3d.zip |
Bug 175811 [Apply Patch] 'Ignore WhiteSpace' in Apply Patch wizard does not work
Diffstat (limited to 'bundles/org.eclipse.compare')
4 files changed, 94 insertions, 28 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java index 6c87d215a..4d82b6dad 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java @@ -16,19 +16,41 @@ import java.util.Iterator; import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.ICompareUIConstants; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.action.*; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; @@ -58,6 +80,13 @@ public class PreviewPatchPage2 extends WizardPage { Assert.isNotNull(configuration); this.fPatcher = patcher; this.fConfiguration = configuration; + this.fConfiguration.addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getProperty().equals(CompareConfiguration.IGNORE_WHITESPACE)){ + rebuildTree(); + } + } + }); } public void createControl(Composite parent) { @@ -193,13 +222,13 @@ public class PreviewPatchPage2 extends WizardPage { fIgnoreWhiteSpace = new Action(PatchMessages.PreviewPatchPage2_IgnoreWSAction, CompareUIPlugin.getImageDescriptor(ICompareUIConstants.IGNORE_WHITESPACE_ENABLED)){ public void run(){ try { - getContainer().run(true, true, new IRunnableWithProgress() { + getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(PatchMessages.PreviewPatchPage2_IgnoreWhitespace, IProgressMonitor.UNKNOWN); if (isChecked() != getPatcher().isIgnoreWhitespace()) { if (promptToRebuild(PatchMessages.PreviewPatchPage2_2)) { if (getPatcher().setIgnoreWhitespace(isChecked())){ - rebuildTree(); + getCompareConfiguration().setProperty(CompareConfiguration.IGNORE_WHITESPACE, new Boolean(isChecked())); } } else { fIgnoreWhiteSpace.setChecked(!isChecked()); diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java index 247e6f8e6..21f1736ce 100644 --- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java +++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java @@ -517,13 +517,17 @@ public class StructureDiffViewer extends DiffTreeViewer { */ protected void diff() { try { - getCompareConfiguration().getContainer().run(true, true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask(CompareMessages.StructureDiffViewer_2, 100); - diffTask.run(new SubProgressMonitor(monitor, 100)); - monitor.done(); - } - }); + CompareConfiguration compareConfiguration = getCompareConfiguration(); + // A null compare configuration indicates that the viewer was disposed + if (compareConfiguration != null) { + compareConfiguration.getContainer().run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(CompareMessages.StructureDiffViewer_2, 100); + diffTask.run(new SubProgressMonitor(monitor, 100)); + monitor.done(); + } + }); + } } catch (InvocationTargetException e) { // Shouldn't happen since the run doesn't throw CompareUIPlugin.log(e.getTargetException()); diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java index 6c87d215a..4d82b6dad 100644 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java +++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java @@ -16,19 +16,41 @@ import java.util.Iterator; import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.ICompareUIConstants; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.action.*; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeSelection; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.*; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; @@ -58,6 +80,13 @@ public class PreviewPatchPage2 extends WizardPage { Assert.isNotNull(configuration); this.fPatcher = patcher; this.fConfiguration = configuration; + this.fConfiguration.addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getProperty().equals(CompareConfiguration.IGNORE_WHITESPACE)){ + rebuildTree(); + } + } + }); } public void createControl(Composite parent) { @@ -193,13 +222,13 @@ public class PreviewPatchPage2 extends WizardPage { fIgnoreWhiteSpace = new Action(PatchMessages.PreviewPatchPage2_IgnoreWSAction, CompareUIPlugin.getImageDescriptor(ICompareUIConstants.IGNORE_WHITESPACE_ENABLED)){ public void run(){ try { - getContainer().run(true, true, new IRunnableWithProgress() { + getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(PatchMessages.PreviewPatchPage2_IgnoreWhitespace, IProgressMonitor.UNKNOWN); if (isChecked() != getPatcher().isIgnoreWhitespace()) { if (promptToRebuild(PatchMessages.PreviewPatchPage2_2)) { if (getPatcher().setIgnoreWhitespace(isChecked())){ - rebuildTree(); + getCompareConfiguration().setProperty(CompareConfiguration.IGNORE_WHITESPACE, new Boolean(isChecked())); } } else { fIgnoreWhiteSpace.setChecked(!isChecked()); diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java index 247e6f8e6..21f1736ce 100644 --- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java +++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java @@ -517,13 +517,17 @@ public class StructureDiffViewer extends DiffTreeViewer { */ protected void diff() { try { - getCompareConfiguration().getContainer().run(true, true, new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask(CompareMessages.StructureDiffViewer_2, 100); - diffTask.run(new SubProgressMonitor(monitor, 100)); - monitor.done(); - } - }); + CompareConfiguration compareConfiguration = getCompareConfiguration(); + // A null compare configuration indicates that the viewer was disposed + if (compareConfiguration != null) { + compareConfiguration.getContainer().run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(CompareMessages.StructureDiffViewer_2, 100); + diffTask.run(new SubProgressMonitor(monitor, 100)); + monitor.done(); + } + }); + } } catch (InvocationTargetException e) { // Shouldn't happen since the run doesn't throw CompareUIPlugin.log(e.getTargetException()); |