From: jsurfer Date: Sat, 25 Sep 2004 22:39:28 +0000 (+0000) Subject: code-template needs new context type X-Git-Url: http://secure.phpeclipse.com code-template needs new context type --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java index 57796de..1452f68 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/template/php/CodeTemplateContextType.java @@ -32,19 +32,19 @@ import net.sourceforge.phpdt.internal.corext.codemanipulation.StubUtility; public class CodeTemplateContextType extends TemplateContextType { /* context types */ - public static final String CATCHBLOCK_CONTEXTTYPE= "catchblock_context"; //$NON-NLS-1$ - public static final String METHODBODY_CONTEXTTYPE= "methodbody_context"; //$NON-NLS-1$ - public static final String CONSTRUCTORBODY_CONTEXTTYPE= "constructorbody_context"; //$NON-NLS-1$ - public static final String GETTERBODY_CONTEXTTYPE= "getterbody_context"; //$NON-NLS-1$ - public static final String SETTERBODY_CONTEXTTYPE= "setterbody_context"; //$NON-NLS-1$ - public static final String NEWTYPE_CONTEXTTYPE= "newtype_context"; //$NON-NLS-1$ - public static final String TYPECOMMENT_CONTEXTTYPE= "typecomment_context"; //$NON-NLS-1$ - public static final String FIELDCOMMENT_CONTEXTTYPE= "fieldcomment_context"; //$NON-NLS-1$ - public static final String METHODCOMMENT_CONTEXTTYPE= "methodcomment_context"; //$NON-NLS-1$ - public static final String CONSTRUCTORCOMMENT_CONTEXTTYPE= "constructorcomment_context"; //$NON-NLS-1$ - public static final String OVERRIDECOMMENT_CONTEXTTYPE= "overridecomment_context"; //$NON-NLS-1$ - public static final String GETTERCOMMENT_CONTEXTTYPE= "gettercomment_context"; //$NON-NLS-1$ - public static final String SETTERCOMMENT_CONTEXTTYPE= "settercomment_context"; //$NON-NLS-1$ + public static final String CATCHBLOCK_CONTEXTTYPE= "php_catchblock_context"; //$NON-NLS-1$ + public static final String METHODBODY_CONTEXTTYPE= "php_methodbody_context"; //$NON-NLS-1$ + public static final String CONSTRUCTORBODY_CONTEXTTYPE= "php_constructorbody_context"; //$NON-NLS-1$ + public static final String GETTERBODY_CONTEXTTYPE= "php_getterbody_context"; //$NON-NLS-1$ + public static final String SETTERBODY_CONTEXTTYPE= "php_setterbody_context"; //$NON-NLS-1$ + public static final String NEWTYPE_CONTEXTTYPE= "php_newtype_context"; //$NON-NLS-1$ + public static final String TYPECOMMENT_CONTEXTTYPE= "php_typecomment_context"; //$NON-NLS-1$ + public static final String FIELDCOMMENT_CONTEXTTYPE= "php_fieldcomment_context"; //$NON-NLS-1$ + public static final String METHODCOMMENT_CONTEXTTYPE= "php_methodcomment_context"; //$NON-NLS-1$ + public static final String CONSTRUCTORCOMMENT_CONTEXTTYPE= "php_constructorcomment_context"; //$NON-NLS-1$ + public static final String OVERRIDECOMMENT_CONTEXTTYPE= "php_overridecomment_context"; //$NON-NLS-1$ + public static final String GETTERCOMMENT_CONTEXTTYPE= "php_gettercomment_context"; //$NON-NLS-1$ + public static final String SETTERCOMMENT_CONTEXTTYPE= "php_settercomment_context"; //$NON-NLS-1$ /* templates */ public static final String COMMENT_SUFFIX= "comment"; //$NON-NLS-1$ @@ -234,10 +234,10 @@ public class CodeTemplateContextType extends TemplateContextType { protected void validateVariables(TemplateVariable[] variables) throws TemplateException { ArrayList required= new ArrayList(5); String contextName= getId(); - if (NEWTYPE_CONTEXTTYPE.equals(contextName)) { - required.add(PACKAGE_DECLARATION); - required.add(TYPE_DECLARATION); - } +// if (NEWTYPE_CONTEXTTYPE.equals(contextName)) { +// required.add(PACKAGE_DECLARATION); +// required.add(TYPE_DECLARATION); +// } for (int i= 0; i < variables.length; i++) { String type= variables[i].getType(); if (getResolver(type) == null) { diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java index fc5d895..e9de7c4 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/util/PHPFileUtil.java @@ -24,11 +24,11 @@ public class PHPFileUtil { "inc", "class" }; - public final static String[] HTML_EXTENSIONS = { - "html", - "htm", - "xhtml" - }; +// public final static String[] HTML_EXTENSIONS = { +// "html", +// "htm", +// "xhtml" +// }; public final static String[] SMARTY_EXTENSIONS = { "tpl" }; diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizard.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizard.java index ea1a3fb..9f4a0e6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizard.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/wizards/PHPFileWizard.java @@ -192,8 +192,6 @@ public class PHPFileWizard extends Wizard implements INewWizard { String lineDelimiter = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ CodeTemplateContext context= new CodeTemplateContext(template.getContextTypeId(), null, lineDelimiter); // context.setCompilationUnitVariables(cu); - - return new ByteArrayInputStream(StubUtility.evaluateTemplate(context, template).getBytes()); } catch (CoreException e) { e.printStackTrace(); diff --git a/net.sourceforge.phpeclipse/templates/default-codetemplates.xml b/net.sourceforge.phpeclipse/templates/default-codetemplates.xml index 45d2b09..1bfbcc9 100644 --- a/net.sourceforge.phpeclipse/templates/default-codetemplates.xml +++ b/net.sourceforge.phpeclipse/templates/default-codetemplates.xml @@ -14,38 +14,38 @@ --> -