Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ActionSet visibility
ActionSet visibility [message #88978] Wed, 21 May 2008 05:12 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

We have the following code :

In plugin.xml:

...
<extension id="com.farbeyond.input.ui.actionSet"
point="org.eclipse.ui.actionSets">
<actionSet id="2.Edit" label="Edit" visible="false">
<action id="menu.edit.new.id" icon="images/new.gif" label="New"
retarget="true"
disabledIcon="images/new_disabled.gif"
toolbarPath="additions/slot.edit/Group1"
tooltip="New"/>
</actionSet>
</extension>
...

In my ActionBarAdvisor:

...
protected void fillCoolBar(ICoolBarManager coolbarManager)
{
coolbarManager.add(new
GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolbarManager.appendToGroup(IWorkbenchActionConstants.MB_AD DITIONS,new
GroupMarker("slot.edit"));
}
...

In my IEditorPart:

...
public void init(IEditorSite site, IEditorInput input) throws
PartInitException
{
setSite(site);
setInput(input);

IAction action = new Action()
{
@Override
public void run()
{
System.out.println("new");
}
};

site.getActionBars().setGlobalActionHandler("menu.edit.new.id ", action);
}
...

The above code is to display certain ActionSet when we open an
IEditorPart, it used to work in our old RCP application, but not anymore
(even in RCP).

Right now we have to set the 'visible' attribute in plugin.xml to 'true'
to see the ActionSet, but this makes the ActionSet visible even if there's
no IEditorPart open.

The only workaround I can think of is attaching a IPartListener in the
IEditorPart and calling IWorkbenchPage.showActionSet/hideActionSet on
partActivated/partDeactivated callbacks, but this doesn't seem right to me
since ActionSet visibility should be taken care by the workbench.

Any help would be greatly appreciated.

Best Regards,

Setya
Re: ActionSet visibility [message #89617 is a reply to message #88978] Fri, 23 May 2008 12:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

you can use EditorActionBarContributor to show/hide menu- and tool-items
if a editor is activated/deactivated.

Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Setya [mailto:jsetya@gmail.com]
Bereitgestellt: Mittwoch, 21. Mai 2008 07:12
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: ActionSet visibility
Betreff: ActionSet visibility


Hi,

We have the following code :

In plugin.xml:

...
<extension id="com.farbeyond.input.ui.actionSet"
point="org.eclipse.ui.actionSets">
<actionSet id="2.Edit" label="Edit" visible="false"> <action
id="menu.edit.new.id" icon="images/new.gif" label="New"
retarget="true"
disabledIcon="images/new_disabled.gif"
toolbarPath="additions/slot.edit/Group1"
tooltip="New"/>
</actionSet>
</extension>
...

In my ActionBarAdvisor:

...
protected void fillCoolBar(ICoolBarManager coolbarManager) {
coolbarManager.add(new
GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

coolbarManager.appendToGroup(IWorkbenchActionConstants.MB_AD DITIONS,new
GroupMarker("slot.edit"));
}
...

In my IEditorPart:

...
public void init(IEditorSite site, IEditorInput input) throws
PartInitException {
setSite(site);
setInput(input);

IAction action = new Action()
{
@Override
public void run()
{
System.out.println("new");
}
};

site.getActionBars().setGlobalActionHandler("menu.edit.new.id ",
action); } ..

The above code is to display certain ActionSet when we open an
IEditorPart, it used to work in our old RCP application, but not anymore
(even in RCP).

Right now we have to set the 'visible' attribute in plugin.xml to 'true'

to see the ActionSet, but this makes the ActionSet visible even if
there's no IEditorPart open.

The only workaround I can think of is attaching a IPartListener in the
IEditorPart and calling IWorkbenchPage.showActionSet/hideActionSet on
partActivated/partDeactivated callbacks, but this doesn't seem right to
me since ActionSet visibility should be taken care by the workbench.

Any help would be greatly appreciated.

Best Regards,

Setya
Re: ActionSet visibility [message #89654 is a reply to message #89617] Fri, 23 May 2008 13:42 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Frank,

> you can use EditorActionBarContributor to show/hide menu- and tool-items
> if a editor is activated/deactivated.

Thanks for your suggestion above.

I've tried with EditorActionBarContributor but it didn't work either. The
strange thing is the code I posted earlier used to work in RCP. I only
have to call site.getActionBars().setGlobalActionHandler to make them
visible.

Regards,

Setya
Previous Topic:BUG: Tree row hight on font change
Next Topic:IFile
Goto Forum:
  


Current Time: Fri Apr 26 12:33:06 GMT 2024

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

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

Back to the top