public static ParameterizedType[] inferArguments(SimpleType[] types, InferTypeArgumentsUpdate update, InferTypeArgumentsTCModel model, CompilationUnitRewrite rewrite) { for (int i= 0; i < types.length; i++) { types[i].setProperty(REWRITTEN, null); } List result= new ArrayList(); HashMap/*<ICompilationUnit, CuUpdate>*/ updates= update.getUpdates(); Set entrySet= updates.entrySet(); for (Iterator iter= entrySet.iterator(); iter.hasNext();) { Map.Entry entry= (Map.Entry) iter.next(); rewrite.setResolveBindings(false); CuUpdate cuUpdate= (CuUpdate) entry.getValue(); for (Iterator cvIter= cuUpdate.getDeclarations().iterator(); cvIter.hasNext();) { ConstraintVariable2 cv= (ConstraintVariable2) cvIter.next(); ParameterizedType newNode= rewriteConstraintVariable(cv, rewrite, model, false, types); if (newNode != null) result.add(newNode); } } return (ParameterizedType[])result.toArray(new ParameterizedType[result.size()]); }
public static ParameterizedType[] inferArguments(SimpleType[] types, InferTypeArgumentsUpdate update, InferTypeArgumentsTCModel model, CompilationUnitRewrite rewrite) { for (int i= 0; i < types.length; i++) { types[i].setProperty(REWRITTEN, null); } List<ParameterizedType> result= new ArrayList<>(); HashMap<ICompilationUnit, CuUpdate> updates= update.getUpdates(); Set<Entry<ICompilationUnit, CuUpdate>> entrySet= updates.entrySet(); for (Iterator<Entry<ICompilationUnit, CuUpdate>> iter= entrySet.iterator(); iter.hasNext();) { Entry<ICompilationUnit, CuUpdate> entry= iter.next(); rewrite.setResolveBindings(false); CuUpdate cuUpdate= entry.getValue(); for (Iterator<CollectionElementVariable2> cvIter= cuUpdate.getDeclarations().iterator(); cvIter.hasNext();) { ConstraintVariable2 cv= cvIter.next(); ParameterizedType newNode= rewriteConstraintVariable(cv, rewrite, model, false, types); if (newNode != null) result.add(newNode); } } return result.toArray(new ParameterizedType[result.size()]); }
public static ParameterizedType[] inferArguments(SimpleType[] types, InferTypeArgumentsUpdate update, InferTypeArgumentsTCModel model, CompilationUnitRewrite rewrite) { for (int i= 0; i < types.length; i++) { types[i].setProperty(REWRITTEN, null); } List<ParameterizedType> result= new ArrayList<>(); HashMap<ICompilationUnit, CuUpdate> updates= update.getUpdates(); Set<Entry<ICompilationUnit, CuUpdate>> entrySet= updates.entrySet(); for (Iterator<Entry<ICompilationUnit, CuUpdate>> iter= entrySet.iterator(); iter.hasNext();) { Entry<ICompilationUnit, CuUpdate> entry= iter.next(); rewrite.setResolveBindings(false); CuUpdate cuUpdate= entry.getValue(); for (Iterator<CollectionElementVariable2> cvIter= cuUpdate.getDeclarations().iterator(); cvIter.hasNext();) { ConstraintVariable2 cv= cvIter.next(); ParameterizedType newNode= rewriteConstraintVariable(cv, rewrite, model, false, types); if (newNode != null) result.add(newNode); } } return result.toArray(new ParameterizedType[result.size()]); }
rewrite.setResolveBindings(false); CuUpdate cuUpdate= (CuUpdate) entry.getValue();
private void rewriteDeclarations(InferTypeArgumentsUpdate update, IProgressMonitor pm) throws CoreException { HashMap<ICompilationUnit, CuUpdate> updates= update.getUpdates(); Set<Entry<ICompilationUnit, CuUpdate>> entrySet= updates.entrySet(); pm.beginTask("", entrySet.size()); //$NON-NLS-1$ pm.setTaskName(RefactoringCoreMessages.InferTypeArgumentsRefactoring_creatingChanges); for (Iterator<Entry<ICompilationUnit, CuUpdate>> iter= entrySet.iterator(); iter.hasNext();) { if (pm.isCanceled()) throw new OperationCanceledException(); Entry<ICompilationUnit, CuUpdate> entry= iter.next(); ICompilationUnit cu= entry.getKey(); pm.worked(1); pm.subTask(BasicElementLabels.getFileName(cu)); CompilationUnitRewrite rewrite= new CompilationUnitRewrite(cu); rewrite.setResolveBindings(false); CuUpdate cuUpdate= entry.getValue(); for (Iterator<CollectionElementVariable2> cvIter= cuUpdate.getDeclarations().iterator(); cvIter.hasNext();) { ConstraintVariable2 cv= cvIter.next(); rewriteConstraintVariable(cv, rewrite, fTCModel, fLeaveUnconstrainedRaw, null); } for (Iterator<CastVariable2> castsIter= cuUpdate.getCastsToRemove().iterator(); castsIter.hasNext();) { CastVariable2 castCv= castsIter.next(); rewriteCastVariable(castCv, rewrite, fTCModel); } CompilationUnitChange change= rewrite.createChange(true); if (change != null) { fChangeManager.manage(cu, change); } } }
private void rewriteDeclarations(InferTypeArgumentsUpdate update, IProgressMonitor pm) throws CoreException { HashMap<ICompilationUnit, CuUpdate> updates= update.getUpdates(); Set<Entry<ICompilationUnit, CuUpdate>> entrySet= updates.entrySet(); pm.beginTask("", entrySet.size()); //$NON-NLS-1$ pm.setTaskName(RefactoringCoreMessages.InferTypeArgumentsRefactoring_creatingChanges); for (Iterator<Entry<ICompilationUnit, CuUpdate>> iter= entrySet.iterator(); iter.hasNext();) { if (pm.isCanceled()) throw new OperationCanceledException(); Entry<ICompilationUnit, CuUpdate> entry= iter.next(); ICompilationUnit cu= entry.getKey(); pm.worked(1); pm.subTask(BasicElementLabels.getFileName(cu)); CompilationUnitRewrite rewrite= new CompilationUnitRewrite(cu); rewrite.setResolveBindings(false); CuUpdate cuUpdate= entry.getValue(); for (Iterator<CollectionElementVariable2> cvIter= cuUpdate.getDeclarations().iterator(); cvIter.hasNext();) { ConstraintVariable2 cv= cvIter.next(); rewriteConstraintVariable(cv, rewrite, fTCModel, fLeaveUnconstrainedRaw, null); } for (Iterator<CastVariable2> castsIter= cuUpdate.getCastsToRemove().iterator(); castsIter.hasNext();) { CastVariable2 castCv= castsIter.next(); rewriteCastVariable(castCv, rewrite, fTCModel); } CompilationUnitChange change= rewrite.createChange(true); if (change != null) { fChangeManager.manage(cu, change); } } }
rewrite.setResolveBindings(true);
rewrite.setResolveBindings(true);
if (!isRewriteKept(whoToAdjust.getCompilationUnit())) { CompilationUnitRewrite rewrite= new CompilationUnitRewrite(whoToAdjust.getCompilationUnit()); rewrite.setResolveBindings(false); rewrites= new HashMap(); rewrites.put(whoToAdjust.getCompilationUnit(), rewrite);
if (!isRewriteKept(whoToAdjust.getCompilationUnit())) { CompilationUnitRewrite rewrite= new CompilationUnitRewrite(whoToAdjust.getCompilationUnit()); rewrite.setResolveBindings(false); rewrites= new HashMap<>(); rewrites.put(whoToAdjust.getCompilationUnit(), rewrite);
if (!isRewriteKept(whoToAdjust.getCompilationUnit())) { CompilationUnitRewrite rewrite= new CompilationUnitRewrite(whoToAdjust.getCompilationUnit()); rewrite.setResolveBindings(false); rewrites= new HashMap<>(); rewrites.put(whoToAdjust.getCompilationUnit(), rewrite);
rewrite.setResolveBindings(true);
rewrite.setResolveBindings(true);
rewrite.setResolveBindings(true);
private void addDeclarationUpdate(TextChangeManager manager) throws CoreException { if (getDelegateUpdating()) { // create the delegate CompilationUnitRewrite rewrite= new CompilationUnitRewrite(getDeclaringCU()); rewrite.setResolveBindings(true); MethodDeclaration methodDeclaration= ASTNodeSearchUtil.getMethodDeclarationNode(getMethod(), rewrite.getRoot()); DelegateMethodCreator creator= new DelegateMethodCreator(); creator.setDeclaration(methodDeclaration); creator.setDeclareDeprecated(getDeprecateDelegates()); creator.setSourceRewrite(rewrite); creator.setCopy(true); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); CompilationUnitChange cuChange= rewrite.createChange(true); if (cuChange != null) { cuChange.setKeepPreviewEdits(true); manager.manage(getDeclaringCU(), cuChange); } } String editName= RefactoringCoreMessages.RenameMethodRefactoring_update_declaration; ISourceRange nameRange= getMethod().getNameRange(); ReplaceEdit replaceEdit= new ReplaceEdit(nameRange.getOffset(), nameRange.getLength(), getNewElementName()); addTextEdit(manager.get(getDeclaringCU()), editName, replaceEdit); }
private void addDeclarationUpdate(TextChangeManager manager) throws CoreException { if (getDelegateUpdating()) { // create the delegate CompilationUnitRewrite rewrite= new CompilationUnitRewrite(getDeclaringCU()); rewrite.setResolveBindings(true); MethodDeclaration methodDeclaration= ASTNodeSearchUtil.getMethodDeclarationNode(getMethod(), rewrite.getRoot()); DelegateMethodCreator creator= new DelegateMethodCreator(); creator.setDeclaration(methodDeclaration); creator.setDeclareDeprecated(getDeprecateDelegates()); creator.setSourceRewrite(rewrite); creator.setCopy(true); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); CompilationUnitChange cuChange= rewrite.createChange(true); if (cuChange != null) { cuChange.setKeepPreviewEdits(true); manager.manage(getDeclaringCU(), cuChange); } } String editName= RefactoringCoreMessages.RenameMethodRefactoring_update_declaration; ISourceRange nameRange= getMethod().getNameRange(); ReplaceEdit replaceEdit= new ReplaceEdit(nameRange.getOffset(), nameRange.getLength(), getNewElementName()); addTextEdit(manager.get(getDeclaringCU()), editName, replaceEdit); }
final void addDeclarationUpdate(TextChangeManager manager) throws CoreException { if (getDelegateUpdating()) { // create the delegate CompilationUnitRewrite rewrite= new CompilationUnitRewrite(getDeclaringCU()); rewrite.setResolveBindings(true); MethodDeclaration methodDeclaration= ASTNodeSearchUtil.getMethodDeclarationNode(getMethod(), rewrite.getRoot()); DelegateMethodCreator creator= new DelegateMethodCreator(); creator.setDeclaration(methodDeclaration); creator.setDeclareDeprecated(getDeprecateDelegates()); creator.setSourceRewrite(rewrite); creator.setCopy(true); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); CompilationUnitChange cuChange= rewrite.createChange(); if (cuChange != null) { cuChange.setKeepPreviewEdits(true); manager.manage(getDeclaringCU(), cuChange); } } String editName= RefactoringCoreMessages.RenameMethodRefactoring_update_declaration; ISourceRange nameRange= getMethod().getNameRange(); ReplaceEdit replaceEdit= new ReplaceEdit(nameRange.getOffset(), nameRange.getLength(), getNewElementName()); addTextEdit(manager.get(getDeclaringCU()), editName, replaceEdit); }
private void addDeclarationUpdate(TextChangeManager manager) throws CoreException { if (getDelegateUpdating()) { // create the delegate CompilationUnitRewrite rewrite= new CompilationUnitRewrite(getDeclaringCU()); rewrite.setResolveBindings(true); MethodDeclaration methodDeclaration= ASTNodeSearchUtil.getMethodDeclarationNode(getMethod(), rewrite.getRoot()); DelegateMethodCreator creator= new DelegateMethodCreator(); creator.setDeclaration(methodDeclaration); creator.setDeclareDeprecated(getDeprecateDelegates()); creator.setSourceRewrite(rewrite); creator.setCopy(true); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); CompilationUnitChange cuChange= rewrite.createChange(true); if (cuChange != null) { cuChange.setKeepPreviewEdits(true); manager.manage(getDeclaringCU(), cuChange); } } String editName= RefactoringCoreMessages.RenameMethodRefactoring_update_declaration; ISourceRange nameRange= getMethod().getNameRange(); ReplaceEdit replaceEdit= new ReplaceEdit(nameRange.getOffset(), nameRange.getLength(), getNewElementName()); addTextEdit(manager.get(getDeclaringCU()), editName, replaceEdit); }