本文整理汇总了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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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));
}
}