本文整理汇总了Java中org.netbeans.modules.refactoring.spi.RefactoringElementsBag.addFileChange方法的典型用法代码示例。如果您正苦于以下问题:Java RefactoringElementsBag.addFileChange方法的具体用法?Java RefactoringElementsBag.addFileChange怎么用?Java RefactoringElementsBag.addFileChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.modules.refactoring.spi.RefactoringElementsBag
的用法示例。
在下文中一共展示了RefactoringElementsBag.addFileChange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preparePackageDelete
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
private Problem preparePackageDelete(NonRecursiveFolder folder, RefactoringElementsBag refactoringElements) {
DataFolder dataFolder = DataFolder.findFolder(folder.getFolder());
// First; delete all files except packages
DataObject children[] = dataFolder.getChildren();
boolean empty = true;
for( int i = 0; children != null && i < children.length; i++ ) {
FileObject fileObject = children[i].getPrimaryFile();
if ( !fileObject.isFolder() ) {
refactoringElements.addFileChange(refactoring, new DeleteFile(fileObject, refactoringElements));
}
else {
empty = false;
}
}
// If empty delete itself
if ( empty ) {
refactoringElements.addFileChange(refactoring, new PackageDeleteElem(folder));
}
return null;
}
示例2: prepare
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
@Override
public Problem prepare(RefactoringElementsBag elements) {
for (FileObject fo: refactoring.getRefactoringSource().lookupAll(FileObject.class)) {
elements.addFileChange(refactoring, new DeleteFile(fo, elements));
}
return null;
}
示例3: prepare
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
@Override
public Problem prepare(RefactoringElementsBag elements) {
URL targetUrl = ((MoveRefactoring) refactoring).getTarget().lookup(URL.class);
if(targetUrl != null) {
for (FileObject o: refactoring.getRefactoringSource().lookupAll(FileObject.class)) {
elements.addFileChange(refactoring, new MoveFile(o, elements));
}
}
return null;
}
示例4: addDataFilesInFolder
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
private void addDataFilesInFolder(FileObject folderFileObject, RefactoringElementsBag refactoringElements) {
for (FileObject childFileObject : folderFileObject.getChildren()) {
if (!childFileObject.isFolder()) {
refactoringElements.addFileChange(refactoring, new DeleteFile(childFileObject, refactoringElements));
}
else if (childFileObject.isFolder()) {
addDataFilesInFolder(childFileObject, refactoringElements);
}
}
}
示例5: prepareFolderDelete
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
private Problem prepareFolderDelete(FileObject fileObject, RefactoringElementsBag refactoringElements) {
addDataFilesInFolder(fileObject, refactoringElements);
refactoringElements.addFileChange(refactoring, new FolderDeleteElem(fileObject));
return null;
}
示例6: prepare
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
@Override
public Problem prepare(RefactoringElementsBag elements) {
elements.addFileChange(refactoring, new RenameFile(refactoring.getRefactoringSource().lookup(FileObject.class), elements));
return null;
}
示例7: prepare
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
@Override
public Problem prepare(RefactoringElementsBag elements) {
elements.addFileChange(refactoring, new RenameNonRecursiveFolder(refactoring.getRefactoringSource().lookup(NonRecursiveFolder.class), elements));
return null;
}
示例8: performApplyPattern
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; //导入方法依赖的package包/类
protected Collection<MessageImpl> performApplyPattern(Iterable<? extends HintDescription> pattern, Scope scope, RefactoringElementsBag refactoringElements) {
ProgressHandleWrapper w = new ProgressHandleWrapper(this, 30, 70);
BatchResult candidates = BatchSearch.findOccurrences(pattern, scope, w, /*XXX:*/HintsSettings.getGlobalSettings());
Collection<RefactoringElementImplementation> fileChanges = new ArrayList<RefactoringElementImplementation>();
Collection<MessageImpl> problems = new LinkedList<MessageImpl>(candidates.problems);
Map<JavaFix, ModificationResult> changesPerFix = new IdentityHashMap<JavaFix, ModificationResult>();
Collection<? extends ModificationResult> res = BatchUtilities.applyFixes(candidates, w, cancel, fileChanges, changesPerFix, problems);
Set<ModificationResult> enabled = Collections.newSetFromMap(new IdentityHashMap<ModificationResult, Boolean>());
Map<FileObject, Map<JavaFix, ModificationResult>> file2Fixes2Changes = new HashMap<FileObject, Map<JavaFix, ModificationResult>>();
Map<FileObject, Set<FileObject>> affectedFiles = new HashMap<FileObject, Set<FileObject>>();
Map<FileObject, List<RefactoringElementImplementation>> file2Changes = new TreeMap<FileObject, List<RefactoringElementImplementation>>(FILE_COMPARATOR);
for (Entry<JavaFix, ModificationResult> changesPerFixEntry : changesPerFix.entrySet()) {
enabled.add(changesPerFixEntry.getValue());
for (FileObject file : changesPerFixEntry.getValue().getModifiedFileObjects()) {
List<RefactoringElementImplementation> currentFileChanges = file2Changes.get(file);
if (currentFileChanges == null) {
file2Changes.put(file, currentFileChanges = new ArrayList<RefactoringElementImplementation>());
}
currentFileChanges.add(new ModificationResultElement(file, changesPerFixEntry.getKey(), changesPerFixEntry.getValue(), enabled));
Map<JavaFix, ModificationResult> perFile = file2Fixes2Changes.get(file);
if (perFile == null) {
file2Fixes2Changes.put(file, perFile = new IdentityHashMap<JavaFix, ModificationResult>());
}
perFile.put(changesPerFixEntry.getKey(), changesPerFixEntry.getValue());
Set<FileObject> aff = affectedFiles.get(file);
if (aff == null) {
affectedFiles.put(file, aff = new HashSet<FileObject>());
}
aff.addAll(changesPerFixEntry.getValue().getModifiedFileObjects());
}
}
for (List<RefactoringElementImplementation> changes : file2Changes.values()) {
Collections.sort(changes, new Comparator<RefactoringElementImplementation>() {
@Override public int compare(RefactoringElementImplementation o1, RefactoringElementImplementation o2) {
return o1.getPosition().getBegin().getOffset() - o2.getPosition().getBegin().getOffset();
}
});
refactoringElements.addAll(refactoring, changes);
}
refactoringElements.registerTransaction(new DelegatingTransaction(enabled, file2Fixes2Changes, affectedFiles, res));
for (RefactoringElementImplementation fileChange : fileChanges) {
refactoringElements.addFileChange(refactoring, fileChange);
}
w.finish();
return problems;
}