当前位置: 首页>>代码示例>>Java>>正文


Java CodeGeneration.getFileComment方法代码示例

本文整理汇总了Java中org.eclipse.jdt.ui.CodeGeneration.getFileComment方法的典型用法代码示例。如果您正苦于以下问题:Java CodeGeneration.getFileComment方法的具体用法?Java CodeGeneration.getFileComment怎么用?Java CodeGeneration.getFileComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.ui.CodeGeneration的用法示例。


在下文中一共展示了CodeGeneration.getFileComment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSourceForNewCu

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
private String createSourceForNewCu(final ICompilationUnit unit, final IProgressMonitor monitor) throws CoreException {
	Assert.isNotNull(unit);
	Assert.isNotNull(monitor);
	try {
		monitor.beginTask("", 2); //$NON-NLS-1$
		final String separator= StubUtility.getLineDelimiterUsed(fType.getJavaProject());
		final String block= getAlignedSourceBlock(unit, fNewSourceOfInputType);
		String fileComment= null;
		if (StubUtility.doAddComments(unit.getJavaProject()))
			fileComment= CodeGeneration.getFileComment(unit, separator);
		String content= CodeGeneration.getCompilationUnitContent(unit, fileComment, null, block, separator);
		if (content == null) {
			final StringBuffer buffer= new StringBuffer();
			if (!fType.getPackageFragment().isDefaultPackage()) {
				buffer.append("package ").append(fType.getPackageFragment().getElementName()).append(';'); //$NON-NLS-1$
			}
			buffer.append(separator).append(separator);
			buffer.append(block);
			content= buffer.toString();
		}
		unit.getBuffer().setContents(content);
		addImportsToTargetUnit(unit, new SubProgressMonitor(monitor, 1));
	} finally {
		monitor.done();
	}
	return unit.getSource();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:MoveInnerToTopRefactoring.java

示例2: getFileComment

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
protected String getFileComment(ICompilationUnit parentCU, String lineDelimiter) throws CoreException {
	if (StubUtility.doAddComments(parentCU.getJavaProject())) {
		return CodeGeneration.getFileComment(parentCU, lineDelimiter);
	}
	return null;

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ParameterObjectFactory.java

示例3: getUnformattedSource

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
private String getUnformattedSource(IProgressMonitor pm) throws CoreException {
	ICompilationUnit newCu= null;
	try {
		newCu= fAccessorPackage.getCompilationUnit(fAccessorPath.lastSegment()).getWorkingCopy(null);

		String typeComment= null, fileComment= null;
		final IJavaProject project= newCu.getJavaProject();
		final String lineDelim= StubUtility.getLineDelimiterUsed(project);
		if (StubUtility.doAddComments(project)) {
			typeComment= CodeGeneration.getTypeComment(newCu, fAccessorClassName, lineDelim);
			fileComment= CodeGeneration.getFileComment(newCu, lineDelim);
		}
		String classContent= createClass(lineDelim);
		String cuContent= CodeGeneration.getCompilationUnitContent(newCu, fileComment, typeComment, classContent, lineDelim);
		if (cuContent == null) {
			StringBuffer buf= new StringBuffer();
			if (fileComment != null) {
				buf.append(fileComment).append(lineDelim);
			}
			if (!fAccessorPackage.isDefaultPackage()) {
				buf.append("package ").append(fAccessorPackage.getElementName()).append(';'); //$NON-NLS-1$
			}
			buf.append(lineDelim).append(lineDelim);
			if (typeComment != null) {
				buf.append(typeComment).append(lineDelim);
			}
			buf.append(classContent);
			cuContent= buf.toString();
		}

		newCu.getBuffer().setContents(cuContent);
		addImportsToAccessorCu(newCu, pm);
		return newCu.getSource();
	} finally {
		if (newCu != null) {
			newCu.discardWorkingCopy();
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:AccessorClassCreator.java

示例4: getFileComment

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
private String getFileComment(ICompilationUnit cu) throws CoreException {
  if (addComments) {
    return CodeGeneration.getFileComment(cu, lineDelimiter);
  }
  return null;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:7,代码来源:TypeCreator.java

示例5: getFileComment

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
private String getFileComment(String lineDelimiterUsed) throws CoreException {
	ICompilationUnit cu= fCreatedPackageFragment.getCompilationUnit(PACKAGE_INFO_JAVA_FILENAME);
	return CodeGeneration.getFileComment(cu, lineDelimiterUsed);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:NewPackageWizardPage.java

示例6: getFileComment

import org.eclipse.jdt.ui.CodeGeneration; //导入方法依赖的package包/类
/**
 * Hook method that gets called from <code>createType</code> to retrieve
 * a file comment. This default implementation returns the content of the
 * 'file comment' template or <code>null</code> if no comment should be created.
 *
 * @param parentCU the parent compilation unit
 * @param lineDelimiter the line delimiter to use
 * @return the file comment or <code>null</code> if a file comment
 * is not desired
 * @throws CoreException when fetching the file comment fails
    *
    * @since 3.1
 */
protected String getFileComment(ICompilationUnit parentCU, String lineDelimiter) throws CoreException {
	if (isAddComments()) {
		return CodeGeneration.getFileComment(parentCU, lineDelimiter);
	}
	return null;

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:NewTypeWizardPage.java


注:本文中的org.eclipse.jdt.ui.CodeGeneration.getFileComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。