Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 298391 - Use commands for RCP mail template (starting with Eclipse 3.4)
Summary: Use commands for RCP mail template (starting with Eclipse 3.4)
Status: CLOSED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 326138 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-22 06:16 EST by Ralf Ebert CLA
Modified: 2012-05-10 14:02 EDT (History)
4 users (show)

See Also:


Attachments
commands for mail templates (26.06 KB, patch)
2009-12-22 06:17 EST, Ralf Ebert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Ebert CLA 2009-12-22 06:16:54 EST
With the attached patch the RCP mail templates are updated to use commands instead of actions.

- Added a new mail template templates_3.4/mail (please copy templates_3.3/mail/bin to templates_3.4/mail)
- Updated template description with "since 3.4" remarks to be backward-compatible
- Added menu contributions to MailTemplate class
- Updated key bindings to use M1 instead of CTRL
- Replaced Actions with Handler classes in templates
- Removed ActionBarAdvisor in templates

tested on Eclipse 3.4 and 3.6 M4
Comment 1 Ralf Ebert CLA 2009-12-22 06:17:38 EST
Created attachment 154925 [details]
commands for mail templates
Comment 2 Ralf Ebert CLA 2010-05-06 13:21:14 EDT
I guess it's too late for this one, so I'll use this bug to rework the patch to do some more cleanups:

- Something seems wrong with the version logic of the patch, it just generates a mix of command/action code for Eclipse 3.5 (adding new features to these templates is painful)
- Separate packages views, perspectives, handlers, app
- Rename "View" to "MessageView", "Perspective" to "MailPerspective"
- remove Activator usage / allow the example to be generated without Activator
- General-purpose constant class "IMailConstant" instead of ICommandIds, add constants for all ui extensions, export only the package with this class
- Proper names for icon files

I already did these changes to the actual project, see http://github.com/ralfebert/rcpmailwiring/commit/9bb134898a450b30d1806134f1c82263ecf265f1 , just need to come up with another patch for the template project
Comment 3 Lars Vogel CLA 2010-09-26 13:39:43 EDT
*** Bug 326138 has been marked as a duplicate of this bug. ***
Comment 4 Lars Vogel CLA 2010-09-26 13:41:20 EDT
@Curtis/ Chris: any chance to get this applied for 3.7?
Comment 5 Curtis Windatt CLA 2010-09-27 14:43:09 EDT
Ralf, did any additional work materialize from comment #2.

Lars, have you tried out the patch and seen if it is complete enough for your needs?

I'll mark for 3.7, but I won't have time to do a proper review of the code right now.  If others can help review the contribution that would make my life much easier.
Comment 6 Lars Vogel CLA 2010-09-27 14:55:08 EDT
@Curtis: I will review the code. Thanks for considering the patches. I hope to give you a status within the next 2 weeks. If that would be to late, please let me know.
Comment 7 Lars Vogel CLA 2010-10-04 16:18:05 EDT
@Curtis unfortunately the patch still does what Ralf describes in comment #2.

@Ralf Could you update your patch? It would be great to get Actions out of the examples.
Comment 8 Ralf Ebert CLA 2010-10-05 05:22:26 EDT
I'll do an updated version of the patch with the changes in the next days, fixing the issue and adding the features described in comment #2.

I'm pretty confident about all the proposed changes except:

- General-purpose constant class "MailConstants" instead of ICommandIds, add constants for all plug-in/extension related ids (PLUGIN_ID, VIEW_ID_*, PERSPECTIVE_ID_*, COMMAND_ID_*) and export-package only the package with this class.

I consider this a good practice, does everybody so? Is there a convention for naming such a class? (I'd name it Mail or MailConstants or MailIds)
Comment 9 Lars Vogel CLA 2010-10-05 10:37:16 EDT
I think having one class for the ID's is good practise.
Comment 10 Ralf Ebert CLA 2010-10-24 14:31:52 EDT
(In reply to comment #7)
> @Curtis unfortunately the patch still does what Ralf describes in comment #2.

Lars, what do you refer to here exactly? I re-tested the patch as-is for 3.2, 3.4, 3.5 and 3.7 RCP targets and it worked in all of them. I guess the problems I have seen came from some leftover project in my workspace. Did you see any problems when you tried the patch?

Also, I started to add the cleanups I proposed in comment #2. Unfortunately, the plugin.xml generation code has to work with all the target 3.0+ version while the source files have been duplicated (in some releases). This is a mess already and I oppose adding even more if/switch-blocks on top of that. I think the right way would be to manage these templates as separate bundle versions, so new versions for newer targets can be created without adding lots and lots of messy code just to keep the old versions compatible. Also, deciding on Bug 296379: "Come up with an official support policy for targets" might help in that regard.

For now, I propose to only add the commands as reported without any further cleanup. I'll fix any problems with my "add commands in the easiest way possible" patch you should find. Please don't forget to copy templates_3.3/mail/bin to templates_3.4/mail.
Comment 11 Lars Vogel CLA 2010-10-24 14:36:28 EDT
@Ralf: I saw the following from you comment #2:

- Something seems wrong with the version logic of the patch, it just generates
a mix of command/action code for Eclipse 3.5 (adding new features to these
templates is painful)
Comment 12 Ralf Ebert CLA 2010-10-24 14:53:32 EDT
For which IDE/target version?
Are you sure you didn't have an old mail project in your workspace folder? (the ActionBarAdvisor class is removed now)
Comment 13 Lars Vogel CLA 2012-05-10 14:02:30 EDT
Closing as won't fix, as Eclipse 4 is different and I know that Ralf doesn't care anymore for this change.