Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 321263 - [e4] install more connectors button not functional
Summary: [e4] install more connectors button not functional
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.5   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 321278 336432
  Show dependency tree
 
Reported: 2010-07-29 14:59 EDT by Steffen Pingel CLA
Modified: 2011-08-18 07:06 EDT (History)
4 users (show)

See Also:


Attachments
fix (3.75 KB, patch)
2010-10-19 00:05 EDT, Steffen Pingel CLA
no flags Details | Diff
mylyn/context/zip (1.42 KB, application/octet-stream)
2010-10-19 00:05 EDT, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2010-07-29 14:59:42 EDT
Steps:
1. Add repository
2. Press Install More Connectors

The wizard does not appear. No error is logged.
Comment 1 Steffen Pingel CLA 2010-10-18 21:13:43 EDT
The code that runs the command looks roughly like this:

	IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
	ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command discoveryWizardCommand = service.getCommand("org.eclipse.mylyn.discovery.ui.discoveryWizardCommand");
	discoveryWizardCommand.executeWithChecks(createExecutionEvent(discoveryWizardCommand, handlerService));
	
It ends up in Workbench.MakeHandlersGo.execute() which seems to do nothing at the moment. I can execute the command manually through Ctrl+3.

Is there a forward/backwards compatible way to programmatically invoking a command?
Comment 2 Remy Suen CLA 2010-10-18 21:22:03 EDT
(In reply to comment #1)
> It ends up in Workbench.MakeHandlersGo.execute() which seems to do nothing at
> the moment. I can execute the command manually through Ctrl+3.

This probably means we're not enabling/disabling your handler(s) correctly then.

> Is there a forward/backwards compatible way to programmatically invoking a
> command?

You can try executing with the IHandlerService instead and see if that gets you anywhere.

CommandProvider's execute() method might be of use to you.
http://dev.eclipse.org/viewcvs/index.cgi/e4/org.eclipse.e4.compatibility/bundles/org.eclipse.ui.workbench/Eclipse%20UI/org/eclipse/ui/internal/quickaccess/CommandElement.java?view=markup
Comment 3 Steffen Pingel CLA 2010-10-19 00:05:06 EDT
Created attachment 181147 [details]
fix
Comment 4 Steffen Pingel CLA 2010-10-19 00:05:07 EDT
Created attachment 181148 [details]
mylyn/context/zip
Comment 5 Steffen Pingel CLA 2010-10-19 00:06:46 EDT
Thanks, that works. Should I file a bug against e4? Seems like the behavior has changed slightly.

I have committed the attached patch. David, could you take a look. You wrote the original command execution code.
Comment 6 Remy Suen CLA 2010-10-19 06:12:56 EDT
(In reply to comment #5)
> Thanks, that works. Should I file a bug against e4? Seems like the behavior has
> changed slightly.

Yes, please do, Steffen. Is everything of interest in the *.tasks.ui bundle? It would help us if we could know where to check for relevant code and plugin.xml extension point definitions. Thanks!
Comment 7 Remy Suen CLA 2010-10-19 07:45:07 EDT
<rcjsuen> paulweb515: yesterday night Steffen CC'd me on a Mylyn bug, apparently command.execute... didn't work
<rcjsuen> i told him to use IHandlerS instead
<rcjsuen> and that worked
<rcjsuen> he said it went inside MakeHnadlersGo
<rcjsuen> so i said it was probably bcuz we weren't "enabling/disabling" his handlers correctly
<rcjsuen> i mean, when he called command.executeWithChecks it went inside MHG
<rcjsuen> but using IHS to execute worked for him
<paulweb515> rcjsuen: cmd.execute(*) doesn't work
<rcjsuen> oh ok
<paulweb515> at all in 4.1
<paulweb515> The protocol is wrong
<rcjsuen> so it's intentional?
<paulweb515> yes
<rcjsuen> paulweb515:  so we'll just tell everyone to use IHS execute instead?
<paulweb515> but I set all commands to MakeHandlerGo otherwise the Command isHandled() returns false ... and nothing in 3.x works
<paulweb515> rcjsuen: they're supposed to do that already, using the 3.x IHandlerService
<rcjsuen> oic
<rcjsuen> ok
<rcjsuen> i'll just copy/paste our convo here to there then
<paulweb515> That's not to say that with some hand-waving we could get cmd.execute(*) working
<rcjsuen> right
<paulweb515> In theory MakeHandlersGo would just be a front for appContext..get(EHandlerService.class).execute(*) except without the ability to provide their own ExecutionEvent :-)
<paulweb515> rcjsuen: but even in 3.x, we've always said get IHandlerService and execute a command that way

So it's not to say we won't make it work in 4.x, but IHandlerService is the way to go.
Comment 8 Steffen Pingel CLA 2010-10-19 13:36:17 EDT
Thanks for the information. It might help to document that in the code so others who follow the execution path know why it doesn't work and how to work around it.

I'll check the Mylyn sources if we execute commands directly anywhere else.
Comment 9 David Green CLA 2010-10-19 16:29:15 EDT
(In reply to comment #5) 
> I have committed the attached patch. David, could you take a look. You wrote the
> original command execution code.

Looks good, in fact it looks cleaner than the original.  Nice to know about @IHandlerService.executeCommand@
Comment 10 Steffen Pingel CLA 2010-10-19 23:46:14 EDT
Thanks for the review. I'll mark it resolved then.