home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 2002 - Miguel Angel Rojas Gonzßlez.
-
- /**
- @Tool: completePage~completes a page tag with empty attributes
- @EndTool:
- @Summary: completePage~completes a page tag
- */
-
- function DoCommand()
- {
- var path = File.getToolsPath() + "\\Smartkeys\\jsp\\completePage.script";
- Application.registerSmartKeyHandler(".jsp", "page\t", path,
- "Complete: page<tab> with <%@ page language=\"java\" import=\"\" %>");
- }
-
- function OnEvent(editor,lineBuffer)
- {
- var idx = lineBuffer.indexOf( "<%@" );
-
- if ( idx != -1 )
- {
- var selection = editor.getSelection();
- editor.replace(" language=\"java\" import=\"\" %>", selection);
-
- editor.select( selection.startLineIndex, selection.endCharIndex + 25,
- selection.startLineIndex, selection.endCharIndex + 25 );
-
- editor.setActive("Complete page");
- return true;
- }
- else
- {
- idx = lineBuffer.indexOf( "page" );
- var selection = editor.getSelection();
- var sCurr = lineBuffer.substring( 0, idx );
- var vPage = sCurr + "<%@ page language=\"java\" import=\"\" %>" + lineBuffer.substring( idx+4, lineBuffer.length );
- editor.replace( vPage, selection.startLineIndex );
-
- editor.select( selection.startLineIndex, selection.endCharIndex + 29,
- selection.startLineIndex, selection.endCharIndex + 29 );
-
- editor.setActive("Complete page");
- return true;
- }
- }
-
- !!/Script
-
-
-