Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » tooltip of handled tool item
tooltip of handled tool item [message #1295698] Mon, 14 April 2014 13:55 Go to next message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
Hi,

I do have a part with a toolbar and some handled tool item in there.
Bound to a command and so to a handler the tool items become disabled or
enabled depending on the canExecute-method of the handlers. So
everything is fine. But when an item is disabled I do want to let the
user know why it is disabled.
My thought lead me to the tooltips of the handled tool items but I do
not know how to access them.
What can I do?

Greetings,

Jan
Re: tooltip of handled tool item [message #1296774 is a reply to message #1295698] Tue, 15 April 2014 07:26 Go to previous messageGo to next message
Eclipse UserFriend
@CanExecute
public boolean ce(..., MHandledItem item){
boolean isEnabled;

...

item.setToolTip(isEnabled?"YES":"NO");
return isEnabled;
}
Re: tooltip of handled tool item [message #1297436 is a reply to message #1296774] Tue, 15 April 2014 17:26 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
Thanks, this might work.
But is there no more elegant way? It seems to me I would break the loose
coupling between the handler and the ui element when I use the ui
element directly...



Am 15.04.2014 09:26, schrieb Sopot Cela:
> @CanExecute
> public boolean ce(..., MHandledItem item){
> boolean isEnabled;
>
> ..
>
> item.setToolTip(isEnabled?"YES":"NO");
> return isEnabled;
> }
>
Re: tooltip of handled tool item [message #1298400 is a reply to message #1297436] Wed, 16 April 2014 08:31 Go to previous messageGo to next message
Eclipse UserFriend
You want to access the tooltip of the item without accessing the item?
Re: tooltip of handled tool item [message #1298556 is a reply to message #1298400] Wed, 16 April 2014 10:53 Go to previous messageGo to next message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
I want a way to tell the user why an ui action can't be executed by him.
The tooltip was just a thought (yes I know poor title of the posting
then). At least there should be such thing as returning an IStatus
instead of a boolean value from @CanExecute. You know what I mean?
I mean it goes a long way of abstractions down to the handler and back
to tell whether an ui action can be executed or not. But grabbing the ui
element and using it directly breaks the abstraction chain and that
feels not right for me. You know?


Am 16.04.2014 10:31, schrieb Sopot Cela:
> You want to access the tooltip of the item without accessing the item?
>
Re: tooltip of handled tool item [message #1298564 is a reply to message #1298556] Wed, 16 April 2014 10:57 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
So you'd like the @CanExecute to return an IStatus instead of a simple
boolean?

Tom

On 16.04.14 12:53, Jan Weidauer wrote:
> I want a way to tell the user why an ui action can't be executed by him.
> The tooltip was just a thought (yes I know poor title of the posting
> then). At least there should be such thing as returning an IStatus
> instead of a boolean value from @CanExecute. You know what I mean?
> I mean it goes a long way of abstractions down to the handler and back
> to tell whether an ui action can be executed or not. But grabbing the ui
> element and using it directly breaks the abstraction chain and that
> feels not right for me. You know?
>
>
> Am 16.04.2014 10:31, schrieb Sopot Cela:
>> You want to access the tooltip of the item without accessing the item?
>>
>
Re: tooltip of handled tool item [message #1298612 is a reply to message #1298564] Wed, 16 April 2014 11:31 Go to previous message
Jan Weidauer is currently offline Jan WeidauerFriend
Messages: 49
Registered: July 2009
Member
I think it would be a nice solution for my request if the message would
be delivered to and interpreted by the corresponding items.

Jan


Am 16.04.2014 12:57, schrieb Tom Schindl:
> So you'd like the @CanExecute to return an IStatus instead of a simple
> boolean?
>
> Tom
>
> On 16.04.14 12:53, Jan Weidauer wrote:
>> I want a way to tell the user why an ui action can't be executed by him.
>> The tooltip was just a thought (yes I know poor title of the posting
>> then). At least there should be such thing as returning an IStatus
>> instead of a boolean value from @CanExecute. You know what I mean?
>> I mean it goes a long way of abstractions down to the handler and back
>> to tell whether an ui action can be executed or not. But grabbing the ui
>> element and using it directly breaks the abstraction chain and that
>> feels not right for me. You know?
>>
>>
>> Am 16.04.2014 10:31, schrieb Sopot Cela:
>>> You want to access the tooltip of the item without accessing the item?
>>>
>>
>
Previous Topic:Dependency Injection (Beginner)
Next Topic:Behavior Differences Between @Active and @Named
Goto Forum:
  


Current Time: Fri Mar 29 08:53:24 GMT 2024

Powered by FUDForum. Page generated in 0.04075 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top