Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [subversive-dev] How to invoke Lock operation before Commit operation using de Commit UI extension point

Hello Alexander,

What I need is invoke Lock operation immediatly before Commit operation and if the Lock fail, to cancel Commit operation. I used this way:

                                int result = Window.CANCEL;
filesToCommit = allFilesToCommit;
CustomCommitDialog dialog = new CustomCommitDialog(shell,
commentPanel);
dialog.setAllFilesToCommit(allFilesToCommit);
try {
result = dialog.open();
if (result == Window.OK) {
LockAction lock = new LockAction();
IAction action = "">
lock.runImpl(acao);
}
} catch (Exception e) {
result = Window.CANCEL;
}
return result;

I used the pre-lock subversion's hook to simulate the Lock fail, but the Commit operation is not cancelled. Is it possible do this? How can I do invoke Lock operation in background without the Lock Dialog?

Best regards, 
Rodrigo


2011/8/4 Alexander Gurov <alexander.gurov@xxxxxxxxxxxx>
Hello Rodrigo,

The API related to the commit dialog were initially created for the specific project, so it may be not the best to work with.
Regarding how to do it now - it is relatively easy. Anyway now you're implementing ICommitDialog interface. Right? In the method open() of this interface you're doing something like this:
            public int open() {
                DefaultDialog dialog = new DefaultDialog(shell, commentPanel);
                return dialog.open();
            }
So, you may as well change the code:
            public int open() {
                DefaultDialog dialog = new DefaultDialog(shell, commentPanel);
                int retVal = dialog.open();
                if (retVal == Window.OK) {
                    // invoke Lock here
                }
                return retVal;
            }
The flaw of this solution is that you will run your code in the UI thread. That is not a very nice thing, but... oh well, that is why I said that API created for a single project is not the best thing to use, it misses many important points. So, if you have any ideas regarding future improvements you're welcome to share your opinion here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=327399

Best regards,
Alexander Gurov,
Subversive Team.

03.08.2011 1:58, rodrigo luiz duarte пишет:
Hi!

I need invoke the Lock command immediatly before the Commit operation. How can i do this using de Commit UI extension point?

Thank you,

--
Rodrigo Luiz Duarte
rodrigo.luizduarte@xxxxxxxxx


_______________________________________________
subversive-dev mailing list
subversive-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/subversive-dev


_______________________________________________
subversive-dev mailing list
subversive-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/subversive-dev




--
Rodrigo Luiz Duarte
rodrigo.luizduarte@xxxxxxxxx

Back to the top