blob: db15ee8468b8a41dcfbb51a4c8d8d5d9913c894a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html lang="en-us" xml:lang="en-us">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2008 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" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "" l gen true r (n 0 s 0 v 0 l 0) "" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Adding items to snippets drawers" />
<meta content="snippets, drawers" name="DC.subject" />
<meta content="snippets, drawers" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="csrcedt001.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt026.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt014.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt022.html" />
<meta scheme="URI" name="DC.Relation" content="tsrcedt016.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tsrcedt015" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Adding items to snippets drawers</title>
<body id="tsrcedt015"><a name="tsrcedt015"><!-- --></a>
<h1 class="topictitle1">Adding items to snippets drawers</h1>
<div class="section"> To add new items to an existing snippets drawer:</div>
<li class="stepexpand"><span>Do one of the following choices:</span>
<div class="tablenoborder"><table summary="" cellspacing="0" cellpadding="4" frame="hsides" border="1" rules="rows">
<thead align="left">
<th valign="top" width="36.18090452261307%" id="N10070">To start with this:</th>
<th valign="top" width="63.81909547738693%" id="N10078">Do this:</th>
<td valign="top" width="36.18090452261307%" headers="N10070 ">An empty item that you can edit</td>
<td valign="top" width="63.81909547738693%" headers="N10078 ">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>
<td valign="top" width="36.18090452261307%" headers="N10070 ">Existing text pasted into a new item in an existing
<td valign="top" width="63.81909547738693%" headers="N10078 ">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>
<td valign="top" width="36.18090452261307%" headers="N10070 ">Existing text pasted into a new item in a new or existing
<td valign="top" width="63.81909547738693%" headers="N10078 ">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="stepexpand"><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="stepexpand"><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="stepexpand"><span>Click <span class="uicontrol">OK</span>.</span></li>
<div class="section">The new item will be added to the list of items in the appropriate
<div><div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="csrcedt001.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.">Snippets view</a></div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><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></div>
<div><a href="tsrcedt014.html" title="This documentation explains how to customize the Snippets view by adding a new drawer.">Adding snippets drawers</a></div>
<div><a href="tsrcedt022.html" title="">Editing snippet items</a></div>
<div><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