Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
11.  Creating Actions and Data Types Using Create Action Limitations of Create Action Action Limitations  Previous   Contents   Next 
   
 

Data Type Limitations

You cannot use Create Action to create the data type for an application if any of the following conditions are true:

  • The data type must have additional actions associated with it other than Open and Print.

  • The Open action for the data type is not the action's command.

    For example, you cannot use Create Action to create the data type that provides a unique icon for the directory representing the application's application group.

Creating an Action and Data Type for an Application with Create Action

There are some things you'll need to know about the application before you run Create Action.

  • The command line for starting the application.

    You'll need to know whether the command line includes a required file argument, an optional file argument, or no file argument.

    If the application requires a non-file argument, you cannot use Create Action to create the action.

  • The types of data files an application can accept.

    Some applications can accept only one type of data. Others (for example, an ASCII editor or graphics editor) can accept multiple data types.

  • The way the application identifies its data files.

    This may be a naming convention (for example, file names ending with.doc), and/or may depend on the content of the file. If the application does not use a file-name convention, you can still set one up for the action icon.

  • Optional: The command line to print the files.

To Create an Action for an Application

  1. Double-click Create Action in the Desktop_Apps application group.

    Figure 11-1 Create Action icon in Application Manager

    This displays the main Create Action window.

    Figure 11-2 Create Action main window

  2. Type the name that will label the action icon into the Action Name text field.

  3. Use the Action Icons controls to specify the icon for the application. Initially, the default icon is shown.

    • To create new icons, choose Edit Icon to run the Icon Editor.

  4. In the Command When Action Icon Is Opened text field, type the command to start the application.

    Use the syntax $n for a file argument; for example:

    	emacs
     	bitmap $1
     	diff $1 $2
     	lp -oraw $1

    If the command line includes a file argument ($n), then the action icon will be a drop zone for files.

    The command lines are not passed to a shell unless you explicitly specify the use of a shell. For example, these lines use shell processing:

    	/bin/sh -c 'ps | lp'
     	/bin/sh -c 'spell $1 | more'
  5. Type the On Item help text for the action icon into the Help Text For Action Icon text field.

    The text will automatically wrap in the text field. However, these line breaks are not preserved online. If you want to specify a hard line break, use \n.

  6. Choose the windowing support required by the action from the Window Type option menu.

    Graphical (X-Window)--the application creates its own window

    Terminal (Auto-Close)--the application will run in a terminal emulator window that closes automatically when the user exits the application

    Terminal (Manual Close)--the application will run in a terminal emulator window that remains open until the user explicitly closes it

    No Output--the application does not produce output to the display

  7. Proceed as follows:

    • If you do not need to create a data type, save the action by choosing Save from the File menu. Then, test the new action by double-clicking its icon in your home directory.

To Create One or More Data Types for an Application

  1. Define the action for the application using the procedure in the previous section, "To Create an Action for an Application".

  2. Click the Advanced button in the Create Action window to expand the window.

    Figure 11-3 Advanced features in the main Create Action window

  3. If you want the application icon to prompt for a file argument when the icon is double-clicked, type the text of the prompt into the ``When Action Opens, Ask Users for'' text field.

    Use these guidelines for this text field:

    • You must use this field if the application's command line has a required file argument.

    • You must leave this field blank if the command line does not include a file argument.

    • If the file argument in the application's command line is optional, you have a choice. If you supply the prompt text, the action icon will prompt for the file when double-clicked. If you do not supply the prompt text, the action will be executed with a null string as the file argument.

  4. Specify the types of files that the action will accept as arguments:

    • If the action can accept any data type, select All Data Types.

    • If the action can accept only the data type(s) you create for the application, select Only Above List.

      Initially, the Datatypes That Use This Action list is empty. As you create data types for the application, they are added to the list.

  5. Click Add beside the Datatypes That Use This Action list box to display the Add Data Type dialog box.

    Figure 11-4 Create Action's Add Datatype dialog box

  6. Optional: If you don't want to use the default data type name, type a new name for the data type into the Name of Datatype Family text field.

    The name cannot include spaces. The data type name is not visible to application users; it is used in the actions/data types database to identify the data type definition.

  7. Click the Edit button beside the Identifying Characteristics box to display the Identifying Characteristics dialog box.

    Figure 11-5 Create Action's Identifying Characteristics dialog box

    Characteristics of a data type are the criteria used to differentiate the data type from others. You can choose one or more of the following criteria:

    Files or Folder--the data type applies only to files or only to folders

    Name Pattern--data typing based on the file name

    Permission Pattern--read, write, execute permissions

    Contents--contents of a specified portion of the file

  8. Select whether the data type represents a file or folder.

    Figure 11-6 Specifying a file or directory characteristic for a data type.

  9. If the data typing depends on the name, select the Name Pattern check box and fill in the text field.

    Figure 11-7 Specifying the file name characteristic for a data type

    You can use * and ? as wildcards:

    *--matches any sequence of characters

    ?--matches any single character

  10. If the data typing depends on the permissions, select the Permission Pattern check box and select the permissions for the data type.

    Figure 11-8 Specifying the permission characteristics for a data type

    On--the file must have the specified permission

    Off--the file must lack the specified permission

    Either--the specified permission does not matter

  11. If the data typing depends on the contents, select the Contents check box and supply the requested information--Pattern to search for and Type of contents. Optionally, you can supply the byte location where the search should start.

    Figure 11-9 Specifying the contents characteristics for a data type


    Note - Use of content-based data typing may affect the performance of the system.


  12. Click OK to close the Identifying Characteristics dialog box.

    The characteristics will be displayed in the Identifying Characteristics field using this coding:

    d--a directory

    r--the file has read permission

    w--the file has write permission

    x--the file has execute permission

    !--logical operator NOT

    &--logical operator AND

  13. Type the help text for the data files into the Help Text text field.

  14. Use the Datatype Icons controls to specify the icon for the data files. Initially, the default icon is shown.

    • To create new icons, click Edit Icon to run the Icon Editor.

  15. Verify the command in the Command to Open this Datatype text field. This is the command that will be executed when the user double-clicks a data file.

  16. Optional: If the application supplies a print command for printing data files from the command line, type the command into the Command to Print this Datatype text field, using the syntax $n for a file argument.

  17. Do one of the following to save the data type definition:

    • Click OK to save the data type and close the Add Datatype dialog box.

    • Click Apply to save the data type without closing the Add Datatype dialog box. This let you immediately proceed to define another data type for the action.

 
 
 
  Previous   Contents   Next