Greetings.
I want to build subversive extension which shows a simply MySimpleDialog after I press "OK" button on the commit dialog.
Then I can do some actions on MySimpleDialog and press button "go ahead" on it.
After "go ahead" button pressed -> the commit process begins,
all the windows closes and some text from MySimpleDialog adds to comment text.
Now I wrote some plugin which extends org.polarion.team.svn.ui.commit,
So, MyCommitActionFactory extends ICommitActionFactoty where "open" method returns MyComitDialog:
MyComitDialog extends DefaulDialog.
In MyComitDialog i overrided "buttonPressed" method to show MySimpleDialog (MySimpleDialog is inner-class in MyComitDialog).
Then I added a simple listener to "go ahead" button on MySimpleDialog which do the same that "buttonPressed" in DefaulDialog does.
Here is the code:
...
public class MyCommitActionFactory implements ICommitActionFactory {
public ICommitDialog getCommitDialog(final Shell shell, Collection allFilesToCommit, final ICommentDialogPanel commentPanel) {
return new ICommitDialog() {
public String getMessage() {
return "testCommitMessage" + commentPanel.getMessage();
}
public int open() {
dialog = new MyCommitDialog(new Shell(shell), commentPanel);
return dialog.open();
}
};
}
...
}
...
public class MyCommitDialog extends DefaultDialog {
...
protected void buttonPressed(int buttonId) {
if (IDialogConstants.OK_ID == buttonId) {
showMySimpleDialog(buttonId);
} else {
super.buttonPressed(buttonId);
}
}
...
public void preCommitAction() {
JOptionPane.showMessageDialog(...);
//XXX:dont works
super.buttonPressed(IDialogConstants.OK_ID);
}
...
protected class MySimpleDialog {
...
public void addListener() {
buttonGoAhead.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
preCommitAction();
}
});
}
...
}
...
}
So, when I press GoAhead Button, the preCommitAction() invokes. It shows JOptionPane, but the Button in DefaultDialog doesnn't presses!
My questions are:
1. How can I press the button "OK" on DefaultDialog from MySimpeDialog (or how to do commit action)?
2. How can I add some text from MySimpleDialog to comment text?
Thank you!
With best regards, Andrey Pavlenko.