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 49675 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]
Fix for ui.navigator plugin
156581_ui_navigator_patch.txt (text/plain), 3.47 KB, created by
Stefan Xenos
on 2006-09-07 19:55:11 EDT
(
hide
)
Description:
Fix for ui.navigator plugin
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2006-09-07 19:55:11 EDT
Size:
3.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.navigator >Index: src/org/eclipse/ui/internal/navigator/AdaptabilityUtility.java >=================================================================== >RCS file: /home/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 7 Sep 2006 23:56:46 -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. >@@ -32,14 +34,32 @@ > * @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); >- } >+ if (anElement == null || anAdapterType == 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().loadAdapter(anElement, anAdapterType.getName()); >+ if (result != null) { >+ return result; >+ } >+ } >+ >+ return null; > } > > } >Index: src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java,v >retrieving revision 1.8 >diff -u -r1.8 NavigatorSaveablesService.java >--- src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java 22 Aug 2006 18:17:51 -0000 1.8 >+++ src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java 7 Sep 2006 23:56:46 -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; >@@ -449,11 +448,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