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