當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。