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 192276 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]
Fix setting LocalResourceSaveableComparison dirty.
patch_312893.txt (text/plain), 8.12 KB, created by
Malgorzata Janczarska
on 2011-03-31 10:17:13 EDT
(
hide
)
Description:
Fix setting LocalResourceSaveableComparison dirty.
Filename:
MIME Type:
Creator:
Malgorzata Janczarska
Created:
2011-03-31 10:17:13 EDT
Size:
8.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: compare/org/eclipse/compare/CompareEditorInput.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java,v >retrieving revision 1.118 >diff -u -r1.118 CompareEditorInput.java >--- compare/org/eclipse/compare/CompareEditorInput.java 10 Aug 2010 10:23:04 -0000 1.118 >+++ compare/org/eclipse/compare/CompareEditorInput.java 31 Mar 2011 12:29:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -1087,7 +1087,72 @@ > Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded())); > } > } >- >+ >+ /** >+ * Sets the dirty state of left site of this input to the given value and >+ * sends out a <code>PropertyChangeEvent</code> if the new value for whole >+ * input differs from the old value. Direct calling this method with >+ * parameter dirty equal to <code>false</code> when there are unsaved >+ * changes in left viewer, results in inconsistent state. The dirty state of >+ * compare input should be based only on the information if there are >+ * changes in viewers for left side. >+ * >+ * @param dirty >+ * the dirty state for this compare input >+ * @since 3.7 >+ * @noreference This method is not intended to be referenced by clients. >+ * @nooverride This method is not intended to be re-implemented or extended >+ * by clients. >+ */ >+ protected void setLeftDirty(boolean dirty) { >+ boolean oldDirty = isSaveNeeded(); >+ boolean newDirty = dirty; >+ if (!newDirty) { >+ fLeftDirtyViewer = null; >+ } else { >+ if (fLeftDirtyViewer == null) >+ fLeftDirtyViewer = (ContentMergeViewer) fContentInputPane >+ .getViewer(); >+ >+ } >+ if (oldDirty != isSaveNeeded()) { >+ Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, >+ Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded())); >+ } >+ } >+ >+ /** >+ * Sets the dirty state of right site of this input to the given value and >+ * sends out a <code>PropertyChangeEvent</code> if the new value for whole >+ * input differs from the old value. Direct calling this method with >+ * parameter dirty equal to <code>false</code> when there are unsaved >+ * changes in right viewer, results in inconsistent state. The dirty state >+ * of compare input should be based only on the information if there are >+ * changes in viewers for right side. >+ * >+ * @param dirty >+ * the dirty state for this compare input >+ * @since 3.7 >+ * @noreference This method is not intended to be referenced by clients. >+ * @nooverride This method is not intended to be re-implemented or extended >+ * by clients. >+ */ >+ protected void setRightDirty(boolean dirty) { >+ boolean oldDirty = isSaveNeeded(); >+ boolean newDirty = dirty; >+ if (!newDirty) { >+ fRightDirtyViewer = null; >+ } else { >+ if (fRightDirtyViewer == null) >+ fRightDirtyViewer = (ContentMergeViewer) fContentInputPane >+ .getViewer(); >+ } >+ if (oldDirty != isSaveNeeded()) { >+ Utilities.firePropertyChange(fListenerList, this, DIRTY_STATE, >+ Boolean.valueOf(oldDirty), Boolean.valueOf(isSaveNeeded())); >+ } >+ } >+ > /** > * Method adds or removes viewers that changed left or right side of this > * compare input. Any modification of any of the list of viewers may result >#P org.eclipse.team.ui >Index: src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java,v >retrieving revision 1.10 >diff -u -r1.10 LocalResourceSaveableComparison.java >--- src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java 10 Aug 2010 10:23:08 -0000 1.10 >+++ src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java 31 Mar 2011 12:29:15 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2010 IBM Corporation and others. >+ * Copyright (c) 2006, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -11,6 +11,7 @@ > package org.eclipse.team.internal.ui.synchronize; > > import org.eclipse.compare.*; >+import org.eclipse.compare.contentmergeviewer.ContentMergeViewer; > import org.eclipse.compare.internal.ISavingSaveable; > import org.eclipse.compare.structuremergeviewer.ICompareInput; > import org.eclipse.core.resources.IFile; >@@ -221,6 +222,11 @@ > * @see org.eclipse.team.ui.mapping.SaveableCompareModel#setDirty(boolean) > */ > protected void setDirty(boolean dirty) { >+ if (editorInput instanceof SaveablesCompareEditorInput) { >+ ((SaveablesCompareEditorInput) editorInput).setSaveNeeded(dirty, >+ this); >+ return; >+ } > // We need to set the dirty state on the compare editor input > // since it is our only connection to the merge viewer > editorInput.setDirty(dirty); >@@ -279,7 +285,23 @@ > Object newValue= e.getNewValue(); > if (newValue instanceof Boolean) > changed= ((Boolean)newValue).booleanValue(); >- setDirty(changed); >+ >+ ContentMergeViewer cmv = (ContentMergeViewer) e.getSource(); >+ >+ if (fileElement.equals(input.getLeft())) { >+ if (changed && cmv.internalIsLeftDirty()) >+ setDirty(changed); >+ else if (!changed && !cmv.internalIsLeftDirty()) { >+ setDirty(changed); >+ } >+ } >+ if (fileElement.equals(input.getRight())) { >+ if (changed && cmv.internalIsRightDirty()) >+ setDirty(changed); >+ else if (!changed && !cmv.internalIsRightDirty()) { >+ setDirty(changed); >+ } >+ } > } > } > >Index: src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java,v >retrieving revision 1.7 >diff -u -r1.7 SaveablesCompareEditorInput.java >--- src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java 24 Jan 2011 11:53:01 -0000 1.7 >+++ src/org/eclipse/team/internal/ui/synchronize/SaveablesCompareEditorInput.java 31 Mar 2011 12:29:15 -0000 >@@ -143,7 +143,7 @@ > fLeftPropertyListener = new IPropertyListener() { > public void propertyChanged(Object source, int propId) { > if (propId == SaveableComparison.PROP_DIRTY) { >- setDirty(fLeftSaveable.isDirty()); >+ setLeftDirty(fLeftSaveable.isDirty()); > } > } > }; >@@ -155,14 +155,15 @@ > fRightPropertyListener = new IPropertyListener() { > public void propertyChanged(Object source, int propId) { > if (propId == SaveableComparison.PROP_DIRTY) { >- setDirty(fRightSaveable.isDirty()); >+ setRightDirty(fRightSaveable.isDirty()); > } > } > }; > rscm.addPropertyListener(fRightPropertyListener); > } > >- setDirty(fLeftSaveable.isDirty() || fRightSaveable.isDirty()); >+ setLeftDirty(fLeftSaveable.isDirty()); >+ setRightDirty(fRightSaveable.isDirty()); > } > > /* >@@ -385,6 +386,15 @@ > return isSaveNeeded(); > } > >+ void setSaveNeeded(boolean dirty, Saveable saveable) { >+ if (saveable.equals(fLeftSaveable)) { >+ setLeftDirty(dirty); >+ } >+ if (saveable.equals(fRightSaveable)) { >+ setRightDirty(dirty); >+ } >+ } >+ > void saveChanges(IProgressMonitor monitor, Saveable saveable) > throws CoreException { > if (saveable.equals(fLeftSaveable)) {
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