本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer类的典型用法代码示例。如果您正苦于以下问题:Java TempOccurrenceAnalyzer类的具体用法?Java TempOccurrenceAnalyzer怎么用?Java TempOccurrenceAnalyzer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TempOccurrenceAnalyzer类属于org.eclipse.jdt.internal.corext.refactoring.rename包,在下文中一共展示了TempOccurrenceAnalyzer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeParamgumentName
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
@Override
protected void changeParamgumentName(ParameterInfo info) {
VariableDeclaration param = getParameter(info.getOldIndex());
if (!info.getOldName().equals(param.getName().getIdentifier()))
return; // don't change if original parameter name != name in rippleMethod
String msg = RefactoringCoreMessages.ChangeSignatureRefactoring_update_parameter_references;
TextEditGroup description = fCuRewrite.createGroupDescription(msg);
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(param, false);
analyzer.perform();
SimpleName[] paramOccurrences =
analyzer
.getReferenceAndDeclarationNodes(); // @param tags are updated in changeJavaDocTags()
for (int j = 0; j < paramOccurrences.length; j++) {
SimpleName occurence = paramOccurrences[j];
getASTRewrite()
.set(occurence, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), description);
}
}
示例2: checkIfDeletedParametersUsed
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
protected void checkIfDeletedParametersUsed() {
for (Iterator<ParameterInfo> iter = getDeletedInfos().iterator(); iter.hasNext(); ) {
ParameterInfo info = iter.next();
VariableDeclaration paramDecl = getParameter(info.getOldIndex());
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(paramDecl, false);
analyzer.perform();
SimpleName[] paramRefs = analyzer.getReferenceNodes();
if (paramRefs.length > 0) {
RefactoringStatusContext context =
JavaStatusContext.create(fCuRewrite.getCu(), paramRefs[0]);
String typeName = getFullTypeName();
Object[] keys =
new String[] {
BasicElementLabels.getJavaElementName(paramDecl.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(getMethod().getElementName()),
BasicElementLabels.getJavaElementName(typeName)
};
String msg =
Messages.format(
RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
fResult.addError(msg, context);
}
}
}
示例3: addTempRenames
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
private void addTempRenames(ASTRewrite rewrite) {
boolean noNameChange = fFieldName.equals(fTempDeclarationNode.getName().getIdentifier());
if (fLinkedProposalModel == null && noNameChange) {
return; // no changes needed
}
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(fTempDeclarationNode, false);
analyzer.perform();
SimpleName[] tempRefs =
analyzer.getReferenceNodes(); // no javadocs (refactoring not for parameters)
for (int j = 0; j < tempRefs.length; j++) {
SimpleName occurence = tempRefs[j];
if (noNameChange) {
addLinkedName(rewrite, occurence, false);
} else {
SimpleName newName = getAST().newSimpleName(fFieldName);
addLinkedName(rewrite, newName, false);
rewrite.replace(occurence, newName, null);
}
}
}
示例4: changeParamgumentName
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
@Override
protected void changeParamgumentName(ParameterInfo info) {
VariableDeclaration param= getParameter(info.getOldIndex());
if (!info.getOldName().equals(param.getName().getIdentifier()))
return; //don't change if original parameter name != name in rippleMethod
String msg= RefactoringCoreMessages.ChangeSignatureRefactoring_update_parameter_references;
TextEditGroup description= fCuRewrite.createGroupDescription(msg);
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(param, false);
analyzer.perform();
SimpleName[] paramOccurrences= analyzer.getReferenceAndDeclarationNodes(); // @param tags are updated in changeJavaDocTags()
for (int j= 0; j < paramOccurrences.length; j++) {
SimpleName occurence= paramOccurrences[j];
getASTRewrite().set(occurence, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), description);
}
}
示例5: checkIfDeletedParametersUsed
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
protected void checkIfDeletedParametersUsed() {
for (Iterator<ParameterInfo> iter= getDeletedInfos().iterator(); iter.hasNext();) {
ParameterInfo info= iter.next();
VariableDeclaration paramDecl= getParameter(info.getOldIndex());
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(paramDecl, false);
analyzer.perform();
SimpleName[] paramRefs= analyzer.getReferenceNodes();
if (paramRefs.length > 0) {
RefactoringStatusContext context= JavaStatusContext.create(fCuRewrite.getCu(), paramRefs[0]);
String typeName= getFullTypeName();
Object[] keys= new String[] { BasicElementLabels.getJavaElementName(paramDecl.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(getMethod().getElementName()),
BasicElementLabels.getJavaElementName(typeName) };
String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
fResult.addError(msg, context);
}
}
}
示例6: addTempRenames
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
private void addTempRenames(ASTRewrite rewrite) {
boolean noNameChange= fFieldName.equals(fTempDeclarationNode.getName().getIdentifier());
if (fLinkedProposalModel == null && noNameChange) {
return; // no changes needed
}
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(fTempDeclarationNode, false);
analyzer.perform();
SimpleName[] tempRefs= analyzer.getReferenceNodes(); // no javadocs (refactoring not for parameters)
for (int j= 0; j < tempRefs.length; j++) {
SimpleName occurence= tempRefs[j];
if (noNameChange) {
addLinkedName(rewrite, occurence, false);
} else {
SimpleName newName= getAST().newSimpleName(fFieldName);
addLinkedName(rewrite, newName, false);
rewrite.replace(occurence, newName, null);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:PromoteTempToFieldRefactoring.java
示例7: changeParamgumentName
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
@Override
protected void changeParamgumentName(ParameterInfo info) {
SingleVariableDeclaration param= (SingleVariableDeclaration) fMethDecl.parameters().get(info.getOldIndex());
if (! info.getOldName().equals(param.getName().getIdentifier()))
return; //don't change if original parameter name != name in rippleMethod
String msg= RefactoringCoreMessages.ChangeSignatureRefactoring_update_parameter_references;
TextEditGroup description= fCuRewrite.createGroupDescription(msg);
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(param, false);
analyzer.perform();
SimpleName[] paramOccurrences= analyzer.getReferenceAndDeclarationNodes(); // @param tags are updated in changeJavaDocTags()
for (int j= 0; j < paramOccurrences.length; j++) {
SimpleName occurence= paramOccurrences[j];
getASTRewrite().set(occurence, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), description);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ChangeSignatureProcessor.java
示例8: checkIfDeletedParametersUsed
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
private void checkIfDeletedParametersUsed() {
for (Iterator<ParameterInfo> iter= getDeletedInfos().iterator(); iter.hasNext();) {
ParameterInfo info= iter.next();
SingleVariableDeclaration paramDecl= (SingleVariableDeclaration) fMethDecl.parameters().get(info.getOldIndex());
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(paramDecl, false);
analyzer.perform();
SimpleName[] paramRefs= analyzer.getReferenceNodes();
if (paramRefs.length > 0){
RefactoringStatusContext context= JavaStatusContext.create(fCuRewrite.getCu(), paramRefs[0]);
String typeName= getFullTypeName(fMethDecl);
Object[] keys= new String[]{ BasicElementLabels.getJavaElementName(paramDecl.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(fMethDecl.getName().getIdentifier()),
BasicElementLabels.getJavaElementName(typeName)};
String msg= Messages.format(RefactoringCoreMessages.ChangeSignatureRefactoring_parameter_used, keys);
fResult.addError(msg, context);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:ChangeSignatureProcessor.java
示例9: getReferences
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
public SimpleName[] getReferences() {
if (fReferences != null) return fReferences;
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(getVariableDeclaration(), false);
analyzer.perform();
fReferences = analyzer.getReferenceNodes();
return fReferences;
}
示例10: getReferences
import org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer; //导入依赖的package包/类
public SimpleName[] getReferences() {
if (fReferences != null)
return fReferences;
TempOccurrenceAnalyzer analyzer= new TempOccurrenceAnalyzer(getVariableDeclaration(), false);
analyzer.perform();
fReferences= analyzer.getReferenceNodes();
return fReferences;
}