当前位置: 首页>>代码示例>>Java>>正文


Java TempOccurrenceAnalyzer类代码示例

本文整理汇总了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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:ChangeSignatureProcessor.java

示例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);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ChangeSignatureProcessor.java

示例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);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:PromoteTempToFieldRefactoring.java

示例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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ChangeSignatureProcessor.java

示例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);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ChangeSignatureProcessor.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:InlineTempRefactoring.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:InlineTempRefactoring.java


注:本文中的org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。