Bug 116138 - [validation] Excess builders re-added and enabled when already exists and disabled (validationBuilder)
Summary: [validation] Excess builders re-added and enabled when already exists and dis...
Status: NEW
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: 0.7.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: Salvador Zalapa CLA
QA Contact: Carl Anderson CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2005-11-13 10:37 EST by Darryl Miles CLA
Modified: 2011-01-19 14:29 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darryl Miles CLA 2005-11-13 10:37:10 EST
wtp-sdk-I200511111814

I have in some projects disabled the validation builder, and a new instance of
the validation builder got added and enabled (not sure when or how).

I am also unable to click the Remove button to remove the excess builders or the
new enabled one, due to the Remove button being inactive/greyed out.  When I
click the checkbox to enable a builder.


I would guess the problem is the way in which builders are retained when they
are disabled, a simple lookup of the name is not possible anymore.  Maybe a new
enabled/disable element should be added to the <buildCommand> rather than
pushing the builder config to ExternalToolBuilder.

I think an API method should be available for looking up if a specific builder
is already set on the project, no matter if it has been enabled or disabled. 
This might be something WTP uses on top of org.eclipse.jem that understands how
to lookup a disabled builder.

Currently the API method
org.eclipse.jem.util.emf.workbench.ProjectUtilities#hasBuilder() exists which
components are using to find out if their builder is already setup on the
project.  This does not detect the case where the builder exists but disabled
due to the renaming into ExternalToolBuilder.

So the builder adds another instance to the builder, which is now enabled, then
things start to go wrong with the properties page handling.

I dont think this problem only affect validationBuilder but all builders.


This is how a enabled builder looks in the .project config:

<buildCommand>                       
<name>org.eclipse.wst.validation.validationbuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>



This is how a disabled builder looks in the .project config:


<buildCommand>                       
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
                        <triggers>full,incremental,</triggers>
                        <arguments>
                                <dictionary>
                                        <key>LaunchConfigHandle</key>
                                       
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch</value>
                                </dictionary>
                        </arguments>
                </buildCommand>
Comment 1 Darryl Miles CLA 2009-01-28 12:56:35 EST
This really isn't that complicated.

 * Take a lock on the per-project builder list (if necessary)
 * Iterate over the list of existing builders (to check to see if the current builder is already in the list)
 * If it is remove it from the list
 * Now add the current builder again (at the end of the list presumably)

I'm saying it should be Eclipse API to provide some basic safe guards to probably invalid usage and that adding the same builder twice is invalid.