blob: 9f04898f13f8cc7f1513bfbaf4f3b701740ee593 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<!-- /*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/ -->
<link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" />
<title>Adding items to snippets drawers</title>
<body id="tsrcedt015"><a name="tsrcedt015"><!-- --></a>
<h1 class="topictitle1">Adding items to snippets drawers</h1>
<div><p>This documentation describes how to add a new item to a drawer
in the Snippets view.</p><div class="skipspace"> To add new items to an existing snippets drawer:</div>
<ol><li class="skipspace"><span>Do one of the following choices:</span>
<div class="skipspace"><table cellpadding="4" cellspacing="0" summary="" frame="hsides" border="1" rules="rows"><thead align="left"><tr><th valign="top" id="d0e24">To start with this:</th>
<th valign="top" id="d0e26">Do this:</th>
<tbody><tr><td valign="top" headers="d0e24 ">An empty item that you can edit</td>
<td valign="top" headers="d0e26 ">Right-click anywhere in an existing drawer, select <span class="uicontrol">Customize</span>,
and click <span class="menucascade"><span class="uicontrol">New</span> &gt; <span class="uicontrol">New Item</span></span>.</td>
<tr><td valign="top" headers="d0e24 ">Existing text pasted into a new item in an existing
<td valign="top" headers="d0e26 ">Copy or cut text to the clipboard. In the Snippets view,
right-click anywhere in an existing drawer and click <span class="uicontrol">Paste</span>.</td>
<tr><td valign="top" headers="d0e24 ">Existing text pasted into a new item in a new or existing
<td valign="top" headers="d0e26 ">Select the text, right-click, click <span class="uicontrol">Add to
Snippets</span>, specify the name of the drawer in the Snippets view
to which you want to add the item, and click <span class="uicontrol">OK</span>.</td>
A <span class="wintitle">Customize Palette</span> window
<li class="skipspace"><span>Type a name for the new item, and, optionally, provide a description.</span> The value that you type in the <span class="uicontrol">Name</span> field
will appear next to the item's icon in the Snippets view.</li>
<li class="skipspace"><span>To include in the <span class="uicontrol">Template Pattern</span> field
a variable that you have already defined, click <span class="uicontrol">Insert Variable
Placeholder</span>. </span> A variable placeholder is a marker that,
when tagging is inserted into the active file, will be replaced by the value
that is entered into the <span class="uicontrol">Insert Template:</span><var class="varname">Item_name</var> dialog
at insertion time. Clicking the <span class="uicontrol">Insert Variable Placeholder</span> button
or typing Ctrl+Space activates a pop-up in the text area that prompts you
with the correct sequences to create a marker for the variable. For
example, if you create two variables named <var class="varname">uri</var> and <var class="varname">prefix</var>,
and create variable placeholders for both, the template pattern might look
like this:<pre>&lt;%@ taglib uri="${uri}" prefix="${prefix}" %&gt;</pre>
<li class="skipspace"><span>Click <span class="uicontrol">OK</span>.</span></li>
<div class="skipspace">The new item will be added to the list of items in the appropriate
<div><p><b class="relconceptshd">Related concepts</b><br />
<a href="csrcedt001.html" title="This documentation gives an overview of the Snippets view.">Snippets view</a><br />
<p><b class="reltaskshd">Related tasks</b><br />
<a href="tsrcedt026.html" title="The Snippets view lets you catalog and organize reusable programming objects, such as HTML tagging, JavaScript, and JSP code, along with files and custom JSP tags. The view can be extended based on additional objects that you define and include.">Editing with snippets - overview</a><br />
<a href="tsrcedt014.html" title="This documentation explains how to customize the Snippets view by adding a new drawer.">Adding snippets drawers</a><br />
<a href="tsrcedt022.html" title="This documentation describes how to modify the template code that is in an item in a drawer in the Snippets view.">Editing snippet items</a><br />
<a href="tsrcedt016.html" title="This documentation describes how to delete or hide drawers and items in the Snippets view.">Deleting or hiding snippet items or
drawers</a><br />