Bug 306545 The changes in the Saveable Service causes the Save button to disable for our modeling resources
Build Identifier: I20100313-1044 (eclipse version 3.6.0) The code changes in eclipse break our saveable provider functionality. class: org.eclipse.ui.internal.navigator.NavigatorSaveablesService method: createSaveablesProvider changed: calling internalGetContentProvider instead of getContentProvider cause: In previous older build, the return value from getContentProvider() for the contentProvider is UMLNavigatorContentProviderWrapper. But in the new build, the value from internalGetContentProvider() is org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider (wrapper of UMLNavigatorContentProviderWrapper) and it is not an adaptable. ===== new code ===== private SaveablesProvider createSaveablesProvider(NavigatorContentDescriptor descriptor) { NavigatorContentExtension extension = contentService.getExtension(descriptor, true); ITreeContentProvider contentProvider = extension.internalGetContentProvider(); return (SaveablesProvider)AdaptabilityUtility.getAdapter(contentProvider, SaveablesProvider.class); } ===== Old code ===== private SaveablesProvider createSaveablesProvider(NavigatorContentDescriptor descriptor) { NavigatorContentExtension extension = contentService.getExtension(descriptor, true); ITreeContentProvider contentProvider = extension.getContentProvider(); return (SaveablesProvider)AdaptabilityUtility.getAdapter(contentProvider, SaveablesProvider.class); } Reproducible: Always Steps to Reproduce: 1.Create a UML modeling project P1 and a UML model file (such as M.emx) 2.Restart the workspace 3.After the workbench shown up, switch to Modeling Perspective. 4.In the Project Explorer, click the + infront of the project P1 to expand and show it contents. Expect: The ModelerSaveablesProvider is created and added to eclipse's saveablesProviderMap in the org.eclipse.ui.internal.navigator.NavigatorSaveablesService class. Result: The ModelerSaveablesProvider is NOT added to the eclipse's saveablesProviderMap. So, when user selected the model tree item in dirty state, the Save button on the toolbar and main menu bar always disable. Thus, user can not save the dirty model.
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorSaveablesService.java
*/
	private Saveable[] getActiveSaveablesFromTreePathProvider(
			IStructuredSelection selection, ITreePathContentProvider provider) {
		Set result = new HashSet();
		for (Iterator it = selection.iterator(); it.hasNext();) {
			Object element = it.next();
			Saveable saveable = getSaveable(element);
			if (saveable != null) {
				result.add(saveable);
			} else {
				TreePath[] paths = provider.getParents(element);
				saveable = findSaveable(paths);
				if (saveable != null) {
					result.add(saveable);
				}
			}
		}
		return (Saveable[]) result.toArray(new Saveable[result.size()]);
	}
	/**
	 * @param selection
	 * @param contentProvider
	 * @return the active saveables
	 */
	private Saveable[] getActiveSaveablesFromTreeProvider(
			IStructuredSelection selection, ITreeContentProvider contentProvider) {
		Set result = new HashSet();
		for (Iterator it = selection.iterator(); it.hasNext();) {
			Object element = it.next();
			Saveable saveable = findSaveable(element, contentProvider);