Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Emf Forms] Tooltips in Views
[Emf Forms] Tooltips in Views [message #1723503] Tue, 16 February 2016 08:44 Go to next message
Eclipse UserFriend
Hello,

is there a way to change the tooltip within the Forms-views?

I mean the tooltip that appears over the Attribute-Name-Lables ...
Currently it shows : _UI_PropertyDescriptor_description from
plugin.properties (in generated edit-Plugin) resulting in

"The <attribute> of the <class>"

But I want to defined a custom tooltip for each eClass and for each of
its Attributes...

Best regards
Oliver
Re: [Emf Forms] Tooltips in Views [message #1723658 is a reply to message #1723503] Wed, 17 February 2016 06:48 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Oliver

I was recently trying out an Extension point from ECP :
org.eclipse.emf.ecp.ui.view.tooltipModifier
This extension point is mention for changing the tooltip on the controls
rendered by ECP. Not sure if this can be used for Label Tooltips also.

I have documented my learning in an article. You may find a link to the
article below.
http://www.ancitconsulting.com/tutorials/ecp/4_ECP%20-%20Custom%20Tooltip%20to%20EMF%20Forms%20Editor.pdf

Regards
Malai

On 2/16/2016 2:14 PM, Geith, Oliver wrote:
> Hello,
>
> is there a way to change the tooltip within the Forms-views?
>
> I mean the tooltip that appears over the Attribute-Name-Lables ...
> Currently it shows : _UI_PropertyDescriptor_description from
> plugin.properties (in generated edit-Plugin) resulting in
>
> "The <attribute> of the <class>"
>
> But I want to defined a custom tooltip for each eClass and for each of
> its Attributes...
>
> Best regards
> Oliver
Re: [Emf Forms] Tooltips in Views [message #1723680 is a reply to message #1723658] Wed, 17 February 2016 08:49 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Oliver,
the text you see is the default text that is generated by emf. You can find it in the generated plugin.properties of your edit bundle. There is this entry:
Quote:
_UI_PropertyDescriptor_description = The {0} of the {1}

Now you can of course customize this. Open the GenModel Editor, select the feature you want to change, and in the properties view add the description you want to the property "Property Description".
If you now generate the edit bundle again, you will find an extra entry at the bottom.
Something like this:
_UI_Task_name_description = The name of the task should not be longer then 72 characters

The TooltipModifier is used to modify prepared tooltips, eg if you have a very long description but want the tooltip to be 50 chars wide, you can provide a modifier that adds line breaks to the provided text so the resulting tooltip will not be to wide.
You can also replace magic keys using your own modifier.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Emf Forms] Tooltips in Views [message #1723697 is a reply to message #1723503] Wed, 17 February 2016 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Update:

I got a hint to use the Extensionpoint
"org.eclipse.emf.ecp.ui.view.tooltipModifier"

This is not exactly what I was looking for, but perhaps a good
workaround. :-)

So I implemented a Class to modify the tooltip for the rendered
controls. This works as far as I can see...BUT:
....now I get lots of messageboxs for each "number" Attribute saying :

"Invalid Number"
"The Number you have entered is invalid. The value will be unset."

Unfortunately there is no stacktrace, no nothing....
I traced this back to NumberControlSWTRenderer, but then I lost
orientation while debugging in all those classes...

Is this a bug ? How to avoid this?!

regards
Oliver




Am 16.02.2016 um 09:44 schrieb Geith, Oliver:
> Hello,
>
> is there a way to change the tooltip within the Forms-views?
>
> I mean the tooltip that appears over the Attribute-Name-Lables ...
> Currently it shows : _UI_PropertyDescriptor_description from
> plugin.properties (in generated edit-Plugin) resulting in
>
> "The <attribute> of the <class>"
>
> But I want to defined a custom tooltip for each eClass and for each of
> its Attributes...
>
> Best regards
> Oliver
Re: [Emf Forms] Tooltips in Views [message #1723699 is a reply to message #1723680] Wed, 17 February 2016 09:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eugen,

this is exactly what I was looking for! Thanks a lot!

> Now you can of course customize this. Open the GenModel Editor, select
> the feature you want to change, and in the properties view add the
> description you want to the property "Property Description".
> If you now generate the edit bundle again, you will find an extra entry
> at the bottom. Something like this:
> _UI_Task_name_description = The name of the task should not be longer
> then 72 characters
>

regards
Oliver
Re: [Emf Forms] Tooltips in Views [message #1791336 is a reply to message #1723699] Thu, 28 June 2018 08:28 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hello everyone,

I am on the same path, trying to customize the tooltips in my app. The proposed solution with property description is working fine.

However, I was hoping to utilize EcoreUtil.getDocumentation(eStructuralFeature) method, as I have this information in the XSD Schema the models are generated from.
After implementing ECPStringModifier and extending "org.eclipse.emf.ecp.ui.view.tooltipModifier", I get the same error as Oliver described.

Is this still the intended way of modifying tooltips? If not (this is more a general EMF question...) is there a way to set genmodel->documentation annotation as feature description?

Thanks and best regards
Nikola

P.S.
Debugging shows that the values passed represent values of the model features. Will try implementing EMFFormsLabelProvider, as getDescription() methods seem promising.

[Updated on: Thu, 28 June 2018 09:18]

Report message to a moderator

Re: [Emf Forms] Tooltips in Views [message #1791534 is a reply to message #1791336] Mon, 02 July 2018 07:51 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Nikola,

the Exceptions when providing your own tooltip modifier are of course not intended.
I will try to create a minimal implementation for the makeithappen example.

Providing your own EMFFormsLabelProvider is also a valid way to go, but check the existing implementation and delegate to the existing services as you can easily break all labels, i18n support etc. (org.eclipse.emfforms.internal.core.services.label.EMFFormsLabelProviderImpl)

Cheers.
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Emf Forms] Tooltips in Views [message #1791776 is a reply to message #1791534] Thu, 05 July 2018 07:52 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hi Eugen,

I have just tested my take on TooltipModifier.
In my plugin, I have defined an extension on "org.eclipse.emf.ecp.ui.view.tooltipModifier" pointing to a class ToolTipModifier implements ECPStringModifier

Implemented method
	@Override
	public String modifyString(String text, Setting setting) {
		if (setting != null) {
			System.out.println("Modifying tooltip for " + setting.getEStructuralFeature().getName() + ", received text: " + text);
		}
		return text;
	}

Output shows that the passed text represents the instance values of the displayed object.
(Form containing a field "Id" with value "asd" produces "Modifying tooltip for id, received text: asd")

I assume that is the reason for the error message, when a non-string-assignable value is present, and a String is returned.
(I am testing with emfforms 1.15)

I would have expected the tooltip text to be passed as argument on this place. Am I missing something?


Cheers
Nikola
Re: [Emf Forms] Tooltips in Views [message #1791787 is a reply to message #1791776] Thu, 05 July 2018 09:33 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Nikola,

do you get the exceptions mentioned above with this TooltipModifier?
The tooltip must be a string as this is how a tooltip is displayed.

The tooltip text is already passed.
It's the text argument.

The idea is, that you can either modify the text like it is done in org.eclipse.emf.ecp.internal.ui.view.linewrapper.ECPStringLineWrapper.
You can also replace the text like it is done in org.eclipse.emf.ecp.edit.internal.swt.table.DateCellStringTooltipModifier .

But maybe one thing that is confusing, is the tooltip we are talking about. The Tooltip modifier allows to modify the tooltips which pop up when you hover over the input field. The tooltip which popup when you hover over the label, is not touched by the modifier. You can change the tooltips on the label only by changing the genmodel or by providing your own org.eclipse.emfforms.spi.core.services.label.EMFFormsLabelProvider.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Emf Forms] Tooltips in Views [message #1791808 is a reply to message #1791787] Thu, 05 July 2018 13:53 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hi Eugen,

the kind of tooltip was a misunderstanding!
Anyhow: I have just tried out following method:
	@Override
	public String modifyString(String text, Setting setting) {
		return "test String";
	}

It produces the mentioned error msg: The number you have entered is invalid. The value will be unset.

Following produces no such error msg:
	@Override
	public String modifyString(String text, Setting setting) {
		return "42";
	}

But, I don't get any hover tooltips on fields. (I might be missing some bundles in the target platform, but since I don't utilize this feature, it never occured to me to check).


Is there an example for implementing/registering a custom labelProvider? The description in https://eclipsesource.com/blogs/tutorials/how-to-customize-emf-forms/ is, as far as I could understand, oriented towards using the default provider...


Thanks
Nikola
Re: [Emf Forms] Tooltips in Views [message #1792039 is a reply to message #1791808] Tue, 10 July 2018 12:44 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Nikola,

I'm sorry we do not have any documentation on how to provide your own custom label provider.
The best thing to do is check the existing implementations:
org.eclipse.emfforms.internal.core.services.label.EMFFormsLabelProviderImpl
org.eclipse.emfforms.internal.core.services.label.EMFFormsLabelProviderDefaultImpl

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Emf Forms] Tooltips in Views [message #1792484 is a reply to message #1792039] Wed, 18 July 2018 14:13 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hi Eugen,

thanks for the tip! I managed to overwrite the EMFFormsLabelProviderImpl without messing everything up.
First I tried registering it via extension point:
 <extension
         point="org.eclipse.emf.ecp.ui.labelProvider">
      <labelProvider
            class="customizations.services.MyLabelProvider">
      </labelProvider>
   </extension>


Didn't work for me. Then I saw that the EMFFormsLabelProviderImpl and EMFFormsLabelProviderDefaultImpl have corresponding OSGi service definitions. Once added, works like a charm!


What I am still missing: For Boolean Control, there is a default label "No boolean set! Click to set boolean."
I checked the source code:
protected String getUnsetText() {
		return LocalizationServiceHelper
			.getString(getClass(), MessageKeys.BooleanControl_NoBooleanSetClickToSetBoolean);

I tried adding bundle.properties in /OSGI-INF/l10n with the appropriate key/value pair, but that does not seem to work. Is there a way to override the bundle properties of the renderer bundle? Or should I consider implementing own LocalizationService?

Best regards
Nikola

P.S.
I have just tried adding
Bundle-Localisation: OSGI-INF/l10n/bundle.properties
to my manifest file, as suggested in https://eclipsesource.com/blogs/tutorials/how-to-customize-emf-forms/#localization

File contains one line
BooleanControl_NoBooleanSetClickToSetBoolean=Testnobooelan

Still no success...


P.P.S.
Implementing localization service solved this problem!
(registered as OSGi service in my bundle)

[Updated on: Thu, 19 July 2018 07:07]

Report message to a moderator

Re: [Emf Forms] Tooltips in Views [message #1792724 is a reply to message #1792484] Mon, 23 July 2018 09:14 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Nikola,

you should be able to override the text by providing a fragment for the bundle with the bundle.properties inside. I think though that you would need to increase its priority by adding a country code to it eg: bundle_en.properties for English or bundle_de.properties for German.
Of course you can solve it the hard way like you did, but it should not be necessary.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [Emf Forms] Tooltips in Views [message #1792863 is a reply to message #1792724] Wed, 25 July 2018 08:48 Go to previous message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 31
Registered: December 2017
Member
Hi Eugen,

thanks for the tip! For now it works, but I will definitely try the easy way around, once I get some time for it.

Cheers,
Nikola
Previous Topic:EMF Forms custom file extension/file type
Next Topic:[EMF Forms] View Proxy on feature-level
Goto Forum:
  


Current Time: Thu Mar 28 22:29:09 GMT 2024

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

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

Back to the top