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 56409 Details for
Bug 167607
[EditorMgmt] Closing compare editor asks to save editor - Saveable should implement IAdaptable
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]
Patch that implements equals and hashCode on Compare's Saveable
patch167607.txt (text/plain), 3.37 KB, created by
Michael Valenta
on 2007-01-04 13:40:58 EST
(
hide
)
Description:
Patch that implements equals and hashCode on Compare's Saveable
Filename:
MIME Type:
Creator:
Michael Valenta
Created:
2007-01-04 13:40:58 EST
Size:
3.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.5 >diff -u -r1.5 LocalResourceSaveableComparison.java >--- src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java 3 Jan 2007 21:52:25 -0000 1.5 >+++ src/org/eclipse/team/internal/ui/synchronize/LocalResourceSaveableComparison.java 4 Jan 2007 18:34:54 -0000 >@@ -17,11 +17,15 @@ > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.jface.text.IDocument; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.swt.graphics.Image; > import org.eclipse.team.internal.ui.*; > import org.eclipse.team.ui.mapping.SaveableComparison; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.Saveable; >+import org.eclipse.ui.texteditor.IDocumentProvider; > > /** > * A saveable that wraps a compare input in which the left side is a {@link LocalResourceTypedElement} >@@ -252,23 +256,59 @@ > setDirty(changed); > } > } >+ >+ /* >+ * @see org.eclipse.ui.Saveable#hashCode() >+ */ >+ public int hashCode() { >+ Object document= getAdapter(IDocument.class); >+ if (document == null) >+ return input.hashCode(); >+ return document.hashCode(); >+ } > >- /* (non-Javadoc) >+ /* > * @see org.eclipse.ui.Saveable#equals(java.lang.Object) > */ >- public boolean equals(Object object) { >- if (object instanceof LocalResourceSaveableComparison) { >- LocalResourceSaveableComparison rscm = (LocalResourceSaveableComparison) object; >+ public boolean equals(Object obj) { >+ if (this == obj) >+ return true; >+ >+ if (!(obj instanceof Saveable)) >+ return false; >+ >+ if (obj instanceof LocalResourceSaveableComparison) { >+ LocalResourceSaveableComparison rscm = (LocalResourceSaveableComparison) obj; > return rscm.input.equals(input); > } >- return false; >+ >+ Object thisDocument= getAdapter(IDocument.class); >+ Object otherDocument= ((Saveable)obj).getAdapter(IDocument.class); >+ >+ if (thisDocument == null && otherDocument == null) >+ return false; >+ >+ return thisDocument != null && thisDocument.equals(otherDocument); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.Saveable#hashCode() >- */ >- public int hashCode() { >- return input.hashCode(); >+ >+ public Object getAdapter(Class adapter) { >+ if (adapter == IDocument.class) { >+ if (fileElement instanceof LocalResourceTypedElement) { >+ LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement; >+ if (lrte.isConnected()) { >+ ISharedDocumentAdapter sda = (ISharedDocumentAdapter)Utils.getAdapter(lrte, ISharedDocumentAdapter.class); >+ if (sda != null) { >+ IEditorInput input = sda.getDocumentKey(lrte); >+ if (input != null) { >+ IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); >+ if (provider != null) >+ return provider.getDocument(input); >+ } >+ } >+ } >+ } >+ } >+ return super.getAdapter(adapter); > } > > /**
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 167607
:
56409
|
56473