Usage of the Extension Point - Build Result Delete Participants
Now I am attempting to delete the files when the build result is deleted. I want to delete the contribution file(small file with ftp connection info) in the repository attached to the result, the zip file residing on the host via ftp and the locally
unzipped files.
I have written a Build Result Delete Participant, but it doesn't seem to get control at time of delete. It seems via the FAQ page that is by design. That it is only marked for deletion and deleted later? Therefore I cannot do all I want to do? I can only delete the contribution file in the respos?
I modeled this after the CompileContributionDeleteParticipant. But I not actually deleting the file yet, just seeing if it gets control before I implement all the other logic. Can I do what I want to do? Is my coding correct and understanding correct? Also I would like to cause a dialog to pop up during the delete because we also have some user specific options the user can select as to what and how to clean various items form the host that were created via the build process. It seems like that cannot be done with the participant if it indeed runs at a later time.
Are there any other ways to accomplish what I want to do. Is there a way to add a custom action off the context menu for a build result?
Also I get a waring when I code the
<prerequisites>
<requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
</prerequisites>
provided in the sample that it is not a legal tag for extensionService so I removed it.
<plugin>
<extension
point="com.ibm.team.build.ui.requestBuildDialogSections">
<requestBuildDialogSection
class="com.ibm.sdwb.zbuild.rtc.buildengine.ui.editors.ZBuildRequestBuildSectionFactory"
order="300"/>
</extension>
<extension
point="com.ibm.team.build.ui.buildContributionProviders">
<buildContributionProvider
id="com.ibm.sdwb.zbuild.rtc.ui.editors.ZBuildBuildResultContributionProviderDelegate"
class="com.ibm.sdwb.zbuild.rtc.buildengine.ui.editors.ZBuildBuildResultContributionProviderDelegate"
name="zBuild Files"/>
</extension>
<extension
point="com.ibm.team.build.service.buildResultDeleteParticipants">
<buildResultDeleteParticipant
id="com.ibm.sdwb.zbuild.rtc.ui.participants.ZBuildContributionDeleteParticipant">
<extensionService
componentId="com.ibm.team.build"
implementationClass="com.ibm.sdwb.zbuild.rtc.ui.participants.ZBuildContributionDeleteParticipant">
</extensionService>
</buildResultDeleteParticipant>
</extension>
</plugin>
public class ZBuildContributionDeleteParticipant
extends AbstractBuildContributionDeleteParticipant
{
public String[] getContributionTypeIdsOfInterest()
{
return new String[] { "zBuildResult" };
}
/*
* (non-Javadoc) Intentionally not documented. See parent.
*/
protected void doDelete( IBuildResultContribution buildResultContribution )
throws TeamRepositoryException
{
System.out.println( "ZBuildContributionDeleteParticipant::doDelete Entry" );
// ICompileContributionHandle handle = (ICompileContributionHandle)buildResultContribution
// .getExtendedContribution();
IRepositoryItemService repoService = getService( IRepositoryItemService.class );
// try {
// // fetch the compile packages and delete them
// CompileContribution compileContribution = (CompileContribution) repoService.fetchItem(handle,
// new String[] { ICompileContribution.PROPERTY_COMPILE_PACKAGES });
// List<ICompilePackageHandle> packages = compileContribution.getCompilePackages();
// deletePackages(packages, repoService);
// // have to call the base class method to delete the compile
// // contribution itself
// super.doDelete(buildResultContribution);
//
// } catch (ItemNotFoundException exception) {
// // The build result contribution reference an item that does not
// // exist. Ignore it and continue.
// handleItemNotFound(handle, exception);
// }
super.doDelete( buildResultContribution );
System.out.println( "ZBuildContributionDeleteParticipant::doDelete Exit" );
}
2 answers
<extension point="org.eclipse.ui.popupMenus">
...
<objectContribution
adaptable="true"
id="com.ibm.team.build.internal.common.model.dto.IBuildResultRecord"
objectClass="com.ibm.team.build.internal.common.model.dto.IBuildResultRecord">
<action
class="com.ibm.team.build.internal.ui.actions.CancelBuildRequestActionDelegate"
enablesFor="+"
id="com.ibm.team.build.ui.cancelBuildRequestAction"
label="%CancelBuildRequestAction"
menubarPath="buildAdminActions">
<enablement>
<objectState
name="buildState"
value="NOT_STARTED">
</objectState>
</enablement>
</action>
...
Comments
Please ignore br tags that were randomly inserted by the forum software.
Nick, thnx, I've been able to add a custom action, but I have an additional question based on that. I'm thinking I'd rather associate this to the View like the "Delete" action vs the BuildResult object and use the "viewContribution" tag. I have located the delete action class in the sdk DeleteBuildResultActionDelegate, but I cannot locate the BuildResults View class to reference in the xml. Also I cannot locate the plugin.xml files in the sdk, so if you can either point me to where I can find the plugin.xml files or paste it here that would be great.
-Steve
Nick, is the view class "BuildQueryView" ? I see that in the sdk and it appears that is the src code for what I was calling the BuildResults View
Yes, that's the view class, but the id for the menu to contribute to is different. In the plugin.xml for the UI plugin, we actually contribute the delete action using a viewer contribution, using targetID="com.ibm.team.build.ui.queryViewContextMenu".
re "Also I cannot locate the plugin.xml files in the sdk", the SDK just has the Java sources, which are intended to be "mixed in" to a target platform (e.g. P2 repository) containing the "binary" plugins you're compiling against. For any of the client-side/UI plugins, you can also check your RTC Eclipse install under eclipse/plugins.