Bug 410087 - [Contributions] DirectToolItem does not evaluate @CanExecute
Summary: [Contributions] DirectToolItem does not evaluate @CanExecute
Status: CLOSED DUPLICATE of bug 465893
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Jonas Helming CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 468605
Blocks:
  Show dependency tree
 
Reported: 2013-06-06 10:55 EDT by Jonas Helming CLA
Modified: 2015-11-03 20:02 EST (History)
6 users (show)

See Also:


Attachments
DirectTool Item example (16.61 KB, application/zip)
2013-06-06 10:55 EDT, Jonas Helming CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Helming CLA 2013-06-06 10:55:00 EDT
Created attachment 232048 [details]
DirectTool Item example

@CanExecute is not evaluated for DirectToolItems, see attached example. The first ToolItem in the example is a direct, the second one a handled. If you click the save button, both should toggle their enabled state.
for DirectMenuItems this has been resolved:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=377884
Comment 1 Paul Webster CLA 2013-06-06 10:58:02 EDT
The enabled state is evaluated for handled tool items using the org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.ToolItemUpdateTimer

We should consider DirectToolItems in whatever solution we find for bug 385394

PW
Comment 2 Lars Vogel CLA 2015-05-22 12:44:36 EDT
Jonas, can you provide a patch for this issue?
Comment 3 Jonas Helming CLA 2015-05-24 10:37:42 EDT
sure, I will give it a try!
Comment 4 Jonas Helming CLA 2015-05-28 05:42:28 EDT
I had a look at DirectContributionItem and HandledContributionItem.

They have a big overlap. Therefore, a couple of fixes in the past had to been done twice, e.g. Bug 385414. Other fixes, e.g. Bug 380946 have only been fixed for HandledItem (Probably the direct case was accidentally missed).

This BR is another case, when fixing Bug 385394, again, it seems to me that the DirectContribution case was overlooked.
To avoid this in the future, I suggest to refactor both classes and create a common super class containing all the common code. This will also enable a pretty simple fix for this BR.

If you agree, I would open up a new BR for the refactoring and do a contribution then.
Comment 5 Lars Vogel CLA 2015-05-28 06:08:56 EDT
(In reply to Jonas Helming from comment #4)
> I had a look at DirectContributionItem and HandledContributionItem.
> If you agree, I would open up a new BR for the refactoring and do a
> contribution then.

Sounds good.
Comment 6 Paul Webster CLA 2015-05-28 09:41:20 EDT
(In reply to Jonas Helming from comment #4)
> 
> If you agree, I would open up a new BR for the refactoring and do a
> contribution then.

I'm OK with that, but you'll have to be careful.  A DirectContributionItem is a rendering that's little more than an SWT widget with some listeners.  A HandledContributionItem renders a full participant in our command and service lifecycle.

PW
Comment 7 Dirk Fauth CLA 2015-07-20 03:00:54 EDT

*** This bug has been marked as a duplicate of bug 465893 ***