Bug 210164 - [Wizards] Remember repository type when sharing a project
Summary: [Wizards] Remember repository type when sharing a project
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P5 enhancement (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-11-16 18:21 EST by Robert Konigsberg CLA
Modified: 2008-02-07 05:16 EST (History)
1 user (show)

See Also:


Attachments
First attemtpt at a patch (12.32 KB, patch)
2007-12-03 13:50 EST, Robert Konigsberg CLA
no flags Details | Diff
Patch rev 2 (against head) (11.07 KB, patch)
2007-12-06 04:03 EST, Robert Konigsberg CLA
no flags Details | Diff
Third patch (4.19 KB, patch)
2007-12-07 10:52 EST, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (9.04 KB, application/octet-stream)
2007-12-07 10:52 EST, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Konigsberg CLA 2007-11-16 18:21:30 EST
When sharing a project using the Team/Share context menu item, I would really like it if it remembered the last repository type I selected. I would make sharing a dozen projects very easy.
Comment 1 Tomasz Zarna CLA 2007-11-20 10:22:58 EST
Sounds like a good idea. This would be an easy change to make. Would you have the time to submit a 
patch?
Comment 2 Robert Konigsberg CLA 2007-11-27 17:23:12 EST
Never done one before, but I would love to do it, because it would get me in to the process of submitting patches. Can you just point me to the correct plug-in? Do I store the changes as a non-visual system preference.
Comment 3 Tomasz Zarna CLA 2007-11-28 05:35:54 EST
Robert, the plug-in to start with is org.eclipse.team.cvs.ui (you can check it out from Eclipse repository - :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse). Next, you should take a look at SharingWizard.java... or ConfigureProjectWizard.java (from org.eclipse.team.ui).

What is worth mentioning that there is a similar wizard which seems to have this issue solved somehow - it's ModelSynchronizeWizard, which pops out from the Sync View. You could take a look at it too.

If you need any help, please don't hesitate to ask. Good luck :)
Comment 4 Robert Konigsberg CLA 2007-11-29 14:53:41 EST
One problem with installing o.e.t.ui is that it comes with a compile error:

The method ChangesSection.getBackgroundColor() does not override the inherited method from Control since it is private to a different package.

This applies to this line in ChangesSection.java:

    protected Color getBackgroundColor() {

It seems that the Control class has a package-private method getBackgroundColor, and Eclipse is not happy. Any thoughts? 
Comment 5 Remy Suen CLA 2007-11-29 15:00:15 EST
(In reply to comment #4)
> The method ChangesSection.getBackgroundColor() does not override the inherited
> method from Control since it is private to a different package.

This looks like a conflict with the gtk+ implementation of the Control class because the Windows version doesn't seem to have this.

GdkColor getBackgroundColor () {
	return getBgColor ();
}
Comment 6 Robert Konigsberg CLA 2007-11-29 15:03:11 EST
Yipe! Any advice?
Comment 7 Remy Suen CLA 2007-11-29 15:09:43 EST
(In reply to comment #6)
> Yipe! Any advice?

I guess you could just rename ChangesSection's method to getBackgroundColor2() for now or something. ;)

In the long term, I think that Team should rename this method to bypass this issue. It is really quite an interesting problem given that the root cause is actually the implementation differences of SWT across the many platforms it supports.
Comment 8 Robert Konigsberg CLA 2007-11-29 15:16:04 EST
Yeah, I just noticed that many other classes extend this one and depend on getBackgroundColor. Sure I can just fix this by renaming the method appropriately, but it changes the nature of the patch. I'll do that for now, just to get by, and this can be addressed separately or together.
Comment 9 Robert Konigsberg CLA 2007-12-03 13:50:53 EST
Created attachment 84346 [details]
First attemtpt at a patch
Comment 10 Tomasz Zarna CLA 2007-12-05 09:31:32 EST
Robert this patch is out of date with HEAD. Could you update please?
Comment 11 Robert Konigsberg CLA 2007-12-05 18:06:45 EST
This, I'm afraid, is where this starts to become a tutorial in submitting patches to Eclipse rather than fixing the bug. I'm OK with that if you are willing to help me out, you see? Alternatively, you might want to just look at the patch and possibly apply it to head for me.

The thing is, now that I have pulled the code from head, I have different compiler errors, and they clearly reflect new code in other dependent bundles. For instance:

'The method "createStructureCreator(LocalResourceTypedElement) is not defined for the type CompareUI'.

So if I import the bundle o.e.compare, does this become an endless cycle of imports? Or, should I have just imported all of HEAD?

Thanks, Robert
Comment 12 Remy Suen CLA 2007-12-05 18:12:54 EST
(In reply to comment #11)
> So if I import the bundle o.e.compare, does this become an endless cycle of
> imports?

It is not very common for this to go on forever. Committers and active contributors usually work off of I builds, so the plug-ins they have on their self-hosting target platform is usually up-to-date enough. Of course, sometimes some collaboration work gets going and you are forced to check out projects from components outside your original scope (like when UI added the new working set control and PDE had to keep the UI plug-ins in their own workspace).

Since the Team and Compare teams are one and the same (as far as I know), it is not entirely illogical for one plug-in to depend on bleeding edge CVS stuff. I'd say give o.e.compare a checkout and see where that leads you.

By the way, Robert, what build are you using for developing this patch? You're using an I or N build, right?
Comment 13 Robert Konigsberg CLA 2007-12-06 04:03:05 EST
Created attachment 84610 [details]
Patch rev 2 (against head)
Comment 14 Tomasz Zarna CLA 2007-12-06 09:20:08 EST
First of all, thanks for the patch :) It works fine, but I've got some suggestions:

1) I would use DialogSettings to save/load selected wizard, since this is not actually a preference. And AFAIK we don't want it to be.
2) In ConfigureProjectWizardMainPage you add getter and setter for selectedWizardId, but their names are slightly different. I belive it's not a standard naming convention.
3) In ConfigureProjectWizard#performFinish method you save the selected wizard ID. It looks like it can be done no matter if the checks are true or not (i.e. can be done as first thing in the method).
4) In ConfigureProjectWizardMainPage#findWizardById you could change the first check to: if (children == null || wizardId==null) {
5) In the same method as above I would change the ConfigurationWizardElement variable name to something different. "e" is used to be use for exceptions

How does is sound?
Comment 15 Robert Konigsberg CLA 2007-12-07 02:05:37 EST
I agree with the getter/setter mismatch except that the method names sort of match the behavior in a strange way. The truth is that if I wanted an initial ID and a selected ID, I could have two String attributes, but it's not worth it, so I renamed it just straight to wizardId.

I don't know enough about Dialog Settings. Right now this.getDialogSettings returns null. What should I do? I think for this one, you should just hand me the answer. :)
Comment 16 Tomasz Zarna CLA 2007-12-07 10:52:34 EST
Created attachment 84741 [details]
Third patch

> I think for this one, you should just hand me the answer. :)

Sure, this is how I would have used the DialogSettings. Actually, I made the whole saving/loading thing. Robert, would you mind taking a quick look at the patch and veryfing if it does what you need?
Comment 17 Tomasz Zarna CLA 2007-12-07 10:52:42 EST
Created attachment 84742 [details]
mylyn/context/zip
Comment 18 Robert Konigsberg CLA 2007-12-07 15:43:17 EST
Yes, that looks great. Plus for some reason you don't have the same problem as I with getBackgroundColor.

Thanks for giving me a chance to fix it, and for doing a better job in the end.
Comment 19 Tomasz Zarna CLA 2007-12-12 05:05:35 EST
No problem, you did a fine job. As you probably noticed I reused some of your ideas, so I did only half the work (or even less).

Feel free to pick up a different bug, I'm still eager to help you :)

I'll assign this bug to me and mark it for M5, so I won't forget about it.
Comment 20 Robert Konigsberg CLA 2007-12-12 16:45:54 EST
Teamwork! :) 
Comment 21 Tomasz Zarna CLA 2008-01-02 10:26:28 EST
The latest patch has been released to HEAD. Thanks again Robert.
Comment 22 Tomasz Zarna CLA 2008-02-07 05:16:53 EST
Verified in I20080205-0010.