本文整理汇总了Java中org.eclipse.jdt.core.IClassFile.getAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java IClassFile.getAdapter方法的具体用法?Java IClassFile.getAdapter怎么用?Java IClassFile.getAdapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IClassFile
的用法示例。
在下文中一共展示了IClassFile.getAdapter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClassFileAnnotationModel
import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
* Creates an annotation model derived from the given class file editor input.
*
* @param classFileEditorInput the editor input from which to query the annotations
* @return the created annotation model
* @exception CoreException if the editor input could not be accessed
*/
protected IAnnotationModel createClassFileAnnotationModel(IClassFileEditorInput classFileEditorInput) throws CoreException {
IResource resource= null;
IClassFile classFile= classFileEditorInput.getClassFile();
IResourceLocator locator= (IResourceLocator) classFile.getAdapter(IResourceLocator.class);
if (locator != null)
resource= locator.getContainingResource(classFile);
if (resource != null) {
ClassFileMarkerAnnotationModel model= new ClassFileMarkerAnnotationModel(resource);
model.setClassFile(classFile);
return model;
}
return null;
}
示例2: getResource
import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
* @see MarkerRulerAction#getResource()
*/
@Override
protected IResource getResource() {
IResource resource= null;
IEditorInput input= getTextEditor().getEditorInput();
if (input instanceof IClassFileEditorInput) {
IClassFile c= ((IClassFileEditorInput) input).getClassFile();
IResourceLocator locator= (IResourceLocator) c.getAdapter(IResourceLocator.class);
if (locator != null) {
try {
resource= locator.getContainingResource(c);
} catch (JavaModelException x) {
// ignore but should inform
}
}
}
return resource;
}
示例3: getResource
import org.eclipse.jdt.core.IClassFile; //导入方法依赖的package包/类
/**
* @see AddMarkerAction#getResource()
*/
@Override
protected IResource getResource() {
IResource resource= null;
IEditorInput input= getTextEditor().getEditorInput();
if (input instanceof IClassFileEditorInput) {
IClassFile c= ((IClassFileEditorInput) input).getClassFile();
IResourceLocator locator= (IResourceLocator) c.getAdapter(IResourceLocator.class);
if (locator != null) {
try {
resource= locator.getContainingResource(c);
} catch (JavaModelException x) {
// ignore but should inform
}
}
}
return resource;
}