Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
5.  Registering an Application General Steps for Registering an Application Step 8: Registering the Application Using dtappintegrate How dtappintegrate Integrates Applications  Previous   Contents   Next 
   
 

Example of Creating a Registration Package

The following steps create a registration package for an existing, non-desktop smart application named BestTextEditor.

Information You Need to Know About ``BestTextEditor''

The example assumes the following facts about the BestTextEditor application:

  • It was installed into the directory /usr/BTE.

  • The user's session language is the default value, C.

  • The command line to start BestTextEditor is:

    	BTEd {filename]

    where filename is the name of the data file to open in the new window. BestTextEditor creates its own window--that is, it does not run inside a terminal emulator window.

  • BestTextEditor creates and uses two types of data files:

    • Documentation files. They use the naming convention *.bte. BestTextEditor provides a command line for printing its .bte data files. The syntax of this command is:

      		BTEPrint [-d destination] [-s] filename

      where:

      -d destination--specifies destination printer.

      -s--specifies silent printing. The application's print dialog box is not displayed.

      filename--specifies the file to be printed.

    • Template files. They use the naming convention *.tpl. Template files cannot be printed.

  • The existing, non-desktop app-defaults files for BestTextEditor contain resources for interface fonts and foreground and background colors.

  • An online help volume for BestTextEditor was created using the desktop Help Developer's Kit. When the online help volume was built, it used the following source files:

    	.../BTEHelp.htg
     	.../graphics/BTE1.xwd
     	.../graphics/BTE2.xwd

    and generated the file .../BTEHelp.sdl.

Steps to Registering ``BestTextEditor''

The following step-wise procedure registers BestTextEditor.

  1. Modify font and color resources.

    In BestTextEditor's app-defaults file, remove resources that set:

    • Fonts for text

    • Colors for foreground and background

  2. Create the application root.

    Create the directory:

    	/desktop_approots/BTE

    If you are integrating an existing application, you should create the application root directory elsewhere than in the installation location for the application; otherwise, the configuration files you create may be removed when you update the application.

  3. Create the registration package directories.

    Create these directories:

    	/desktop_approots/BTE/dt/appconfig/types/C
     	/desktop_approots/BTE/dt/appconfig/help/C
     	/desktop_approots/BTE/dt/appconfig/icons/C
     	/desktop_approots/BTE/dt/appconfig/appmanager/C/BestTextEditor
  4. Create the actions and data types for the application.

    1. Create the configuration file for the action and data type definitions:

          /desktop_approots/BTE/dt/appconfig/types/C/BTE.dt
    2. Create the action definition for running BestTextEditor:

      ACTION BTEditor
           {
              WINDOW_TYPE    NO_STDIO
              ICON           BTERun
              DESCRIPTION    Double-click this icon or drop \
                             a BTE data file on it to run \
                             BestTextEditor.
              EXEC_STRING    /usr/BTE/BTEd %Arg_1%
          }
    3. Create the data type for *.bte files:

      DATA_ATTRIBUTES BTEDataFile
          {
              DESCRIPTION				BestTextEditor data file.
              ICON						BTEData
              ACTIONS					Open,Print
          }
      
              DATA_CRITERIA BTEDataFileCriteria1
          {
              DATA_ATTRIBUTES_NAME    BTEDataFile
              NAME_PATTERN    *.bte
              MODE        f
          }
    4. Create the data type for *.tpl files:

      		DATA_ATTRIBUTES BTETemplateFile
       		{
       				DESCRIPTION			BestTextEditor template file.
       				ICON					BTETempl
       				ACTIONS				Open
       		}
      
       		DATA_CRITERIAL BTETemplateFileCriteria1
       		{
       				DATA_ATTRIBUTES_NAME			BTETemplateFile
       				NAME_PATTERN						*.tpl
       				MODE									f
       		}
    5. Create the Open action for *.bte files.

      		ACTION Open
       		{
       				ARG_TYPE			BTEDataFile
       				TYPE				MAP
       				MAP_ACTION		BTEditor
       		}
    6. Create the Print action for *.bte files.

      Here are simple Print actions that will print the data files. These actions require a value for the LPDEST environment variable and ignore the -s print option. (If LPDEST isn't set, the action may fail.)

      		ACTION Print
       		{
       				ARG_TYPE				BTEDataFile
       				TYPE					MAP
       				MAP_ACTION			BTEPrintData
       		}
      		ACTION BTEPrintData
       		{ 		WINDOW_TYPE				NO_STDIO
       				EXEC_STRING				BTEPrint -d $LPDEST %Arg_1%
       		}

      Here is another version of the BTEPrintData action and an accompanying script. Together, they handle situations where LPDEST is not set or if silent printing is requested.

      		ACTION BTEPrintData
       		{
       				WINDOW_TYPE				NO_STDIO
       				EXEC_STRING				/usr/BTE/bin/BTEenvprint \
       											%(File)Arg_1%
       		}

      The contents of the /usr/BTE/bin/BTEenvprint script are:

      		# BTEenvprint
       		#!/bin/sh
       		DEST=""
       		SILENT=""
       		if [ $LPDEST ] ; then
       			DEST="-d $LPDEST"
       		fi
       		BTEPrint $DEST SILENT $1
    7. Create the Open action for *.tpl files:

      		ACTION Open
       		{
       				ARG_TYPE			BTETemplateFile
       				TYPE				MAP
       				MAP_ACTION		BTEditor
       		}
    8. Create the Print action for *.tpl files:

      		ACTION Print
       		{
       				ARG_TYPES		BTETemplateFile
       				TYPE				MAP
       				MAP_ACTION		NoPrint
       		}

      NoPrint is a built-in action that displays a dialog box telling the user the file cannot be printed.

  5. Put the help files into the registration package.

    1. Place the help files in the following locations:

      		/desktop_approots/BTE/dt/appconfig/help/C/BTEHelp.sdl
       		/desktop_approots/BTE/dt/appconfig/help/C/graphics/BTE1.xwd
       		/desktop_approots/BTE/dt/appconfig/help/C/graphics/BTE2.xwd
    2. Create the file:

      		/desktop_approots/BTE/dt/appconfig/types/C/BTEhelp.dt. 

      Put the following action definition in the file:

      		ACTION BTEHelp
          {
              WINDOW_TYPE    NO_STDIO
              EXEC_STRING    /usr/dt/bin/dthelpview -helpVolume \
                  BTEHelp.sdl
              DESCRIPTION    Opens the BestTextEditor help volume.
          }
  6. Create icons for the application.

    Use Icon Editor to create the icons. Table 5-3 shows the size guidelines to use.

    Table 5-3 Icon Size Guidelines

    Name

    Size

    basename.t.pm

    16 by 16

    basename.m.pm

    32 by 32

    basename.l.pm

    48 by 48

    Create these icon files in the directory /desktop_approots/BTE/dt/appconfig/icons/C:

    • Icons to represent the action that runs the application: BTERun.t.pm, BTERun.m.pm, BTERun.l.pm

    • Icons to represent *.bte files: BTEData.t.pm, BTEData.m.pm,

    • Icons to represent *.tpl files: BTETempl.t.pm, BTETempl.m.pm

    • Icons to represent the application group (used in step 7): BTEApp.t.pm, BTEApp.m.pm

  7. Create the application group.

    1. If you haven't already done so, create the directory.

      	/desktop_approots/BTE/dt/appconfig/appmanager/C/BestTextEditor
    2. This step is optional. It provides a unique icon for the application group icon by creating a data type and associated actions for the application group. If you omit this step, the application group will use the default icon.

      Add the following data type and action definitions to the file /desktop_approots/BTE/dt/appconfig/types/C/BTE.dt. The data type specifies the icon to be used by the BestTextEditor application group. The actions provide the same Open and Print behavior as the built-in application groups.

      		DATA_ATTRIBUTES BestTextEditorAppGroup
       		{
       				ACTIONS		OpenInPlace,OpenNewView
       				ICON			BTEApp
       		{
      		DATA_CRITERIA BestTextEditorAppGroupCriterial
       		{
       				DATA_ATTRIBUTES_NAME	BestTextEditorAppGroup
       				MODE							d
       				PATH_PATTERN				*/appmanager/*/BestTextEditor
       		}
      		ACTION Open
       		{
       				ARG_TYPE				BestTextEditorAppGroup
       				TYPE					MAP
       				MAP_ACTION			OpenAppGroup
       		}
      		ACTION Print
       		{
       				ARG_TYPE				BestTextEditorAppGroup
       				TYPE					MAP
       				MAP_ACTION			PrintAppGroup
       		}
    3. Create an icon in the application group that will start the application. To do this, create the file:

      		/desktop_approots/BTE/dt/appconfig/appmanager/C \
       		/BestTextEditor/BTEditor

      and make the file executable.

    4. Create the action file in the application group that will open the help volume. To do this, create the file:

      		/desktop_approots/BTE/dt/appconfig/appmanager/C \
       		/BestTextEditor/BTEHelp

      and make the file executable.

    5. Put other files into the application group; for example, "read me" files, sample data and template files.

  8. Register the application.

    In a terminal emulator window:

    1. Log in as root.

    2. Run the command:

      		/usr/dt/bin/dtappintegrate -s /desktop_approots/BTE
    3. Open the Desktop_Tools application group and double-click Reload Applications.

 
 
 
  Previous   Contents   Next