本文整理汇总了Java中org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor.getFields方法的典型用法代码示例。如果您正苦于以下问题:Java ExtractClassDescriptor.getFields方法的具体用法?Java ExtractClassDescriptor.getFields怎么用?Java ExtractClassDescriptor.getFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor
的用法示例。
在下文中一共展示了ExtractClassDescriptor.getFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkInitialConditions
import org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
RefactoringStatus result= new RefactoringStatus();
pm.beginTask(RefactoringCoreMessages.ExtractClassRefactoring_progress_msg_check_initial_condition, 5);
try {
result.merge(fDescriptor.validateDescriptor());
if (!result.isOK())
return result;
IType type= fDescriptor.getType();
result.merge(Checks.checkAvailability(type));
if (!result.isOK())
return result;
pm.worked(1);
Field[] fields= ExtractClassDescriptor.getFields(fDescriptor.getType());
pm.worked(1);
if (pm.isCanceled())
throw new OperationCanceledException();
fVariables= new LinkedHashMap<String, FieldInfo>();
if (fields.length == 0) {
result.addFatalError(RefactoringCoreMessages.ExtractClassRefactoring_error_no_usable_fields, JavaStatusContext.create(type));
return result;
}
for (int i= 0; i < fields.length; i++) {
Field field= fields[i];
String fieldName= field.getFieldName();
IField declField= type.getField(fieldName);
ParameterInfo info= new ParameterInfo(Signature.toString(declField.getTypeSignature()), fieldName, i);
fVariables.put(fieldName, new FieldInfo(info, declField));
if (pm.isCanceled())
throw new OperationCanceledException();
}
pm.worked(3);
} finally {
pm.done();
}
return result;
}
示例2: getElements
import org.eclipse.jdt.core.refactoring.descriptors.ExtractClassDescriptor; //导入方法依赖的package包/类
public Object[] getElements(Object inputElement) {
if (inputElement instanceof ExtractClassDescriptor) {
ExtractClassDescriptor descriptor= (ExtractClassDescriptor) inputElement;
return descriptor.getFields();
}
return null;
}