Snippets View Contributions Extension

Identifier:
org.eclipse.wst.common.snippets.SnippetContributions

Since:
1.0

Description:
Contributions to be shown in the Snippets view. Plugins may contribute new categories and items into those categories that have custom behavior when dropped onto an editor or certain views.

Configuration Markup:

<!ELEMENT extension (category+)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT category (item*)>

<!ATTLIST category

description  CDATA #IMPLIED

smallicon    CDATA #IMPLIED

id           CDATA #REQUIRED

label        CDATA #REQUIRED

largeicon    CDATA #IMPLIED

extensions   CDATA #IMPLIED

contenttypes CDATA #IMPLIED>

Defines a category within the Snippets model, represented as a drawer in the Snippets view. Drawers are used to categorize items much like a simple filing cabinet. Categories contributed without any items within them will not be loaded into the Snippets model. Categories without specific file types or content types will always have their drawers default to shown if the view is managing drawers according to the active editor.



<!ELEMENT item (content , variable*)>

<!ATTLIST item

class       CDATA #IMPLIED

description CDATA #IMPLIED

smallicon   CDATA #IMPLIED

id          CDATA #REQUIRED

label       CDATA #REQUIRED

largeicon   CDATA #IMPLIED>

Individual snippet item for the Snippets view. Contains text and information to help control and customize the related drag and drop behavior.



<!ELEMENT content (#PCDATA)>

Specifies the raw data for this Snippets item, usually as a CDATA section. The insertion object and editor must both understand how to manipulate this data. The default implementations understand embedded variable markers.



<!ELEMENT variable EMPTY>

<!ATTLIST variable

default     CDATA #IMPLIED

description CDATA #IMPLIED

id          CDATA #REQUIRED

name        CDATA #IMPLIED>

A marker describing a replaceable section of the content. The user should be asked for the value to use whenever Snippets is inserting the parent Item.



Examples:

   <extension
         point="org.eclipse.wst.common.snippets.SnippetContributions">
      <category
            smallicon="icons/tag-jsp.gif"
            label="JSP"
            description="Java Server Pages"
            id="org.eclipse.wst.jsp.category0"
            contenttypes="org.eclipse.wst.jsp.core.jspsource"
            extensions="*.jsp, *.jsf, *.jspf">
        <item
              smallicon="icons/tag-generic.gif"
              label="%jsp_hidden_comment"
              id="org.eclipse.wst.jsp.jsp_hidden_comment">
           <content>
              %jsp_hidden_comment_content
           </content>
        </item>
        <item
              label="%jsp_page_directive"
              id="org.eclipse.wst.jsp.jsp_page_directive">
           <content>
              %jsp_page_directive_content
           </content>
        </item>
        <item
              smallicon="icons/jsptaglib.gif"
              label="%jsp_taglib_directive"
              class="org.eclipse.wst.common.snippets.insertions.PrependInsertion"
              id="org.eclipse.wst.jsp.jsp_taglib_directive">
           <content>
              <![CDATA[ <%@taglib uri="$uri" prefix="$prefix" %> ]]>
           </content>
           <variable
                 description="%jsp_taglib_directive_uri"
                 id="uri">
           </variable>
           <variable
                 default="mylib"
                 description="%jsp_taglib_directive_prefix"
                 id="prefix">
           </variable>
        </item>
      </category>
   </extension>

Supplied Implementation:
The supplied implementation of the Snippets view requires the Graphical Editing Framework and Structured Source Editing components.


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 http://www.eclipse.org/legal/epl-v10.html