Community
Participate
Working Groups
This bug tracks the work to allow facet constraints to conditionally ignore facets not present in the install. The bug this was cloned from was resolved when the IllegalArgumentException was fixed, but the original scenario specified in that bug is still not supported. +++ This bug was initially created as a clone of Bug #186051 +++ I have a plugin that defines a project facet. The definition has constraints which determine when the facet can be used. This facet definitions needs to work when just WST without JST is installed and when both WST and JST are available. Below is the facet definition <extension point="org.eclipse.wst.common.project.facet.core.facets"> <project-facet id="dojo"> <label>Dojo</label> <category>atf.category</category> <description>Adds support for developing Ajax web applications with the Dojo toolkit.</description> </project-facet> <project-facet-version facet="dojo" version="1.0"> <constraint> <or> <and> <requires facet="jst.web" version="[2.2"/> <requires facet="jst.java" version="[1.3"/> </and> <and> <requires facet="wst.web" version="[1.0"/> </and> </or> </constraint> </project-facet-version> <action type="install" facet="dojo" version="1.0"> <delegate class="org.eclipse.atf.personality.dojo.facet.DojoFacetInstallDelegate"/> </action> <action type="uninstall" facet="dojo" version="1.0"> <delegate class="org.eclipse.atf.personality.dojo.facet.DojoFacetUninstallDelegate"/> </action> </extension> If only WST is installed, when attempting to create a "Static Web Project" (New>>Project>>Web>>Static Web Project) the following error is returned. Problem Opening Wizard: The selected wizard could not be started. The problem is caused by the following two lines in the constraint definition (when only WST is installed). I'm assuming that this is because the facets don't exists. <requires facet="jst.web" version="[2.2"/> <requires facet="jst.java" version="[1.3"/> If I remove the two lines or install JST the problem goes away. I'm trying to have one facet definition that works when either WST or both WST and JST are installed. A work around for this problem would be helpful. I'm testing using a WTP 2.0 M6 build and importing the WST or WST/JST plugins into a runtime workspace until an official WST only build is available,
My current thinking is that this scenario will be supported via the following syntax: <project-facet-version facet="dojo" version="1.0"> <constraint> <or> <and options="IGNORE_ON_UNDEFINED_FACET"> <requires facet="jst.web" version="[2.2"/> <requires facet="jst.java" version="[1.3"/> </and> <and> <requires facet="wst.web" version="[1.0"/> </and> </or> </constraint> </project-facet-version>
Past the api-freeze at this point, so postponing.
Made two improvements to support the scenario described here. First, when a problem is encountered in a constraint expression, the framework will try to retain as much of the remaining expression as possible rather than ignoring the whole expression. Currently, the only case that is supported like this is when the problem is in one of the branches of an OR operand. In that case, only the problematic branch will be removed. The rest of the constraint will remain. Second, it is now possible to instruct the framework to ignore (rather than log) certain types of problems in certain specific cases. This is accomplished via the new ignore-problems attribute that can be added to the constraint element or any of it's child elements. Here is a quote from the extension point schema docs: ignore-problems Used to control how the framework reports problems when the entities referenced by this constraint are not defined. When a problem is encountered, the framework will prune the constraint expression in a way that maintains as much of the expression as possible while removing the part that has the problem. For instance, if a problem is found in one branch of an OR expression, only that branch is removed. Once the problem has been handled, the framework will (by default) log an error with information about the problem. The framework can be told not to log anything in specific circumstances by using the ignore-problems attribute. If the ignore-problems attribute is specified at multiple levels in the constraint expression, the one that's closest to the source of the problem takes affect. Currently, the following rules are supported. Multiple rules can be specified by separating them with a comma. The master "not-defined" rule is a short hand notation for specifying all of the *-not-defined rules at the same time. not-defined facet-not-defined facet-version-not-defined group-not-defined Released these changes to the 3.1 M6 code stream.
*** Bug 297736 has been marked as a duplicate of this bug. ***