SetInitiallyVisible(boolean) for ActionSet not working [message #326546] |
Mon, 24 March 2008 11:36  |
Eclipse User |
|
|
|
Hi,
I have added an action using actionSets. I believe for it to get constructed
I need to set its visibility as true in plugin.xml
However, I don't want this action to be visible or available until a certain
type of file is selected in workspace. (I tried objectClass filters too)..
So in order to make its visibility false when Eclipse with my plug-in loads,
I accessed the constructor method for this action and there tried to set the
setInitiallyVisible(false) for the actionSet under which this action falls
(WorkbenchPlugin.getDefault().getActionSetRegistry().findAct ionSet(id).setInitiallyVisible(false))
I also did the IWorkbenchWindow.getActivePage().hideActionSet(id).
But neither seems to work, since the action still comes up as an item in the
File Menu.
Am I doing something wrong here or do I need to do something else?
Thanks,
Rahul
|
|
|
|
|
Re: SetInitiallyVisible(boolean) for ActionSet not working [message #326651 is a reply to message #326618] |
Thu, 27 March 2008 09:23   |
Eclipse User |
|
|
|
Hi Paul,
Thanks for your help again! I was just about to drop in here to post that
its working now. I used perspectiveExtensions extension point and tied the
views and actionSet to my perspective. For some reason in case of
ationSetPartAssociation, I felt it was not working since my action set
became visible only when one of the associated views "was in focus" and not
just activated and visible. In case of perspectiveExtensions I do not need
to wait for the "in focus" aspect and the actionSet is visible exactly when
I want!! :-) So its moving on track as of now!
Thanks a lot Paul! However, there is one more issue related to the
enablement/disablement of actionSet. The actionSet that I have defined
defines an action similar to "Save" and I want this action to be initially
disabled (I managed to do that by action.setDisabled(true) in the
selectionChanged method of the action which is called after constructor).
And when certain conditions are true, I want to enable this "save" like
button. As of now I am doing it by accessing the action via
ActiveWorkbenchWindow >> CoolbarManager >> myActionSetContribution
(ToolBarContributionItem) >> ToolbarManager >> ActionContribution >>
getAction >> setEnabled (true);
This is pretty much a hack through the internal code and doesn't look neat.
Could you suggest me something better or a cleaner simpler way to do things?
Thanks,
Rahul
"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:fsdnvd$n9u$1@build.eclipse.org...
> Rahul Kamdar wrote:
>> Hi,
>>
>> I have added an action using actionSets. I believe for it to get
>> constructed I need to set its visibility as true in plugin.xml
>>
>> However, I don't want this action to be visible or available until a
>> certain type of file is selected in workspace. (I tried objectClass
>> filters too)..
>
> You can use selection or enablement to enable/disable the actions, or an
> actionSetPartAssociation to make them appear/disappear when a given view
> is active. You would only set the actionSet itself to visible true if you
> always want it visible in every perspective.
>
> If one of the above is not working for you, please post the XML and
> describe how it is not working.
>
> Hacking the internal code is not likely to work.
>
> --
> 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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03561 seconds