It's all about the answers!

Ask a question

Usage of the Extension Point - Build Result Delete Participants

Steve White (4021213) | asked Aug 09 '13, 11:54 a.m.
I have published a custom contribution to the build result and also have a contribution provider so it appears in the Build Results view in its own tab(it retreives a zip file via ftp from a host, unzips it locally and formats the files for viewing). The file is too large to store as a contribution as discussed in my other forum questions. That all works great, no issues with that part.
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
            <requiredService interface=""/>

provided in the sample that it is not a legal tag for extensionService so I removed it.

name="zBuild Files"/>

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

permanent link
Nick Edgar (6.5k711) | answered Aug 13 '13, 8:54 p.m.
edited Aug 13 '13, 8:58 p.m.
Is there a way to add a custom action off the context menu for a build result? 
Yes, some of Build's own actions are contributed in this way, e.g. the plugin.xml for has:
   <extension point="org.eclipse.ui.popupMenus">

Nick Edgar commented Aug 13 '13, 9:07 p.m.

Please ignore br tags that were randomly inserted by the forum software.

Steve White commented Aug 21 '13, 10:41 a.m.

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 White commented Aug 21 '13, 11:01 a.m.

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

Nick Edgar commented Aug 22 '13, 11:45 a.m.

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="".

Nick Edgar commented Aug 22 '13, 1:03 p.m.

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.

permanent link
Nick Edgar (6.5k711) | answered Aug 13 '13, 8:50 p.m.
Hi Steve, the issue is likely due to adding the delete participant extension in the same plugin as the UI extension.  The delete participants extension point is server-side, not UI, JBE or other client-side.  I would expect your Eclipse error log to contain an entry complaining about an unknown extension point.

A delete participant extension is called some time after the build gets deleted, when the build result pruner background task runs (by default it's every 15 mins). When a build (IBuildResult) is deleted, it just marks its associated contributions (IBuildResultContributions item) for deletion, which the pruner task discover when it runs.  If the item has any contributions matching a delete participant extension, the extension is called to clean them up.

As for cleaning up the file associated with the build, if the file was published to the build result using own of the publishing Ant tasks (filePublisher, artifactFilePublisher, logPublisher) then its content is described by an IContent associated with the BuildResultContribution.  These get cleaned up automatically when the referencing item is deleted.  The external file on the FTP site would still need to be deleted, of course.  

See the extensions workshop article for more on developing / deploying server-side plugins.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.