Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Subversive » Extension of Subversive-Plug-In(Coding additional commitment-action to the subversive-plug-in)
Extension of Subversive-Plug-In [message #557924] Thu, 09 September 2010 12:40 Go to next message
JC Temp is currently offline JC TempFriend
Messages: 7
Registered: September 2010
Junior Member
Hi @ all,

I'm using the Subversive-plugIn for Eclipse to check in/out code to and from my subversion-repository.

Beside the subversive-history I have got an own historyfile on a server (System i) which I have to edit everytime I commit a java-source. To improve the usability of the plugIn I've started to implemet a data-interchange into that plugIn, using the "commit" exit point.

Therefore I had to extend some classes and manipulate them. I don't like that solution because it is very rude. And finally I stuck at the point where I can retrieve information about comitted resources.

So here are my questions:
- I use the extension-point "commit". How can I write my own (initial) text into the comment-text-box?
- After hitting the OK-button to commit my sources to the repository I need to know which java-files were commited and wheather they were added/deleted/changed/... The version of the source is important too. How can I get this information?

The methods where I want to perform some "actions" are the implemented methods getCommitDialog and performAfterCommitTasks of the interface ICommitActionFactory (inside an own new class).

I've found out that the commit-panel (the text is transfered as parameter into the commit-panels constructor) is already created when the exit is called. And therefore it's to late to write an individual text into the comment-text-box.

Are there some other exits which I can use to continue my implementation?

Thank you!
Re: Extension of Subversive-Plug-In [message #558280 is a reply to message #557924] Fri, 10 September 2010 19:15 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 123
Registered: July 2009
Senior Member
Hi,

This is one of the extension points that were initially developed for the specific project and later were shared "as is". So, there is some room for improvement and we will appreciate your suggestions on this topic.

Currently this extension point allows you to:
1) customize commit message after "Ok" button is pressed
2) customize Commit operation (i.e. add some depended actions). Those actions could fetch committed revisions information from the IRevisionProvider interface (but still there is no information about additions, deletions etc.)
Re: Extension of Subversive-Plug-In [message #558504 is a reply to message #558280] Mon, 13 September 2010 09:48 Go to previous messageGo to next message
JC Temp is currently offline JC TempFriend
Messages: 7
Registered: September 2010
Junior Member
Hi,

first of all, thank's for your fast reply.

When you open the commit-dialog there is shown a table with all modified sources you want to commit.
This table contains a column named "Content". How do you fill the cells of this column? How can I get that information?

Would it be possible to enhance some of the subversive-classes, so you could put it into subversive default inplementation in the future?
Re: Extension of Subversive-Plug-In [message #558849 is a reply to message #558504] Tue, 14 September 2010 15:33 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 123
Registered: July 2009
Senior Member
Both columns ('Content' and 'Properties') shows change type for the resource content or its properties appropriately.
This information is provided to the resources table through the ITableLabelProvider interface. Concrete status values are obtained through Subversive API:
ILocalResource local = SVNRemoteStorage.instance().asLocalResource(resource);
contentStatus = local.getTextStatus();
propertyStatus = local.getPropStatus();

Regarding changes in Subversive code - everything is possible. Smile
But important matter is what are those changes you want to see? If those will be helpful for the Subversive project and people who uses this plug-in - why not? Smile
Re: Extension of Subversive-Plug-In [message #559444 is a reply to message #558849] Thu, 16 September 2010 15:47 Go to previous messageGo to next message
JC Temp is currently offline JC TempFriend
Messages: 7
Registered: September 2010
Junior Member
Yeehaw, that works! Wink

Ok, now all changes are made and I got all information I need for my little extra action.

I've changed these classes/files:
- ICommitActionFactory (new methods)
- CommitAction (calling a new exit from here)
- DefaultCommitActionFactory (implements new methods from ICommitActionFactory)
- CommitOperation (the 2nd new exit is called from here)
- MANIFEST.MF of the svn-core jar (needs two additional imports)

So, how do you want to check the code? May I send you a zipped file with all changes? Via this forum or mail?
Re: Extension of Subversive-Plug-In [message #560076 is a reply to message #557924] Tue, 21 September 2010 07:05 Go to previous messageGo to next message
JC Temp is currently offline JC TempFriend
Messages: 7
Registered: September 2010
Junior Member
After a few tests I had to change three more classes:
- ShareProjectWizard
- OverrideAndCommitModelActionHelper
- CommitActionHelper

All these classes got similar changes to the class CommitAction.
They needed one of the new exits...
Re: Extension of Subversive-Plug-In [message #630635 is a reply to message #557924] Mon, 04 October 2010 12:59 Go to previous messageGo to next message
JC Temp is currently offline JC TempFriend
Messages: 7
Registered: September 2010
Junior Member
Hi it's me again,

so now all changes were made and the plugIn works fine.

What's about the implementation into default? Do you want to take a look into the sources? What are the next steps?
Re: Extension of Subversive-Plug-In [message #631894 is a reply to message #557924] Sun, 10 October 2010 07:44 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 123
Registered: July 2009
Senior Member
Hi,

In that case we need to review the code and discuss changes with you if it is required.
So, you can create a *.patch file which contains all the changes you have made and send it to us.

P.S.
You can send patch directly to my mailbox: alexander<dot>gurov<at>polarion<dot>com.
Re: Extension of Subversive-Plug-In [message #1701017 is a reply to message #631894] Wed, 08 July 2015 16:23 Go to previous messageGo to next message
chacho chacho is currently offline chacho chachoFriend
Messages: 2
Registered: July 2015
Junior Member
Hello Alexander,

First, thank you for your answers.

You said "customize Commit operation (i.e. add some depended actions).".
I'm trying to find the new revision number. I'm in the postcomit method. Is it possible ?

Thank you and excuse me for the bad english...
Re: Extension of Subversive-Plug-In [message #1705665 is a reply to message #1701017] Tue, 18 August 2015 09:01 Go to previous message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 123
Registered: July 2009
Senior Member
Hello !

There is the ICommitActionFactory interface which provides the following method:

/**
* The method allows customizing of the Commit Operation
* @param operation prepared Commit operation
* @param revisionProvider committed revision provider
* @param dependsOn dependencies which can prevent commit operation execution in case of failure
* @param part workbench part which will be used to interact with user
*/
public void performAfterCommitTasks(CompositeOperation operation, IRevisionProvider revisionProvider,
IActionOperation[] dependsOn, IWorkbenchPart part);

So, in general case you should do the following:
1) implement your own operation and add it into the common execution context (since commit itself is asynchronous)
2) in the run method of the implemented operation you should ask IRevisionProvider for committed revisions.
3) if you need to proceed only if commit is succeeded, then please use the dependsOn parameter while adding your own operation in order to prevent its execution if commit wasn't performed either.

There is a sample method from tests you may use as a reference:

public void performAfterCommitTasks(CompositeOperation operation, final IRevisionProvider revisionProvider, IActionOperation[] dependsOn, IWorkbenchPart part) {
// very simple way to get after-commit revisions, if it's not enough then intercepting calls will do (see above)
operation.add(new AbstractActionOperation("SomeOp" /*the key for NLS message from the second parameter*/, SVNMessages.class /* I don't like this parameter very much, so I'll think of what to do with it later on*/) {
protected void runImpl(IProgressMonitor monitor) throws Exception {
// process post commit revisions here....
revisionProvider.getRevisions();
}
}, dependsOn);
}

Please feel free to ask if there is still questions you want to clarify.

P.S.

I have a complete test project, so I'll just share it here (that is where the method implementation sample comes from).

Best regards,
Alexander Gurov,
Subversive Team.

[Updated on: Tue, 18 August 2015 09:04]

Report message to a moderator

Previous Topic:file modified time
Next Topic:Revision number in performAfterCommitTasks method
Goto Forum:
  


Current Time: Fri Sep 04 16:36:11 GMT 2015

Powered by FUDForum. Page generated in 0.02126 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software