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


Java IClassFile.getParent方法代码示例

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


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

示例1: appendClassFileLabel

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * Appends the label for a class file. Considers the CF_* flags.
 *
 * @param classFile the element to render
 * @param flags the rendering flags. Flags with names starting with 'CF_' are considered.
 */
public void appendClassFileLabel(IClassFile classFile, long flags) {
	if (getFlag(flags, JavaElementLabels.CF_QUALIFIED)) {
		IPackageFragment pack= (IPackageFragment) classFile.getParent();
		if (!pack.isDefaultPackage()) {
			appendPackageFragmentLabel(pack, (flags & QUALIFIER_FLAGS));
			fBuilder.append('.');
		}
	}
	fBuilder.append(classFile.getElementName());

	if (getFlag(flags, JavaElementLabels.CF_POST_QUALIFIED)) {
		fBuilder.append(JavaElementLabels.CONCAT_STRING);
		appendPackageFragmentLabel((IPackageFragment) classFile.getParent(), flags & QUALIFIER_FLAGS);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:22,代码来源:JavaElementLabelComposer.java

示例2: appendClassFileLabel

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * Appends the label for a class file. Considers the CF_* flags.
 *
 * @param classFile the element to render
 * @param flags the rendering flags. Flags with names starting with 'CF_' are considered.
 */
public void appendClassFileLabel(IClassFile classFile, long flags) {
  if (getFlag(flags, JavaElementLabels.CF_QUALIFIED)) {
    IPackageFragment pack = (IPackageFragment) classFile.getParent();
    if (!pack.isDefaultPackage()) {
      appendPackageFragmentLabel(pack, (flags & QUALIFIER_FLAGS));
      fBuffer.append('.');
    }
  }
  fBuffer.append(classFile.getElementName());

  if (getFlag(flags, JavaElementLabels.CF_POST_QUALIFIED)) {
    int offset = fBuffer.length();
    fBuffer.append(JavaElementLabels.CONCAT_STRING);
    appendPackageFragmentLabel((IPackageFragment) classFile.getParent(), flags & QUALIFIER_FLAGS);
    if (getFlag(flags, JavaElementLabels.COLORIZE)) {
      fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:JavaElementLabelComposer.java

示例3: appendClassFileLabel

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * Appends the label for a class file. Considers the CF_* flags.
 *
 * @param classFile the element to render
 * @param flags the rendering flags. Flags with names starting with 'CF_' are considered.
 */
public void appendClassFileLabel(IClassFile classFile, long flags) {
	if (getFlag(flags, CF_QUALIFIED)) {
		IPackageFragment pack= (IPackageFragment) classFile.getParent();
		if (!pack.isDefaultPackage()) {
			appendPackageFragmentLabel(pack, (flags & QUALIFIER_FLAGS));
			fBuffer.append('.');
		}
	}
	fBuffer.append(classFile.getElementName());

	if (getFlag(flags, CF_POST_QUALIFIED)) {
		int offset= fBuffer.length();
		fBuffer.append(CONCAT_STRING);
		appendPackageFragmentLabel((IPackageFragment) classFile.getParent(), flags & QUALIFIER_FLAGS);
	}
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:23,代码来源:JavaElementLabelComposer.java

示例4: appendClassFileLabel

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * Appends the label for a class file. Considers the CF_* flags.
 *
 * @param classFile the element to render
 * @param flags the rendering flags. Flags with names starting with 'CF_' are considered.
 */
public void appendClassFileLabel(IClassFile classFile, long flags) {
	if (getFlag(flags, JavaElementLabels.CF_QUALIFIED)) {
		IPackageFragment pack= (IPackageFragment) classFile.getParent();
		if (!pack.isDefaultPackage()) {
			appendPackageFragmentLabel(pack, (flags & QUALIFIER_FLAGS));
			fBuffer.append('.');
		}
	}
	fBuffer.append(classFile.getElementName());

	if (getFlag(flags, JavaElementLabels.CF_POST_QUALIFIED)) {
		int offset= fBuffer.length();
		fBuffer.append(JavaElementLabels.CONCAT_STRING);
		appendPackageFragmentLabel((IPackageFragment) classFile.getParent(), flags & QUALIFIER_FLAGS);
		if (getFlag(flags, JavaElementLabels.COLORIZE)) {
			fBuffer.setStyle(offset, fBuffer.length() - offset, QUALIFIER_STYLE);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:JavaElementLabelComposer.java

示例5: getPackageFragmentRoot

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
private IPackageFragmentRoot getPackageFragmentRoot(IClassFile file) {

		IJavaElement element= file.getParent();
		while (element != null && element.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT)
			element= element.getParent();

		return (IPackageFragmentRoot) element;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:JavaStatusContextViewer.java

示例6: getPackageFragmentRoot

import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
 * Returns the package fragment root of this file.
 *
 * @param file the class file
 * @return the package fragment root of the given class file
 */
private IPackageFragmentRoot getPackageFragmentRoot(IClassFile file) {

	IJavaElement element= file.getParent();
	while (element != null && element.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT)
		element= element.getParent();

	return (IPackageFragmentRoot) element;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:ClassFileEditor.java

示例7: 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


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