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
.size()]), true));
					outsideListener
							.handleLifecycleEvent(new SaveablesLifecycleEvent(
									saveablesSource,
									SaveablesLifecycleEvent.POST_CLOSE,
									(Saveable[]) removedSaveables
											.toArray(new Saveable[removedSaveables
													.size()]), false));
				}
			});
		}
	}
	/**
	 * @param startedBundleId
	 */
	private void updateSaveablesProviders(String startedBundleId) {
		List result = new ArrayList(Arrays.asList(saveablesProviders));
		List descriptors = (List) inactivePluginsWithSaveablesProviders
				.get(startedBundleId);
		for (Iterator it = descriptors.iterator(); it.hasNext();) {
			NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) it
					.next();
			SaveablesProvider saveablesProvider = createSaveablesProvider(descriptor);
			if (saveablesProvider != null) {
				saveablesProvider.init(saveablesLifecycleListener);
				result.add(saveablesProvider);
				saveablesProviderMap.put(descriptor, saveablesProvider);
			}
		}
		saveablesProviders = (SaveablesProvider[]) result