Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348780 - CCE thrown when using 'Link with Selection' from the view menu of the 'Git Repositories' view
Summary: CCE thrown when using 'Link with Selection' from the view menu of the 'Git Re...
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 0.12   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-08 13:08 EDT by Remy Suen CLA
Modified: 2011-07-01 10:15 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-06-08 13:08:40 EDT
EGit 0.12.1

1. Window > Open Perspective > Other... > Git Repository Exploring.
2. Activate the 'Git Repositories' view.
3. Ctrl+F10 > Link with Selection
4. Check your logs, you will have a CCE.

java.lang.ClassCastException: org.eclipse.swt.widgets.MenuItem
	at org.eclipse.egit.ui.internal.repository.tree.command.LinkWithSelectionCommand.execute(LinkWithSelectionCommand.java:27)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
Comment 1 Paul Webster CLA 2011-06-08 13:12:14 EDT
There's a blind cast to an SWT ToolItem, but that can be a MenuItem (in this case) or even a random Control (in the keybinding case).

But I think this command wants to be a toggle command.

See org.eclipse.example.commands.monitorCount as an example of a toggle command that saves its state between runs.  https://github.com/paulweb515/commandsEclipseCon2011/blob/master/org.eclipse.example.commands/plugin.xml and https://github.com/paulweb515/commandsEclipseCon2011/blob/master/org.eclipse.example.commands/src/org/eclipse/example/commands/MonitorCountHandler.java

PW
Comment 2 Matthias Sohn CLA 2011-06-29 07:17:06 EDT
Pushed patch for review http://egit.eclipse.org/r/#change,3798
Comment 3 Matthias Sohn CLA 2011-07-01 10:15:21 EDT
merged as 4b93402ae3ad3de7116a83b6cf08c6db23bed631