Bug 296728 [CommonNavigator] Problem with enablement on navigatorContent extension point
If I use the enablement node with the expression "WITH", no variable was found because no real context is given. example : <extension point="org.eclipse.ui.navigator.navigatorContent"> <commonWizard type="new" wizardId="com.mywizard"> <enablement> <with variable="activeWorkbenchWindow.activePerspective"> <equals value="com.myperpective"> </equals> </with> </enablement> </commonWizard> make this error : org.eclipse.core.runtime.CoreException: The variable activeWorkbenchWindow.activePerspective is not defined at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:65) at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53) at org.eclipse.core.internal.expressions.EnablementExpression.evaluate(EnablementExpression.java:53) at org.eclipse.ui.internal.navigator.wizards.CommonWizardDescriptor.isEnabledFor(CommonWizardDescriptor.java:145) at org.eclipse.ui.internal.navigator.wizards.CommonWizardDescriptorManager.getEnabledCommonWizardDescriptors(CommonWizardDescriptorManager.java:158) at org.eclipse.ui.navigator.WizardActionGroup.setContext(WizardActionGroup.java:193) at org.eclipse.ui.internal.navigator.resources.actions.NewActionProvider.fillContextMenu(NewActionProvider.java:107) You could do use the currentState of the IEvaluationService. (see WorkbenchWindow line 3035)
bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/wizards/CommonWizardDescriptor.java
* value of the associatedExtensionId
		 *  
		 * Code elsewhere anticipates that this attribute may be null, so there is 
		 * no need to set it to a default non-null value. Indeed, this will cause
		 * incorrect behavior. 
		 * */
		if(id == null) {
			id = configElement.getAttribute(ATT_ASSOCIATED_EXTENSION_ID);
		}
		if (wizardId == null || wizardId.length() == 0) {
			throw new WorkbenchException("Missing attribute: " + 
					ATT_WIZARD_ID + " in common wizard extension: " + 
					configElement.getDeclaringExtension().getNamespaceIdentifier());
		}
		if (type == null || type.length() == 0) {
			throw new WorkbenchException("Missing attribute: " + 
					ATT_TYPE + " in common wizard extension: " + 
					configElement.getDeclaringExtension().getNamespaceIdentifier());
		}
		IConfigurationElement[] children = configElement
				.getChildren(TAG_ENABLEMENT);
		if (children.length == 1) {
			try {
				enablement = ElementHandler.getDefault().create(
						ExpressionConverter.getDefault(), children[0]);
			} catch (CoreException e) {
				NavigatorPlugin.log(IStatus.ERROR, 0, e.getMessage(), e);
			}
		} else if (children.length > 1) {
			throw new WorkbenchException("More than one element: " +