Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 156928 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java (-1 / +15 lines)
Lines 23-28 Link Here
23
import org.eclipse.core.runtime.IConfigurationElement;
23
import org.eclipse.core.runtime.IConfigurationElement;
24
import org.eclipse.core.runtime.IStatus;
24
import org.eclipse.core.runtime.IStatus;
25
import org.eclipse.jface.viewers.IStructuredSelection;
25
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.ui.IPluginContribution;
26
import org.eclipse.ui.WorkbenchException;
27
import org.eclipse.ui.WorkbenchException;
27
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
28
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
28
import org.eclipse.ui.internal.navigator.extensions.INavigatorContentExtPtConstants;
29
import org.eclipse.ui.internal.navigator.extensions.INavigatorContentExtPtConstants;
Lines 37-43 Link Here
37
 * 
38
 * 
38
 * @since 3.2
39
 * @since 3.2
39
 */
40
 */
40
public class CommonWizardDescriptor implements INavigatorContentExtPtConstants {
41
public class CommonWizardDescriptor implements INavigatorContentExtPtConstants, IPluginContribution {
41
	
42
	
42
	/** The default menu group id for commonWizards without a menuGroupId attribute. */
43
	/** The default menu group id for commonWizards without a menuGroupId attribute. */
43
	public static final String DEFAULT_MENU_GROUP_ID = "all-uncategorized"; //$NON-NLS-1$
44
	public static final String DEFAULT_MENU_GROUP_ID = "all-uncategorized"; //$NON-NLS-1$
Lines 243-246 Link Here
243
		return "CommonWizardDescriptor["+getId()+", wizardId="+getWizardId()+"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
244
		return "CommonWizardDescriptor["+getId()+", wizardId="+getWizardId()+"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
244
	}
245
	}
245
246
247
	/* (non-Javadoc)
248
	 * @see org.eclipse.ui.IPluginContribution#getLocalId()
249
	 */
250
	public String getLocalId() {
251
		return getId();
252
	}
253
	
254
	/* (non-Javadoc)
255
	 * @see org.eclipse.ui.IPluginContribution#getPluginId()
256
	 */
257
	public String getPluginId() {
258
        return (configElement != null) ? configElement.getNamespaceIdentifier() : null;
259
	}
246
}
260
}
(-)src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptorManager.java (-9 / +11 lines)
Lines 20-25 Link Here
20
20
21
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IConfigurationElement;
22
import org.eclipse.ui.WorkbenchException;
22
import org.eclipse.ui.WorkbenchException;
23
import org.eclipse.ui.activities.WorkbenchActivityHelper;
23
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
24
import org.eclipse.ui.internal.navigator.NavigatorPlugin;
24
import org.eclipse.ui.internal.navigator.extensions.NavigatorContentRegistryReader;
25
import org.eclipse.ui.internal.navigator.extensions.NavigatorContentRegistryReader;
25
import org.eclipse.ui.navigator.INavigatorContentService;
26
import org.eclipse.ui.navigator.INavigatorContentService;
Lines 117-123 Link Here
117
					.next();
118
					.next();
118
119
119
			if (isVisible(aContentService, descriptor)
120
			if (isVisible(aContentService, descriptor)
120
						&& descriptor.isEnabledFor(anElement)) {
121
					&& descriptor.isEnabledFor(anElement)) {
121
				descriptorIds.add(descriptor.getWizardId());
122
				descriptorIds.add(descriptor.getWizardId());
122
			}
123
			}
123
		}
124
		}
Lines 154-160 Link Here
154
					.next();
155
					.next();
155
156
156
			if (isVisible(aContentService, descriptor)
157
			if (isVisible(aContentService, descriptor)
157
						&& descriptor.isEnabledFor(anElement)) {
158
					&& descriptor.isEnabledFor(anElement)) {
158
				descriptors.add(descriptor);
159
				descriptors.add(descriptor);
159
			}
160
			}
160
		}
161
		}
Lines 168-180 Link Here
168
	 * @return True if the descriptor is visible to the given content service.
169
	 * @return True if the descriptor is visible to the given content service.
169
	 */
170
	 */
170
	private boolean isVisible(INavigatorContentService aContentService, CommonWizardDescriptor descriptor) {
171
	private boolean isVisible(INavigatorContentService aContentService, CommonWizardDescriptor descriptor) {
171
		return (aContentService == null || 
172
		return !WorkbenchActivityHelper.filterItem(descriptor) && 
172
					(descriptor.getId() == null || 
173
					(aContentService == null || 
173
						(aContentService.isVisible(descriptor.getId()) && 
174
							(descriptor.getId() == null || 
174
							aContentService.isActive(descriptor.getId())
175
									( aContentService.isVisible(descriptor.getId()) && 
175
						)
176
											aContentService.isActive(descriptor.getId())
176
					)
177
									)
177
				);
178
							)
179
					);
178
	}
180
	}
179
  
181
  
180
	private class CommonWizardRegistry extends NavigatorContentRegistryReader {
182
	private class CommonWizardRegistry extends NavigatorContentRegistryReader {
(-)schema/navigatorContent.exsd (-2 / +4 lines)
Lines 319-325 Link Here
319
   <element name="commonWizard">
319
   <element name="commonWizard">
320
      <annotation>
320
      <annotation>
321
         <documentation>
321
         <documentation>
322
            The extension point provides the ability to contribute to the menu defined by type.
322
            Defines a binding between an existing Eclipse New/Import/Export Wizard and a given set of items. Each valid binding determines which menu items will appear in the submenus for New/Import/Export in the context menu of a Common Navigator Viewer. Since Eclipse 3.2.1, the wizard menu items respect Eclipse Capabilities (see &lt;b&gt;org.eclipse.ui.activites&lt;/b&gt; for more information). 
323
&lt;br&gt;&lt;br&gt;
324
All of the following conditions must be met for a &lt;b&gt;commonWizard&lt;/b&gt; item to appear in the menu: (1) The &lt;b&gt;commonWizard&lt;/b&gt; is NOT filtered by an Eclipse Capability, (2) The identifier of the &lt;b&gt;commonWizard&lt;/b&gt; is NOT null, (3) The associated &lt;b&gt;navigatorContent&lt;/b&gt; extension is &lt;i&gt;visible&lt;/i&gt; for the current content service (the content service used to initialize the &lt;code&gt;NavigatorActionService&lt;/code&gt; or supplied to &lt;code&gt;WizardActionGroup&lt;/code&gt;), (4) The associated &lt;b&gt;navigatorContent&lt;/b&gt; extension is &lt;i&gt;active&lt;/i&gt; for the current content service, and (5) The &lt;b&gt;enablement&lt;/b&gt; of the &lt;b&gt;commonWizard&lt;/b&gt; returns true for the current selection that was supplied to the context menu.
323
         </documentation>
325
         </documentation>
324
      </annotation>
326
      </annotation>
325
      <complexType>
327
      <complexType>
Lines 360-366 Link Here
360
         <attribute name="associatedExtensionId" type="string">
362
         <attribute name="associatedExtensionId" type="string">
361
            <annotation>
363
            <annotation>
362
               <documentation>
364
               <documentation>
363
                  A &lt;b&gt;commonWizard&lt;/b&gt; may be defined as the nested child of a &lt;b&gt;navigatorContent&lt;/b&gt; extension point, in which case the &lt;i&gt;associatedExtensionId&lt;/i&gt; is automatically set to the id of its enclosing &lt;b&gt;naviagatorContent&lt;/b&gt; element. However, when specified as a top-level extension, a &lt;b&gt;commonWizard&lt;/b&gt; may indicate an content extension that it should be associated with explicitly. When a &lt;b&gt;commonWizard&lt;/b&gt; is associated with a content extension, it will inherit the &lt;i&gt;visibility&lt;/i&gt; and the &lt;i&gt;activation&lt;/i&gt; of that content extension. 
365
                  A &lt;b&gt;commonWizard&lt;/b&gt; may be defined as the nested child of a &lt;b&gt;navigatorContent&lt;/b&gt; extension point, in which case the &lt;i&gt;associatedExtensionId&lt;/i&gt; is automatically set to the id of its enclosing &lt;b&gt;naviagatorContent&lt;/b&gt; element. However, when specified as a top-level extension, a &lt;b&gt;commonWizard&lt;/b&gt; may indicate an content extension that it should be associated with explicitly. When a &lt;b&gt;commonWizard&lt;/b&gt; is associated with a content extension, it will inherit the &lt;i&gt;visibility&lt;/i&gt; and the &lt;i&gt;activation&lt;/i&gt; of that content extension. It will not inherit the &lt;i&gt;enablement&lt;/i&gt;; so you must specify an &lt;b&gt;enablement&lt;/b&gt; for the wizard menu item to appear.
364
&lt;br&gt;&lt;br&gt;
366
&lt;br&gt;&lt;br&gt;
365
That is, if the content extension is bound to a Common Navigator (see &lt;b&gt;org.eclipse.ui.navigator.viewer/viewerContentBinding&lt;/b&gt;) and the user has the content extension &lt;i&gt;activated&lt;/i&gt; either by default or through the &quot;Available Extensions&quot; dialog, then the &lt;b&gt;commonWizard&lt;/b&gt; menu option would appear. However, when the user &lt;i&gt;deactivates&lt;/i&gt; that content extension, the &lt;b&gt;commonWizard&lt;/b&gt; menu option would no longer be shown in the menu.
367
That is, if the content extension is bound to a Common Navigator (see &lt;b&gt;org.eclipse.ui.navigator.viewer/viewerContentBinding&lt;/b&gt;) and the user has the content extension &lt;i&gt;activated&lt;/i&gt; either by default or through the &quot;Available Extensions&quot; dialog, then the &lt;b&gt;commonWizard&lt;/b&gt; menu option would appear. However, when the user &lt;i&gt;deactivates&lt;/i&gt; that content extension, the &lt;b&gt;commonWizard&lt;/b&gt; menu option would no longer be shown in the menu.
366
&lt;br&gt;&lt;br&gt;
368
&lt;br&gt;&lt;br&gt;

Return to bug 156928