Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 237500

Summary: [wikitext] Task repository should have a properties field where configuration settings can be made
Product: z_Archived Reporter: Jingwen 'Owen' Ou <jingweno>
Component: MylynAssignee: Jingwen 'Owen' Ou <jingweno>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: greensopinion, steffen.pingel
Version: unspecified   
Target Milestone: 1.0.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
extracted relevant parts from Davd's patch
none
contribute a popup menu to TaskRepositoryView
none
all-in-one patch adding "none" and default setting for the repository
none
mylyn/context/zip
none
visibility test
none
a patch adding a PropertyTester
none
mylyn/context/zip
none
mylyn/context/zip none

Description Jingwen 'Owen' Ou CLA 2008-06-17 13:50:57 EDT
Task repository should have a properties field where configuration settings can be made, e.g. wiki editor style
Comment 1 Steffen Pingel CLA 2008-06-17 16:21:19 EDT
Owen, can you extract the relevant parts from David's patch on bug 234210? Based on that we can iterate over the design.
Comment 2 Jingwen 'Owen' Ou CLA 2008-06-18 16:51:57 EDT
Created attachment 105347 [details]
extracted relevant parts from Davd's patch

please compare it with the original file, key line starts from 486
Comment 3 Steffen Pingel CLA 2008-06-20 04:53:11 EDT
Sorry, I should have been more clear. My intention was to only extract the parts that add the settings to the page instead of creating a copy of the whole class. 

How about this: Instead of modifying the setting page the sandbox could contribute an submenu to the popup menu of the task repositories view that allows the selection of the desired task editor extension. This page has some examples how to contribute dynamic menus: http://wiki.eclipse.org/Menu_Contributions . What do you think?
Comment 4 David Green CLA 2008-06-20 11:18:13 EDT
(In reply to comment #3)
> How about this: Instead of modifying the setting page the sandbox could
> contribute an submenu to the popup menu of the task repositories view that
> allows the selection of the desired task editor extension. This page has some
> examples how to contribute dynamic menus:
> http://wiki.eclipse.org/Menu_Contributions . What do you think?

In the short-term this might be fine, but for a long-term solution I would prefer to see the setting in the properties dialog.  This is where the user would expect to see it.
Comment 5 Steffen Pingel CLA 2008-06-20 17:13:22 EDT
(In reply to comment #4)
> In the short-term this might be fine, but for a long-term solution I would
> prefer to see the setting in the properties dialog.  This is where the user
> would expect to see it.

Yes, it definitely makes sense to aggregate the settings in the dialog for Mylyn 3.1 either by making the settings page extensible or adding to the abstract class. For now the popup menu is the best option I can think of to contribute to.
Comment 6 David Green CLA 2008-06-20 18:25:14 EDT
(In reply to comment #5)
> Yes, it definitely makes sense to aggregate the settings in the dialog for
> Mylyn 3.1 either by making the settings page extensible or adding to the
> abstract class. For now the popup menu is the best option I can think of to
> contribute to.

Agreed.  I guess that's the cost of having a sandbox.  We'll just have to remember to integrate them later.
Comment 7 Steffen Pingel CLA 2008-06-25 14:40:46 EDT
Owen, can you try take the code from the patch in AbstractRepositorySettingsPage that configures the task editor extension and make that a menu contribution in the Sandbox? The releveant parts of the code is in this chunk:

 if (needsEditorExtensionSelector()) {
   ...
 }

Instead of using a combo box you could try to contribute a submenu in the popup menu of task repositories view (see comment 3).
Comment 8 Jingwen 'Owen' Ou CLA 2008-06-25 18:26:11 EDT
Created attachment 105848 [details]
contribute a popup menu to TaskRepositoryView

Daivd, right now only Textile style works? When I switched to other makrup language (confluence), it doesn't seem working
Comment 9 David Green CLA 2008-06-25 23:45:30 EDT
(In reply to comment #8)
> Daivd, right now only Textile style works? When I switched to other makrup
> language (confluence), it doesn't seem working

Owen, it works for me!  (Nice work)
Note that a changed editor extension setting currently only affects newly opened editors.  

A couple of other things that I noticed about your patch:

* the submenu items should indicate which one is the default setting for the repository.  You can get this with @TaskEditorExtensions.getDefaultTaskEditorExtensionId(taskRepository)@
* the submenu should provide an option that sets it to 'None', so that the extension can be turned off
Comment 10 Jingwen 'Owen' Ou CLA 2008-06-26 17:14:31 EDT
Created attachment 105957 [details]
all-in-one patch adding "none" and default setting for the repository

David, would it be possible that you added a null editor style using TaskEditorExtensions.addTaskEditorExtension() then when TaskeEditorExtensions.getTaskEditorExtensions() and the null editor extension always return first, so that we don't need to treat no style as a special style (no style is also a kind of style)
Comment 11 Jingwen 'Owen' Ou CLA 2008-06-26 17:15:12 EDT
 detail please refer to EditorStyleContributionItems.getContributionItems()
 
> Created an attachment (id=105957)
> all-in-one patch adding "none" and default setting for the repository
> 
> David, would it be possible that you added a null editor style using
> TaskEditorExtensions.addTaskEditorExtension() then when
> TaskeEditorExtensions.getTaskEditorExtensions() and the null editor extension
> always return first, so that we don't need to treat no style as a special style
> (no style is also a kind of style)
Comment 12 David Green CLA 2008-06-26 17:27:30 EDT
(In reply to comment #10)
> David, would it be possible that you added a null editor style using
> TaskEditorExtensions.addTaskEditorExtension() then when
> TaskeEditorExtensions.getTaskEditorExtensions() and the null editor extension
> always return first, so that we don't need to treat no style as a special style
> (no style is also a kind of style)

No, that's a bad idea (sorry).  The place where this concern should be handled is where the menu is constructed.
Comment 13 Jingwen 'Owen' Ou CLA 2008-06-26 17:40:11 EDT
> No, that's a bad idea (sorry).  The place where this concern should be handled
> is where the menu is constructed.

Ok, but you may need to treat "None" in saving the editor style setting as well, so that the users can get back the configuration next time.
Comment 14 David Green CLA 2008-06-26 17:48:03 EDT
(In reply to comment #13)
> Ok, but you may need to treat "None" in saving the editor style setting as
> well, so that the users can get back the configuration next time.
> 

I agree.  The original patch was able to store a 'none' or null setting and have it stick so that next time a user opens an issue editor the editor does not use any extension.  The "None" menu should basically do the same thing.
Comment 15 Steffen Pingel CLA 2008-06-27 03:36:38 EDT
Great patch Owen! I have applied it with one minor changes: I chose singular for the class name to be consistent with the name of the super class. I have renamed the menu item to "Task Editor Extension" since it is a generic extension that is not limited to WikiText.

I agree that the "None" state is a UI concern and should be handled in the menu contribution rather than the extension. I don't think it is a big deal that the setting does not apply to open editors. Refreshing the editors would require saving and additional user interaction. I think we should keep it the way it is for now and improve it in case there are requests from the community.

Owen, it would be great if could attach contexts with the patches just check attach context in the task editor. You can "cleanup" the context from the context page in the task editor in case it contains irrelevant items.

Please close this bug if it resolved. Persisting the "None" selection seemed to work fine for me.
Comment 16 Steffen Pingel CLA 2008-06-27 03:36:42 EDT
Created attachment 105980 [details]
mylyn/context/zip
Comment 17 Steffen Pingel CLA 2008-06-27 03:52:07 EDT
Created attachment 105981 [details]
visibility test
Comment 18 Steffen Pingel CLA 2008-06-27 03:54:45 EDT
I just noticed that the setting is enabled for all repositories. Owen, could you add an expression that makes sure that the menu is only visible for bugzilla repositories? I have attached a patch with an example. To make that work you'll have to implement a property tester for TaskRepository object. You can use TaskPropertyTester as an example.
Comment 19 Jingwen 'Owen' Ou CLA 2008-06-28 23:35:30 EDT
Created attachment 106068 [details]
a patch adding a PropertyTester

Steffen, ur welcomed to make more request. U too, David. :)
Comment 20 Jingwen 'Owen' Ou CLA 2008-06-28 23:35:35 EDT
Created attachment 106069 [details]
mylyn/context/zip
Comment 21 Jingwen 'Owen' Ou CLA 2008-06-28 23:42:38 EDT
(In reply to comment #15)
> Great patch Owen! I have applied it with one minor changes: I chose singular for
> the class name to be consistent with the name of the super class. I have renamed
> the menu item to "Task Editor Extension" since it is a generic extension that is
> not limited to WikiText.
no problem, this is what I am here for :).

> I agree that the "None" state is a UI concern and should be handled in the menu
> contribution rather than the extension. I don't think it is a big deal that the
> setting does not apply to open editors. Refreshing the editors would require
> saving and additional user interaction. I think we should keep it the way it is
> for now and improve it in case there are requests from the community.
after a careful consideration, maybe you guys are right: the "None" is an UI concern and should go to where its created


> Owen, it would be great if could attach contexts with the patches just check
> attach context in the task editor. You can "cleanup" the context from the
> context page in the task editor in case it contains irrelevant items.
done with the latest patch and will be in the future...personally I seldom download context unless to pinpoint classes I don't know. But it seems its a good practise to let people know what you have uploaded relating to their workspaces.

> Please close this bug if it resolved. Persisting the "None" selection seemed to
> work fine for me.

yup, it does work.

Any more requests for this bug? If not, I might close it.
Comment 22 Jingwen 'Owen' Ou CLA 2008-06-28 23:47:24 EDT
Created attachment 106070 [details]
mylyn/context/zip

a more accurate context, ignore the pre one
Comment 23 Steffen Pingel CLA 2008-07-03 22:50:22 EDT
Marking resolved.
Comment 24 Jingwen 'Owen' Ou CLA 2008-07-04 13:03:29 EDT
(In reply to comment #23)
> Marking resolved.

Steffen, did you apply the last patch which enables the setting only for bugzilla? Or plans change?
Comment 25 Steffen Pingel CLA 2008-07-04 14:31:36 EDT
Thanks for catching that! I have applied the outstanding patch. Great work!