Build property editors extension point
Basically, I want to provide a richer editing experience for build properties, I want to:
Display a list/combo of all of our available properties so that you can pick one.
Based on what you've picked display some relevant ui to allow you to select a value. So, for example, a project navigator/picker for one of our properties that requires the name of a project.
Unfortunately, from poking around with a basic implementation, this extension point doesn't quite seem to give me enough capability to achieve this.
The com.ibm.team.build.ui.buildPropertyEditors extension point seems to let me contribute a new type of property, which is displayed in the "Add Build Property - select property type" dialog. When that is selected the "edit" button on the next dialog then launches my contributed class/ui.
I would prefer to be able to contribute an entirely new edit dialog, after the user has selected my contributed property type, is this possible?
If not, I was hoping I could work around it. When the edit button is clicked my class gets a call back and I can launch my own dialog. If I do not have the ability to control the previous dialog, then I would like to let the user have the ability to change the name/description/value of the property from my dialog.
All my contribution has access to is an IBuildPropertyEditorContext, which then gives an IBuildProperty. When I set the name/description/value on the IBuildProperty and close my dialog only the changes to property value are reflected in the edit dialog.
Is there any way to force all the changes to the property object to be honoured?
2 answers
in com.ibm.team.build.ui's plugin.xml:
<extension
point="com.ibm.team.build.ui.requestBuildDialogSections">
<requestBuildDialogSection
class="com.ibm.team.build.internal.ui.dialogs.ScmOptionsSection$Factory"
order="100"/>
...
</extension>
----
import com.ibm.team.build.ui.dialogs.requestbuild.IRequestBuildSectionFactory;
import com.ibm.team.build.ui.dialogs.requestbuild.RequestBuildSection;
import com.ibm.team.build.ui.dialogs.requestbuild.RequestBuildSectionSite;
public class ScmOptionsSection extends RequestBuildSection {
/**
* Factory interface for creating the section.
*/
public static class Factory implements IRequestBuildSectionFactory {
public RequestBuildSection createRequestBuildSection(RequestBuildSectionSite site) {
return new ScmOptionsSection(site);
}
}
The site object gives access to the containing context of the request dialog:
public ScmOptionsSection(RequestBuildSectionSite site) {
super(site);
}
You can create your own SWT controls under the given section control:
@Override
protected void createSectionContent(Section section) {
...
}
The initialize method is called in the background and lets you fetch info from the repository, based on request/definition info from the section's site:
@Override
public void initialize(IProgressMonitor monitor) {
if (getSite().isRebuild()) {
setPersonalBuildWorkspace(getWorkspace(getSite().getBuildRequest(), monitor));
setComponentLoadRules(getComponentLoadRules(getSite().getBuildRequest(), monitor));
} else {
setPersonalBuildWorkspace(getPersistedWorkspace(getSite().getBuildDefinition(), monitor));
setComponentLoadRules(getComponentLoadRules(getSite().getBuildDefinition(), monitor));
}
}
You can validate fields and add error/warning messages via site API:
@Override
public boolean validate2() {
...
if (isBuildWorkspacePrivate) {
getSite().addWarningMessage(
BuildUIDialogMessages.ScmOptionsSection_WARNING_MESSAGE_PRIVATE_BUILD_WORKSPACE,
BuildUIDialogMessages.ScmOptionsSection_WARNING_MESSAGE_PRIVATE_BUILD_WORKSPACE);
} else {
getSite().removeWarningMessage(
BuildUIDialogMessages.ScmOptionsSection_WARNING_MESSAGE_PRIVATE_BUILD_WORKSPACE);
}
...
}
I hope this gives a general idea of how one can add a section to the build request dialog in the Eclipse UI. The web UI has a similar extension point.
Comments
kathleen sharp
Aug 22 '12, 10:47 a.m.Hi, I didn't like the way this extension point worked - it seemed like a pretty bad user experience. I ended up using the build section extension point instead, and added a new section for my rich properties, with some richer UI. com.ibm.team.build.ui.requestBuildDialogSections
1 vote
Liora Milbaum
Aug 26 '12, 5:04 a.m.Thanks. I'll look into it. Did you find info regarding how to start developing an extension for RTC?
Nick Edgar
JAZZ DEVELOPER Aug 31 '12, 3:53 p.m.Liora, please see https://jazz.net/wiki/bin/view/Main/WebHome?topic=RtcSdk30