Figure 15-17 The properties view showing Favorites context file attributes in Java

Creator DataMatrix in Java Figure 15-17 The properties view showing Favorites context file attributes
Figure 15-17 The properties view showing Favorites context file attributes
ECC200 Printer In Java
Using Barcode encoder for Java Control to generate, create Data Matrix image in Java applications.
If you switch to the Source page of the plug-in manifest editor, you will see the following new section of XML defining the new context file
Bar Code Encoder In Java
Using Barcode generator for Java Control to generate, create bar code image in Java applications.
TT 15 Implementing Help
Recognize Bar Code In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
<extension point="orgeclipsehelpcontexts"> <contexts file="contextsxml" plugin="comqualityeclipsefavorites"> </contexts> </extension>
Make DataMatrix In Visual C#
Using Barcode creator for .NET framework Control to generate, create Data Matrix image in .NET applications.
The plugin attribute is important for associating this context file with the comqualityeclipsefavorites plug-in If that is not specified, the context file is associated with the local plug-in in which it is defined Note that multiple context files from different plug-ins may be associated with the context ID This allows one plug-in to extend the context help provided by another Now that we have completed the definition of our context-sensitive infopop help, we can test it by opening the Favorites view and pressing F1 The infopop content for the favorites_view context ID should appear (see Figure 15-18)
ECC200 Printer In VS .NET
Using Barcode generator for ASP.NET Control to generate, create Data Matrix 2d barcode image in ASP.NET applications.
Accessing Help Programmatically
Encoding ECC200 In .NET Framework
Using Barcode creator for VS .NET Control to generate, create Data Matrix ECC200 image in VS .NET applications.
Figure 15-18 The Favorites view showing the context-sensitive infopop
DataMatrix Creator In Visual Basic .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Data Matrix ECC200 image in .NET applications.
154 ACCESSING HELP PROGRAMMATICALLY
Drawing GS1 128 In Java
Using Barcode encoder for Java Control to generate, create EAN / UCC - 14 image in Java applications.
So far, we have seen how to integrate help into the Eclipse Help window and access it using standard Eclipse mechanisms such as the Help > Help Contents menu and the F1 key There may be times that you want to provide other ways of accessing your help content than the standard mechanisms As we saw earlier, the WorkbenchHelp class defines a large number of useful APIs In this section, we will concentrate on a couple of the display methods
Creating ANSI/AIM Code 128 In Java
Using Barcode encoder for Java Control to generate, create Code 128 image in Java applications.
TT 15 Implementing Help
Code 39 Extended Creator In Java
Using Barcode drawer for Java Control to generate, create Code-39 image in Java applications.
If you want to programmatically open the Help window, call the displayHelp()
Barcode Maker In Java
Using Barcode printer for Java Control to generate, create barcode image in Java applications.
method without an argument If you want to programmatically
Barcode Generation In Java
Using Barcode maker for Java Control to generate, create barcode image in Java applications.
open the infopop for a specific context ID, call the displayHelp() method with the context ID string as the single argument For example, to open the infopop associated with the Favorites view, use the following code:
ISSN Creator In Java
Using Barcode printer for Java Control to generate, create International Standard Serial Number image in Java applications.
WorkbenchHelpdisplayHelp( "comqualityeclipsefavoritesfavorites_view");
ECC200 Decoder In Visual Studio .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in VS .NET applications.
Opening a specific help page
Code39 Creator In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create ANSI/AIM Code 39 image in ASP.NET applications.
The most interesting API, however, is the displayHelpReource() method that takes a single String argument representing the path to the help page to be displayed For example, to open the main help page for the Favorites plugin, use the following code:
Printing ANSI/AIM Code 128 In .NET
Using Barcode drawer for VS .NET Control to generate, create Code 128C image in .NET framework applications.
WorkbenchHelpdisplayHelpResource( "/comqualityeclipsefavoriteshelp/html/tochtml");
Draw Code 39 Extended In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create Code-39 image in .NET framework applications.
The path argument is composed of the ID of the plug-in containing the help file and the path to the resource relative to the plug-in root directory Based on this last example, we can easily add a custom help button to the toolbar of the Favorites view (see Figure 15-19) by creating the following
GS1 - 12 Scanner In VS .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET framework applications.
Accessing Help Programmatically
Recognizing Code 39 Extended In .NET Framework
Using Barcode scanner for VS .NET Control to read, scan read, scan image in Visual Studio .NET applications.
method in the FavoritesView class and calling it from the createPartControl() method:
Make Barcode In Visual Basic .NET
Using Barcode creator for .NET framework Control to generate, create barcode image in .NET framework applications.
private void addHelpButtonToToolBar() { Action helpAction = new Action() { public void run() { WorkbenchHelpdisplayHelpResource( "/comqualityeclipsefavoriteshelp" + "/html/tochtml"); } }; helpActionsetToolTipText( "Open the Favorites view help"); helpActionsetImageDescriptor( ImageDescriptorcreateFromFile( FavoritesViewclass, "helpgif")); getViewSite() getActionBars() getToolBarManager() add(helpAction); }
Figure 15-19 The Favorites view with the new help button showing
TT 15 Implementing Help
Opening a web page
In addition to opening a specific help page in the Eclipse Help window, you might want to open a web browser on a specific web page Eclipse includes a class, orgeclipseswtprogramProgram, that is used to launch external programs including the system web browser In particular, we are interested in the launch() method that takes a string encoding the path to the program to be launched or the URL of the web page to be accessed We can now add a button to the Favorites view s toolbar (see Figure 15-20) that will open a specific web page (we ll use the web page for this book as an example) We will do this by adding the following method to the
FavoritesView
class and calling it from the createPartControl() method (see
Section 204 for more):
private void addWebButtonToToolBar() { Action helpAction = new Action() { public void run() { Programlaunch( "http://wwwqualityeclipsecom"); } }; helpActionsetToolTipText( "Open a web page"); helpActionsetImageDescriptor( ImageDescriptorcreateFromFile( FavoritesViewclass, "webgif")); getViewSite() getActionBars() getToolBarManager()
Accessing Help Programmatically
add(helpAction); }
Figure 15-20 The Favorites view with the new web button showing
Tip: You can use this technique to generate an e-mail message from your application back to your sales or support group For example, executing
Programlaunch( "mailto:info@qualityeclipsecom" + " Subject=Information Request")
will generate an e-mail message with the subject Information Request Embedding a Body= tag gives you the ability to pre-populate the body of the message with information such as the user s Eclipse configuration