Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Dynamic Auto-Complete on a single details page
[EMF Forms] Dynamic Auto-Complete on a single details page [message #1794026] Wed, 22 August 2018 15:41 Go to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 23
Registered: December 2017
Junior Member
Hi Everyone,

I have a case, where the values of auto-complete proposals depend on another value in the same view. (I am extending the generic editor)

I could solve the problem by implementing following:

- in CommandStackListener, when the field is changed, upon which the autocomplete values depend, set a local field "jumpToAfterRendering" to the value of current selection

- set selection of the tree-master-detail to empty
tmd.setSelection(new StructuredSelection());

- implement the renderingFinished callback to the tree-master-detail
tmd.registerDetailPanelRenderingFinishedCallback(new DetailPanelRenderingFinishedCallback() {

			@Override
			public void renderingFinished(Object renderedObject) {
				if (jumpToAfterRendering != null) {
					tmd.setSelection(new StructuredSelection(jumpToAfterRendering));
					jumpToAfterRendering = null;
				}
			}
		});



This results in fresh rendering of the detail panel, with new call to the Autocomplete service.

Donwside is that there is a not-so-nice looking transition to empty selection and back.
Is there a more elegant way of implementing this?


Best regards
Nikola

P.S.
If I remember my recent analysis of the Autocomplete Control correctly, the values are calculated on rendering.
At that moment I thought, wouldn't it be possible to change the control in a way to make it call the autocomplete service when the values are required?

I will try to find time to look into it more closely, but maybe someone could point out a better solution, or disillusion me on this subject...

[Updated on: Thu, 23 August 2018 16:27]

Report message to a moderator

Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794153 is a reply to message #1794026] Fri, 24 August 2018 13:52 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 82
Registered: December 2013
Member

Hi,

you could try to override
AutocompleteTextControlSWTRenderer.createJFaceViewer(Composite)
in order to keep track of the ComboViewer and the AutoCompleteField and then update the combo's input/the field's proposals every time the combo gets focus. However I haven't tried this myself and I am not sure if reacting on a focus change catches all cases.

The other option I see currently would be to add a callback/update-mechanism to the AutocompleteViewModelService at which the renderer registers itself. You could then update the service which will notify the renderer about the proposals change.

I hope this helps!

Cheers
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794173 is a reply to message #1794153] Sat, 25 August 2018 07:57 Go to previous messageGo to next message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 23
Registered: December 2017
Junior Member
Hello Johannes,

I will try the proposal with onFocus. That would't require any complex logic for updating, assuming it covers all cases. Maybe an additional method in the autocomplete service, isDynamic(), which would let one define the non-changing fields, so the service is not called unnecessarily.

Cheers
Nikola
Re: [EMF Forms] Dynamic Auto-Complete on a single details page [message #1794215 is a reply to message #1794173] Mon, 27 August 2018 15:04 Go to previous message
Nikola Veber is currently offline Nikola VeberFriend
Messages: 23
Registered: December 2017
Junior Member
Implemented with onFocusListener. Looks good so far (still looking for cases not covered by this implementation).

Thanks!
Nikola
Previous Topic:[EMF Forms] Sorting numbers in a table control
Goto Forum:
  


Current Time: Wed Sep 19 05:46:22 GMT 2018

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

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

Back to the top