本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.UnqualifiedFieldAccess方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.UnqualifiedFieldAccess方法的具體用法?Java IProblem.UnqualifiedFieldAccess怎麽用?Java IProblem.UnqualifiedFieldAccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.compiler.IProblem
的用法示例。
在下文中一共展示了IProblem.UnqualifiedFieldAccess方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addGetterSetterProposal
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
/**
* Used by quick assist
*
* @param context the invocation context
* @param coveringNode the covering node
* @param locations the problems at the corrent location
* @param resultingCollections the resulting proposals
* @return <code>true</code> if the quick assist is applicable at this offset
*/
public static boolean addGetterSetterProposal(
IInvocationContext context,
ASTNode coveringNode,
IProblemLocation[] locations,
ArrayList<ICommandAccess> resultingCollections) {
if (locations != null) {
for (int i = 0; i < locations.length; i++) {
int problemId = locations[i].getProblemId();
if (problemId == IProblem.UnusedPrivateField) return false;
if (problemId == IProblem.UnqualifiedFieldAccess) return false;
}
}
return addGetterSetterProposal(
context, coveringNode, resultingCollections, IProposalRelevance.GETTER_SETTER_QUICK_ASSIST);
}
示例2: canFix
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
/** {@inheritDoc} */
public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) {
if (IProblem.UnqualifiedFieldAccess == problem.getProblemId())
return isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS)
&& isEnabled(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS);
if (CodeStyleFix.isIndirectStaticAccess(problem))
return isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS)
&& isEnabled(
CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS);
if (CodeStyleFix.isNonStaticAccess(problem))
return isEnabled(CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS)
&& isEnabled(
CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS);
return false;
}
示例3: createAddFieldQualifierFix
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static CompilationUnitRewriteOperationsFix createAddFieldQualifierFix(
CompilationUnit compilationUnit, IProblemLocation problem) {
if (IProblem.UnqualifiedFieldAccess != problem.getProblemId()) return null;
AddThisQualifierOperation operation =
getUnqualifiedFieldAccessResolveOperation(compilationUnit, problem);
if (operation == null) return null;
String groupName = operation.getDescription();
return new CodeStyleFix(
groupName, compilationUnit, new CompilationUnitRewriteOperation[] {operation});
}
示例4: createCleanUp
import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static ICleanUpFix createCleanUp(
CompilationUnit compilationUnit,
IProblemLocation[] problems,
boolean addThisQualifier,
boolean changeNonStaticAccessToStatic,
boolean changeIndirectStaticAccessToDirect) {
if (!addThisQualifier && !changeNonStaticAccessToStatic && !changeIndirectStaticAccessToDirect)
return null;
List<CompilationUnitRewriteOperation> operations =
new ArrayList<CompilationUnitRewriteOperation>();
if (addThisQualifier) {
for (int i = 0; i < problems.length; i++) {
IProblemLocation problem = problems[i];
if (problem.getProblemId() == IProblem.UnqualifiedFieldAccess) {
AddThisQualifierOperation operation =
getUnqualifiedFieldAccessResolveOperation(compilationUnit, problem);
if (operation != null) operations.add(operation);
}
}
}
addToStaticAccessOperations(
compilationUnit,
problems,
changeNonStaticAccessToStatic,
changeIndirectStaticAccessToDirect,
operations);
if (operations.isEmpty()) return null;
CompilationUnitRewriteOperation[] operationsArray =
operations.toArray(new CompilationUnitRewriteOperation[operations.size()]);
return new CodeStyleFix(FixMessages.CodeStyleFix_change_name, compilationUnit, operationsArray);
}