use of org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer in project che by eclipse.
the class PromoteTempToFieldRefactoring method addTempRenames.
private void addTempRenames(ASTRewrite rewrite) {
boolean noNameChange = fFieldName.equals(fTempDeclarationNode.getName().getIdentifier());
if (fLinkedProposalModel == null && noNameChange) {
// no changes needed
return;
}
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(fTempDeclarationNode, false);
analyzer.perform();
// no javadocs (refactoring not for parameters)
SimpleName[] tempRefs = analyzer.getReferenceNodes();
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);
}
}
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer in project che by eclipse.
the class InlineTempRefactoring method getReferences.
public SimpleName[] getReferences() {
if (fReferences != null)
return fReferences;
TempOccurrenceAnalyzer analyzer = new TempOccurrenceAnalyzer(getVariableDeclaration(), false);
analyzer.perform();
fReferences = analyzer.getReferenceNodes();
return fReferences;
}
Aggregations