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


Java IClassFile.getElementName方法代码示例

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


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

示例1: parse

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * @param newCfSource the source
 * @param originalCf the class file to get the name and project from
 * @param resolveBindings whether bindings are to be resolved
 * @param recovery whether statements and binding recovery should be enabled
 * @param pm an {@link IProgressMonitor}, or <code>null</code>
 * @return the parsed CompilationUnit
 */
public CompilationUnit parse(
    String newCfSource,
    IClassFile originalCf,
    boolean resolveBindings,
    boolean recovery,
    IProgressMonitor pm) {
  fParser.setResolveBindings(resolveBindings);
  fParser.setStatementsRecovery(recovery);
  fParser.setBindingsRecovery(recovery);
  fParser.setSource(newCfSource.toCharArray());
  String cfName = originalCf.getElementName();
  fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX);
  fParser.setProject(originalCf.getJavaProject());
  fParser.setCompilerOptions(getCompilerOptions(originalCf));
  CompilationUnit newCUNode = (CompilationUnit) fParser.createAST(pm);
  return newCUNode;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:RefactoringASTParser.java

示例2: parse

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * @param newCfSource the source
 * @param originalCf the class file to get the name and project from
 * @param resolveBindings whether bindings are to be resolved
 * @param recovery whether statements and binding recovery should be enabled
 * @param pm an {@link IProgressMonitor}, or <code>null</code>
 * @return the parsed CompilationUnit
 */
public CompilationUnit parse(String newCfSource, IClassFile originalCf, boolean resolveBindings, boolean recovery, IProgressMonitor pm) {
	fParser.setResolveBindings(resolveBindings);
	fParser.setStatementsRecovery(recovery);
	fParser.setBindingsRecovery(recovery);
	fParser.setSource(newCfSource.toCharArray());
	String cfName= originalCf.getElementName();
	fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX);
	fParser.setProject(originalCf.getJavaProject());
	fParser.setCompilerOptions(getCompilerOptions(originalCf));
	CompilationUnit newCUNode= (CompilationUnit) fParser.createAST(pm);
	return newCUNode;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:RefactoringASTParser.java

示例3: makeResourceItem

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
private static ResourceItem makeResourceItem(IClassFile file) {
	String resourcePath = file.getPath() + "|" + file.getParent().getElementName().replaceAll("\\.", "/") + "/" + file.getElementName();
	return new ResourceItem(extractName(file.getElementName()), resourcePath, "[class]");
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:5,代码来源:EclipseWorkbench.java

示例4: setupSourceMapper

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
protected void setupSourceMapper(IClassFile classFile) 
{
	try 
	{
		// Search package fragment root and classPath
		IJavaElement packageFragment = classFile.getParent();
		IJavaElement packageFragmentRoot = packageFragment.getParent();

		if (packageFragmentRoot instanceof PackageFragmentRoot)
		{
			// Setup a new source mapper.
			PackageFragmentRoot root = (PackageFragmentRoot)packageFragmentRoot;				
				
			// Location of the archive file containing classes.
			IPath basePath = root.getPath();
			File baseFile = basePath.makeAbsolute().toFile();	
			
			if (!baseFile.exists()) {
				IResource resource = root.getCorrespondingResource();
				basePath = resource.getLocation();
				baseFile = basePath.makeAbsolute().toFile();
			}
			
			// Class path
			String classPath = classFile.getElementName();
			String packageName = packageFragment.getElementName();
			if ((packageName != null) && (packageName.length() > 0))
				classPath = packageName.replace('.', '/') + '/' + classPath;
			
			// Location of the archive file containing source.
			IPath sourcePath = root.getSourceAttachmentPath();
			if (sourcePath == null) sourcePath = basePath;
			
			// Location of the package fragment root within the zip 
			// (empty specifies the default root).
			IPath sourceAttachmentRootPath = root.getSourceAttachmentRootPath();
			String sourceRootPath;
			
			if (sourceAttachmentRootPath == null) {
				sourceRootPath = null;
			} else {
				sourceRootPath = sourceAttachmentRootPath.toString();
				if ((sourceRootPath != null) && (sourceRootPath.length() == 0))
					sourceRootPath = null;
			}
			
			// Options
			Map options = root.getJavaProject().getOptions(true);
			
			root.setSourceMapper(new JDSourceMapper(
				baseFile, sourcePath, sourceRootPath, options));				
		}		
	} 
	catch (CoreException e) 
	{
		JavaDecompilerPlugin.getDefault().getLog().log(new Status(
			Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID, 
			0, e.getMessage(), e));
	}
}
 
开发者ID:java-decompiler,项目名称:jd-eclipse,代码行数:62,代码来源:JDClassFileEditor.java

示例5: parse

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * @param newCfSource
 *            the source
 * @param originalCf
 *            the class file to get the name and project from
 * @param resolveBindings
 *            whether bindings are to be resolved
 * @param recovery
 *            whether statements and binding recovery should be enabled
 * @param pm
 *            an {@link IProgressMonitor}, or <code>null</code>
 * @return the parsed CompilationUnit
 */
public CompilationUnit parse(String newCfSource, IClassFile originalCf, boolean resolveBindings, boolean recovery, IProgressMonitor pm) {
	fParser.setResolveBindings(resolveBindings);
	fParser.setStatementsRecovery(recovery);
	fParser.setBindingsRecovery(recovery);
	fParser.setSource(newCfSource.toCharArray());
	String cfName = originalCf.getElementName();
	fParser.setUnitName(cfName.substring(0, cfName.length() - 6) + JavaModelUtil.DEFAULT_CU_SUFFIX);
	fParser.setProject(originalCf.getJavaProject());
	fParser.setCompilerOptions(getCompilerOptions(originalCf));
	CompilationUnit newCUNode = (CompilationUnit) fParser.createAST(pm);
	return newCUNode;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:26,代码来源:RefactoringASTParser.java


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