Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Visible Action set(project dependant visibility)
Visible Action set [message #541425] Mon, 21 June 2010 07:04 Go to next message
Sandeep  is currently offline Sandeep Friend
Messages: 14
Registered: June 2010
Junior Member
Hello Everyone,

I have an action set and i want to make that action set visible only if a certain kind of project is selected in the projects menu.(lets say a Java project). If no such project or some other type of project is selected, then my action set in the Menu should stay greyed out.

Any help ?
Re: Visible Action set [message #541529 is a reply to message #541425] Mon, 21 June 2010 13:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

ActionSet visibility was not defined to be so fine grained. it's not
supposed to track selection, but enable a group of actions for that
perspective (task oriented). Or with actionSetPartAssociations, as long
as a specific part is active.

But the actions themselves can respond to the current selection and
enable/disable themselves.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Visible Action set [message #541682 is a reply to message #541425] Tue, 22 June 2010 07:38 Go to previous messageGo to next message
Sandeep  is currently offline Sandeep Friend
Messages: 14
Registered: June 2010
Junior Member
Thanks Paul for the info.
But i want to do something like this :

Depending upon the project selected, i want to transfer some default template files to that project from my plugin jar file. Now i am facing two potential problems:

1. How to get the selected node from package explorer? ( On solution is mentioned in this but i am getting selection = null, so i am stranded on this)

2. How to transfer files from the jar file of my plugin to that selected project?

Thanks in advance,
Sandeep.
Re: Visible Action set [message #541766 is a reply to message #541682] Tue, 22 June 2010 13:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Sandeep wrote:
> 1. How to get the selected node from package explorer? ( On solution is
> mentioned in
> http://stackoverflow.com/questions/585802/how-to-get-the-sel ected-node-in-the-package-explorer-from-an-eclipse-plugin
> but i am getting selection = null, so i am stranded on this)

In commands/handlers, you use HandlerUtil to get the current selection.
In an ActionSet, your IActionDelegate will be told the current
selection in org.eclipse.ui.IActionDelegate.selectionChanged(IAction,
ISelection)

>
> 2. How to transfer files from the jar file of my plugin to that selected
> project?

See the conversation in How to Install a Plug-in?
http://www.eclipse.org/forums/index.php?t=msg&&th=16 8754&goto=535652

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Visible Action set [message #541959 is a reply to message #541425] Wed, 23 June 2010 11:42 Go to previous messageGo to next message
Sandeep  is currently offline Sandeep Friend
Messages: 14
Registered: June 2010
Junior Member
AWESOME reply Paul!

Corrected both my problems and also gained tonnes of insights into eclipse working.

Thanks a lot.
Sandeep.
Re: Visible Action set [message #542998 is a reply to message #541425] Mon, 28 June 2010 07:51 Go to previous message
Sandeep  is currently offline Sandeep Friend
Messages: 14
Registered: June 2010
Junior Member
Regarding my original question, there is a way..
in plugin.xml, all i did was :

enablesFor="1"
<selection class="org.eclipse.jdt.internal.core.JavaProject">
</selection>

and now the action set is visible only if a Java project is selected.
This is all i wanted Smile

Sandeep.
Previous Topic:Disabling save for dirty Editor Part
Next Topic:interactive splash not working on the final product
Goto Forum:
  


Current Time: Sat Apr 27 01:33:07 GMT 2024

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

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

Back to the top