Aptana Studioヘルプ > はじめに > Aptana Studioの各画面

Displaying the Snippets and Scripts Views

This page explains what the Actions View is, how to display it, and how to use its scripts.

Contents

  • Introduction

    Use the Snippets View and Scripts View to run and manage JavaScript scripts that automate common coding tasks.

    About the Snippets View

    Snippets are short scripts that you can use to help format your code. An example of this is selecting text in the HTML editor and wrapping it with a <b></b> tag set. The Snippet View contains many useful snippets that you can use as examples or to help you format your code.

    About the Scripts View

    Scripts are generally more complicated than Snippets and usually perform automation tasks within your IDE. An example of this would be to create a new scriptable view or a Code Assist profile. The Scripts View contains more examples for you to learn from and use.

    The engine for the Scripts Views is the Eclipse Monkey scripting tool. To learn more about Eclipse Monkey, see Scripting with Eclipse Monkey.

    Instructions

    Displaying the Views

    The Scripts and Snippets View should be displayed as part of the default Aptana Web Perspective by default. If it is not, or if you closed them and need to re-open them, you can access the Views from the Window menu:

    To display the Snippets View:

    1. From the Window menu, select Show View > Other... to open a Show Views pop-up window.
    2. On the Show Views pop-up window, expand the Aptana Views folder.
    3. Select the Snippets View and click OK.

    Aptana displays the Snippets View, as shown in the image below.

    Image:SnippetsView.png

    To display the Scripts View:

    1. From the Window menu, select Show View > Other... to open a Show Views pop-up window.
    2. On the Show Views pop-up window, expand the Scripting folder.
    3. Select Scripts and click OK.

    Aptana displays the Scripts View, as shown in the image below.

    Image:ScriptsView.png

    Running a script from the Snippets or Scripts Views

    To run a script from the Snippets or Scripts View:

    1. Select any applicable text (e.g. text to comment or wrap in a tag).
    2. Double-click the script in the Scripts or Snippets View.

    You can also run scripts from the Scripts View or via a hotkey. To learn more about menu and hotkey options for your scripts, see Adding metadata to an Eclipse Monkey script.

    Adding a script to the Snippets or Scripts View

    You can easily add new snippets and scripts to the Snippets and Scripts Views.

    To add a new snippet to the Snippets View:

    1. Create a folder named snippets in any top-level folder in your Project View.
    2. Add your snippet to that folder. Make sure to include the appropriate metadata (see Adding metadata to an Eclipse Monkey script).

    To add a new script to the Scripts View, follow the instructions in Creating a new Eclipse Monkey script.

    You can share your scripts and snippets folders across your workspaces, which easily makes your scripts and snippets portable.

    Resetting the scripting environment

    Occasionally, after working with scripts, you may need to reset your scripting environment by refreshing the Scripts View.

    To reset the scripting environment, click the Refresh button Image:iconRefresh.png on the Scripts View. This will reset and reload all of your scripts.

    Related Topics