本文整理汇总了Java中org.eclipse.jdt.core.dom.VariableDeclarationStatement.FRAGMENTS_PROPERTY属性的典型用法代码示例。如果您正苦于以下问题:Java VariableDeclarationStatement.FRAGMENTS_PROPERTY属性的具体用法?Java VariableDeclarationStatement.FRAGMENTS_PROPERTY怎么用?Java VariableDeclarationStatement.FRAGMENTS_PROPERTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.dom.VariableDeclarationStatement
的用法示例。
在下文中一共展示了VariableDeclarationStatement.FRAGMENTS_PROPERTY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInlineLocalProposal
private static boolean getInlineLocalProposal(IInvocationContext context, final ASTNode node, Collection<ICommandAccess> proposals) throws CoreException {
if (!(node instanceof SimpleName))
return false;
SimpleName name= (SimpleName) node;
IBinding binding= name.resolveBinding();
if (!(binding instanceof IVariableBinding))
return false;
IVariableBinding varBinding= (IVariableBinding) binding;
if (varBinding.isField() || varBinding.isParameter())
return false;
ASTNode decl= context.getASTRoot().findDeclaringNode(varBinding);
if (!(decl instanceof VariableDeclarationFragment) || decl.getLocationInParent() != VariableDeclarationStatement.FRAGMENTS_PROPERTY)
return false;
if (proposals == null) {
return true;
}
InlineTempRefactoring refactoring= new InlineTempRefactoring((VariableDeclaration) decl);
if (refactoring.checkInitialConditions(new NullProgressMonitor()).isOK()) {
String label= CorrectionMessages.QuickAssistProcessor_inline_local_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
RefactoringCorrectionProposal proposal= new RefactoringCorrectionProposal(label, context.getCompilationUnit(), refactoring, IProposalRelevance.INLINE_LOCAL, image);
proposal.setCommandId(INLINE_LOCAL_ID);
proposals.add(proposal);
}
return true;
}
示例2: getConvertLocalToFieldProposal
private static boolean getConvertLocalToFieldProposal(IInvocationContext context, final ASTNode node, Collection<ICommandAccess> proposals) throws CoreException {
if (!(node instanceof SimpleName))
return false;
SimpleName name= (SimpleName) node;
IBinding binding= name.resolveBinding();
if (!(binding instanceof IVariableBinding))
return false;
IVariableBinding varBinding= (IVariableBinding) binding;
if (varBinding.isField() || varBinding.isParameter())
return false;
ASTNode decl= context.getASTRoot().findDeclaringNode(varBinding);
if (decl == null || decl.getLocationInParent() != VariableDeclarationStatement.FRAGMENTS_PROPERTY)
return false;
if (proposals == null) {
return true;
}
PromoteTempToFieldRefactoring refactoring= new PromoteTempToFieldRefactoring((VariableDeclaration) decl);
if (refactoring.checkInitialConditions(new NullProgressMonitor()).isOK()) {
String label= CorrectionMessages.QuickAssistProcessor_convert_local_to_field_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
LinkedProposalModel linkedProposalModel= new LinkedProposalModel();
refactoring.setLinkedProposalModel(linkedProposalModel);
RefactoringCorrectionProposal proposal= new RefactoringCorrectionProposal(label, context.getCompilationUnit(), refactoring, IProposalRelevance.CONVERT_LOCAL_TO_FIELD, image);
proposal.setLinkedProposalModel(linkedProposalModel);
proposal.setCommandId(CONVERT_LOCAL_TO_FIELD_ID);
proposals.add(proposal);
}
return true;
}
示例3: getInlineLocalProposal
private static boolean getInlineLocalProposal(IInvocationContext context, final ASTNode node, Collection<ICommandAccess> proposals) throws CoreException {
if (!(node instanceof SimpleName))
return false;
SimpleName name= (SimpleName) node;
IBinding binding= name.resolveBinding();
if (!(binding instanceof IVariableBinding))
return false;
IVariableBinding varBinding= (IVariableBinding) binding;
if (varBinding.isField() || varBinding.isParameter())
return false;
ASTNode decl= context.getASTRoot().findDeclaringNode(varBinding);
if (!(decl instanceof VariableDeclarationFragment) || decl.getLocationInParent() != VariableDeclarationStatement.FRAGMENTS_PROPERTY)
return false;
if (proposals == null) {
return true;
}
InlineTempRefactoring refactoring= new InlineTempRefactoring((VariableDeclaration) decl);
if (refactoring.checkInitialConditions(new NullProgressMonitor()).isOK()) {
String label= CorrectionMessages.QuickAssistProcessor_inline_local_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
RefactoringCorrectionProposal proposal= new RefactoringCorrectionProposal(label, context.getCompilationUnit(), refactoring, 5, image);
proposal.setCommandId(INLINE_LOCAL_ID);
proposals.add(proposal);
}
return true;
}
示例4: getConvertLocalToFieldProposal
private static boolean getConvertLocalToFieldProposal(IInvocationContext context, final ASTNode node, Collection<ICommandAccess> proposals) throws CoreException {
if (!(node instanceof SimpleName))
return false;
SimpleName name= (SimpleName) node;
IBinding binding= name.resolveBinding();
if (!(binding instanceof IVariableBinding) || name.getLocationInParent() != VariableDeclarationFragment.NAME_PROPERTY)
return false;
IVariableBinding varBinding= (IVariableBinding) binding;
if (varBinding.isField() || varBinding.isParameter())
return false;
VariableDeclarationFragment decl= (VariableDeclarationFragment) name.getParent();
if (decl.getLocationInParent() != VariableDeclarationStatement.FRAGMENTS_PROPERTY)
return false;
if (proposals == null) {
return true;
}
PromoteTempToFieldRefactoring refactoring= new PromoteTempToFieldRefactoring(decl);
if (refactoring.checkInitialConditions(new NullProgressMonitor()).isOK()) {
String label= CorrectionMessages.QuickAssistProcessor_convert_local_to_field_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
LinkedProposalModel linkedProposalModel= new LinkedProposalModel();
refactoring.setLinkedProposalModel(linkedProposalModel);
RefactoringCorrectionProposal proposal= new RefactoringCorrectionProposal(label, context.getCompilationUnit(), refactoring, 5, image);
proposal.setLinkedProposalModel(linkedProposalModel);
proposal.setCommandId(CONVERT_LOCAL_TO_FIELD_ID);
proposals.add(proposal);
}
return true;
}