Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 254790

Summary: User should be able to disable library configuration for a facet
Product: [WebTools] WTP Common Tools Reporter: Konstantin Komissarchik <konstantin>
Component: Faceted Project FrameworkAssignee: Konstantin Komissarchik <konstantin>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: gerry.kessler, paul.fullbright
Version: 3.1Keywords: plan
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Konstantin Komissarchik CLA 2008-11-10 15:02:46 EST
In order to support cases where user wants to take full control over configuring libraries for a facet and to not stand in the way of use cases that we have not anticipated, the Library Provider Framework should let the user to opt-out of configuring libraries for a facet.

This feature is to be implemented via a checkbox above the current library configuration UI. The framework should allow the controlling facets to control the text of warning.
Comment 1 Konstantin Komissarchik CLA 2008-11-13 18:32:29 EST
After thinking about this scenario some more, I ended up backing off from the dedicated checkbox idea and instead going with making a no-op library provider available for facets to register. The main reason for my change of opinion regarding the checkbox is that disabling library configuration should be a very infrequent scenario, but having a prominent checkbox would place this option in plain sight of users who will very likely not care about this option. This doesn't fit well with the goal of making this possible, but not emphasizing this option.

The no-op library provider has "Disable Library Configuration" as the default label and is configured by default with priority of -1000 (placing it fairly reliably at the bottom of the library providers list). The declaration of the "no-op-library-provider" in the framework is marked abstract. In order to use this for a particular facet, a derived library provider declaration needs to be added. The derived declaration should constrain enablement based on a facet. Besides the constraint, the derived declaration needs to provide a "message" parameter and optionally a "warning" parameter. The message parameter should include text that will appear directly beneath the library type combo when the no-op provider is selected. The warning parameter should be self-explanatory. The text will typically appear in the banner area of the panel's container.

Here is an example of the derived declaration for the JPA facet:

<extension point="org.eclipse.jst.common.project.facet.core.libraryProviders">
  <provider id="jpa-no-op-library-provider" extends="no-op-library-provider">
    <param name="message" value="%noOpLibraryProviderMessage"/>
    <param name="warning" value="%noOpLibraryProviderWarning"/>
    <enablement>
      <with variable="requestingProjectFacet">
        <test 
          property="org.eclipse.wst.common.project.facet.core.projectFacet"
          value="jpt.jpa" forcePluginActivation="true"/>
      </with>
    </enablement>
  </provider>
</extension>

noOpLibraryProviderWarning = Library configuration is disabled. Further classpath changes may be required later.

noOpLibraryProviderMessage = This facet requires JPA implementation library to be present on project classpath. By disabling library configuration, user takes on responsibility of configuring classpath appropriately via alternate means.

Released framework changes to the 3.1 M4 build stream.
Comment 2 Paul Fullbright CLA 2008-11-14 11:37:48 EST
I like this better as well.