Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Subversive » template commit commentary
template commit commentary [message #1115706] Tue, 24 September 2013 13:04 Go to next message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
hello.
i'm trying to develop a feature for subversive, and i think that one extends the commit action. that feature would allow me to have some template messages to put in the commit commentary, and some kind of drop down list to choose the template message.
but i think that i can't do it by myself, so i decided to get some help with this, if you guys want to help me.
the thing is, i'm not confortable with subversive extension points.

- it is possible to do this feature? (both the drop down list to choose the message, and the text insertion on commentary text field)

- do i need to analyse subversive source code to do this?

- what should i do to start the plugin? (the new one)

thanks for your attention.
best regards,
Gabriel.
Re: template commit commentary [message #1116449 is a reply to message #1115706] Wed, 25 September 2013 13:12 Go to previous messageGo to next message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
hi again.
i'm trying to get access to subversive source code repository (http://dev.eclipse.org/svnroot/technology/org.eclipse.subversive/) via subversive plugin on eclipse, but the connection is refused.

index.php/fa/16289/0/

my connector is: SVNKit 1.3.8 and i tried the SVNKit 1.7.10 also.

how can i solve this?

___

EDIT: forget this reply. it's not related with the original post, and i already solved the problem.
  • Attachment: img.jpg
    (Size: 27.67KB, Downloaded 767 times)

[Updated on: Thu, 10 October 2013 10:43]

Report message to a moderator

Re: template commit commentary [message #1118583 is a reply to message #1116449] Fri, 27 September 2013 14:57 Go to previous messageGo to next message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
Ok guys, so i managed, somehow, to put some content in the commit dialog. These contents (combobox and button) work together so that when the user press the button, it will trigger a runnable to append some specific text into the comment area of commit dialog.

For this, i created my plugin that connects to commit extension point. I created my "CustomFactory implements ICommitActionFactory", and my "CustomDialog extends DefaultDialog".

To put my own contents in the commit dialog, i overrided "createMainPanel" from DefaultDialog:

protected Control createMainPanel(Composite parent) {
Control control = super.createMainPanel(parent);
if(Composite.class.isAssignableFrom(control.getClass())) {
Composite aux = (Composite)control;
Composite composite = new Composite(aux, SWT.NONE);
composite.setLayout(new FillLayout());

...

Combo combo_box = new Combo(composite, SWT.READ_ONLY);
combo_box.setItems(items);
combo_box.select(0);

Button button = new Button(composite, SWT.PUSH);
button.setText("ADD REFERENCE");
button.addSelectionListener(new CustomSelectionListener(combo_box));
}

return control;
}

The Listener will get the text selected in the Combo, and put it in the panel. Having this class attribute:

private CommentPanel panel;

The runnable will change the textarea (StyledText in CommentComposite).

public void run() {
panel.buttonPressed(0); //This is done so i can get the current text in the text field.
String str = (panel.getMessage() != null ? panel.getMessage() : "") + '\n' + TEXT_TO_APPEND;
panel.setMessage(str);
}

Can you guys give me some feedback please?
Re: template commit commentary [message #1127575 is a reply to message #1118583] Sun, 06 October 2013 21:10 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 148
Registered: July 2009
Senior Member
Hello,

You may override the commit dialog implementation and provide your own controls for this task. And that's what you did, as I understand. But since the commit templates is more or less a standard function, should we discuss adding an extension point that would allow to place templates programmatically into the default comment templates dropdown? Or is it not the task you're trying to solve?
Re: template commit commentary [message #1128422 is a reply to message #1115706] Mon, 07 October 2013 17:21 Go to previous messageGo to next message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
Hello.
Thanks for the feedback.
Yeah, it's kinda like what you said.

But i think that would be better if subversion had some kind of extension point that allows the user to insert extra components on the commit dialog, and allow those components to interact with the commit dialog in real time. In my case, my components would interact with the text box (revision comments), just to append some text. With my code, i can do that. But it's not perfect. Notice this:

public void run() {
panel.buttonPressed(0); //This is done so i can get the current text in the text field.
String str = (panel.getMessage() != null ? panel.getMessage() : "") + '\n' + TEXT_TO_APPEND;
panel.setMessage(str);
}

If i just do "panel.getMessage()", i will get empty text because this method just returns some String content, and not the text in the text box. To fix this, i call "panel.buttonPressed(0);" before, because it will put the text box content on that String. Then, it will return what i want to get. BUT, this will also save that content in the comment history, and i dont want that. We can see that below:

public abstract class AbstractDialogPanel implements IDialogPanel, IValidationManager {
...
public void buttonPressed(int idx) {
if (idx == 0) {
this.saveChanges();
}
else {
this.cancelChanges();
}
}
...
}
...
public class CommentComposite extends Composite {
public void saveChanges() {
this.message = this.text.getText();
this.history.addLine(this.message);
CommentComposite.TEMPORARY_COMMENT = null;

if (this.bugIdText != null) {
this.bugID = this.bugIdText.getText();
}
}
...
}

And, besides, this is not a very intuitive way of doing things.

Eventually, i decided to change my code. Now, i can interact directly with the text box object. But, for that, i did something that i dont like either. From the Composite, i search for the text box object (StyledText), keep it, and then use it directly. You can see it below:

public class CustomDialog extends DefaultDialog {

private StyledText comment_text;

protected Control createMainPanel(Composite parent) {
Control control = super.createMainPanel(parent);
if(Composite.class.isAssignableFrom(control.getClass())) {
Composite aux = (Composite)control;
comment_text = findStyledText(aux);
createExtraComponents(aux);
}
return control;
}

private StyledText findStyledText(Composite composite) {
StyledText text = null;
Control[] children = composite.getChildren();
int i = 0;
while(i < children.length && text == null) {
if(StyledText.class.isAssignableFrom(children[i].getClass())) {
text = ((StyledText)children[i]);
}
else if(Composite.class.isAssignableFrom(children[i].getClass())) {
text = findStyledText((Composite)children[i]); //May return null
}
i++;
}
return text; //May be null
}
...
}

AGENT CODE:

public void run() {
if(CustomDialog.this.comment_text != null) {
CustomDialog.this.comment_text.append(text_to_append);
}
}

This code works. But, again, it's not very intuitive, and maybe is not safe to do it.

___

EDIT: sorry for my weak English.

[Updated on: Mon, 07 October 2013 17:24]

Report message to a moderator

Re: template commit commentary [message #1129132 is a reply to message #1128422] Tue, 08 October 2013 10:15 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 148
Registered: July 2009
Senior Member
>> BUT, this will also save that content in the comment history, and i dont want that.
What is the reson for not wanting it to be stored in history? Is there is no chance of reusing the same comment or its variations in the future?
Re: template commit commentary [message #1129245 is a reply to message #1129132] Tue, 08 October 2013 12:50 Go to previous messageGo to next message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
Alexander Gurov wrote on Tue, 08 October 2013 06:15
What is the reson for not wanting it to be stored in history? Is there is no chance of reusing the same comment or its variations in the future?


because i can append text many times in the same revision comment. so, it will save many variations of the same comment. it will save the current status of the comment everytime i append something with the combo box.

__

EDIT: in my opinion, the history should only save the final status of the message to comment in the revision.

[Updated on: Tue, 08 October 2013 12:52]

Report message to a moderator

Re: template commit commentary [message #1130982 is a reply to message #1129245] Thu, 10 October 2013 04:36 Go to previous messageGo to next message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 148
Registered: July 2009
Senior Member
I created a task for this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419093

If there is anything you want to add please feel free to make your comments in the task. The first version including this API should be aligned with the Luna M4 build.

[Updated on: Fri, 01 November 2013 20:01]

Report message to a moderator

Re: template commit commentary [message #1131237 is a reply to message #1130982] Thu, 10 October 2013 10:26 Go to previous message
Gabriel Ferreira is currently offline Gabriel FerreiraFriend
Messages: 6
Registered: September 2013
Junior Member
Alexander Gurov wrote on Thu, 10 October 2013 00:36
I created a task for this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419093


thanks Smile

please edit your post, and remove the dot in the end of the link.

[Updated on: Sun, 13 October 2013 17:46]

Report message to a moderator

Previous Topic:Conflict icon always when comparing models
Next Topic:Optimizing backup strategy with Tortoise SVN
Goto Forum:
  


Current Time: Thu Mar 28 10:30:28 GMT 2024

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

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

Back to the top