本文整理汇总了Java中org.eclipse.jdt.ui.CodeGeneration.INTERFACE_BODY_TEMPLATE_ID属性的典型用法代码示例。如果您正苦于以下问题:Java CodeGeneration.INTERFACE_BODY_TEMPLATE_ID属性的具体用法?Java CodeGeneration.INTERFACE_BODY_TEMPLATE_ID怎么用?Java CodeGeneration.INTERFACE_BODY_TEMPLATE_ID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.ui.CodeGeneration
的用法示例。
在下文中一共展示了CodeGeneration.INTERFACE_BODY_TEMPLATE_ID属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTypeStub
private String createTypeStub(ICompilationUnit cu, ImportRewrite imports) throws CoreException {
StringBuffer buffer = new StringBuffer();
// Default modifiers is just: public
buffer.append("public ");
String type = "";
String templateID = "";
switch (elementType) {
case CLASS:
type = "class ";
templateID = CodeGeneration.CLASS_BODY_TEMPLATE_ID;
break;
case INTERFACE:
type = "interface ";
templateID = CodeGeneration.INTERFACE_BODY_TEMPLATE_ID;
break;
}
buffer.append(type);
buffer.append(simpleTypeName);
addInterfaces(buffer, imports);
buffer.append(" {").append(lineDelimiter);
// Generate the type body according to the template in preferences
String typeBody = CodeGeneration.getTypeBody(templateID, cu, simpleTypeName, lineDelimiter);
if (typeBody != null) {
buffer.append(typeBody);
} else {
buffer.append(lineDelimiter);
}
buffer.append('}').append(lineDelimiter);
return buffer.toString();
}
示例2: constructTypeStub
private String constructTypeStub(ICompilationUnit parentCU, ImportsManager imports, String lineDelimiter) throws CoreException {
StringBuffer buf= new StringBuffer();
int modifiers= getModifiers();
buf.append(Flags.toString(modifiers));
if (modifiers != 0) {
buf.append(' ');
}
String type= ""; //$NON-NLS-1$
String templateID= ""; //$NON-NLS-1$
switch (fTypeKind) {
case CLASS_TYPE:
type= "class "; //$NON-NLS-1$
templateID= CodeGeneration.CLASS_BODY_TEMPLATE_ID;
break;
case INTERFACE_TYPE:
type= "interface "; //$NON-NLS-1$
templateID= CodeGeneration.INTERFACE_BODY_TEMPLATE_ID;
break;
case ENUM_TYPE:
type= "enum "; //$NON-NLS-1$
templateID= CodeGeneration.ENUM_BODY_TEMPLATE_ID;
break;
case ANNOTATION_TYPE:
type= "@interface "; //$NON-NLS-1$
templateID= CodeGeneration.ANNOTATION_BODY_TEMPLATE_ID;
break;
}
buf.append(type);
buf.append(getTypeName());
writeSuperClass(buf, imports);
writeSuperInterfaces(buf, imports);
buf.append(" {").append(lineDelimiter); //$NON-NLS-1$
String typeBody= CodeGeneration.getTypeBody(templateID, parentCU, getTypeName(), lineDelimiter);
if (typeBody != null) {
buf.append(typeBody);
} else {
buf.append(lineDelimiter);
}
buf.append('}').append(lineDelimiter);
return buf.toString();
}