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 49972 Details for
Bug 156581
[Workbench] Inconsistent adapter usage in the workbench
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]
updated patch against o.e.ui.navigator
patch-156581-navigator.txt (text/plain), 3.81 KB, created by
Boris Bokowski
on 2006-09-12 14:59:26 EDT
(
hide
)
Description:
updated patch against o.e.ui.navigator
Filename:
MIME Type:
Creator:
Boris Bokowski
Created:
2006-09-12 14:59:26 EDT
Size:
3.81 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.navigator >Index: src/org/eclipse/ui/internal/navigator/AdaptabilityUtility.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/AdaptabilityUtility.java,v >retrieving revision 1.4 >diff -u -r1.4 AdaptabilityUtility.java >--- src/org/eclipse/ui/internal/navigator/AdaptabilityUtility.java 8 May 2006 20:54:42 -0000 1.4 >+++ src/org/eclipse/ui/internal/navigator/AdaptabilityUtility.java 12 Sep 2006 19:02:02 -0000 >@@ -10,8 +10,10 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.navigator; > >+import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.PlatformObject; > > /** > * Provides utilities for working with adaptable and non-adaptable objects. >@@ -26,20 +28,39 @@ > * > * @param anElement > * The element to adapt, which may or may not implement >- * {@link IAdaptable} >+ * {@link IAdaptable}, or null > * @param anAdapterType > * The class type to return > * @return An adapter of the requested type or null > */ > public static Object getAdapter(Object anElement, Class anAdapterType) { >- if (anElement == null) { >- return null; >- } else if (anElement instanceof IAdaptable) { >- return ((IAdaptable) anElement).getAdapter(anAdapterType); >- } else { >- return Platform.getAdapterManager().getAdapter(anElement, >- anAdapterType); >- } >+ Assert.isNotNull(anAdapterType); >+ if (anElement == null) { >+ return null; >+ } >+ if (anAdapterType.isInstance(anElement)) { >+ return anElement; >+ } >+ >+ if (anElement instanceof IAdaptable) { >+ IAdaptable adaptable = (IAdaptable) anElement; >+ >+ Object result = adaptable.getAdapter(anAdapterType); >+ if (result != null) { >+ // Sanity-check >+ Assert.isTrue(anAdapterType.isInstance(result)); >+ return result; >+ } >+ } >+ >+ if (!(anElement instanceof PlatformObject)) { >+ Object result = Platform.getAdapterManager().getAdapter(anElement, anAdapterType); >+ if (result != null) { >+ return result; >+ } >+ } >+ >+ return null; > } > > } >Index: src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java,v >retrieving revision 1.9 >diff -u -r1.9 NavigatorSaveablesService.java >--- src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java 7 Sep 2006 17:35:04 -0000 1.9 >+++ src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java 12 Sep 2006 19:02:02 -0000 >@@ -21,7 +21,6 @@ > import java.util.Set; > import java.util.TreeMap; > >-import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.ITreeContentProvider; >@@ -462,11 +461,8 @@ > .getExtension(descriptor, true); > ITreeContentProvider contentProvider = extension > .getContentProvider(); >- if (contentProvider instanceof IAdaptable) { >- return (SaveablesProvider) ((IAdaptable) contentProvider) >- .getAdapter(SaveablesProvider.class); >- } >- return null; >+ >+ return (SaveablesProvider)AdaptabilityUtility.getAdapter(contentProvider, SaveablesProvider.class); > } > > private Saveable[] getShownSaveables(Saveable[] saveables) {
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 156581
:
49647
|
49674
|
49675
|
49961
|
49970
| 49972