Extension SDK 9.0.5

oracle.jdeveloper.jsp.utils
Class JSPTagUtils

java.lang.Object
  extended byoracle.jdeveloper.jsp.utils.JSPTagUtils

public class JSPTagUtils
extends java.lang.Object

The JSPTagUtils class is a utility class to insert/remove tags and their associated taglib declarations into the CodeEditor.


Constructor Summary
JSPTagUtils()
           
 
Method Summary
static void addArchive(oracle.ideimpl.palette.model.Jsplibrary jspLib, JProject prj)
           
static void addArchive(oracle.ideimpl.palette.model.Jsplibrary jspLib, java.net.URL url, JProject prj)
          Adds archives to lib folder under the document root / WEB-INF folder
static void addJspTagToPalette(java.lang.String pageName, java.lang.String libraryName, java.lang.String tagName, java.lang.String image)
          Add Tag to Palette
static boolean addLibrary(java.lang.String uri, java.lang.String prefix, java.lang.String tldURL, java.lang.String classesURL, java.lang.String displayName, java.lang.String icon)
          Install Selected Library into JspTagLibrary.xml
static void addTaglibDefinition(java.lang.String prefix, java.lang.String archiveLocation, java.net.URL url)
          Add taglib definition to web descriptor file
static void addTaglibDefinitionToActiveProject(oracle.ideimpl.palette.model.Jsplibrary library)
          Add Taglib Definition to Web Deployment Descriptor
static void addTaglibDefinitionToActiveProject(java.lang.String uri, java.lang.String archiveLocation)
          Add taglib definition to web descriptor file
static void addTaglibDefinitionToProject(oracle.ideimpl.palette.model.Jsplibrary lib, JProject prj)
          Add taglib definition to web.xml
static void addTaglibDefinitionToProject(oracle.ideimpl.palette.model.Jsplibrary lib, JProject prj, java.lang.String relativePath)
          Add taglib definition to web.xml
static void addTagToPalette(java.lang.String libraryName, java.lang.String tagName, java.lang.String image)
          Add Tag to Palette
static void addTld(oracle.ideimpl.palette.model.Jsplibrary jspLib)
           
static void addTld(oracle.ideimpl.palette.model.Jsplibrary jspLib, JProject prj)
          Updates the project to handle the specified JSP Tag Library.
static boolean checkForURI(java.lang.String uri)
          Check to see if uri is already in use.
static void doAll(oracle.ideimpl.palette.model.Jsplibrary jspLib, java.lang.String tag)
           
static void doAll(oracle.ideimpl.palette.model.Jsplibrary jspLib, oracle.jdevimpl.jsp.tags.taglib.model.Tag tag)
          Does a Tag and taglib insertion w/ ArchiveCopy
static java.lang.String formatXMLString(java.lang.String xml)
           
static CodeEditor getCodeEditor()
          Retrieve the CodeEditor for PaletteWindow Context
static oracle.ideimpl.palette.model.Jsplibrary getJsplibrary(java.lang.String prefix)
           
static oracle.ideimpl.palette.model.Jsplibrary getLibraryByURI(java.lang.String uri)
           
static java.io.InputStream getLibraryInputStream(java.lang.String tldURL)
          Retrieve InputStream for Tag Library
static java.lang.String getTag(oracle.ideimpl.palette.model.Jsplibrary jspLib, oracle.jdevimpl.jsp.tags.taglib.model.Tag tag)
          Build a Tag using the JspLibrary and the Tag itself
static java.lang.String getTaglib(java.lang.String prefix)
           
static java.lang.String getTaglibDeclaration(oracle.ideimpl.palette.model.Jsplibrary jspLib)
          Build a taglib declaration from Jsplibrary
static java.net.URL getTaglibDescriptorURL(java.lang.String tldURL)
           
static java.util.ArrayList getTagsInLibrary(oracle.ideimpl.palette.model.Jsplibrary jspLibrary)
          Returns a list of all Tag Names in a given JspLibrary
static java.util.Iterator getTagsInLibrary(JspLibrary jspLibrary)
          Returns a list of all Tag Names in a given JspLibrary
static java.net.URL getWebInfLibURL(JProject project)
          Returns the current WEB-INF/lib directory of the project
static java.net.URL getWebInfURL(JProject project)
          Returns the current WEB-INF directory of the project
static void insertAtPosition(java.lang.String str, int position)
          Inserts given text at specified position
static void insertAtPosition(java.lang.String tag, int position, Document document)
           
static void insertEndTag(java.lang.String endTag, CodeEditor editor)
          Inserts HTML Tag Completion
static void insertTag(java.lang.String tag)
          Inserts a tag into the CodeEditor or into the JSP Visual Editor based on the current selection.
static void insertTag(java.lang.String newTag, java.lang.String tag, boolean before)
          Inserts any given string ( generally a tag ) to be inserted before or after another tag.
static void insertTagAndTaglib(java.lang.String tag, java.lang.String taglib)
          Inserts a Tag and Taglib declaration into the Active CodeEditor
static void insertTaglib(oracle.ideimpl.palette.model.Jsplibrary jspLib)
          Inserts a taglib declaration into the CodeEditor( Note: Inserts at the top position )
static void insertTaglib(oracle.ideimpl.palette.model.Jsplibrary jspLib, Context context, Document document)
           
static void insertTaglib(java.lang.String taglib)
          Inserts a taglib declaration into the CodeEditor (Note: Inserts at the top position)
static void insertTaglib(java.lang.String taglib, Document document)
           
static void insertTaglib(java.lang.String uri, java.lang.String prefix)
           
static void insertTaglib(java.lang.String uri, java.lang.String prefix, Document document)
           
static boolean isJspDocument()
          Checks to see if the JSP is a JSP Document
static boolean libraryExists(java.lang.String prefix)
          Check to see if JSP Tag Library is already registered.
static void refreshPalette()
          Refreshes the current Palette (if needed)
static boolean unregisterTagLibrary(Context context, java.lang.String prefix)
          Removes all reference of a tag library from the web deployment descriptor as well as from the additional classpath.
static void updateArchives(Context context)
          Updates the project with the latest Tag Libraries as definied in jsp-libraries.xml
static void updateJspLibrary(oracle.ideimpl.palette.model.Jsplibrary library, JProject project)
           
static void updateJspLibrary(oracle.ideimpl.palette.model.Jsplibrary library, java.net.URL libURL)
          Updates the JspLibrary tld and class references inside the ide.
static void updateProjectWithTagLibrary(oracle.ideimpl.palette.model.Jsplibrary jspLib, JProject project)
          Updates project with the current Jsplibrary.
static void updateTagLibraries()
           
static void updateTld(oracle.ideimpl.palette.model.Jsplibrary library)
          Update project with Tag Library Descriptor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSPTagUtils

public JSPTagUtils()
Method Detail

insertTagAndTaglib

public static void insertTagAndTaglib(java.lang.String tag,
                                      java.lang.String taglib)
Inserts a Tag and Taglib declaration into the Active CodeEditor

Parameters:
tag - Tag to insert. (Note: Uses the caretposition )
taglib - Taglib to insert. (Note: Will insert at the top position)

insertTag

public static void insertTag(java.lang.String tag)
Inserts a tag into the CodeEditor or into the JSP Visual Editor based on the current selection.

Parameters:
tag - The tag to insert.

insertEndTag

public static final void insertEndTag(java.lang.String endTag,
                                      CodeEditor editor)
Inserts HTML Tag Completion


insertTag

public static final void insertTag(java.lang.String newTag,
                                   java.lang.String tag,
                                   boolean before)
Inserts any given string ( generally a tag ) to be inserted before or after another tag.

Parameters:
newTag - Tag to insert
tag - The tag to find
before - True if insert new tag before tag. False will insert after tag.

isJspDocument

public static boolean isJspDocument()
Checks to see if the JSP is a JSP Document

Returns:
true if JSP Document

insertTaglib

public static final void insertTaglib(java.lang.String uri,
                                      java.lang.String prefix,
                                      Document document)

insertTaglib

public static final void insertTaglib(java.lang.String uri,
                                      java.lang.String prefix)

insertTaglib

public static final void insertTaglib(java.lang.String taglib,
                                      Document document)

insertTaglib

public static final void insertTaglib(java.lang.String taglib)
Inserts a taglib declaration into the CodeEditor (Note: Inserts at the top position)

Parameters:
taglib - taglib to insert

insertTaglib

public static void insertTaglib(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                                Context context,
                                Document document)

insertTaglib

public static void insertTaglib(oracle.ideimpl.palette.model.Jsplibrary jspLib)
Inserts a taglib declaration into the CodeEditor( Note: Inserts at the top position )

Parameters:
jspLib - JspLibrary to build declaration from

updateProjectWithTagLibrary

public static final void updateProjectWithTagLibrary(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                                                     JProject project)
Updates project with the current Jsplibrary. This does not effect code generation.

Parameters:
jspLib - - the Jsplibary to add to project
project - - the project to add Jsplibrary to.

getTaglib

public static final java.lang.String getTaglib(java.lang.String prefix)

getJsplibrary

public static final oracle.ideimpl.palette.model.Jsplibrary getJsplibrary(java.lang.String prefix)

getLibraryByURI

public static final oracle.ideimpl.palette.model.Jsplibrary getLibraryByURI(java.lang.String uri)

getTag

public static java.lang.String getTag(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                                      oracle.jdevimpl.jsp.tags.taglib.model.Tag tag)
Build a Tag using the JspLibrary and the Tag itself

Parameters:
jspLib - - the Jsplibrary
tag - - the Tag to insert

getTaglibDeclaration

public static java.lang.String getTaglibDeclaration(oracle.ideimpl.palette.model.Jsplibrary jspLib)
Build a taglib declaration from Jsplibrary

Parameters:
jspLib - - the Jsplibrary used to build the taglib declaration

doAll

public static void doAll(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                         oracle.jdevimpl.jsp.tags.taglib.model.Tag tag)
Does a Tag and taglib insertion w/ ArchiveCopy


doAll

public static void doAll(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                         java.lang.String tag)

addArchive

public static void addArchive(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                              JProject prj)

insertAtPosition

public static void insertAtPosition(java.lang.String tag,
                                    int position,
                                    Document document)

insertAtPosition

public static void insertAtPosition(java.lang.String str,
                                    int position)
Inserts given text at specified position

Parameters:
str - String to insert
position - int position to insert text at

getCodeEditor

public static CodeEditor getCodeEditor()
Retrieve the CodeEditor for PaletteWindow Context


addTaglibDefinitionToActiveProject

public static void addTaglibDefinitionToActiveProject(java.lang.String uri,
                                                      java.lang.String archiveLocation)
Add taglib definition to web descriptor file


addTaglibDefinitionToProject

public static void addTaglibDefinitionToProject(oracle.ideimpl.palette.model.Jsplibrary lib,
                                                JProject prj)
Add taglib definition to web.xml


addTaglibDefinitionToProject

public static void addTaglibDefinitionToProject(oracle.ideimpl.palette.model.Jsplibrary lib,
                                                JProject prj,
                                                java.lang.String relativePath)
Add taglib definition to web.xml


addTaglibDefinitionToActiveProject

public static void addTaglibDefinitionToActiveProject(oracle.ideimpl.palette.model.Jsplibrary library)
Add Taglib Definition to Web Deployment Descriptor


addTaglibDefinition

public static void addTaglibDefinition(java.lang.String prefix,
                                       java.lang.String archiveLocation,
                                       java.net.URL url)
Add taglib definition to web descriptor file


addArchive

public static void addArchive(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                              java.net.URL url,
                              JProject prj)
Adds archives to lib folder under the document root / WEB-INF folder


getTagsInLibrary

public static java.util.ArrayList getTagsInLibrary(oracle.ideimpl.palette.model.Jsplibrary jspLibrary)
Returns a list of all Tag Names in a given JspLibrary

Parameters:
jspLibrary - JspLibrary to search
Returns:
ArrayList List of all Tag Names (Strings)

getTagsInLibrary

public static java.util.Iterator getTagsInLibrary(JspLibrary jspLibrary)
Returns a list of all Tag Names in a given JspLibrary

Parameters:
jspLibrary - JspLibrary to search
Returns:
ArrayList List of all Tag Names (Strings)

getLibraryInputStream

public static java.io.InputStream getLibraryInputStream(java.lang.String tldURL)
Retrieve InputStream for Tag Library


addTagToPalette

public static void addTagToPalette(java.lang.String libraryName,
                                   java.lang.String tagName,
                                   java.lang.String image)
Add Tag to Palette


addJspTagToPalette

public static void addJspTagToPalette(java.lang.String pageName,
                                      java.lang.String libraryName,
                                      java.lang.String tagName,
                                      java.lang.String image)
Add Tag to Palette


refreshPalette

public static void refreshPalette()
Refreshes the current Palette (if needed)


addLibrary

public static boolean addLibrary(java.lang.String uri,
                                 java.lang.String prefix,
                                 java.lang.String tldURL,
                                 java.lang.String classesURL,
                                 java.lang.String displayName,
                                 java.lang.String icon)
Install Selected Library into JspTagLibrary.xml


checkForURI

public static boolean checkForURI(java.lang.String uri)
Check to see if uri is already in use.


libraryExists

public static boolean libraryExists(java.lang.String prefix)
Check to see if JSP Tag Library is already registered.


getTaglibDescriptorURL

public static java.net.URL getTaglibDescriptorURL(java.lang.String tldURL)

unregisterTagLibrary

public static boolean unregisterTagLibrary(Context context,
                                           java.lang.String prefix)
Removes all reference of a tag library from the web deployment descriptor as well as from the additional classpath.


updateJspLibrary

public static final void updateJspLibrary(oracle.ideimpl.palette.model.Jsplibrary library,
                                          JProject project)

updateJspLibrary

public static final void updateJspLibrary(oracle.ideimpl.palette.model.Jsplibrary library,
                                          java.net.URL libURL)
Updates the JspLibrary tld and class references inside the ide.

Parameters:
library - library to check for update
libURL - the web-inf/lib url

updateTld

public static final void updateTld(oracle.ideimpl.palette.model.Jsplibrary library)
Update project with Tag Library Descriptor.

Parameters:
library - library to check for update

updateTagLibraries

public static final void updateTagLibraries()

updateArchives

public static final void updateArchives(Context context)
Updates the project with the latest Tag Libraries as definied in jsp-libraries.xml


addTld

public static final void addTld(oracle.ideimpl.palette.model.Jsplibrary jspLib)

addTld

public static final void addTld(oracle.ideimpl.palette.model.Jsplibrary jspLib,
                                JProject prj)
Updates the project to handle the specified JSP Tag Library. This method will handle 3 different types of Tag Libraries.
1) Spec. 1.1 taglib where the file is named taglib.tld and exists under meta-inf in an archive.
2) Handle implicit taglibs as specified by spec. 1.2. This handles the uri specified in that taglib.
3) Handle explicit taglibs where the registered does not match the one found in the taglib itself.

Parameters:
jspLib - The JSP Tag Library to add to the project
prj - The project to update.

formatXMLString

public static final java.lang.String formatXMLString(java.lang.String xml)

getWebInfURL

public static final java.net.URL getWebInfURL(JProject project)
Returns the current WEB-INF directory of the project

Parameters:
project - The current project
Returns:
url The WEB-INF url.

getWebInfLibURL

public static final java.net.URL getWebInfLibURL(JProject project)
Returns the current WEB-INF/lib directory of the project

Parameters:
project - The current project
Returns:
url The WEB-INF/lib url.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.