MoveFilesFoldersAndCusPolicy(IFile[] files, IFolder[] folders, ICompilationUnit[] cus) { super(files, folders, cus); fUpdateQualifiedNames= false; fQualifiedNameSearchResult= new QualifiedNameSearchResult(); }
@Override protected IFile[] getChangedFiles() throws CoreException { List<IFile> result= new ArrayList<>(); result.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); if (fQualifiedNameSearchResult != null) result.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); if (willRenameCU()) result.add(ResourceUtil.getFile(fType.getCompilationUnit())); return result.toArray(new IFile[result.size()]); }
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)); } else { return null; } }
public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { int start= matchAccess.getMatchOffset(); int length= matchAccess.getMatchLength(); // skip embedded FQNs (bug 130764): if (start > 0) { char before= matchAccess.getFileContentChar(start - 1); if (before == '.' || Character.isJavaIdentifierPart(before)) return true; } int fileContentLength= matchAccess.getFileContentLength(); int end= start + length; if (end < fileContentLength) { char after= matchAccess.getFileContentChar(end); if (Character.isJavaIdentifierPart(after)) return true; } IFile file= matchAccess.getFile(); TextChange change= fResult.getChange(file); TextChangeCompatibility.addTextEdit( change, RefactoringCoreMessages.QualifiedNameFinder_update_name, new ReplaceEdit(start, length, fNewValue), QUALIFIED_NAMES); return true; } }
@Override public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { int start= matchAccess.getMatchOffset(); int length= matchAccess.getMatchLength(); // skip embedded FQNs (bug 130764): if (start > 0) { char before= matchAccess.getFileContentChar(start - 1); if (before == '.' || Character.isJavaIdentifierPart(before)) return true; } int fileContentLength= matchAccess.getFileContentLength(); int end= start + length; if (end < fileContentLength) { char after= matchAccess.getFileContentChar(end); if (Character.isJavaIdentifierPart(after)) return true; } IFile file= matchAccess.getFile(); synchronized(fResult) { TextChange change= fResult.getChange(file); TextChangeCompatibility.addTextEdit( change, RefactoringCoreMessages.QualifiedNameFinder_update_name, new ReplaceEdit(start, length, fNewValue), QUALIFIED_NAMES); } return true; } }
protected IFile[] getChangedFiles() throws CoreException { List result= new ArrayList(); result.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); if (fQualifiedNameSearchResult != null) result.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); if (willRenameCU()) result.add(ResourceUtil.getFile(fType.getCompilationUnit())); return (IFile[]) result.toArray(new IFile[result.size()]); }
MoveFilesFoldersAndCusPolicy(IFile[] files, IFolder[] folders, ICompilationUnit[] cus) { super(files, folders, cus); fUpdateQualifiedNames= false; fQualifiedNameSearchResult= new QualifiedNameSearchResult(); }
@Override public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { try { return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)); } finally { fQualifiedNameSearchResult= null; } } else { return null; } }
@Override public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException { int start= matchAccess.getMatchOffset(); int length= matchAccess.getMatchLength(); // skip embedded FQNs (bug 130764): if (start > 0) { char before= matchAccess.getFileContentChar(start - 1); if (before == '.' || Character.isJavaIdentifierPart(before)) return true; } int fileContentLength= matchAccess.getFileContentLength(); int end= start + length; if (end < fileContentLength) { char after= matchAccess.getFileContentChar(end); if (Character.isJavaIdentifierPart(after)) return true; } IFile file= matchAccess.getFile(); synchronized(fResult) { TextChange change= fResult.getChange(file); TextChangeCompatibility.addTextEdit( change, RefactoringCoreMessages.QualifiedNameFinder_update_name, new ReplaceEdit(start, length, fNewValue), QUALIFIED_NAMES); } return true; } }
@Override protected IFile[] getChangedFiles() throws CoreException { List<IFile> result= new ArrayList<>(); result.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); if (fQualifiedNameSearchResult != null) result.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); if (willRenameCU()) result.add(ResourceUtil.getFile(fType.getCompilationUnit())); return result.toArray(new IFile[result.size()]); }
MoveFilesFoldersAndCusPolicy(IFile[] files, IFolder[] folders, ICompilationUnit[] cus) { super(files, folders, cus); fUpdateReferences= true; fUpdateQualifiedNames= false; fQualifiedNameSearchResult= new QualifiedNameSearchResult(); }
@Override public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { try { return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)); } finally { fQualifiedNameSearchResult= null; } } else { return null; } }
public IFile[] getAllModifiedFiles() { Set result= new HashSet(); result.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); result.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); if (getDestinationAsPackageFragment() != null && getUpdateReferences()) result.addAll(Arrays.asList(ResourceUtil.getFiles(getCus()))); return (IFile[]) result.toArray(new IFile[result.size()]); }
private void computeQualifiedNameMatches(IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult == null) fQualifiedNameSearchResult= new QualifiedNameSearchResult(); QualifiedNameFinder.process(fQualifiedNameSearchResult, fPackage.getElementName(), getNewElementName(), fFilePatterns, fPackage.getJavaProject().getProject(), pm); }
@Override public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)); } else { return null; } }
protected IFile[] getChangedFiles() throws CoreException { Set combined= new HashSet(); combined.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); if (fRenameSubpackages) { IPackageFragment[] allPackages= JavaElementUtil.getPackageAndSubpackages(fPackage); for (int i= 0; i < allPackages.length; i++) { combined.addAll(Arrays.asList(ResourceUtil.getFiles(allPackages[i].getCompilationUnits()))); } } else { combined.addAll(Arrays.asList(ResourceUtil.getFiles(fPackage.getCompilationUnits()))); } if (fQualifiedNameSearchResult != null) combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); return (IFile[]) combined.toArray(new IFile[combined.size()]); }
private void computeQualifiedNameMatches(IProgressMonitor pm) { if (fQualifiedNameSearchResult == null) fQualifiedNameSearchResult= new QualifiedNameSearchResult(); QualifiedNameFinder.process(fQualifiedNameSearchResult, fPackage.getElementName(), getNewElementName(), fFilePatterns, fPackage.getJavaProject().getProject(), pm); }
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException { if (fQualifiedNameSearchResult != null) { try { return fQualifiedNameSearchResult.getSingleChange(Changes.getModifiedFiles(participantChanges)); } finally { fQualifiedNameSearchResult= null; } } else { return null; } }
@Override public IFile[] getAllModifiedFiles() { Set<IFile> result= new HashSet<>(); result.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()))); result.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles())); if (!(getJavaElementDestination() instanceof IPackageFragmentRoot) && getDestinationAsPackageFragment() != null && getUpdateReferences()) result.addAll(Arrays.asList(ResourceUtil.getFiles(getCus()))); return result.toArray(new IFile[result.size()]); }
private void computeQualifiedNameMatches(IProgressMonitor pm) { if (fQualifiedNameSearchResult == null) fQualifiedNameSearchResult= new QualifiedNameSearchResult(); QualifiedNameFinder.process(fQualifiedNameSearchResult, fPackage.getElementName(), getNewElementName(), fFilePatterns, fPackage.getJavaProject().getProject(), pm); }