public Change getSingleChange(IFile[] alreadyTouchedFiles) { Collection<TextChange> values= fChanges.values(); if (values.size() == 0) return null; CompositeChange result= new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name); result.markAsSynthetic(); List<IFile> files= Arrays.asList(alreadyTouchedFiles); for (Iterator<TextChange> iter= values.iterator(); iter.hasNext();) { TextFileChange change= (TextFileChange)iter.next(); if (!files.contains(change.getFile())) { result.add(change); } } return result; } }
public Change getSingleChange(IFile[] alreadyTouchedFiles) { Collection<TextChange> values= fChanges.values(); if (values.size() == 0) { return null; } CompositeChange result= new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name); result.markAsSynthetic(); List<IFile> files= Arrays.asList(alreadyTouchedFiles); for (Iterator<TextChange> iter= values.iterator(); iter.hasNext();) { TextFileChange change= (TextFileChange)iter.next(); if (!files.contains(change.getFile())) { result.add(change); } } return result; } }
public Change getSingleChange(IFile[] alreadyTouchedFiles) { Collection<TextChange> values= fChanges.values(); if (values.size() == 0) return null; CompositeChange result= new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name); result.markAsSynthetic(); List<IFile> files= Arrays.asList(alreadyTouchedFiles); for (Iterator<TextChange> iter= values.iterator(); iter.hasNext();) { TextFileChange change= (TextFileChange)iter.next(); if (!files.contains(change.getFile())) { result.add(change); } } return result; } }
public Change getSingleChange(IFile[] alreadyTouchedFiles) { Collection values= fChanges.values(); if (values.size() == 0) return null; CompositeChange result= new CompositeChange(RefactoringCoreMessages.QualifiedNameSearchResult_change_name); result.markAsSynthetic(); List files= Arrays.asList(alreadyTouchedFiles); for (Iterator iter= values.iterator(); iter.hasNext();) { TextFileChange change= (TextFileChange)iter.next(); if (!files.contains(change.getFile())) { result.add(change); } } return result; } }
private void addToTextChangeMap(Change change) { if (change instanceof TextChange) { Object element= ((TextChange) change).getModifiedElement(); if (element != null) { fTextChangeMap.put(element, (TextChange) change); } // check if we have a subclass of TextFileChange. If so also put the change // under the file resource into the hash table if possible. if (change instanceof TextFileChange && !change.getClass().equals(TextFileChange.class)) { TextFileChange textFileChange= (TextFileChange) change; IFile file= textFileChange.getFile(); fTextChangeMap.put(file, textFileChange); } } else if (change instanceof CompositeChange) { Change[] children= ((CompositeChange) change).getChildren(); for (int i= 0; i < children.length; i++) { addToTextChangeMap(children[i]); } } } }
private void addToTextChangeMap(Change change) { if (change instanceof TextChange) { Object element= ((TextChange)change).getModifiedElement(); if (element != null) { fTextChangeMap.put(element, change); } // check if we have a subclass of TextFileChange. If so also put the change // under the file resource into the hash table if possible. if (change instanceof TextFileChange && !change.getClass().equals(TextFileChange.class)) { IFile file= ((TextFileChange)change).getFile(); fTextChangeMap.put(file, change); } } else if (change instanceof CompositeChange) { Change[] children= ((CompositeChange)change).getChildren(); for (int i= 0; i < children.length; i++) { addToTextChangeMap(children[i]); } } } }
private void addToTextChangeMap(Change change) { if (change instanceof TextChange) { Object element= ((TextChange) change).getModifiedElement(); if (element != null) { fTextChangeMap.put(element, (TextChange) change); } // check if we have a subclass of TextFileChange. If so also put the change // under the file resource into the hash table if possible. if (change instanceof TextFileChange && !change.getClass().equals(TextFileChange.class)) { TextFileChange textFileChange= (TextFileChange) change; IFile file= textFileChange.getFile(); fTextChangeMap.put(file, textFileChange); } } else if (change instanceof CompositeChange) { Change[] children= ((CompositeChange) change).getChildren(); for (int i= 0; i < children.length; i++) { addToTextChangeMap(children[i]); } } } }
public TextFileChange getChange(IFile file) throws CoreException { final SelfEncapsulateFieldRefactoring refactoring= new SelfEncapsulateFieldRefactoring(fField); refactoring.setVisibility(Flags.AccPublic); refactoring.setConsiderVisibility(false);//private field references are just searched in local file refactoring.checkInitialConditions(new NullProgressMonitor()); refactoring.checkFinalConditions(new NullProgressMonitor()); Change createdChange= refactoring.createChange(new NullProgressMonitor()); if (createdChange instanceof CompositeChange) { Change[] children= ((CompositeChange) createdChange).getChildren(); for (int i= 0; i < children.length; i++) { Change curr= children[i]; if (curr instanceof TextFileChange && ((TextFileChange) curr).getFile().equals(file)) { return (TextFileChange) curr; } } } return null; }
public TextFileChange getChange(IFile file) throws CoreException { final SelfEncapsulateFieldRefactoring refactoring= new SelfEncapsulateFieldRefactoring(fField); refactoring.setVisibility(Flags.AccPublic); refactoring.setConsiderVisibility(false);//private field references are just searched in local file refactoring.checkInitialConditions(new NullProgressMonitor()); refactoring.checkFinalConditions(new NullProgressMonitor()); Change createdChange= refactoring.createChange(new NullProgressMonitor()); if (createdChange instanceof CompositeChange) { Change[] children= ((CompositeChange) createdChange).getChildren(); for (int i= 0; i < children.length; i++) { Change curr= children[i]; if (curr instanceof TextFileChange && ((TextFileChange) curr).getFile().equals(file)) { return (TextFileChange) curr; } } } return null; }
/** * Returns the text used to render this node in the * UI. * * @return a human readable representation of this node */ public String getText() { Change change= getTextEditBasedChange(); if (change instanceof TextFileChange) { IFile file= ((TextFileChange)change).getFile(); return Messages.format( RefactoringUIMessages.PreviewWizardPage_changeElementLabelProvider_textFormat, new String[] {file.getName(), getPath(file)}); } return super.getText(); }