From b30305f33e5ef84466436dc49d855676bea10e03 Mon Sep 17 00:00:00 2001 From: incastrix Date: Wed, 7 Oct 2009 22:50:46 +0000 Subject: [PATCH] Refactory: fix templates. --- net.sourceforge.phpeclipse.ui/plugin.xml | 10 +- .../src/net/sourceforge/phpeclipse/ui/WebUI.java | 25 +- .../templates/default-codetemplates.xml | 94 +++ .../templates/default-templates-html.properties | 10 + .../templates/default-templates-html.xml | 452 +++++++++++++ .../templates/default-templates.properties | 137 ++++ .../templates/default-templates.xml | 664 +++++++------------- 7 files changed, 950 insertions(+), 442 deletions(-) create mode 100644 net.sourceforge.phpeclipse.ui/templates/default-codetemplates.xml create mode 100644 net.sourceforge.phpeclipse.ui/templates/default-templates-html.properties create mode 100644 net.sourceforge.phpeclipse.ui/templates/default-templates-html.xml diff --git a/net.sourceforge.phpeclipse.ui/plugin.xml b/net.sourceforge.phpeclipse.ui/plugin.xml index 90e8b17..706cf5c 100644 --- a/net.sourceforge.phpeclipse.ui/plugin.xml +++ b/net.sourceforge.phpeclipse.ui/plugin.xml @@ -661,8 +661,12 @@ translations="templates/default-templates.properties"> + + + translations="templates/default-templates-html.properties"> + file="templates/default-templates-html.xml" + translations="templates/default-templates-html.properties"> diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java index 4dbdae9..7ae8cfb 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/WebUI.java @@ -131,7 +131,13 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants { public static final String EDITOR_ID = WebUI.PLUGIN_ID + ".PHPUnitEditor"; - private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$ + + /** + * The key to store customized templates. + * + * @since 3.0 + */ + private static final String TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_templates"; //$NON-NLS-1$ /** * The key to store customized code templates. @@ -139,6 +145,19 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants { * @since 3.0 */ private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$ + + + + + + private static final String CUSTOM_TEMPLATES_KEY = "net.sourceforge.phpeclipse.ui.templates"; //$NON-NLS-1$ + + /** + * The key to store customized code templates. + * + * @since 3.0 + */ +// private static final String CODE_TEMPLATES_KEY = "net.sourceforge.phpdt.ui.text.custom_code_templates"; //$NON-NLS-1$ /** * The maximum number of allowed proposals by category */ @@ -309,8 +328,8 @@ public class WebUI extends AbstractUIPlugin implements IPreferenceConstants { */ public TemplateStore getTemplateStore() { if (fStore == null) { - fStore = new ContributionTemplateStore(getContextTypeRegistry(), - getDefault().getPreferenceStore(), CUSTOM_TEMPLATES_KEY); + fStore = new ContributionTemplateStore(/*getContextTypeRegistry()*/getTemplateContextRegistry(), + getDefault().getPreferenceStore(), /*CUSTOM_*/TEMPLATES_KEY); try { fStore.load(); } catch (IOException e) { diff --git a/net.sourceforge.phpeclipse.ui/templates/default-codetemplates.xml b/net.sourceforge.phpeclipse.ui/templates/default-codetemplates.xml new file mode 100644 index 0000000..5943bce --- /dev/null +++ b/net.sourceforge.phpeclipse.ui/templates/default-codetemplates.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/net.sourceforge.phpeclipse.ui/templates/default-templates-html.properties b/net.sourceforge.phpeclipse.ui/templates/default-templates-html.properties new file mode 100644 index 0000000..b200f2b --- /dev/null +++ b/net.sourceforge.phpeclipse.ui/templates/default-templates-html.properties @@ -0,0 +1,10 @@ +############################################################################### +# Copyright (c) 2000, 2004 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Common Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/cpl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### diff --git a/net.sourceforge.phpeclipse.ui/templates/default-templates-html.xml b/net.sourceforge.phpeclipse.ui/templates/default-templates-html.xml new file mode 100644 index 0000000..46deae9 --- /dev/null +++ b/net.sourceforge.phpeclipse.ui/templates/default-templates-html.xml @@ -0,0 +1,452 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/net.sourceforge.phpeclipse.ui/templates/default-templates.properties b/net.sourceforge.phpeclipse.ui/templates/default-templates.properties index b200f2b..c28546d 100644 --- a/net.sourceforge.phpeclipse.ui/templates/default-templates.properties +++ b/net.sourceforge.phpeclipse.ui/templates/default-templates.properties @@ -8,3 +8,140 @@ # Contributors: # IBM Corporation - initial API and implementation ############################################################################### + +Templates.for_array=iterate over array +Templates.for_temp=iterate over array with temporary variable +Templates.for_collection=iterate over collection +Templates.while_enumeration=iterate with enumeration +Templates.while_iterator=iterate with iterator +Templates.do=do while statement +Templates.switch=switch case statement +Templates.if=if statement +Templates.ifelse=if else statement +Templates.elseif=else if block +Templates.else=else block +Templates.try=try catch block +Templates.catch=catch block +Templates.main=main method +Templates.public_method=public method +Templates.protected_method=protected method +Templates.private_method=private method +Templates.private_static_method=private static method +Templates.instanceof=dynamic type test and cast +Templates.cast=dynamic cast +Templates.toarray=convert collection to array +Templates.test=test method +Templates.systrace=print current method to standard out +Templates.sysout=print to standard out +Templates.syserr=print to standard error +Templates.code_tag= +Templates.code_tag_null=null +Templates.code_tag_true=true +Templates.code_tag_false=false +Templates.pre_tag=

+Templates.b_tag=
+Templates.i_tag=
+Templates.author=author name
+Templates.new=create new object
+Templates.lazy=lazy creation
+Templates.while_condition=while loop with condition
+Templates.non-nls= non-externalized string marker
+Templates.synchronized= blocksynchronized block
+Templates.runnable= runnable
+
+# Java Only stuff
+CompilationUnitContextType.variable.description.file=Filename of compilation unit
+CompilationUnitContextType.variable.description.primary.type.name=Filename without extension
+CompilationUnitContextType.variable.description.enclosing.method=Enclosing method name
+CompilationUnitContextType.variable.description.enclosing.type=Enclosing type name
+CompilationUnitContextType.variable.description.enclosing.package=Enclosing package name
+CompilationUnitContextType.variable.description.enclosing.project=Enclosing project name
+CompilationUnitContextType.variable.description.enclosing.method.arguments=Argument names of enclosing method
+CompilationUnitContextType.variable.description.return.type=Enclosing method return type
+
+JavaContextType.variable.description.array=A proposal for an array
+JavaContextType.variable.description.array.type=A proposal for the element type of an array
+JavaContextType.variable.description.array.element=A proposal for the element name of an array
+JavaContextType.variable.description.index=A proposal for an index (int)
+JavaContextType.variable.description.collection=A proposal for a collection (java.util.Collection)
+JavaContextType.variable.description.iterator=A proposal for an iterator (java.util.Iterator)
+JavaContextType.variable.description.todo=Todo task tag
+
+JavaContext.error.title=Template Error
+JavaContext.error.message=Template file incomplete or has errors.  You can load the default templates from the template preference page (Java>Templates).
+
+CodeTemplateContextType.variable.description.todo=Todo task tag
+CodeTemplateContextType.variable.description.packdeclaration=Package declaration of the new type
+CodeTemplateContextType.variable.description.typedeclaration=Generated type declaration
+CodeTemplateContextType.variable.description.getterfieldname=The name of field to set or get
+CodeTemplateContextType.variable.description.getterfieldtype=The type of the field to set or get
+CodeTemplateContextType.variable.description.fieldname=The name of field
+CodeTemplateContextType.variable.description.fieldtype=The type of the field
+CodeTemplateContextType.variable.description.barefieldname=The name of field to set or get without prefix or suffix
+CodeTemplateContextType.variable.description.param=The parameter passed into the setter method
+CodeTemplateContextType.variable.description.typecomment=Content of code template 'typecomment'
+CodeTemplateContextType.variable.description.exceptiontype=The type of the caught exception
+CodeTemplateContextType.variable.description.exceptionvar=The variable name of the caught exception
+CodeTemplateContextType.variable.description.enclosingtype=The type enclosing this method
+CodeTemplateContextType.variable.description.typename=Name of the current type
+CodeTemplateContextType.variable.description.enclosingmethod=The enclosing method
+CodeTemplateContextType.variable.description.bodystatement=Return statement or super call
+CodeTemplateContextType.variable.description.returntype=Return type of the enclosing method
+CodeTemplateContextType.variable.description.tags=Generated Javadoc tags (@param, @return...)
+CodeTemplateContextType.variable.description.seetag=See tag pointing to the overridden method (@see T#m())
+
+CodeTemplateContextType.variable.description.filename=Name of the enclosing compilation unit
+CodeTemplateContextType.variable.description.packagename=Name of the enclosing package
+CodeTemplateContextType.variable.description.projectname=Name of the enclosing project
+
+CodeTemplateContextType.validate.unknownvariable=Variable ''{0}'' is unknown.
+CodeTemplateContextType.validate.missingvariable=Variable ''{0}'' is required.
+CodeTemplateContextType.validate.invalidcomment=Pattern is not a valid Java comment.
+
+
+
+CodeTemplates.error.title=Error accessing code templates.
+
+# strings in default templates
+CodeTemplates.constructorcomment=Comment for created constructors
+CodeTemplates.typecomment=Comment for created types
+CodeTemplates.fieldcomment=Comment for fields
+CodeTemplates.nonoverridingcomment=Comment for non-overriding methods
+CodeTemplates.overridecomment=Comment for overriding methods
+CodeTemplates.gettercomment=Comment for getter method
+# ! Do not translate ${bare_field_name} !
+CodeTemplates.gettercomment.returntagcontent=Returns the ${bare_field_name}.
+CodeTemplates.settercomment=Comment for setter method
+# ! Do not translate ${bare_field_name} !
+CodeTemplates.settercomment.paramtagcontent=The ${bare_field_name} to set.
+
+CodeTemplates.newfile=Newly created PHP files
+CodeTemplates.newhtml=Newly created HTML files
+CodeTemplates.catchblock=Code in new catch blocks
+CodeTemplates.methodstub=Code in created method stubs
+CodeTemplates.constructorstub=Code in created constructor stubs
+CodeTemplates.getterstub=Code in created getters
+CodeTemplates.setterstub=Code in created setters
+
+# ! Do not translate @todo !
+CodeTemplates.typecomment.content1=To change the template for this generated type comment go to
+CodeTemplates.typecomment.content2=Window - Preferences - Java - Code Style - Code Templates
+
+# ! Do not translate ${field} !
+CodeTemplates.fieldcomment.content=Comment for ${field}
+
+CodeTemplates.overridecomment.nonjd=(non-Javadoc)
+
+# ! Do not translate ${date} !
+CodeTemplates.newfile.content1=Created on ${date}
+CodeTemplates.newfile.content2=To change the template for this generated file go to
+CodeTemplates.newfile.content3=Window - Preferences - PHPeclipse - PHP - Code Templates
+
+CodeTemplates.newhtml.content1=Created on ${date}
+CodeTemplates.newhtml.content2=To change the template for this generated file go to
+CodeTemplates.newhtml.content3=Window - Preferences - PHPeclipse - PHP - Code Templates
+
+CodeTemplates.catchblock.tododesc=Auto-generated catch block
+CodeTemplates.methodstub.tododesc=Auto-generated method stub
+CodeTemplates.constructorstub.tododesc=Auto-generated constructor stub
+
diff --git a/net.sourceforge.phpeclipse.ui/templates/default-templates.xml b/net.sourceforge.phpeclipse.ui/templates/default-templates.xml
index 46deae9..cdec7e2 100644
--- a/net.sourceforge.phpeclipse.ui/templates/default-templates.xml
+++ b/net.sourceforge.phpeclipse.ui/templates/default-templates.xml
@@ -1,452 +1,244 @@
 
 
-