View | Details | Raw Unified | Return to bug 252618
Collapse All | Expand All

(-).externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch (-6 lines)
Removed Link Here
1
<?xml version="1.0" encoding="UTF-8"?><launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
2
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
3
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.emf.codegen.JETBuilder"/>
4
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
5
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
6
</launchConfiguration>
(-).project (-6 / +1 lines)
Lines 6-18 Link Here
6
	</projects>
6
	</projects>
7
	<buildSpec>
7
	<buildSpec>
8
		<buildCommand>
8
		<buildCommand>
9
			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
9
			<name>org.eclipse.emf.codegen.JETBuilder</name>
10
			<triggers>full,incremental,</triggers>
11
			<arguments>
10
			<arguments>
12
				<dictionary>
13
					<key>LaunchConfigHandle</key>
14
					<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.emf.codegen.JETBuilder.launch</value>
15
				</dictionary>
16
			</arguments>
11
			</arguments>
17
		</buildCommand>
12
		</buildCommand>
18
		<buildCommand>
13
		<buildCommand>
(-).settings/org.eclipse.jdt.core.prefs (-80 / +82 lines)
Lines 1-95 Link Here
1
#Wed Jun 10 12:11:14 EDT 2009
1
#Thu Feb 18 13:56:30 EET 2010
2
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
3
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
4
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
5
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
6
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
7
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
8
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
9
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
10
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
11
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
12
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
13
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
14
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
15
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
4
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
16
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
5
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
17
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
6
org.eclipse.jdt.core.builder.invalidClasspath=abort
18
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
19
org.eclipse.jdt.core.compiler.problem.deprecation=warning
20
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
21
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
22
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
23
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
24
org.eclipse.jdt.core.compiler.problem.unusedImport=error
25
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
7
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
26
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
8
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
9
org.eclipse.jdt.core.circularClasspath=error
10
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
27
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
11
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
28
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
29
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
30
org.eclipse.jdt.core.builder.invalidClasspath=abort
31
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
32
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
33
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
34
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
35
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
12
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
36
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
13
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
37
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
14
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
15
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
16
org.eclipse.jdt.core.codeComplete.localPrefixes=
17
org.eclipse.jdt.core.codeComplete.localSuffixes=
18
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
19
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
38
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
20
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
39
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
21
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
40
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
22
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
41
org.eclipse.jdt.core.compiler.problem.nullReference=error
23
org.eclipse.jdt.core.compiler.compliance=1.5
42
org.eclipse.jdt.core.compiler.source=1.5
24
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
25
org.eclipse.jdt.core.compiler.debug.localVariable=generate
26
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
27
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
28
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
29
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
30
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
31
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
32
org.eclipse.jdt.core.compiler.problem.deadCode=error
33
org.eclipse.jdt.core.compiler.problem.deprecation=warning
34
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
35
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
36
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
37
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
43
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
38
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
44
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
39
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
45
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
40
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
46
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
41
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
47
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
42
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
48
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
49
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
50
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
51
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
43
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
52
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
44
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
53
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
45
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
54
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
46
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
55
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
56
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
57
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
47
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
58
eclipse.preferences.version=1
48
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
59
org.eclipse.jdt.core.incompleteClasspath=error
49
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
60
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
50
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
61
org.eclipse.jdt.core.compiler.problem.deadCode=error
62
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
63
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
64
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
65
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
66
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled
67
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
51
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
68
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
52
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
69
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
53
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
70
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
54
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
71
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
55
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
72
org.eclipse.jdt.core.compiler.problem.autoboxing=warning
56
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
73
org.eclipse.jdt.core.circularClasspath=error
57
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
74
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
58
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
75
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
59
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
76
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
60
org.eclipse.jdt.core.compiler.problem.nullReference=error
77
org.eclipse.jdt.core.codeComplete.localSuffixes=
61
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
78
org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
62
org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
63
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
64
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
65
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
66
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
67
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
68
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
79
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
69
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
80
org.eclipse.jdt.core.codeComplete.localPrefixes=
70
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
81
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
71
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
82
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
72
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
83
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
84
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
85
org.eclipse.jdt.core.compiler.compliance=1.5
86
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
87
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
88
org.eclipse.jdt.core.compiler.debug.localVariable=generate
89
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
90
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
91
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
92
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
93
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
73
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
74
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
75
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
76
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
77
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
78
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
79
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
80
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
81
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
82
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeUncheckedExceptions=disabled
94
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
83
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
95
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
84
org.eclipse.jdt.core.compiler.problem.unusedImport=error
85
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
86
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
87
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
88
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
89
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
90
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
91
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
92
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
93
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
94
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
95
org.eclipse.jdt.core.compiler.source=1.5
96
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
97
org.eclipse.jdt.core.incompleteClasspath=error
(-)templates/_class.template (-1 / +1 lines)
Lines 29-35 Link Here
29
	}
29
	}
30
	
30
	
31
 	for (int i = 0; i < interfaces.size(); i++) {
31
 	for (int i = 0; i < interfaces.size(); i++) {
32
   		String INTERFACE = (String) interfaces.get(i);
32
   		String INTERFACE = interfaces.get(i);
33
   		if (i > 0) {
33
   		if (i > 0) {
34
%>, 
34
%>, 
35
<%
35
<%
(-)templates/filter_classHeader.template (-1 / +8 lines)
Lines 59-62 Link Here
59
		} 
59
		} 
60
	}
60
	}
61
%>
61
%>
62
 */
62
 */
63
  <% 
64
	if ("3.0".equals(model.getJavaEEVersion())) { 
65
%>
66
@WebFilter<%=model.getJavaEE6AnnotationParameters()%>
67
<%
68
}
69
%>
(-)templates/listener_classHeader.template (-1 / +8 lines)
Lines 8-11 Link Here
8
<% 
8
<% 
9
	}
9
	}
10
%>
10
%>
11
 */
11
 */
12
  <% 
13
	if ("3.0".equals(model.getJavaEEVersion())) { 
14
%>
15
@WebListener
16
<%
17
}
18
%>
(-)templates/servlet_classHeader.template (-1 / +8 lines)
Lines 45-48 Link Here
45
		} 
45
		} 
46
	} 
46
	} 
47
%>
47
%>
48
 */
48
 */
49
 <% 
50
	if ("3.0".equals(model.getJavaEEVersion())) { 
51
%>
52
@WebServlet<%=model.getJavaEE6AnnotationParameters()%>
53
<%
54
}
55
%>
(-)web/org/eclipse/jst/j2ee/internal/web/operations/AddWebClassOperation.java (-1 / +2 lines)
Lines 14-19 Link Here
14
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
14
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.CLASS_NAME;
15
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.GENERATE_DD;
15
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.GENERATE_DD;
16
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
16
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
17
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
17
18
18
import java.lang.reflect.InvocationTargetException;
19
import java.lang.reflect.InvocationTargetException;
19
20
Lines 67-73 Link Here
67
			qualifiedClassName = createClass();
68
			qualifiedClassName = createClass();
68
69
69
		// If the filter is not annotated, generate the filter metadata for the DD
70
		// If the filter is not annotated, generate the filter metadata for the DD
70
		if (!model.getBooleanProperty(USE_ANNOTATIONS))
71
		if (!model.getBooleanProperty(USE_ANNOTATIONS) && model.getBooleanProperty(REGISTER_IN_WEB_XML))
71
		{
72
		{
72
			if (model.getBooleanProperty(GENERATE_DD))
73
			if (model.getBooleanProperty(GENERATE_DD))
73
			{
74
			{
(-)web/org/eclipse/jst/j2ee/internal/web/operations/CreateFilterTemplateModel.java (+49 lines)
Lines 23-34 Link Here
23
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
23
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DESTROY;
24
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_FILTER;
24
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_DO_FILTER;
25
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
25
import static org.eclipse.jst.j2ee.web.IServletConstants.METHOD_INIT;
26
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
26
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CHAIN;
27
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CHAIN;
27
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CONFIG;
28
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_FILTER_CONFIG;
28
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
29
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_IO_EXCEPTION;
29
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
30
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
30
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
31
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
31
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
32
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
33
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_FILTER;
32
34
33
import java.util.ArrayList;
35
import java.util.ArrayList;
34
import java.util.Collection;
36
import java.util.Collection;
Lines 65-70 Link Here
65
			collection.add(QUALIFIED_IO_EXCEPTION);
67
			collection.add(QUALIFIED_IO_EXCEPTION);
66
			collection.add(QUALIFIED_SERVLET_EXCEPTION);
68
			collection.add(QUALIFIED_SERVLET_EXCEPTION);
67
		}
69
		}
70
		if (SERVLET_3.equals(getJavaEEVersion())){
71
			collection.add(QUALIFIED_WEB_FILTER);
72
			if (getInitParams()!= null && getInitParams().size()>0){
73
				collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
74
			}
75
		}
68
		
76
		
69
		return collection;
77
		return collection;
70
	}
78
	}
Lines 167-171 Link Here
167
		
175
		
168
		return unimplementedMethods;
176
		return unimplementedMethods;
169
	}
177
	}
178
	
179
	public String getJavaEE6AnnotationParameters(){
180
		String result = "("; //$NON-NLS-1$
181
		List<IFilterMappingItem> filterMappings = getFilterMappings();
182
		if (filterMappings != null && filterMappings.size()>0 && hasUrlMapping(filterMappings)){
183
			result+="urlPatterns={"; //$NON-NLS-1$
184
			for (IFilterMappingItem filterMapItem : filterMappings) {
185
				result+="\""+filterMapItem.getName()+"\",";  //$NON-NLS-1$//$NON-NLS-2$
186
			}
187
			result = result.substring(0, result.length()-1);
188
			result+='}';
189
			
190
		}
191
		List<String[]> initParams = getInitParams();
192
		if (initParams != null && initParams.size()>0){
193
			if (result.length() > 1){
194
				result+=", "; //$NON-NLS-1$
195
			}
196
			result+="initParams={"; //$NON-NLS-1$
197
			for (String[] iParams : initParams) {
198
				result+=generateInitParamAnnotation(iParams[0], iParams[1]) + ","; //$NON-NLS-1$
199
			}
200
			result = result.substring(0, result.length()-1);
201
			result+="}"; //$NON-NLS-1$
202
		}
203
		result+=")"; //$NON-NLS-1$
204
		return result.length() > 2 ? result : ""; //$NON-NLS-1$
205
	}
206
	
207
	private boolean hasUrlMapping(List<IFilterMappingItem> filterMappings) {
208
		for (IFilterMappingItem filterMapItem : filterMappings) {
209
			if (filterMapItem.isUrlPatternType()){
210
				return true;
211
			}
212
		}
213
		return false;
214
	}
215
216
	private String generateInitParamAnnotation(String name, String value){
217
		return "@WebInitParam(name=\""+name+"\", value=\""+value+"\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
218
	}
170
219
171
}
220
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/CreateListenerTemplateModel.java (+5 lines)
Lines 24-29 Link Here
24
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
24
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_LISTENER;
25
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_EVENT;
25
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_EVENT;
26
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
26
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST_LISTENER;
27
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_LISTENER;
27
28
28
import java.util.Collection;
29
import java.util.Collection;
29
import java.util.List;
30
import java.util.List;
Lines 76-81 Link Here
76
			collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT);
77
			collection.add(QUALIFIED_SERVLET_REQUEST_ATTRIBUTE_EVENT);
77
		}
78
		}
78
		
79
		
80
		if (SERVLET_3.equals(getJavaEEVersion())){
81
			collection.add(QUALIFIED_WEB_LISTENER);
82
		}
83
		
79
		return collection;
84
		return collection;
80
	}
85
	}
81
86
(-)web/org/eclipse/jst/j2ee/internal/web/operations/CreateServletTemplateModel.java (+50 lines)
Lines 60-65 Link Here
60
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
60
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_EXCEPTION;
61
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
61
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_REQUEST;
62
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
62
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_SERVLET_RESPONSE;
63
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_WEB_SERVLET;
64
import static org.eclipse.jst.j2ee.web.IServletConstants.QUALIFIED_ANNOTATION_INIT_PARAM;
63
import static org.eclipse.jst.j2ee.web.IServletConstants.SERVICE_SIGNATURE;
65
import static org.eclipse.jst.j2ee.web.IServletConstants.SERVICE_SIGNATURE;
64
import static org.eclipse.jst.j2ee.web.IServletConstants.SERVLET_INIT_SIGNATURE;
66
import static org.eclipse.jst.j2ee.web.IServletConstants.SERVLET_INIT_SIGNATURE;
65
67
Lines 118-123 Link Here
118
			collection.add(QUALIFIED_IO_EXCEPTION);
120
			collection.add(QUALIFIED_IO_EXCEPTION);
119
		}
121
		}
120
		
122
		
123
		if (SERVLET_3.equals(getJavaEEVersion())){
124
			collection.add(QUALIFIED_WEB_SERVLET);
125
			if (getInitParams()!= null && getInitParams().size()>0){
126
				collection.add(QUALIFIED_ANNOTATION_INIT_PARAM);
127
			}
128
			
129
			
130
131
		}
132
		
121
		return collection;
133
		return collection;
122
	}
134
	}
123
135
Lines 287-291 Link Here
287
		
299
		
288
		return unimplementedMethods;
300
		return unimplementedMethods;
289
	}
301
	}
302
	
303
	public String getJavaEE6AnnotationParameters(){
304
		String result = "(";
305
		if (!getClassName().equals(getServletName())){
306
			result+="name=\""+getServletName()+"\"";
307
		}
308
		List<String[]> servletMappings = getServletMappings();
309
		if (servletMappings != null && servletMappings.size()>0){
310
			if (result.length() > 1){
311
				result+=", ";
312
			}
313
			result+="urlPatterns={";
314
			for (String[] strings : servletMappings) {
315
				result+="\""+strings[0]+"\",";
316
			}
317
			result = result.substring(0, result.length()-1);
318
			result+='}';
319
			
320
		}
321
		List<String[]> initParams = getInitParams();
322
		if (initParams != null && initParams.size()>0){
323
			if (result.length() > 1){
324
				result+=", ";
325
			}
326
			result+="initParams={";
327
			for (String[] iParams : initParams) {
328
				result+=generateInitParamAnnotation(iParams[0], iParams[1]) + ",";
329
			}
330
			result = result.substring(0, result.length()-1);
331
			result+="}";
332
		}
333
		result+=")";
334
		return result.length() > 2 ? result : ""; //$NON-NLS-1$
335
	}
336
	
337
	private String generateInitParamAnnotation(String name, String value){
338
		return "@WebInitParam(name=\""+name+"\", value=\""+value+"\")";
339
	}
290
340
291
}
341
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/CreateWebClassTemplateModel.java (+7 lines)
Lines 14-19 Link Here
14
import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
14
import static org.eclipse.jst.j2ee.application.internal.operations.IAnnotationsDataModel.USE_ANNOTATIONS;
15
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
15
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
16
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
16
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
17
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
17
18
18
import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel;
19
import org.eclipse.jst.j2ee.internal.common.operations.CreateJavaEEArtifactTemplateModel;
19
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
20
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
Lines 21-26 Link Here
21
public class CreateWebClassTemplateModel extends
22
public class CreateWebClassTemplateModel extends
22
		CreateJavaEEArtifactTemplateModel {
23
		CreateJavaEEArtifactTemplateModel {
23
	
24
	
25
	public static final String SERVLET_3 = "3.0"; //$NON-NLS-1$
26
	
24
	public CreateWebClassTemplateModel(IDataModel dataModel) {
27
	public CreateWebClassTemplateModel(IDataModel dataModel) {
25
		super(dataModel);
28
		super(dataModel);
26
	}
29
	}
Lines 36-40 Link Here
36
	public boolean isAnnotated() {
39
	public boolean isAnnotated() {
37
		return dataModel.getBooleanProperty(USE_ANNOTATIONS);
40
		return dataModel.getBooleanProperty(USE_ANNOTATIONS);
38
	}
41
	}
42
	
43
	public String getJavaEEVersion() {
44
		return dataModel.getStringProperty(JAVA_EE_VERSION);
45
	}
39
46
40
}
47
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/FilterTemplate.java (-86 / +95 lines)
Lines 14-78 Link Here
14
    return result;
14
    return result;
15
  }
15
  }
16
16
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "package "; //$NON-NLS-1$
18
  protected final String TEXT_1 = "package ";
19
  protected final String TEXT_2 = ";"; //$NON-NLS-1$
19
  protected final String TEXT_2 = ";";
20
  protected final String TEXT_3 = NL;
20
  protected final String TEXT_3 = NL;
21
  protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
21
  protected final String TEXT_4 = NL + "import ";
22
  protected final String TEXT_5 = ";"; //$NON-NLS-1$
22
  protected final String TEXT_5 = ";";
23
  protected final String TEXT_6 = NL;
23
  protected final String TEXT_6 = NL;
24
  protected final String TEXT_7 = NL;
24
  protected final String TEXT_7 = NL;
25
  protected final String TEXT_8 = "/**" + NL + " * Servlet Filter implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
25
  protected final String TEXT_8 = "/**" + NL + " * Servlet Filter implementation class ";
26
  protected final String TEXT_9 = NL + " *" + NL + " * @web.filter" + NL + " *   name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
26
  protected final String TEXT_9 = NL + " *" + NL + " * @web.filter" + NL + " *   name=\"";
27
  protected final String TEXT_10 = "\"" + NL + " *   display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
27
  protected final String TEXT_10 = "\"" + NL + " *   display-name=\"";
28
  protected final String TEXT_11 = "\""; //$NON-NLS-1$
28
  protected final String TEXT_11 = "\"";
29
  protected final String TEXT_12 = NL + " *   description=\""; //$NON-NLS-1$
29
  protected final String TEXT_12 = NL + " *   description=\"";
30
  protected final String TEXT_13 = "\""; //$NON-NLS-1$
30
  protected final String TEXT_13 = "\"";
31
  protected final String TEXT_14 = NL + " *" + NL + " * @web.filter-mapping"; //$NON-NLS-1$ //$NON-NLS-2$
31
  protected final String TEXT_14 = NL + " *" + NL + " * @web.filter-mapping";
32
  protected final String TEXT_15 = NL + " *   url-pattern=\""; //$NON-NLS-1$
32
  protected final String TEXT_15 = NL + " *   url-pattern=\"";
33
  protected final String TEXT_16 = "\""; //$NON-NLS-1$
33
  protected final String TEXT_16 = "\"";
34
  protected final String TEXT_17 = NL + " *   servlet-name=\""; //$NON-NLS-1$
34
  protected final String TEXT_17 = NL + " *   servlet-name=\"";
35
  protected final String TEXT_18 = "\""; //$NON-NLS-1$
35
  protected final String TEXT_18 = "\"";
36
  protected final String TEXT_19 = NL + " *   dispatcher=\""; //$NON-NLS-1$
36
  protected final String TEXT_19 = NL + " *   dispatcher=\"";
37
  protected final String TEXT_20 = "\""; //$NON-NLS-1$
37
  protected final String TEXT_20 = "\"";
38
  protected final String TEXT_21 = NL + " *" + NL + " * @web.filter-init-param" + NL + " *    name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
38
  protected final String TEXT_21 = NL + " *" + NL + " * @web.filter-init-param" + NL + " *    name=\"";
39
  protected final String TEXT_22 = "\"" + NL + " *    value=\""; //$NON-NLS-1$ //$NON-NLS-2$
39
  protected final String TEXT_22 = "\"" + NL + " *    value=\"";
40
  protected final String TEXT_23 = "\""; //$NON-NLS-1$
40
  protected final String TEXT_23 = "\"";
41
  protected final String TEXT_24 = NL + " *    description=\""; //$NON-NLS-1$
41
  protected final String TEXT_24 = NL + " *    description=\"";
42
  protected final String TEXT_25 = "\""; //$NON-NLS-1$
42
  protected final String TEXT_25 = "\"";
43
  protected final String TEXT_26 = NL + " */"; //$NON-NLS-1$
43
  protected final String TEXT_26 = NL + " */";
44
  protected final String TEXT_27 = NL + "public "; //$NON-NLS-1$
44
  protected final String TEXT_27 = NL + "@WebFilter";
45
  protected final String TEXT_28 = "abstract "; //$NON-NLS-1$
45
  protected final String TEXT_28 = NL + "public ";
46
  protected final String TEXT_29 = "final "; //$NON-NLS-1$
46
  protected final String TEXT_29 = "abstract ";
47
  protected final String TEXT_30 = "class "; //$NON-NLS-1$
47
  protected final String TEXT_30 = "final ";
48
  protected final String TEXT_31 = " extends "; //$NON-NLS-1$
48
  protected final String TEXT_31 = "class ";
49
  protected final String TEXT_32 = " implements "; //$NON-NLS-1$
49
  protected final String TEXT_32 = " extends ";
50
  protected final String TEXT_33 = ", "; //$NON-NLS-1$
50
  protected final String TEXT_33 = " implements ";
51
  protected final String TEXT_34 = " {"; //$NON-NLS-1$
51
  protected final String TEXT_34 = ", ";
52
  protected final String TEXT_35 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
52
  protected final String TEXT_35 = " {";
53
  protected final String TEXT_36 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
53
  protected final String TEXT_36 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public ";
54
  protected final String TEXT_37 = NL + "       " + NL + "    /**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
54
  protected final String TEXT_37 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
55
  protected final String TEXT_38 = "#"; //$NON-NLS-1$
55
  protected final String TEXT_38 = NL + "       " + NL + "    /**" + NL + "     * @see ";
56
  protected final String TEXT_39 = "("; //$NON-NLS-1$
56
  protected final String TEXT_39 = "#";
57
  protected final String TEXT_40 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
57
  protected final String TEXT_40 = "(";
58
  protected final String TEXT_41 = "("; //$NON-NLS-1$
58
  protected final String TEXT_41 = ")" + NL + "     */" + NL + "    public ";
59
  protected final String TEXT_42 = ") {" + NL + "        super("; //$NON-NLS-1$ //$NON-NLS-2$
59
  protected final String TEXT_42 = "(";
60
  protected final String TEXT_43 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
60
  protected final String TEXT_43 = ") {" + NL + "        super(";
61
  protected final String TEXT_44 = NL + NL + "\t/**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$
61
  protected final String TEXT_44 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
62
  protected final String TEXT_45 = "#"; //$NON-NLS-1$
62
  protected final String TEXT_45 = NL + NL + "\t/**" + NL + "     * @see ";
63
  protected final String TEXT_46 = "("; //$NON-NLS-1$
63
  protected final String TEXT_46 = "#";
64
  protected final String TEXT_47 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
64
  protected final String TEXT_47 = "(";
65
  protected final String TEXT_48 = " "; //$NON-NLS-1$
65
  protected final String TEXT_48 = ")" + NL + "     */" + NL + "    public ";
66
  protected final String TEXT_49 = "("; //$NON-NLS-1$
66
  protected final String TEXT_49 = " ";
67
  protected final String TEXT_50 = ") {" + NL + "        // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
67
  protected final String TEXT_50 = "(";
68
  protected final String TEXT_51 = NL + "\t\t\treturn "; //$NON-NLS-1$
68
  protected final String TEXT_51 = ") {" + NL + "        // TODO Auto-generated method stub";
69
  protected final String TEXT_52 = ";"; //$NON-NLS-1$
69
  protected final String TEXT_52 = NL + "\t\t\treturn ";
70
  protected final String TEXT_53 = NL + "    }"; //$NON-NLS-1$
70
  protected final String TEXT_53 = ";";
71
  protected final String TEXT_54 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
71
  protected final String TEXT_54 = NL + "    }";
72
  protected final String TEXT_55 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
72
  protected final String TEXT_55 = NL + NL + "\t/**" + NL + "\t * @see Filter#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
73
  protected final String TEXT_56 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
73
  protected final String TEXT_56 = NL + NL + "\t/**" + NL + "\t * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)" + NL + "\t */" + NL + "\tpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\t// place your code here" + NL + "" + NL + "\t\t// pass the request along the filter chain" + NL + "\t\tchain.doFilter(request, response);" + NL + "\t}";
74
  protected final String TEXT_57 = NL + NL + "}"; //$NON-NLS-1$
74
  protected final String TEXT_57 = NL + NL + "\t/**" + NL + "\t * @see Filter#init(FilterConfig)" + NL + "\t */" + NL + "\tpublic void init(FilterConfig fConfig) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
75
  protected final String TEXT_58 = NL;
75
  protected final String TEXT_58 = NL + NL + "}";
76
  protected final String TEXT_59 = NL;
76
77
77
  public String generate(Object argument)
78
  public String generate(Object argument)
78
  {
79
  {
Lines 176-207 Link Here
176
	}
177
	}
177
178
178
    stringBuffer.append(TEXT_26);
179
    stringBuffer.append(TEXT_26);
180
     
181
	if ("3.0".equals(model.getJavaEEVersion())) { 
182
183
    stringBuffer.append(TEXT_27);
184
    stringBuffer.append(model.getJavaEE6AnnotationParameters());
185
    
186
}
187
179
    
188
    
180
	if (model.isPublic()) { 
189
	if (model.isPublic()) { 
181
190
182
    stringBuffer.append(TEXT_27);
191
    stringBuffer.append(TEXT_28);
183
     
192
     
184
	} 
193
	} 
185
194
186
	if (model.isAbstract()) { 
195
	if (model.isAbstract()) { 
187
196
188
    stringBuffer.append(TEXT_28);
197
    stringBuffer.append(TEXT_29);
189
    
198
    
190
	}
199
	}
191
200
192
	if (model.isFinal()) {
201
	if (model.isFinal()) {
193
202
194
    stringBuffer.append(TEXT_29);
203
    stringBuffer.append(TEXT_30);
195
    
204
    
196
	}
205
	}
197
206
198
    stringBuffer.append(TEXT_30);
207
    stringBuffer.append(TEXT_31);
199
    stringBuffer.append( model.getClassName() );
208
    stringBuffer.append( model.getClassName() );
200
    
209
    
201
	String superClass = model.getSuperclassName();
210
	String superClass = model.getSuperclassName();
202
 	if (superClass != null && superClass.length() > 0) {
211
 	if (superClass != null && superClass.length() > 0) {
203
212
204
    stringBuffer.append(TEXT_31);
213
    stringBuffer.append(TEXT_32);
205
    stringBuffer.append( superClass );
214
    stringBuffer.append( superClass );
206
    
215
    
207
	}
216
	}
Lines 209-215 Link Here
209
	List<String> interfaces = model.getInterfaces(); 
218
	List<String> interfaces = model.getInterfaces(); 
210
 	if ( interfaces.size() > 0) { 
219
 	if ( interfaces.size() > 0) { 
211
220
212
    stringBuffer.append(TEXT_32);
221
    stringBuffer.append(TEXT_33);
213
    
222
    
214
	}
223
	}
215
	
224
	
Lines 217-223 Link Here
217
   		String INTERFACE = interfaces.get(i);
226
   		String INTERFACE = interfaces.get(i);
218
   		if (i > 0) {
227
   		if (i > 0) {
219
228
220
    stringBuffer.append(TEXT_33);
229
    stringBuffer.append(TEXT_34);
221
    
230
    
222
		}
231
		}
223
232
Lines 225-237 Link Here
225
    
234
    
226
	}
235
	}
227
236
228
    stringBuffer.append(TEXT_34);
237
    stringBuffer.append(TEXT_35);
229
     
238
     
230
	if (!model.hasEmptySuperclassConstructor()) { 
239
	if (!model.hasEmptySuperclassConstructor()) { 
231
240
232
    stringBuffer.append(TEXT_35);
233
    stringBuffer.append( model.getClassName() );
234
    stringBuffer.append(TEXT_36);
241
    stringBuffer.append(TEXT_36);
242
    stringBuffer.append( model.getClassName() );
243
    stringBuffer.append(TEXT_37);
235
     
244
     
236
	} 
245
	} 
237
246
Lines 240-258 Link Here
240
		for (Constructor constructor : constructors) {
249
		for (Constructor constructor : constructors) {
241
			if (constructor.isPublic() || constructor.isProtected()) { 
250
			if (constructor.isPublic() || constructor.isProtected()) { 
242
251
243
    stringBuffer.append(TEXT_37);
244
    stringBuffer.append( model.getSuperclassName() );
245
    stringBuffer.append(TEXT_38);
252
    stringBuffer.append(TEXT_38);
246
    stringBuffer.append( model.getSuperclassName() );
253
    stringBuffer.append( model.getSuperclassName() );
247
    stringBuffer.append(TEXT_39);
254
    stringBuffer.append(TEXT_39);
248
    stringBuffer.append( constructor.getParamsForJavadoc() );
255
    stringBuffer.append( model.getSuperclassName() );
249
    stringBuffer.append(TEXT_40);
256
    stringBuffer.append(TEXT_40);
250
    stringBuffer.append( model.getClassName() );
257
    stringBuffer.append( constructor.getParamsForJavadoc() );
251
    stringBuffer.append(TEXT_41);
258
    stringBuffer.append(TEXT_41);
252
    stringBuffer.append( constructor.getParamsForDeclaration() );
259
    stringBuffer.append( model.getClassName() );
253
    stringBuffer.append(TEXT_42);
260
    stringBuffer.append(TEXT_42);
254
    stringBuffer.append( constructor.getParamsForCall() );
261
    stringBuffer.append( constructor.getParamsForDeclaration() );
255
    stringBuffer.append(TEXT_43);
262
    stringBuffer.append(TEXT_43);
263
    stringBuffer.append( constructor.getParamsForCall() );
264
    stringBuffer.append(TEXT_44);
256
    
265
    
257
			} 
266
			} 
258
		} 
267
		} 
Lines 262-306 Link Here
262
	if (model.shouldImplementAbstractMethods()) {
271
	if (model.shouldImplementAbstractMethods()) {
263
		for (Method method : model.getUnimplementedMethods()) { 
272
		for (Method method : model.getUnimplementedMethods()) { 
264
273
265
    stringBuffer.append(TEXT_44);
266
    stringBuffer.append( method.getContainingJavaClass() );
267
    stringBuffer.append(TEXT_45);
274
    stringBuffer.append(TEXT_45);
268
    stringBuffer.append( method.getName() );
275
    stringBuffer.append( method.getContainingJavaClass() );
269
    stringBuffer.append(TEXT_46);
276
    stringBuffer.append(TEXT_46);
270
    stringBuffer.append( method.getParamsForJavadoc() );
277
    stringBuffer.append( method.getName() );
271
    stringBuffer.append(TEXT_47);
278
    stringBuffer.append(TEXT_47);
272
    stringBuffer.append( method.getReturnType() );
279
    stringBuffer.append( method.getParamsForJavadoc() );
273
    stringBuffer.append(TEXT_48);
280
    stringBuffer.append(TEXT_48);
274
    stringBuffer.append( method.getName() );
281
    stringBuffer.append( method.getReturnType() );
275
    stringBuffer.append(TEXT_49);
282
    stringBuffer.append(TEXT_49);
276
    stringBuffer.append( method.getParamsForDeclaration() );
283
    stringBuffer.append( method.getName() );
277
    stringBuffer.append(TEXT_50);
284
    stringBuffer.append(TEXT_50);
285
    stringBuffer.append( method.getParamsForDeclaration() );
286
    stringBuffer.append(TEXT_51);
278
     
287
     
279
			String defaultReturnValue = method.getDefaultReturnValue();
288
			String defaultReturnValue = method.getDefaultReturnValue();
280
			if (defaultReturnValue != null) { 
289
			if (defaultReturnValue != null) { 
281
290
282
    stringBuffer.append(TEXT_51);
283
    stringBuffer.append( defaultReturnValue );
284
    stringBuffer.append(TEXT_52);
291
    stringBuffer.append(TEXT_52);
292
    stringBuffer.append( defaultReturnValue );
293
    stringBuffer.append(TEXT_53);
285
    
294
    
286
			} 
295
			} 
287
296
288
    stringBuffer.append(TEXT_53);
297
    stringBuffer.append(TEXT_54);
289
     
298
     
290
		}
299
		}
291
	} 
300
	} 
292
301
293
     if (model.shouldGenDestroy()) { 
302
     if (model.shouldGenDestroy()) { 
294
    stringBuffer.append(TEXT_54);
295
     } 
296
     if (model.shouldGenDoFilter()) { 
297
    stringBuffer.append(TEXT_55);
303
    stringBuffer.append(TEXT_55);
298
     } 
304
     } 
299
     if (model.shouldGenInit()) { 
305
     if (model.shouldGenDoFilter()) { 
300
    stringBuffer.append(TEXT_56);
306
    stringBuffer.append(TEXT_56);
301
     } 
307
     } 
308
     if (model.shouldGenInit()) { 
302
    stringBuffer.append(TEXT_57);
309
    stringBuffer.append(TEXT_57);
310
     } 
303
    stringBuffer.append(TEXT_58);
311
    stringBuffer.append(TEXT_58);
312
    stringBuffer.append(TEXT_59);
304
    return stringBuffer.toString();
313
    return stringBuffer.toString();
305
  }
314
  }
306
}
315
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/INewWebClassDataModelProperties.java (+11 lines)
Lines 31-34 Link Here
31
	 */
31
	 */
32
	public static final String USE_EXISTING_CLASS = "NewServletClassDataModel.USE_EXISTING_CLASS"; //$NON-NLS-1$
32
	public static final String USE_EXISTING_CLASS = "NewServletClassDataModel.USE_EXISTING_CLASS"; //$NON-NLS-1$
33
	
33
	
34
	/**
35
	 * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
36
	 */
37
	public static final String REGISTER_IN_WEB_XML = "NewServletClassDataModel.REGISTER_IN_WEB_XML"; //$NON-NLS-1$
38
	
39
	/**
40
	 * Optional, boolean property used to specify whether or not to generate artifacts in web.xml
41
	 */
42
	public static final String JAVA_EE_VERSION = "NewServletClassDataModel.JAVA_EE_VERSION"; //$NON-NLS-1$
43
	
44
	
34
}
45
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/ListenerTemplate.java (-65 / +73 lines)
Lines 14-60 Link Here
14
    return result;
14
    return result;
15
  }
15
  }
16
16
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "package "; //$NON-NLS-1$
18
  protected final String TEXT_1 = "package ";
19
  protected final String TEXT_2 = ";"; //$NON-NLS-1$
19
  protected final String TEXT_2 = ";";
20
  protected final String TEXT_3 = NL;
20
  protected final String TEXT_3 = NL;
21
  protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
21
  protected final String TEXT_4 = NL + "import ";
22
  protected final String TEXT_5 = ";"; //$NON-NLS-1$
22
  protected final String TEXT_5 = ";";
23
  protected final String TEXT_6 = NL;
23
  protected final String TEXT_6 = NL;
24
  protected final String TEXT_7 = NL;
24
  protected final String TEXT_7 = NL;
25
  protected final String TEXT_8 = "/**" + NL + " * Application Lifecycle Listener implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
25
  protected final String TEXT_8 = "/**" + NL + " * Application Lifecycle Listener implementation class ";
26
  protected final String TEXT_9 = NL + " *"; //$NON-NLS-1$
26
  protected final String TEXT_9 = NL + " *";
27
  protected final String TEXT_10 = NL + " * @web.listener"; //$NON-NLS-1$
27
  protected final String TEXT_10 = NL + " * @web.listener";
28
  protected final String TEXT_11 = NL + " */"; //$NON-NLS-1$
28
  protected final String TEXT_11 = NL + " */";
29
  protected final String TEXT_12 = NL + "public "; //$NON-NLS-1$
29
  protected final String TEXT_12 = NL + "@WebListener";
30
  protected final String TEXT_13 = "abstract "; //$NON-NLS-1$
30
  protected final String TEXT_13 = NL + "public ";
31
  protected final String TEXT_14 = "final "; //$NON-NLS-1$
31
  protected final String TEXT_14 = "abstract ";
32
  protected final String TEXT_15 = "class "; //$NON-NLS-1$
32
  protected final String TEXT_15 = "final ";
33
  protected final String TEXT_16 = " extends "; //$NON-NLS-1$
33
  protected final String TEXT_16 = "class ";
34
  protected final String TEXT_17 = " implements "; //$NON-NLS-1$
34
  protected final String TEXT_17 = " extends ";
35
  protected final String TEXT_18 = ", "; //$NON-NLS-1$
35
  protected final String TEXT_18 = " implements ";
36
  protected final String TEXT_19 = " {"; //$NON-NLS-1$
36
  protected final String TEXT_19 = ", ";
37
  protected final String TEXT_20 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
37
  protected final String TEXT_20 = " {";
38
  protected final String TEXT_21 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
38
  protected final String TEXT_21 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public ";
39
  protected final String TEXT_22 = NL + "       " + NL + "    /**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
39
  protected final String TEXT_22 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
40
  protected final String TEXT_23 = "#"; //$NON-NLS-1$
40
  protected final String TEXT_23 = NL + "       " + NL + "    /**" + NL + "     * @see ";
41
  protected final String TEXT_24 = "("; //$NON-NLS-1$
41
  protected final String TEXT_24 = "#";
42
  protected final String TEXT_25 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
42
  protected final String TEXT_25 = "(";
43
  protected final String TEXT_26 = "("; //$NON-NLS-1$
43
  protected final String TEXT_26 = ")" + NL + "     */" + NL + "    public ";
44
  protected final String TEXT_27 = ") {" + NL + "        super("; //$NON-NLS-1$ //$NON-NLS-2$
44
  protected final String TEXT_27 = "(";
45
  protected final String TEXT_28 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
45
  protected final String TEXT_28 = ") {" + NL + "        super(";
46
  protected final String TEXT_29 = NL + NL + "\t/**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$
46
  protected final String TEXT_29 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
47
  protected final String TEXT_30 = "#"; //$NON-NLS-1$
47
  protected final String TEXT_30 = NL + NL + "\t/**" + NL + "     * @see ";
48
  protected final String TEXT_31 = "("; //$NON-NLS-1$
48
  protected final String TEXT_31 = "#";
49
  protected final String TEXT_32 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
49
  protected final String TEXT_32 = "(";
50
  protected final String TEXT_33 = " "; //$NON-NLS-1$
50
  protected final String TEXT_33 = ")" + NL + "     */" + NL + "    public ";
51
  protected final String TEXT_34 = "("; //$NON-NLS-1$
51
  protected final String TEXT_34 = " ";
52
  protected final String TEXT_35 = ") {" + NL + "        // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
52
  protected final String TEXT_35 = "(";
53
  protected final String TEXT_36 = NL + "\t\t\treturn "; //$NON-NLS-1$
53
  protected final String TEXT_36 = ") {" + NL + "        // TODO Auto-generated method stub";
54
  protected final String TEXT_37 = ";"; //$NON-NLS-1$
54
  protected final String TEXT_37 = NL + "\t\t\treturn ";
55
  protected final String TEXT_38 = NL + "    }"; //$NON-NLS-1$
55
  protected final String TEXT_38 = ";";
56
  protected final String TEXT_39 = NL + "\t" + NL + "}"; //$NON-NLS-1$ //$NON-NLS-2$
56
  protected final String TEXT_39 = NL + "    }";
57
  protected final String TEXT_40 = NL;
57
  protected final String TEXT_40 = NL + "\t" + NL + "}";
58
  protected final String TEXT_41 = NL;
58
59
59
  public String generate(Object argument)
60
  public String generate(Object argument)
60
  {
61
  {
Lines 96-127 Link Here
96
	}
97
	}
97
98
98
    stringBuffer.append(TEXT_11);
99
    stringBuffer.append(TEXT_11);
100
     
101
	if ("3.0".equals(model.getJavaEEVersion())) { 
102
103
    stringBuffer.append(TEXT_12);
104
    
105
}
106
99
    
107
    
100
	if (model.isPublic()) { 
108
	if (model.isPublic()) { 
101
109
102
    stringBuffer.append(TEXT_12);
110
    stringBuffer.append(TEXT_13);
103
     
111
     
104
	} 
112
	} 
105
113
106
	if (model.isAbstract()) { 
114
	if (model.isAbstract()) { 
107
115
108
    stringBuffer.append(TEXT_13);
116
    stringBuffer.append(TEXT_14);
109
    
117
    
110
	}
118
	}
111
119
112
	if (model.isFinal()) {
120
	if (model.isFinal()) {
113
121
114
    stringBuffer.append(TEXT_14);
122
    stringBuffer.append(TEXT_15);
115
    
123
    
116
	}
124
	}
117
125
118
    stringBuffer.append(TEXT_15);
126
    stringBuffer.append(TEXT_16);
119
    stringBuffer.append( model.getClassName() );
127
    stringBuffer.append( model.getClassName() );
120
    
128
    
121
	String superClass = model.getSuperclassName();
129
	String superClass = model.getSuperclassName();
122
 	if (superClass != null && superClass.length() > 0) {
130
 	if (superClass != null && superClass.length() > 0) {
123
131
124
    stringBuffer.append(TEXT_16);
132
    stringBuffer.append(TEXT_17);
125
    stringBuffer.append( superClass );
133
    stringBuffer.append( superClass );
126
    
134
    
127
	}
135
	}
Lines 129-135 Link Here
129
	List<String> interfaces = model.getInterfaces(); 
137
	List<String> interfaces = model.getInterfaces(); 
130
 	if ( interfaces.size() > 0) { 
138
 	if ( interfaces.size() > 0) { 
131
139
132
    stringBuffer.append(TEXT_17);
140
    stringBuffer.append(TEXT_18);
133
    
141
    
134
	}
142
	}
135
	
143
	
Lines 137-143 Link Here
137
   		String INTERFACE = interfaces.get(i);
145
   		String INTERFACE = interfaces.get(i);
138
   		if (i > 0) {
146
   		if (i > 0) {
139
147
140
    stringBuffer.append(TEXT_18);
148
    stringBuffer.append(TEXT_19);
141
    
149
    
142
		}
150
		}
143
151
Lines 145-157 Link Here
145
    
153
    
146
	}
154
	}
147
155
148
    stringBuffer.append(TEXT_19);
156
    stringBuffer.append(TEXT_20);
149
     
157
     
150
	if (!model.hasEmptySuperclassConstructor()) { 
158
	if (!model.hasEmptySuperclassConstructor()) { 
151
159
152
    stringBuffer.append(TEXT_20);
153
    stringBuffer.append( model.getClassName() );
154
    stringBuffer.append(TEXT_21);
160
    stringBuffer.append(TEXT_21);
161
    stringBuffer.append( model.getClassName() );
162
    stringBuffer.append(TEXT_22);
155
     
163
     
156
	} 
164
	} 
157
165
Lines 160-178 Link Here
160
		for (Constructor constructor : constructors) {
168
		for (Constructor constructor : constructors) {
161
			if (constructor.isPublic() || constructor.isProtected()) { 
169
			if (constructor.isPublic() || constructor.isProtected()) { 
162
170
163
    stringBuffer.append(TEXT_22);
164
    stringBuffer.append( model.getSuperclassName() );
165
    stringBuffer.append(TEXT_23);
171
    stringBuffer.append(TEXT_23);
166
    stringBuffer.append( model.getSuperclassName() );
172
    stringBuffer.append( model.getSuperclassName() );
167
    stringBuffer.append(TEXT_24);
173
    stringBuffer.append(TEXT_24);
168
    stringBuffer.append( constructor.getParamsForJavadoc() );
174
    stringBuffer.append( model.getSuperclassName() );
169
    stringBuffer.append(TEXT_25);
175
    stringBuffer.append(TEXT_25);
170
    stringBuffer.append( model.getClassName() );
176
    stringBuffer.append( constructor.getParamsForJavadoc() );
171
    stringBuffer.append(TEXT_26);
177
    stringBuffer.append(TEXT_26);
172
    stringBuffer.append( constructor.getParamsForDeclaration() );
178
    stringBuffer.append( model.getClassName() );
173
    stringBuffer.append(TEXT_27);
179
    stringBuffer.append(TEXT_27);
174
    stringBuffer.append( constructor.getParamsForCall() );
180
    stringBuffer.append( constructor.getParamsForDeclaration() );
175
    stringBuffer.append(TEXT_28);
181
    stringBuffer.append(TEXT_28);
182
    stringBuffer.append( constructor.getParamsForCall() );
183
    stringBuffer.append(TEXT_29);
176
    
184
    
177
			} 
185
			} 
178
		} 
186
		} 
Lines 182-217 Link Here
182
	if (model.shouldImplementAbstractMethods()) {
190
	if (model.shouldImplementAbstractMethods()) {
183
		for (Method method : model.getUnimplementedMethods()) { 
191
		for (Method method : model.getUnimplementedMethods()) { 
184
192
185
    stringBuffer.append(TEXT_29);
186
    stringBuffer.append( method.getContainingJavaClass() );
187
    stringBuffer.append(TEXT_30);
193
    stringBuffer.append(TEXT_30);
188
    stringBuffer.append( method.getName() );
194
    stringBuffer.append( method.getContainingJavaClass() );
189
    stringBuffer.append(TEXT_31);
195
    stringBuffer.append(TEXT_31);
190
    stringBuffer.append( method.getParamsForJavadoc() );
196
    stringBuffer.append( method.getName() );
191
    stringBuffer.append(TEXT_32);
197
    stringBuffer.append(TEXT_32);
192
    stringBuffer.append( method.getReturnType() );
198
    stringBuffer.append( method.getParamsForJavadoc() );
193
    stringBuffer.append(TEXT_33);
199
    stringBuffer.append(TEXT_33);
194
    stringBuffer.append( method.getName() );
200
    stringBuffer.append( method.getReturnType() );
195
    stringBuffer.append(TEXT_34);
201
    stringBuffer.append(TEXT_34);
196
    stringBuffer.append( method.getParamsForDeclaration() );
202
    stringBuffer.append( method.getName() );
197
    stringBuffer.append(TEXT_35);
203
    stringBuffer.append(TEXT_35);
204
    stringBuffer.append( method.getParamsForDeclaration() );
205
    stringBuffer.append(TEXT_36);
198
     
206
     
199
			String defaultReturnValue = method.getDefaultReturnValue();
207
			String defaultReturnValue = method.getDefaultReturnValue();
200
			if (defaultReturnValue != null) { 
208
			if (defaultReturnValue != null) { 
201
209
202
    stringBuffer.append(TEXT_36);
203
    stringBuffer.append( defaultReturnValue );
204
    stringBuffer.append(TEXT_37);
210
    stringBuffer.append(TEXT_37);
211
    stringBuffer.append( defaultReturnValue );
212
    stringBuffer.append(TEXT_38);
205
    
213
    
206
			} 
214
			} 
207
215
208
    stringBuffer.append(TEXT_38);
216
    stringBuffer.append(TEXT_39);
209
     
217
     
210
		}
218
		}
211
	} 
219
	} 
212
220
213
    stringBuffer.append(TEXT_39);
214
    stringBuffer.append(TEXT_40);
221
    stringBuffer.append(TEXT_40);
222
    stringBuffer.append(TEXT_41);
215
    return stringBuffer.toString();
223
    return stringBuffer.toString();
216
  }
224
  }
217
}
225
}
(-)web/org/eclipse/jst/j2ee/internal/web/operations/NewWebClassDataModelProvider.java (-2 / +33 lines)
Lines 19-24 Link Here
19
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
19
import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS;
20
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
20
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DESCRIPTION;
21
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
21
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.DISPLAY_NAME;
22
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.JAVA_EE_VERSION;
23
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.REGISTER_IN_WEB_XML;
22
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
24
import static org.eclipse.jst.j2ee.internal.web.operations.INewWebClassDataModelProperties.USE_EXISTING_CLASS;
23
25
24
import java.io.File;
26
import java.io.File;
Lines 26-31 Link Here
26
import java.util.Set;
28
import java.util.Set;
27
29
28
import org.eclipse.core.resources.IProject;
30
import org.eclipse.core.resources.IProject;
31
import org.eclipse.core.resources.ResourcesPlugin;
32
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.core.runtime.IStatus;
33
import org.eclipse.core.runtime.IStatus;
30
import org.eclipse.jdt.core.Signature;
34
import org.eclipse.jdt.core.Signature;
31
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
35
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
Lines 34-42 Link Here
34
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
38
import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
35
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
39
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
36
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
40
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
41
import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
42
import org.eclipse.wst.common.componentcore.internal.util.FacetedProjectUtilities;
37
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
43
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
38
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
44
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
39
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
45
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
46
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
40
47
41
/**
48
/**
42
 * The NewWebClassDataModelProvider is a subclass of
49
 * The NewWebClassDataModelProvider is a subclass of
Lines 128-138 Link Here
128
	public Set getPropertyNames() {
135
	public Set getPropertyNames() {
129
		// Add web artifact specific properties defined in this data model
136
		// Add web artifact specific properties defined in this data model
130
		Set propertyNames = super.getPropertyNames();
137
		Set propertyNames = super.getPropertyNames();
131
		
138
		propertyNames.add(REGISTER_IN_WEB_XML);
132
		propertyNames.add(DISPLAY_NAME);
139
		propertyNames.add(DISPLAY_NAME);
133
		propertyNames.add(DESCRIPTION);
140
		propertyNames.add(DESCRIPTION);
134
		propertyNames.add(USE_EXISTING_CLASS);
141
		propertyNames.add(USE_EXISTING_CLASS);
135
		propertyNames.add(USE_ANNOTATIONS);
142
		propertyNames.add(USE_ANNOTATIONS);
143
		propertyNames.add(JAVA_EE_VERSION);
136
		
144
		
137
		return propertyNames;
145
		return propertyNames;
138
	}
146
	}
Lines 161-171 Link Here
161
			return Boolean.FALSE;
169
			return Boolean.FALSE;
162
		else if (propertyName.equals(CONSTRUCTOR))
170
		else if (propertyName.equals(CONSTRUCTOR))
163
			return hasSuperClass();
171
			return hasSuperClass();
164
		
172
		else if (propertyName.equals(REGISTER_IN_WEB_XML)){
173
			return !isJavaEE6Project();
174
		} else if (JAVA_EE_VERSION.equals(propertyName)){
175
			return getJavaEEVersion();
176
		}
165
		// Otherwise check super for default value for property
177
		// Otherwise check super for default value for property
166
		return super.getDefaultProperty(propertyName);
178
		return super.getDefaultProperty(propertyName);
167
	}
179
	}
168
180
181
	@SuppressWarnings("restriction")
182
	public boolean isJavaEE6Project() {
183
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
184
		if (project != null && project.isAccessible()){
185
			try {
186
				return FacetedProjectFramework.hasProjectFacet(project, WebFacetUtils.WEB_FACET.getId(), WebFacetUtils.WEB_30.getVersionString());
187
			} catch (CoreException e) {
188
				e.printStackTrace();
189
			}
190
		}
191
		return false;
192
	}
193
	
194
	@SuppressWarnings("restriction")
195
	public String getJavaEEVersion() {
196
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getStringProperty(PROJECT_NAME));
197
		return FacetedProjectUtilities.getProjectFacetVersion(project, WebFacetUtils.WEB_FACET.getId()).getVersionString();
198
	}
199
169
	/**
200
	/**
170
	 * Subclasses may extend this method to add their own specific behavior when
201
	 * Subclasses may extend this method to add their own specific behavior when
171
	 * a certain property in the data model hierarchy is set. this method does
202
	 * a certain property in the data model hierarchy is set. this method does
(-)web/org/eclipse/jst/j2ee/internal/web/operations/ServletTemplate.java (-103 / +112 lines)
Lines 14-84 Link Here
14
    return result;
14
    return result;
15
  }
15
  }
16
16
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; //$NON-NLS-1$
17
  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "package "; //$NON-NLS-1$
18
  protected final String TEXT_1 = "package ";
19
  protected final String TEXT_2 = ";"; //$NON-NLS-1$
19
  protected final String TEXT_2 = ";";
20
  protected final String TEXT_3 = NL;
20
  protected final String TEXT_3 = NL;
21
  protected final String TEXT_4 = NL + "import "; //$NON-NLS-1$
21
  protected final String TEXT_4 = NL + "import ";
22
  protected final String TEXT_5 = ";"; //$NON-NLS-1$
22
  protected final String TEXT_5 = ";";
23
  protected final String TEXT_6 = NL;
23
  protected final String TEXT_6 = NL;
24
  protected final String TEXT_7 = NL;
24
  protected final String TEXT_7 = NL;
25
  protected final String TEXT_8 = "/**" + NL + " * Servlet implementation class "; //$NON-NLS-1$ //$NON-NLS-2$
25
  protected final String TEXT_8 = "/**" + NL + " * Servlet implementation class ";
26
  protected final String TEXT_9 = NL + " *" + NL + " * @web.servlet" + NL + " *   name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
26
  protected final String TEXT_9 = NL + " *" + NL + " * @web.servlet" + NL + " *   name=\"";
27
  protected final String TEXT_10 = "\"" + NL + " *   display-name=\""; //$NON-NLS-1$ //$NON-NLS-2$
27
  protected final String TEXT_10 = "\"" + NL + " *   display-name=\"";
28
  protected final String TEXT_11 = "\""; //$NON-NLS-1$
28
  protected final String TEXT_11 = "\"";
29
  protected final String TEXT_12 = NL + " *   description=\""; //$NON-NLS-1$
29
  protected final String TEXT_12 = NL + " *   description=\"";
30
  protected final String TEXT_13 = "\""; //$NON-NLS-1$
30
  protected final String TEXT_13 = "\"";
31
  protected final String TEXT_14 = NL + " *" + NL + " * @web.servlet-mapping" + NL + " *   url-pattern=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
31
  protected final String TEXT_14 = NL + " *" + NL + " * @web.servlet-mapping" + NL + " *   url-pattern=\"";
32
  protected final String TEXT_15 = "\""; //$NON-NLS-1$
32
  protected final String TEXT_15 = "\"";
33
  protected final String TEXT_16 = NL + " *" + NL + " * @web.servlet-init-param" + NL + " *    name=\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
33
  protected final String TEXT_16 = NL + " *" + NL + " * @web.servlet-init-param" + NL + " *    name=\"";
34
  protected final String TEXT_17 = "\"" + NL + " *    value=\""; //$NON-NLS-1$ //$NON-NLS-2$
34
  protected final String TEXT_17 = "\"" + NL + " *    value=\"";
35
  protected final String TEXT_18 = "\""; //$NON-NLS-1$
35
  protected final String TEXT_18 = "\"";
36
  protected final String TEXT_19 = NL + " *    description=\""; //$NON-NLS-1$
36
  protected final String TEXT_19 = NL + " *    description=\"";
37
  protected final String TEXT_20 = "\""; //$NON-NLS-1$
37
  protected final String TEXT_20 = "\"";
38
  protected final String TEXT_21 = NL + " */"; //$NON-NLS-1$
38
  protected final String TEXT_21 = NL + " */";
39
  protected final String TEXT_22 = NL + "public "; //$NON-NLS-1$
39
  protected final String TEXT_22 = NL + "@WebServlet";
40
  protected final String TEXT_23 = "abstract "; //$NON-NLS-1$
40
  protected final String TEXT_23 = NL + "public ";
41
  protected final String TEXT_24 = "final "; //$NON-NLS-1$
41
  protected final String TEXT_24 = "abstract ";
42
  protected final String TEXT_25 = "class "; //$NON-NLS-1$
42
  protected final String TEXT_25 = "final ";
43
  protected final String TEXT_26 = " extends "; //$NON-NLS-1$
43
  protected final String TEXT_26 = "class ";
44
  protected final String TEXT_27 = " implements "; //$NON-NLS-1$
44
  protected final String TEXT_27 = " extends ";
45
  protected final String TEXT_28 = ", "; //$NON-NLS-1$
45
  protected final String TEXT_28 = " implements ";
46
  protected final String TEXT_29 = " {"; //$NON-NLS-1$
46
  protected final String TEXT_29 = ", ";
47
  protected final String TEXT_30 = NL + "\tprivate static final long serialVersionUID = 1L;"; //$NON-NLS-1$
47
  protected final String TEXT_30 = " {";
48
  protected final String TEXT_31 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
48
  protected final String TEXT_31 = NL + "\tprivate static final long serialVersionUID = 1L;";
49
  protected final String TEXT_32 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
49
  protected final String TEXT_32 = NL + NL + "    /**" + NL + "     * Default constructor. " + NL + "     */" + NL + "    public ";
50
  protected final String TEXT_33 = NL + "       " + NL + "    /**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
50
  protected final String TEXT_33 = "() {" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
51
  protected final String TEXT_34 = "#"; //$NON-NLS-1$
51
  protected final String TEXT_34 = NL + "       " + NL + "    /**" + NL + "     * @see ";
52
  protected final String TEXT_35 = "("; //$NON-NLS-1$
52
  protected final String TEXT_35 = "#";
53
  protected final String TEXT_36 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
53
  protected final String TEXT_36 = "(";
54
  protected final String TEXT_37 = "("; //$NON-NLS-1$
54
  protected final String TEXT_37 = ")" + NL + "     */" + NL + "    public ";
55
  protected final String TEXT_38 = ") {" + NL + "        super("; //$NON-NLS-1$ //$NON-NLS-2$
55
  protected final String TEXT_38 = "(";
56
  protected final String TEXT_39 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
56
  protected final String TEXT_39 = ") {" + NL + "        super(";
57
  protected final String TEXT_40 = NL + NL + "\t/**" + NL + "     * @see "; //$NON-NLS-1$ //$NON-NLS-2$
57
  protected final String TEXT_40 = ");" + NL + "        // TODO Auto-generated constructor stub" + NL + "    }";
58
  protected final String TEXT_41 = "#"; //$NON-NLS-1$
58
  protected final String TEXT_41 = NL + NL + "\t/**" + NL + "     * @see ";
59
  protected final String TEXT_42 = "("; //$NON-NLS-1$
59
  protected final String TEXT_42 = "#";
60
  protected final String TEXT_43 = ")" + NL + "     */" + NL + "    public "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
60
  protected final String TEXT_43 = "(";
61
  protected final String TEXT_44 = " "; //$NON-NLS-1$
61
  protected final String TEXT_44 = ")" + NL + "     */" + NL + "    public ";
62
  protected final String TEXT_45 = "("; //$NON-NLS-1$
62
  protected final String TEXT_45 = " ";
63
  protected final String TEXT_46 = ") {" + NL + "        // TODO Auto-generated method stub"; //$NON-NLS-1$ //$NON-NLS-2$
63
  protected final String TEXT_46 = "(";
64
  protected final String TEXT_47 = NL + "\t\t\treturn "; //$NON-NLS-1$
64
  protected final String TEXT_47 = ") {" + NL + "        // TODO Auto-generated method stub";
65
  protected final String TEXT_48 = ";"; //$NON-NLS-1$
65
  protected final String TEXT_48 = NL + "\t\t\treturn ";
66
  protected final String TEXT_49 = NL + "    }"; //$NON-NLS-1$
66
  protected final String TEXT_49 = ";";
67
  protected final String TEXT_50 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
67
  protected final String TEXT_50 = NL + "    }";
68
  protected final String TEXT_51 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
68
  protected final String TEXT_51 = NL + NL + "\t/**" + NL + "\t * @see Servlet#init(ServletConfig)" + NL + "\t */" + NL + "\tpublic void init(ServletConfig config) throws ServletException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
69
  protected final String TEXT_52 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
69
  protected final String TEXT_52 = NL + NL + "\t/**" + NL + "\t * @see Servlet#destroy()" + NL + "\t */" + NL + "\tpublic void destroy() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
70
  protected final String TEXT_53 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
70
  protected final String TEXT_53 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletConfig()" + NL + "\t */" + NL + "\tpublic ServletConfig getServletConfig() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null;" + NL + "\t}";
71
  protected final String TEXT_54 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
71
  protected final String TEXT_54 = NL + NL + "\t/**" + NL + "\t * @see Servlet#getServletInfo()" + NL + "\t */" + NL + "\tpublic String getServletInfo() {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t\treturn null; " + NL + "\t}";
72
  protected final String TEXT_55 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
72
  protected final String TEXT_55 = NL + NL + "\t/**" + NL + "\t * @see Servlet#service(ServletRequest request, ServletResponse response)" + NL + "\t */" + NL + "\tpublic void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
73
  protected final String TEXT_56 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
73
  protected final String TEXT_56 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
74
  protected final String TEXT_57 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
74
  protected final String TEXT_57 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
75
  protected final String TEXT_58 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
75
  protected final String TEXT_58 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)" + NL + "\t */" + NL + "\tprotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
76
  protected final String TEXT_59 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
76
  protected final String TEXT_59 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doPut(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
77
  protected final String TEXT_60 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
77
  protected final String TEXT_60 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doDelete(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
78
  protected final String TEXT_61 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
78
  protected final String TEXT_61 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
79
  protected final String TEXT_62 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
79
  protected final String TEXT_62 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doOptions(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
80
  protected final String TEXT_63 = NL + NL + "}"; //$NON-NLS-1$
80
  protected final String TEXT_63 = NL + NL + "\t/**" + NL + "\t * @see HttpServlet#doTrace(HttpServletRequest, HttpServletResponse)" + NL + "\t */" + NL + "\tprotected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {" + NL + "\t\t// TODO Auto-generated method stub" + NL + "\t}";
81
  protected final String TEXT_64 = NL;
81
  protected final String TEXT_64 = NL + NL + "}";
82
  protected final String TEXT_65 = NL;
82
83
83
  public String generate(Object argument)
84
  public String generate(Object argument)
84
  {
85
  {
Lines 163-194 Link Here
163
	} 
164
	} 
164
165
165
    stringBuffer.append(TEXT_21);
166
    stringBuffer.append(TEXT_21);
167
     
168
	if ("3.0".equals(model.getJavaEEVersion())) { 
169
170
    stringBuffer.append(TEXT_22);
171
    stringBuffer.append(model.getJavaEE6AnnotationParameters());
172
    
173
}
174
166
    
175
    
167
	if (model.isPublic()) { 
176
	if (model.isPublic()) { 
168
177
169
    stringBuffer.append(TEXT_22);
178
    stringBuffer.append(TEXT_23);
170
     
179
     
171
	} 
180
	} 
172
181
173
	if (model.isAbstract()) { 
182
	if (model.isAbstract()) { 
174
183
175
    stringBuffer.append(TEXT_23);
184
    stringBuffer.append(TEXT_24);
176
    
185
    
177
	}
186
	}
178
187
179
	if (model.isFinal()) {
188
	if (model.isFinal()) {
180
189
181
    stringBuffer.append(TEXT_24);
190
    stringBuffer.append(TEXT_25);
182
    
191
    
183
	}
192
	}
184
193
185
    stringBuffer.append(TEXT_25);
194
    stringBuffer.append(TEXT_26);
186
    stringBuffer.append( model.getClassName() );
195
    stringBuffer.append( model.getClassName() );
187
    
196
    
188
	String superClass = model.getSuperclassName();
197
	String superClass = model.getSuperclassName();
189
 	if (superClass != null && superClass.length() > 0) {
198
 	if (superClass != null && superClass.length() > 0) {
190
199
191
    stringBuffer.append(TEXT_26);
200
    stringBuffer.append(TEXT_27);
192
    stringBuffer.append( superClass );
201
    stringBuffer.append( superClass );
193
    
202
    
194
	}
203
	}
Lines 196-202 Link Here
196
	List<String> interfaces = model.getInterfaces(); 
205
	List<String> interfaces = model.getInterfaces(); 
197
 	if ( interfaces.size() > 0) { 
206
 	if ( interfaces.size() > 0) { 
198
207
199
    stringBuffer.append(TEXT_27);
208
    stringBuffer.append(TEXT_28);
200
    
209
    
201
	}
210
	}
202
	
211
	
Lines 204-210 Link Here
204
   		String INTERFACE = interfaces.get(i);
213
   		String INTERFACE = interfaces.get(i);
205
   		if (i > 0) {
214
   		if (i > 0) {
206
215
207
    stringBuffer.append(TEXT_28);
216
    stringBuffer.append(TEXT_29);
208
    
217
    
209
		}
218
		}
210
219
Lines 212-231 Link Here
212
    
221
    
213
	}
222
	}
214
223
215
    stringBuffer.append(TEXT_29);
224
    stringBuffer.append(TEXT_30);
216
     
225
     
217
	if (model.isGenericServletSuperclass()) { 
226
	if (model.isGenericServletSuperclass()) { 
218
227
219
    stringBuffer.append(TEXT_30);
228
    stringBuffer.append(TEXT_31);
220
     
229
     
221
	} 
230
	} 
222
231
223
     
232
     
224
	if (!model.hasEmptySuperclassConstructor()) { 
233
	if (!model.hasEmptySuperclassConstructor()) { 
225
234
226
    stringBuffer.append(TEXT_31);
227
    stringBuffer.append( model.getClassName() );
228
    stringBuffer.append(TEXT_32);
235
    stringBuffer.append(TEXT_32);
236
    stringBuffer.append( model.getClassName() );
237
    stringBuffer.append(TEXT_33);
229
     
238
     
230
	} 
239
	} 
231
240
Lines 234-252 Link Here
234
		for (Constructor constructor : constructors) {
243
		for (Constructor constructor : constructors) {
235
			if (constructor.isPublic() || constructor.isProtected()) { 
244
			if (constructor.isPublic() || constructor.isProtected()) { 
236
245
237
    stringBuffer.append(TEXT_33);
238
    stringBuffer.append( model.getSuperclassName() );
239
    stringBuffer.append(TEXT_34);
246
    stringBuffer.append(TEXT_34);
240
    stringBuffer.append( model.getSuperclassName() );
247
    stringBuffer.append( model.getSuperclassName() );
241
    stringBuffer.append(TEXT_35);
248
    stringBuffer.append(TEXT_35);
242
    stringBuffer.append( constructor.getParamsForJavadoc() );
249
    stringBuffer.append( model.getSuperclassName() );
243
    stringBuffer.append(TEXT_36);
250
    stringBuffer.append(TEXT_36);
244
    stringBuffer.append( model.getClassName() );
251
    stringBuffer.append( constructor.getParamsForJavadoc() );
245
    stringBuffer.append(TEXT_37);
252
    stringBuffer.append(TEXT_37);
246
    stringBuffer.append( constructor.getParamsForDeclaration() );
253
    stringBuffer.append( model.getClassName() );
247
    stringBuffer.append(TEXT_38);
254
    stringBuffer.append(TEXT_38);
248
    stringBuffer.append( constructor.getParamsForCall() );
255
    stringBuffer.append( constructor.getParamsForDeclaration() );
249
    stringBuffer.append(TEXT_39);
256
    stringBuffer.append(TEXT_39);
257
    stringBuffer.append( constructor.getParamsForCall() );
258
    stringBuffer.append(TEXT_40);
250
    
259
    
251
			} 
260
			} 
252
		} 
261
		} 
Lines 256-330 Link Here
256
	if (model.shouldImplementAbstractMethods()) {
265
	if (model.shouldImplementAbstractMethods()) {
257
		for (Method method : model.getUnimplementedMethods()) { 
266
		for (Method method : model.getUnimplementedMethods()) { 
258
267
259
    stringBuffer.append(TEXT_40);
260
    stringBuffer.append( method.getContainingJavaClass() );
261
    stringBuffer.append(TEXT_41);
268
    stringBuffer.append(TEXT_41);
262
    stringBuffer.append( method.getName() );
269
    stringBuffer.append( method.getContainingJavaClass() );
263
    stringBuffer.append(TEXT_42);
270
    stringBuffer.append(TEXT_42);
264
    stringBuffer.append( method.getParamsForJavadoc() );
271
    stringBuffer.append( method.getName() );
265
    stringBuffer.append(TEXT_43);
272
    stringBuffer.append(TEXT_43);
266
    stringBuffer.append( method.getReturnType() );
273
    stringBuffer.append( method.getParamsForJavadoc() );
267
    stringBuffer.append(TEXT_44);
274
    stringBuffer.append(TEXT_44);
268
    stringBuffer.append( method.getName() );
275
    stringBuffer.append( method.getReturnType() );
269
    stringBuffer.append(TEXT_45);
276
    stringBuffer.append(TEXT_45);
270
    stringBuffer.append( method.getParamsForDeclaration() );
277
    stringBuffer.append( method.getName() );
271
    stringBuffer.append(TEXT_46);
278
    stringBuffer.append(TEXT_46);
279
    stringBuffer.append( method.getParamsForDeclaration() );
280
    stringBuffer.append(TEXT_47);
272
     
281
     
273
			String defaultReturnValue = method.getDefaultReturnValue();
282
			String defaultReturnValue = method.getDefaultReturnValue();
274
			if (defaultReturnValue != null) { 
283
			if (defaultReturnValue != null) { 
275
284
276
    stringBuffer.append(TEXT_47);
277
    stringBuffer.append( defaultReturnValue );
278
    stringBuffer.append(TEXT_48);
285
    stringBuffer.append(TEXT_48);
286
    stringBuffer.append( defaultReturnValue );
287
    stringBuffer.append(TEXT_49);
279
    
288
    
280
			} 
289
			} 
281
290
282
    stringBuffer.append(TEXT_49);
291
    stringBuffer.append(TEXT_50);
283
     
292
     
284
		}
293
		}
285
	} 
294
	} 
286
295
287
     if (model.shouldGenInit()) { 
296
     if (model.shouldGenInit()) { 
288
    stringBuffer.append(TEXT_50);
289
     } 
290
     if (model.shouldGenDestroy()) { 
291
    stringBuffer.append(TEXT_51);
297
    stringBuffer.append(TEXT_51);
292
     } 
298
     } 
293
     if (model.shouldGenGetServletConfig()) { 
299
     if (model.shouldGenDestroy()) { 
294
    stringBuffer.append(TEXT_52);
300
    stringBuffer.append(TEXT_52);
295
     } 
301
     } 
296
     if (model.shouldGenGetServletInfo()) { 
302
     if (model.shouldGenGetServletConfig()) { 
297
    stringBuffer.append(TEXT_53);
303
    stringBuffer.append(TEXT_53);
298
     } 
304
     } 
299
     if (model.shouldGenService() && !model.isHttpServletSuperclass()) { 
305
     if (model.shouldGenGetServletInfo()) { 
300
    stringBuffer.append(TEXT_54);
306
    stringBuffer.append(TEXT_54);
301
     } 
307
     } 
302
     if (model.shouldGenService() && model.isHttpServletSuperclass()) { 
308
     if (model.shouldGenService() && !model.isHttpServletSuperclass()) { 
303
    stringBuffer.append(TEXT_55);
309
    stringBuffer.append(TEXT_55);
304
     } 
310
     } 
305
     if (model.shouldGenDoGet()) { 
311
     if (model.shouldGenService() && model.isHttpServletSuperclass()) { 
306
    stringBuffer.append(TEXT_56);
312
    stringBuffer.append(TEXT_56);
307
     } 
313
     } 
308
     if (model.shouldGenDoPost()) { 
314
     if (model.shouldGenDoGet()) { 
309
    stringBuffer.append(TEXT_57);
315
    stringBuffer.append(TEXT_57);
310
     } 
316
     } 
311
     if (model.shouldGenDoPut()) { 
317
     if (model.shouldGenDoPost()) { 
312
    stringBuffer.append(TEXT_58);
318
    stringBuffer.append(TEXT_58);
313
     } 
319
     } 
314
     if (model.shouldGenDoDelete()) { 
320
     if (model.shouldGenDoPut()) { 
315
    stringBuffer.append(TEXT_59);
321
    stringBuffer.append(TEXT_59);
316
     } 
322
     } 
317
     if (model.shouldGenDoHead()) { 
323
     if (model.shouldGenDoDelete()) { 
318
    stringBuffer.append(TEXT_60);
324
    stringBuffer.append(TEXT_60);
319
     } 
325
     } 
320
     if (model.shouldGenDoOptions()) { 
326
     if (model.shouldGenDoHead()) { 
321
    stringBuffer.append(TEXT_61);
327
    stringBuffer.append(TEXT_61);
322
     } 
328
     } 
323
     if (model.shouldGenDoTrace()) { 
329
     if (model.shouldGenDoOptions()) { 
324
    stringBuffer.append(TEXT_62);
330
    stringBuffer.append(TEXT_62);
325
     } 
331
     } 
332
     if (model.shouldGenDoTrace()) { 
326
    stringBuffer.append(TEXT_63);
333
    stringBuffer.append(TEXT_63);
334
     } 
327
    stringBuffer.append(TEXT_64);
335
    stringBuffer.append(TEXT_64);
336
    stringBuffer.append(TEXT_65);
328
    return stringBuffer.toString();
337
    return stringBuffer.toString();
329
  }
338
  }
330
}
339
}
(-)web/org/eclipse/jst/j2ee/web/IServletConstants.java (+6 lines)
Lines 18-23 Link Here
18
	public static final String QUALIFIED_GENERIC_SERVLET = "javax.servlet.GenericServlet"; //$NON-NLS-1$
18
	public static final String QUALIFIED_GENERIC_SERVLET = "javax.servlet.GenericServlet"; //$NON-NLS-1$
19
	public static final String QUALIFIED_HTTP_SERVLET = "javax.servlet.http.HttpServlet"; //$NON-NLS-1$
19
	public static final String QUALIFIED_HTTP_SERVLET = "javax.servlet.http.HttpServlet"; //$NON-NLS-1$
20
	
20
	
21
	public static final String QUALIFIED_WEB_SERVLET = "javax.servlet.annotation.WebServlet"; //$NON-NLS-1$
22
	public static final String QUALIFIED_WEB_LISTENER = "javax.servlet.annotation.WebListener"; //$NON-NLS-1$
23
	public static final String QUALIFIED_WEB_FILTER = "javax.servlet.annotation.WebFilter"; //$NON-NLS-1$
24
	public static final String QUALIFIED_ANNOTATION_INIT_PARAM = "javax.servlet.annotation.WebInitParam"; //$NON-NLS-1$
25
	
26
	
21
	public static final String QUALIFIED_SERVLET_EXCEPTION = "javax.servlet.ServletException"; //$NON-NLS-1$
27
	public static final String QUALIFIED_SERVLET_EXCEPTION = "javax.servlet.ServletException"; //$NON-NLS-1$
22
	public static final String QUALIFIED_SERVLET_CONFIG = "javax.servlet.ServletConfig"; //$NON-NLS-1$
28
	public static final String QUALIFIED_SERVLET_CONFIG = "javax.servlet.ServletConfig"; //$NON-NLS-1$
23
	public static final String QUALIFIED_SERVLET_REQUEST = "javax.servlet.ServletRequest"; //$NON-NLS-1$
29
	public static final String QUALIFIED_SERVLET_REQUEST = "javax.servlet.ServletRequest"; //$NON-NLS-1$

Return to bug 252618