Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Programmatically invoking a cheat sheet
Programmatically invoking a cheat sheet [message #329412] Mon, 23 June 2008 10:43 Go to next message
Eclipse UserFriend
I'm trying to display a certain cheat sheet as one of the tasks for a
pop-up action. The org.eclipse.ui.cheatsheet.OpenCheatSheetAction seems
to be what I need. But I'm not sure how to invoke it.

I figured it should be run asynchronously from my action-delegate so I
wrapped its invocation in a Job class invocation. The code in the job is:

String cheatSheetId = "com.myplugin.cheatsheet";
OpenCheatSheetAction action = new OpenCheatSheetAction(cheatSheetId);
action.run();
return Status.OK_STATUS;

But this yields me a NullPointerException:

!ENTRY org.eclipse.core.jobs 4 2 2008-06-23 07:22:29.686
!MESSAGE An internal error occurred during: "CheatSheetJob".
!STACK 0
java.lang.NullPointerException
at
org.eclipse.ui.cheatsheets.OpenCheatSheetAction.run(OpenChea tSheetAction.java:87)
at
treewizard.popup.actions.PopupWizard$CheatSheetJob.run(Popup Wizard.java:59)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

Can someone point me into the proper direction for such an invocation.
Perhaps Jobs are not the way to go here.

- Paul
Re: Programmatically invoking a cheat sheet [message #329416 is a reply to message #329412] Mon, 23 June 2008 11:12 Go to previous messageGo to next message
Eclipse UserFriend
I meant to also ask for direction on how to invoke an action in general.
Various tutorials show us how to create actions to be invoked by the
workbench. But my questions seems to be a special case of how actions
should be invoked programmatically by other plug-ins.

Thanks,
- Paul
Re: Programmatically invoking a cheat sheet [message #329426 is a reply to message #329412] Mon, 23 June 2008 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Commands are set up to be invoked programmatically ... although I'll
point out in this case, it seems like cheatsheets should be invoked on
the UI thread.


org.eclipse.ui.cheatsheets.openCheatSheet is the command and it takes a
parameter of cheatSheetId

Check out the Platform_Command_Framework for some general information on
invoking commands+handlers.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: Programmatically invoking a cheat sheet [message #329453 is a reply to message #329426] Tue, 24 June 2008 22:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi Paul,

Thanks for the Eclipse Command info. I think I get it conceptually.
But how did you learn about the openCheatSheet command you mention? Are
available commands documented somewhere? I couldn't locate such a list
in either the Javadoc nor the plug-in extension docs. I was able to
find the command declared in the plugin.xml of the
org.eclipse.ui.cheatsheets plug-in once I knew what to look for (after
reading your post and links). Is this the usual way one determines
commands implemented by a plug-in?

Thanks for getting me started,
- Paul


Paul Webster wrote:
> Commands are set up to be invoked programmatically ... although I'll
> point out in this case, it seems like cheatsheets should be invoked on
> the UI thread.
>
>
> org.eclipse.ui.cheatsheets.openCheatSheet is the command and it takes a
> parameter of cheatSheetId
>
> Check out the Platform_Command_Framework for some general information on
> invoking commands+handlers.
>
> PW
>
Re: Programmatically invoking a cheat sheet [message #329473 is a reply to message #329453] Wed, 25 June 2008 10:23 Go to previous message
Eclipse UserFriend
Paul Glezen wrote:
> Hi Paul,
>
> Thanks for the Eclipse Command info. I think I get it conceptually. But
> how did you learn about the openCheatSheet command you mention? Are
> available commands documented somewhere? I couldn't locate such a list
> in either the Javadoc nor the plug-in extension docs. I was able to
> find the command declared in the plugin.xml of the
> org.eclipse.ui.cheatsheets plug-in once I knew what to look for (after
> reading your post and links). Is this the usual way one determines
> commands implemented by a plug-in?
>

To find a list of commands, you can either browse through the Keys
preference page (Window>Preferences>General>Keys) or look in the Plug-in
Registry View (which works great in 3.4).

I often have a quick look in Keys, which provides names and then use
that to look up the IDs in the Plug-in Registry View.

There are a couple of other ways to do it as well.

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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Dynamically changing state of menus and toolbuttons
Next Topic:Programmatically finding references to extension points in the workspace
Goto Forum:
  


Current Time: Thu Mar 13 13:17:36 EDT 2025

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

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

Back to the top