Programatically modify Files in a Deliver Operation
I am looking to be able to automatically modify files that are being delivered. I have code that runs as a precondition that looks at every file being delivered and makes the changes to the IFiles that are in the ChangeSets.
The problem I am having is getting the changes the precondition makes back in to the deliver.
When I run a test Delivery the precondition fires and makes the changes to the file successfully, however the delivery continues on with the old files instead of the newly modified files. How do I get the changes to make it through to the delivery. The local files do reflect the changes made by the precondition but those changes aren't reflected in the files that are on the server after a deliver is made.
How would I get the changes to stick?
Also this is a Client Side plugin
The problem I am having is getting the changes the precondition makes back in to the deliver.
When I run a test Delivery the precondition fires and makes the changes to the file successfully, however the delivery continues on with the old files instead of the newly modified files. How do I get the changes to make it through to the delivery. The local files do reflect the changes made by the precondition but those changes aren't reflected in the files that are on the server after a deliver is made.
How would I get the changes to stick?
Also this is a Client Side plugin
5 answers
The short answer is that you would need to check the changes in to get
them to "stick". However, this may not be possible in the context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor. The
copyright is then added and the user must check in the change and retry
the deliver. This is a bit safer, IMHO, than the way you suggest as the
user has a chance to inspect the changes before they are delivered.
Michael
jackdhall wrote:
them to "stick". However, this may not be possible in the context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor. The
copyright is then added and the user must check in the change and retry
the deliver. This is a bit safer, IMHO, than the way you suggest as the
user has a chance to inspect the changes before they are delivered.
Michael
jackdhall wrote:
I am looking to be able to automatically modify files that are being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.
The problem I am having is getting the changes the precondition makes
back in to the deliver.
When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes aren't
reflected in the files that are on the server after a deliver is
made.
How would I get the changes to stick?
Ok I understand. How would I go about Implementing a QuickFix? I know I need to create my own Resolution Delegate, but after looking at InsertRequiredTextResolutionDelegate.class and RequiredContentAdvisor.class I am still unsure about how to accomplish this.
Thanks, Jack
Thanks, Jack
The short answer is that you would need to check the changes in to get
them to "stick". However, this may not be possible in the context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor. The
copyright is then added and the user must check in the change and retry
the deliver. This is a bit safer, IMHO, than the way you suggest as the
user has a chance to inspect the changes before they are delivered.
Michael
jackdhall wrote:
I am looking to be able to automatically modify files that are being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.
The problem I am having is getting the changes the precondition makes
back in to the deliver.
When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes aren't
reflected in the files that are on the server after a deliver is
made.
How would I get the changes to stick?
Jack,
I don't know much about that area but if you loasd the source code for
RTC, there are some examples of this in the
com.ibm.team.filesystem.ide.ui plug-in. Have a look at the subclasses of
AbstractFileAdvisor.
Michael
jackdhall wrote:
I don't know much about that area but if you loasd the source code for
RTC, there are some examples of this in the
com.ibm.team.filesystem.ide.ui plug-in. Have a look at the subclasses of
AbstractFileAdvisor.
Michael
jackdhall wrote:
Ok I understand. How would I go about Implementing a QuickFix? I know
I need to create my own Resolution Delegate, but after looking at
InsertRequiredTextResolutionDelegate.class and
RequiredContentAdvisor.class I am still unsure about how to
accomplish this.
Thanks, Jack
Michael Valentawrote:
The short answer is that you would need to check the changes in to
get
them to "stick". However, this may not be possible in the
context of a
deliver operation. The RTC team process does a similar things with
copyrights but it works this way. If the copyright is missing from a
file, the team process prevents the deliver and gives the user the
option to add the copyrights by clicking a link in the Team advisor.
The
copyright is then added and the user must check in the change and
retry
the deliver. This is a bit safer, IMHO, than the way you suggest as
the
user has a chance to inspect the changes before they are delivered.
Michael
jackdhall wrote:
I am looking to be able to automatically modify files that are
being
delivered. I have code that runs as a precondition that looks at
every file being delivered and makes the changes to the IFiles that
are in the ChangeSets.
The problem I am having is getting the changes the precondition
makes
back in to the deliver.
When I run a test Delivery the precondition fires and makes the
changes to the file successfully, however the delivery continues on
with the old files instead of the newly modified files. How do I
get
the changes to make it through to the delivery. The local files do
reflect the changes made by the precondition but those changes
aren't
reflected in the files that are on the server after a deliver is
made.
How would I get the changes to stick?
Ok I got it working. You need to create a delegate that implements IAdvisorProblemResolutionDelegate. This delegate will be the code that runs when your quickfix is applied. To get your quickfix to be recognized you need to add the following lines to your plugin.xml file:
After that when you add your error in your IOperationAdvisor you need to make sure that you set the problemType to be the same thing in you plugin.xml. Such as this,
If you do that then when your precondition sets up the error then your resolution delegate should show up as a quick fix.
</extension>
<Add>
<extension>
<advisorProblemResolution>
</advisorProblemResolution>
</extension>
After that when you add your error in your IOperationAdvisor you need to make sure that you set the problemType to be the same thing in you plugin.xml. Such as this,
IAdvisorInfoCollector collector;
IAdvisorInfo info = collector.createProblemInfo(summary, desc, "MyError");
collector.addInfo(info);
If you do that then when your precondition sets up the error then your resolution delegate should show up as a quick fix.