Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » activities and filter out GUI
activities and filter out GUI [message #334080] Mon, 19 January 2009 16:35 Go to next message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
Hi,
I use activities extension point to filter out menus and toolbars.
I define it in the plugin.xml as below. But I still get
"Edit","Navigate","Project" menus. My application don't need to edit or
build. It is not editable.
<extension
point="org.eclipse.ui.activities">
<category
name="Filter GUI Category"
id="org.myorg.category.excludeFromGUI">
</category>
<categoryActivityBinding
activityId="org.myorg.activity.excludeFromGUI"
categoryId="org.myorg.category.excludeFromGUI">
</categoryActivityBinding>
<activity
name = "Exclude GUI"
description="Exclude GUI"
id="org.myorg.activity.excludeFromGUI">
</activity>
<activityPatternBinding
activityId="org.myorg.activity.excludeFromGUI"
pattern=".*/org\.eclipse\.ui\.examples\.*">
</activityPatternBinding>
<activityPatternBinding
activityId="org.myorg.activity.excludeFromGUI"
pattern=".*/org.eclipse.search.menu.*">
</activityPatternBinding>
<activityPatternBinding
activityId="org.myorg.activity.excludeFromGUI"
pattern=".*/org.eclipse.edit.menu.*">
</activityPatternBinding>
</extension>

1) How may I detect the ids of different menu items in order to define
them in activity binding, for example:
Project->Build Working Set, Build Automatically
Edit->Undo,Redo,Cut,Copy,Paste
2) Is it possible to remove all the menus and tool bars and add my owns ?
When I tried to define as following - I still get some menus
<activityPatternBinding
activityId="org.myorg.activity.excludeFromGUI"
pattern=".*/.*">
</activityPatternBinding>

Thanks a lot.
Stella
Re: activities and filter out GUI [message #493434 is a reply to message #334080] Mon, 26 October 2009 09:28 Go to previous messageGo to next message
Dilip G is currently offline Dilip GFriend
Messages: 3
Registered: October 2009
Junior Member
Stella,
Did you find a way to hide Project->Build Working Set, Build Automatically, Edit->Undo,Redo,Cut,Copy,Paste ??

I am looking to hide the Close Project action and am unable to do it.

Let me know if you found a way out.

thanks
Dilip
Re: activities and filter out GUI [message #493554 is a reply to message #334080] Mon, 26 October 2009 19:39 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
I'd like to remove the Run menu completely. I've got all of the menu items removed with activities but I'm unable to remove the empty Run menu. My activity is:

<activity description="Hide Run menu" id="activity.runMenu" name="RunMenu activity"
</activity>

<activityPatternBinding activityId="activity.runMenu" pattern=".*/org.eclipse.ui.run">
<activityPatternBinding>

Could the problem be groupMarkers left in the menu? If so, they have no id so do I use a matcher for their name? Or is there something else to this?

Any help greatly appreciated.

Craig
Re: activities and filter out GUI [message #493582 is a reply to message #493554] Tue, 27 October 2009 04:32 Go to previous messageGo to next message
Dilip G is currently offline Dilip GFriend
Messages: 3
Registered: October 2009
Junior Member
Hi Craig,
Were you successful with hiding any actions from the Project menu ? I am able to hide actions from the Search menu with :

<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.search/org.eclipse.search.OpenFileSearchPage ">
</activityPatternBinding>

<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.search/org.eclipse.search.OpenSearchDialog ">
</activityPatternBinding>


<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.ui.ide/org.eclipse.ui.openLocalFile">
</activityPatternBinding>

I tried this for the Close Project action :

<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.ui.ide/org.eclipse.ui.project.closeProject ">
</activityPatternBinding>

but that does not work.

Any thoughts on what could be wrong ??
Any help will be appreciated.
thanks a ton.
dilip




Re: activities and filter out GUI [message #493610 is a reply to message #334080] Tue, 27 October 2009 08:57 Go to previous messageGo to next message
Stella Levin is currently offline Stella LevinFriend
Messages: 89
Registered: July 2009
Member
Hi, I just copy my working activities from plugin.xml (put attention that pattern is a regexp). Other possiblity is to remove activities in the run time - see below. Hope it helps. Stella
------------------------------------------------------------ --------------------------
<extension
point="org.eclipse.ui.activities">

<activity
name = "Exclude GUI"
description="Exclude GUI"
id="org.mlnx.activity.excludeFromGUI">
</activity>
<activityPatternBinding
activityId="org.mlnx.activity.excludeFromGUI"
pattern="org\.eclipse\..*quickdiff.*">
</activityPatternBinding>
<activityPatternBinding
activityId="org.mlnx.activity.excludeFromGUI"
pattern="org\.eclipse\.search.*">
</activityPatternBinding>
<activityPatternBinding
activityId="org.mlnx.activity.excludeFromGUI"
pattern="org.eclipse.ui.editors\/org\.eclipse\.ui\.edi
t\.text\.gotoLastEditPosition">
</activityPatternBinding>
<activityPatternBinding
activityId="org.mlnx.activity.excludeFromGUI"
pattern="org\.eclipse\..*externaltools.*">
</activityPatternBinding>
</extension>
------------------------------------------------------------ --------------------------
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
// Actions to remove
private String actionId = "org.eclipse.ui.edit.text.actionSet.convertLineDelim
itersTo";
ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegis
try();
IActionSetDescriptor[] actionSets = reg.getActionSets();
for (int i = 0; i <actionSets.length; i++) {
if (!actionSets[i].getId().equals(actionId)) continue;
IExtension ext = actionSets[i].getConfigurationElement()
.getDeclaringExtension();
reg.removeExtension(ext, new Object[] { actionSets[i] });
}

------------------------------------------------------------ --------------------------
Re: activities and filter out GUI [message #493644 is a reply to message #493582] Tue, 27 October 2009 13:02 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Dilip G wrote on Tue, 27 October 2009 00:32

I tried this for the Close Project action :

<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.ui.ide/org.eclipse.ui.project.closeProject ">
</activityPatternBinding>

but that does not work.




Close and Open project are added in the WorkbenchActionBuilder (for an IDE based application). If you're in RCP you can just "not add them" yourself. If you're based on the IDE, there's no easy way to remove them (activities won't work, they're programmatic contributions). Its ID is closeProject from IDEActionFactory

In 3.5 you can always org.eclipse.ui.perspectiveExtensions to hide the menu item by ID.

PW


Re: activities and filter out GUI [message #493645 is a reply to message #493610] Tue, 27 October 2009 13:03 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Stella wrote on Tue, 27 October 2009 04:57

------------------------------------------------------------ --------------------------
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
// Actions to remove
private String actionId = "org.eclipse.ui.edit.text.actionSet.convertLineDelim
itersTo";
ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegis
try();
IActionSetDescriptor[] actionSets = reg.getActionSets();
for (int i = 0; i <actionSets.length; i++) {
if (!actionSets[i].getId().equals(actionId)) continue;
IExtension ext = actionSets[i].getConfigurationElement()
.getDeclaringExtension();
reg.removeExtension(ext, new Object[] { actionSets[i] });
}

------------------------------------------------------------ --------------------------



Just a note ... this is not guaranteed to exist from one release to the next (even between 3.5.0 and 3.5.1 for example) and it definitely won't work reliably within one session (if there's any dynamic content going on).

PW


Re: activities and filter out GUI [message #494304 is a reply to message #493644] Fri, 30 October 2009 06:23 Go to previous messageGo to next message
Dilip G is currently offline Dilip GFriend
Messages: 3
Registered: October 2009
Junior Member
Thanks a lot Stella and Paul.
Re: activities and filter out GUI [message #798331 is a reply to message #493644] Tue, 14 February 2012 14:53 Go to previous messageGo to next message
n m is currently offline n mFriend
Messages: 7
Registered: February 2012
Junior Member
Paul Webster wrote on Tue, 27 October 2009 09:02
Dilip G wrote on Tue, 27 October 2009 00:32

I tried this for the Close Project action :

<activityPatternBinding
activityId="com.xyz.ui.disable"

pattern="org.eclipse.ui.ide/org.eclipse.ui.project.closeProject ">
</activityPatternBinding>

but that does not work.



Close and Open project are added in the WorkbenchActionBuilder (for an IDE based application). If you're in RCP you can just "not add them" yourself. If you're based on the IDE, there's no easy way to remove them (activities won't work, they're programmatic contributions). Its ID is closeProject from IDEActionFactory

In 3.5 you can always org.eclipse.ui.perspectiveExtensions to hide the menu item by ID.

PW


I have an eclipse plug-in, NOT an RCP, in which I need to remove the Project menu as I will be exporting this plug-in as a product which has no Project menu. From your message, does this mean that it is not possible to remove the eclipse menus using activities?

I have tried every combination of a pattern in the activity with project and it just doesn't seem to remove it. I am able to remove views such as the Project Explorer but I am not able to with menus.
Re: activities and filter out GUI [message #808452 is a reply to message #798331] Mon, 27 February 2012 20:02 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Correct, if you are based on the ide application (using WorkbenchActionBuilder) there is no way to remove the Project menu.

PW


Re: activities and filter out GUI [message #1603438 is a reply to message #493554] Fri, 06 February 2015 06:45 Go to previous message
kumar manish is currently offline kumar manishFriend
Messages: 5
Registered: January 2015
Junior Member
Hi Craig,

could you please let me know how you removed all menu items from the eclipse.

Thanks,
Manish
Previous Topic:Request for feature: more support for method calls in debugger
Next Topic: Problem with StatusLine in application running through Eclipse Luna Service Release 1 (4.4.1)
Goto Forum:
  


Current Time: Fri Apr 26 21:05:24 GMT 2024

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

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

Back to the top