Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 206199 Details for
Bug 312893
Flushing content merge viewer resets dirty flag for a Saveable that is not being saved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fixing refreshing ContentMergeViewer with test
patch_312893_withTest.txt (text/plain), 7.56 KB, created by
Malgorzata Janczarska
on 2011-10-31 07:04:04 EDT
(
hide
)
Description:
Fixing refreshing ContentMergeViewer with test
Filename:
MIME Type:
Creator:
Malgorzata Janczarska
Created:
2011-10-31 07:04:04 EDT
Size:
7.56 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java >index b479316..9980c51 100644 >--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java >+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java >@@ -1306,6 +1306,9 @@ public abstract class ContentMergeViewer extends ContentViewer > } > } > } >+ if (isSaving() && (isLeftDirty() || isRightDirty())) { >+ return; // Do not refresh until saving both sides is complete >+ } > refresh(); > } > >diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >index bd53f5b..c7676f3 100644 >--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/SaveableCompareEditorInputTest.java >@@ -19,8 +19,11 @@ import java.util.List; > import junit.framework.Test; > > import org.eclipse.compare.CompareConfiguration; >+import org.eclipse.compare.CompareViewerSwitchingPane; > import org.eclipse.compare.ITypedElement; > import org.eclipse.compare.contentmergeviewer.TextMergeViewer; >+import org.eclipse.compare.internal.CompareEditor; >+import org.eclipse.compare.internal.CompareUIPlugin; > import org.eclipse.compare.internal.MergeSourceViewer; > import org.eclipse.compare.structuremergeviewer.Differencer; > import org.eclipse.compare.structuremergeviewer.ICompareInput; >@@ -33,12 +36,14 @@ import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.ILogListener; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.jface.viewers.Viewer; > import org.eclipse.swt.custom.StyledText; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.team.internal.ui.mapping.AbstractCompareInput; > import org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier; > import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement; >+import org.eclipse.team.internal.ui.synchronize.SaveablesCompareEditorInput; > import org.eclipse.team.tests.core.TeamTest; > import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput; > import org.eclipse.ui.PlatformUI; >@@ -49,17 +54,21 @@ public class SaveableCompareEditorInputTest extends TeamTest { > return suite(SaveableCompareEditorInputTest.class); > } > >+ private static final String COMPARE_EDITOR = CompareUIPlugin.PLUGIN_ID >+ + ".CompareEditor"; //$NON-NLS-1$ >+ > private IFile file1; > private IFile file2; > private String appendFileContents = "_append"; > private String fileContents1 = "FileContents"; > private String fileContents2 = "FileContents2"; > private TestLogListener logListener = new TestLogListener(); >+ private IProject project; > > protected void setUp() throws Exception { > super.setUp(); > >- IProject project = createProject("Project_", new String[] { >+ project = createProject("Project_", new String[] { > "File1.txt", "File2.txt" }); > > file1 = project.getFile("File1.txt"); >@@ -106,7 +115,8 @@ public class SaveableCompareEditorInputTest extends TeamTest { > > private class TestLogListener implements ILogListener { > public void logging(IStatus status, String plugin) { >- fail(status.getMessage()); >+ if (status.getSeverity() == IStatus.ERROR) >+ fail(status.getMessage()); > } > } > >@@ -324,4 +334,98 @@ public class SaveableCompareEditorInputTest extends TeamTest { > * handled, see javadoc to SaveableCompareEditorInput. > */ > } >+ >+ private void verifyModifyAndSaveBothSidesOfCompareEditor(String extention) >+ throws InterruptedException, InvocationTargetException, >+ IllegalArgumentException, SecurityException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ >+ // create files to compare >+ IFile file1 = project.getFile("CompareFile1." + extention); >+ IFile file2 = project.getFile("CompareFile2." + extention); >+ file1.create(new ByteArrayInputStream(fileContents1.getBytes()), true, >+ null); >+ file2.create(new ByteArrayInputStream(fileContents2.getBytes()), true, >+ null); >+ >+ // prepare comparison >+ SaveablesCompareEditorInput input = new SaveablesCompareEditorInput( >+ null, SaveablesCompareEditorInput.createFileElement(file1), >+ SaveablesCompareEditorInput.createFileElement(file2), >+ PlatformUI.getWorkbench().getActiveWorkbenchWindow() >+ .getActivePage()); >+ input.run(null); >+ >+ // open CompareEditor >+ CompareEditor editor = (CompareEditor) PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow().getActivePage() >+ .openEditor(input, COMPARE_EDITOR, true); >+ >+ CompareViewerSwitchingPane pane = (CompareViewerSwitchingPane) ReflectionUtils >+ .getField(input, "fContentInputPane", true); >+ >+ Viewer viewer = pane.getViewer(); >+ >+ MergeSourceViewer left = (MergeSourceViewer) ReflectionUtils.getField( >+ viewer, "fLeft", true); >+ MergeSourceViewer right = (MergeSourceViewer) ReflectionUtils.getField( >+ viewer, "fRight", true); >+ >+ // modify both sides of CompareEditor >+ StyledText leftText = left.getSourceViewer().getTextWidget(); >+ StyledText rightText = right.getSourceViewer().getTextWidget(); >+ leftText.append(appendFileContents); >+ rightText.append(appendFileContents); >+ >+ // save both sides >+ editor.doSave(null); >+ >+ assertFalse(editor.isDirty()); >+ >+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() >+ .closeEditor(editor, false); >+ >+ // validate if both sides where saved >+ assertTrue(compareContent(new ByteArrayInputStream( >+ (fileContents1 + appendFileContents).getBytes()), >+ file1.getContents())); >+ assertTrue(compareContent(new ByteArrayInputStream( >+ (fileContents2 + appendFileContents).getBytes()), >+ file2.getContents())); >+ } >+ >+ public void testModifyAndSaveBothSidesOfCompareEditorHtml() >+ throws IllegalArgumentException, SecurityException, >+ InterruptedException, InvocationTargetException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ verifyModifyAndSaveBothSidesOfCompareEditor("html"); >+ } >+ >+ public void testModifyAndSaveBothSidesOfCompareEditorTxt() >+ throws IllegalArgumentException, SecurityException, >+ InterruptedException, InvocationTargetException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ verifyModifyAndSaveBothSidesOfCompareEditor("txt"); >+ } >+ >+ public void testModifyAndSaveBothSidesOfCompareEditorJava() >+ throws IllegalArgumentException, SecurityException, >+ InterruptedException, InvocationTargetException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ verifyModifyAndSaveBothSidesOfCompareEditor("java"); >+ } >+ >+ public void testModifyAndSaveBothSidesOfCompareEditorXml() >+ throws IllegalArgumentException, SecurityException, >+ InterruptedException, InvocationTargetException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ verifyModifyAndSaveBothSidesOfCompareEditor("xml"); >+ } >+ >+ public void testModifyAndSaveBothSidesOfCompareEditorProperties() >+ throws IllegalArgumentException, SecurityException, >+ InterruptedException, InvocationTargetException, >+ IllegalAccessException, NoSuchFieldException, CoreException { >+ verifyModifyAndSaveBothSidesOfCompareEditor("properties"); >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 312893
:
192276
|
205988
| 206199 |
206200