Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Hiding Toggle Mark Occurrences icon in the coolbar(UI)
Hiding Toggle Mark Occurrences icon in the coolbar [message #1742713] Tue, 06 September 2016 18:57 Go to next message
Aleksy Schubert is currently offline Aleksy SchubertFriend
Messages: 2
Registered: September 2016
Junior Member
I have a problem with hiding "Toggle Mark Occurrences" button in my coolbar on a
standalone RCP application based upon Xtext. When I run the Plug-in Menu Spy it identifies
the button as follows:

The active contribution item identifier:
ui.editor.markOccurrences
The active contribution item class:
AbstractToggleActionContributor$InternalToggleAction
The contributing plug-in:
org.eclipse.xtext.ui (2.10.0.v201605250459)


I tried to use two methods to hide the button, but each of them failed.

1) I defined a hiding activity and added there
      <activityPatternBinding
            activityId="net.afyre.haha.demo.rcp.hidejunk"
            pattern=".*/.*markOccurrences">
      </activityPatternBinding>


with several experiments that consisted in changing the pattern to

pattern=".*markOccurrences"
pattern="ui.editor.markOccurrences"


2) I tried to disable the action from within ApplicationWorkbenchWindowAdvisor
class in my plugin, using a code similar to

	  IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer ().getMenuManager ();
	  IContributionItem[] mItems = mm.getItems ();
	  for (String menu : menusToRemove) {
		  for (IContributionItem iContributionItem : mItems) {
			  if (iContributionItem.getId().equals(menu)) {
				  mm.remove(menu); //IContributionItem does not work here
			  }
		  }
	  }


or

  ICoolBarManager mm = getWindowConfigurer ().getActionBarConfigurer ().getCoolBarManager ();
	  IContributionItem[] mItems = mm.getItems ();
	  for (String menu : menusToRemove) {
		  for (IContributionItem iContributionItem : mItems) {
			  if (iContributionItem.getId().equals(menu)) {
				  mm.remove(menu); //IContributionItem does not work here
			  }
		  }
	  }


Any ideas?
Re: Hiding Toggle Mark Occurrences icon in the coolbar [message #1742740 is a reply to message #1742713] Wed, 07 September 2016 06:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
simply go to the ui moodule, overriding org.eclipse.xtext.ui.DefaultUiModule.configureMarkOccurrencesAction(Binder) and dont call super does not work?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Hiding Toggle Mark Occurrences icon in the coolbar [message #1743023 is a reply to message #1742740] Fri, 09 September 2016 14:44 Go to previous message
Aleksy Schubert is currently offline Aleksy SchubertFriend
Messages: 2
Registered: September 2016
Junior Member
Great thanks for the tip! It indeed works Cool (Although I feel a little bit uneasy with introduction of a 3rd method to reduce my GUI to pieces that are relevant for my application.)
Previous Topic:Xtend memory and speed issue
Next Topic:ParseHelper accepts illegal input
Goto Forum:
  


Current Time: Sat Apr 27 02:24:04 GMT 2024

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

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

Back to the top