Community
Participate
Working Groups
Build Identifier: 3.6.0 [I20100608-0911] Currently the CDT Build Option Settings page supports a limited number of field-editors which are displayed based on the valueType of the underlying build-option. This patch allows to contribute a custom field-editor for an option. The patch adds two new optional attributes to the <option> element in the buildDefinitions extension-point. The 'fieldEditor' attribute specifies the class of the field-editor implementation. The 'fieldEditorExtraArgument' allows the contributor to specify a free-form string argument to the field-editor (we use this to specify encoded XML meta-data to further parameterize our custom field-editor). If the two optional extension-point attributes aren't specified, CDT defaults to the old behaviour. The custom field-editor itself also has a programmatic way to "abort" itself, and default to the original behaviour (through returning 'false' in the ICustomBuildOptionEditor.init() method). The managedbuild model (IOption class) stores the field-editor as the IConfigurationElement in order not to introduce any unnecessary dependencies on JFace. The field-editor itself is instantiated only from the UI layer. Reproducible: Always Steps to Reproduce: N/A.
Created attachment 175261 [details] Workspace patch - applies to HEAD.
Created attachment 186838 [details] Updated patch - applies to HEAD
In reply to comment #0) > The managedbuild model (IOption class) stores the field-editor as the > IConfigurationElement in order not to introduce any unnecessary dependencies on > JFace. The field-editor itself is instantiated only from the UI layer. In general I support the idea of adding custom editors for options. I think this aspect of the patch needs to be reworked though. IConfigurationElements are not supposed to be long-lived objects so you shouldn't be using them as handles. Also, since you are contributing UI it doesn't make sense to contribute the editor itself in the core plugin, it really ought to be in the UI plugin. I think a better way to do this would be for there to be an option editor extension point in managedbuilder.ui. Contributions to that point would allow one to specify an option editor and a mandatory string ID. Then the Option element in the buildDefinitions in managedbuilder.core could optionally specify the string ID of the editor it should use. That way there are no UI APIs bleeding through into the core. At the time the UI is generated, the Option's editor ID would be consulted to see if a special editor should be instantiated, and instantiate it as necessary.
Created attachment 188093 [details] Updated patch - applies to HEAD Chris, Thanks for looking into this. I've uploaded an updated patch incorporating your feedback. In summary, I've added a new extension-point - "org.eclipse.cdt.managedbuilder.ui.buildDefinitionsUI". I gave it a generic name, "buildDefinitionsUI", in case if anyone in the future needs to add any other UI contributions with the need to reference them from the core.buildDefinitions extension-point. And also to give this new extension-point a logical connection to the core.buildDefinitions extension-point. Just as before, the custom field-editor still gets instantiated only at the point when the dialog page is rendered on the UI thread. Let me know if you have any other comments. Thanks!
Comment on attachment 188093 [details] Updated patch - applies to HEAD Applied to HEAD. Thanks.
Marking FIXED.
*** cdt cvs genie on behalf of crecoskie *** Bug 320949 - Add ability to contribute custom field-editor GUI to the Build Option Settings page [*] IOption.java 1.31 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java?root=Tools_Project&r1=1.30&r2=1.31 [*] Option.java 1.52 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java?root=Tools_Project&r1=1.51&r2=1.52 [*] OptionReference.java 1.39 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java?root=Tools_Project&r1=1.38&r2=1.39 [*] buildDefinitions.exsd 1.48 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd?root=Tools_Project&r1=1.47&r2=1.48 [*] plugin.properties 1.70 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/plugin.properties?root=Tools_Project&r1=1.69&r2=1.70 [*] plugin.xml 1.134 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/plugin.xml?root=Tools_Project&r1=1.133&r2=1.134 [+] buildDefinitionsUI.exsd http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/schema/buildDefinitionsUI.exsd?root=Tools_Project&revision=1.1&view=markup [*] BuildOptionSettingsUI.java 1.25 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/BuildOptionSettingsUI.java?root=Tools_Project&r1=1.24&r2=1.25 [+] ICustomBuildOptionEditor.java http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ICustomBuildOptionEditor.java?root=Tools_Project&revision=1.1&view=markup