### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.views.properties.tabbed Index: plugin.xml =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/plugin.xml,v retrieving revision 1.2 diff -u -r1.2 plugin.xml --- plugin.xml 1 Feb 2006 00:10:51 -0000 1.2 +++ plugin.xml 13 Nov 2006 16:43:54 -0000 @@ -5,5 +5,23 @@ + + + + + + Index: plugin.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/plugin.properties,v retrieving revision 1.2 diff -u -r1.2 plugin.properties --- plugin.properties 1 Feb 2006 00:10:52 -0000 1.2 +++ plugin.properties 13 Nov 2006 16:43:54 -0000 @@ -14,3 +14,6 @@ ExtPoint.propertyContributor = Property Contributor ExtPoint.propertyTabs = Property Tabs ExtPoint.propertySections = Property Sections + +Context = Context +Java = Java Index: src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java,v retrieving revision 1.7 diff -u -r1.7 TabbedPropertySheetPage.java --- src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java 29 Aug 2006 13:27:39 -0000 1.7 +++ src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java 13 Nov 2006 16:43:55 -0000 @@ -539,7 +539,12 @@ * org.eclipse.jface.viewers.ISelection) */ public void selectionChanged(IWorkbenchPart part, ISelection selection) { - setInput(part, selection); + ISelection convertedSelection = selection; + ISelectionConverter selectionConverter = registry.getSelectionConverter(); + if (selectionConverter != null ) { + convertedSelection = selectionConverter.structuredSelection(selection); + } + setInput(part, convertedSelection); } /** Index: src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java,v retrieving revision 1.2 diff -u -r1.2 TabbedPropertyRegistry.java --- src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java 29 Aug 2006 13:27:39 -0000 1.2 +++ src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java 13 Nov 2006 16:43:54 -0000 @@ -32,6 +32,7 @@ import org.eclipse.ui.views.properties.tabbed.IActionProvider; import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; import org.eclipse.ui.views.properties.tabbed.ISectionDescriptorProvider; +import org.eclipse.ui.views.properties.tabbed.ISelectionConverter; import org.eclipse.ui.views.properties.tabbed.ITypeMapper; /** @@ -68,6 +69,8 @@ private static final String ATT_LABEL_PROVIDER = "labelProvider"; //$NON-NLS-1$ private static final String ATT_ACTION_PROVIDER = "actionProvider"; //$NON-NLS-1$ + + private static final String ATT_SELECTION_CONVERTER = "selectionConverter"; //$NON-NLS-1$ private static final String TOP = "top"; //$NON-NLS-1$ @@ -80,6 +83,8 @@ protected ILabelProvider labelProvider; protected IActionProvider actionProvider; + + protected ISelectionConverter selectionConverter; protected ITypeMapper typeMapper; @@ -117,6 +122,10 @@ typeMapper = (ITypeMapper) configurationElement .createExecutableExtension(ATT_TYPE_MAPPER); } + if (configurationElement.getAttribute(ATT_SELECTION_CONVERTER) != null) { + selectionConverter = (ISelectionConverter) configurationElement + .createExecutableExtension(ATT_SELECTION_CONVERTER); + } } catch (CoreException exception) { handleConfigurationError(id, exception); } @@ -452,6 +461,15 @@ public IActionProvider getActionProvider() { return actionProvider; } + + /** + * Gets the structured selection provider for the contributor. + * + * @return the structured selection provider for the contributor. + */ + public ISelectionConverter getSelectionConverter() { + return selectionConverter; + } /** * Sets the section descriptor provider for the contributor. Index: schema/propertyContributor.exsd =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.views.properties.tabbed/schema/propertyContributor.exsd,v retrieving revision 1.2 diff -u -r1.2 propertyContributor.exsd --- schema/propertyContributor.exsd 29 Aug 2006 13:27:39 -0000 1.2 +++ schema/propertyContributor.exsd 13 Nov 2006 16:43:54 -0000 @@ -81,6 +81,16 @@ + + + + The class that implements the selection converter, i.e. implements <tt>org.eclipse.ui.views.properties.tabbed.ISelectionConverter</tt> + + + + + + Index: src/org/eclipse/ui/views/properties/tabbed/ISelectionConverter.java =================================================================== RCS file: src/org/eclipse/ui/views/properties/tabbed/ISelectionConverter.java diff -N src/org/eclipse/ui/views/properties/tabbed/ISelectionConverter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/ui/views/properties/tabbed/ISelectionConverter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2006 Oracle. All rights reserved. + * This program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0, which accompanies this distribution and is available at + * http://www.eclipse.org/legal/epl-v10.html. + * + * Contributors: + * Oracle - initial API and implementation + ******************************************************************************/ +package org.eclipse.ui.views.properties.tabbed; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; + + +/** + * Allows property sheet page contributors to convert an ISelection into an + * IStructuredSelection for use by the tabbed properties framework. map the input object type to a + * domain model type. The domain model type is then used for matching against + * the input attribute of the propertySection extension. + *

+ * The selectionConverter will be needed if the selection events given by the property + * sheet page contributor are not IStructuredSelections as is the case for ITextEditors. + *

+ * + * @since 3.3 + * @author Karen Moore + */ + +public interface ISelectionConverter +{ + /** + * Return an IStructuredSelection for the given ISelection + * @param selection + * @return the IStructuredSelection, not null + */ + IStructuredSelection structuredSelection(ISelection selection); +}