Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Update label of search page
Update label of search page [message #1804611] Fri, 29 March 2019 13:26 Go to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
Hi, Is there a way to update the label of search page with number of matches after find references operation
Thanks,
Re: Update label of search page [message #1804613 is a reply to message #1804611] Fri, 29 March 2019 13:48 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 705
Registered: July 2009
Location: Dortmund, Germany
Senior Member

If you mean the "Xtext References to" label, customize org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor and bind it into the UI module.
Re: Update label of search page [message #1804615 is a reply to message #1804613] Fri, 29 March 2019 14:52 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
It helps to change the message itself, but label does not change after query execution
I want to show number of matches so I need to update Label of search page after finishing query execution
Re: Update label of search page [message #1804617 is a reply to message #1804615] Fri, 29 March 2019 15:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
hi,

am not sure if i can follow you,
labels are given by ReferenceSearchResultLabelProvider
which delegates to
GlobalDescriptionLabelProvider


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 29 March 2019 15:20]

Report message to a moderator

Re: Update label of search page [message #1804625 is a reply to message #1804617] Fri, 29 March 2019 16:53 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
I need to find a way to add number of matches beside existing label e.g(1 match in workspace)
as Karsten Thoms said , customizing org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor would help to change the label
what I'm asking about, how to change this label with correct number of matches
  • Attachment: xtextRef.PNG
    (Size: 1.34KB, Downloaded 35 times)
Re: Update label of search page [message #1804630 is a reply to message #1804625] Fri, 29 March 2019 17:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
did you debug at exactly that place i gave you

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804635 is a reply to message #1804630] Fri, 29 March 2019 17:28 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
Yes, ReferenceSearchResultLabelProvider provide a label for each element of search result, I need to update the label of ReferenceSearchViewPage itself
After debugging , I found that I have to call org.eclipse.search.ui.ISearchResultViewPart.updateLabel(). but I don't know where to call it !
Re: Update label of search page [message #1804642 is a reply to message #1804635] Fri, 29 March 2019 17:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
i am not sure if you should call that. you should customize/subclass the provider shouldnt you?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804647 is a reply to message #1804642] Fri, 29 March 2019 17:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
see (patched in xtext codebase

public class ReferenceSearchResultLabelProvider extends org.eclipse.jface.viewers.LabelProvider {

	@Inject
	private GlobalDescriptionLabelProvider globalDescriptionProvider; 
	
	@Override
	public String getText(Object element) {
		if (element instanceof ReferenceSearchViewTreeNode) {
			return "patched" + globalDescriptionProvider.getText(((ReferenceSearchViewTreeNode) element).getLabelDescription());
		}
		


index.php/fa/35158/0/


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804650 is a reply to message #1804611] Fri, 29 March 2019 18:04 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
I think we are taking about different labels :)
I need to add total number of matches beside basic label to be as attached:
Xtext Refrences to A (resource ) - (<number of matches> matches )
  • Attachment: Label.png
    (Size: 22.55KB, Downloaded 21 times)
Re: Update label of search page [message #1804654 is a reply to message #1804650] Fri, 29 March 2019 18:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
that is org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor.getLabel(EObject)



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804656 is a reply to message #1804654] Fri, 29 March 2019 18:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
+ a patch for org.eclipse.xtext.ui.editor.findrefs.ReferenceSearchViewPage.createQueryListener().new IQueryListener() {...}.() that calls part.updateLabel on finish
or in showBusyLabel when false


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804657 is a reply to message #1804654] Fri, 29 March 2019 18:22 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
Great, how "org.eclipse.xtext.ui.editor.findrefs.ReferenceQueryExecutor.getLabel(EObject)"
be called after finding all references ?
Re: Update label of search page [message #1804658 is a reply to message #1804656] Fri, 29 March 2019 18:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
(that might be even something to be fixed in xtext itself.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Update label of search page [message #1804662 is a reply to message #1804658] Fri, 29 March 2019 18:41 Go to previous messageGo to next message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
Is there a workaround ?
Re: Update label of search page [message #1804663 is a reply to message #1804662] Fri, 29 March 2019 18:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13155
Registered: July 2009
Senior Member
i assume everything can be overriden.

here is how it looks like now

protected IQueryListener createQueryListener() {
		return new IQueryListener() {

			@Override
			public void queryStarting(ISearchQuery query) {
				showBusyLabel(true);
			}

			@Override
			public void queryRemoved(ISearchQuery query) {
				showBusyLabel(false);
			}

			@Override
			public void queryFinished(ISearchQuery query) {
				
				
				
				showBusyLabel(false);
				
				Display.getDefault().asyncExec(new Runnable() {

					@Override
					public void run() {
						ReferenceSearchViewPage.this.part.updateLabel();
					}
					
				});
				
			}

			@Override
			public void queryAdded(ISearchQuery query) {
				showBusyLabel(false);
			}
		};
	}

(am not sure which stuff is visible from a subclass, in doubt reflection)

we would also need a github issue at eclipse/xtext-eclipse for that


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 29 March 2019 18:49]

Report message to a moderator

Re: Update label of search page [message #1804681 is a reply to message #1804663] Fri, 29 March 2019 19:20 Go to previous message
Elen Mouner is currently offline Elen MounerFriend
Messages: 13
Registered: November 2018
Junior Member
Thank you for all your assistance
Previous Topic:Xtend code generation: include library
Next Topic: Issues updating Eclipse | 2018-12 → 2019-03
Goto Forum:
  


Current Time: Tue Oct 15 21:21:23 GMT 2019

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

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

Back to the top