本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange类的典型用法代码示例。如果您正苦于以下问题:Java RenamePackageChange类的具体用法?Java RenamePackageChange怎么用?Java RenamePackageChange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenamePackageChange类属于org.eclipse.jdt.internal.corext.refactoring.changes包,在下文中一共展示了RenamePackageChange类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChange
import org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(RefactoringCoreMessages.RenamePackageRefactoring_creating_change, 1);
final RenameJavaElementDescriptor descriptor = createRefactoringDescriptor();
final DynamicValidationRefactoringChange result =
new DynamicValidationRefactoringChange(
descriptor, RefactoringCoreMessages.RenamePackageRefactoring_change_name);
result.addAll(fChangeManager.getAllChanges());
fRenamePackageChange =
new RenamePackageChange(fPackage, getNewElementName(), fRenameSubpackages);
result.add(fRenamePackageChange);
monitor.worked(1);
return result;
} finally {
fChangeManager = null;
fImportsManager = null;
monitor.done();
}
}
示例2: createChange
import org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(RefactoringCoreMessages.RenamePackageRefactoring_creating_change, 1);
final RenameJavaElementDescriptor descriptor= createRefactoringDescriptor();
final DynamicValidationRefactoringChange result= new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenamePackageRefactoring_change_name);
result.addAll(fChangeManager.getAllChanges());
fRenamePackageChange= new RenamePackageChange( fPackage, getNewElementName(), fRenameSubpackages);
result.add(fRenamePackageChange);
monitor.worked(1);
return result;
} finally {
fChangeManager= null;
fImportsManager= null;
monitor.done();
}
}
示例3: prepareChangesInfo
import org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange; //导入依赖的package包/类
/**
* Prepare the information about changes which were applied.
*
* @param changes array of the applied changes
* @param changesInfo prepared list of {@link ChangeInfo}
*/
public void prepareChangesInfo(Change[] changes, List<ChangeInfo> changesInfo) {
for (Change ch : changes) {
if (ch instanceof DynamicValidationStateChange) {
prepareChangesInfo(((DynamicValidationStateChange) ch).getChildren(), changesInfo);
} else {
ChangeInfo changeInfo = DtoFactory.newDto(ChangeInfo.class);
String refactoringName = ch.getName();
if (ch instanceof UndoTextFileChange) {
changeInfo.setName(ChangeInfo.ChangeName.UPDATE);
changeInfo.setPath(((CompilationUnit) ch.getModifiedElement()).getPath().toString());
}
if (refactoringName.startsWith("Rename")) {
if (ch instanceof RenameCompilationUnitChange) {
prepareRenameCompilationUnitChange(changeInfo, ch);
} else if (ch instanceof RenamePackageChange) {
prepareRenamePackageChange(changesInfo, changeInfo, ch);
}
}
if (refactoringName.startsWith("Move")) {
prepareMoveChange(changeInfo, ch);
}
changesInfo.add(changeInfo);
}
}
}
示例4: prepareRenamePackageChange
import org.eclipse.jdt.internal.corext.refactoring.changes.RenamePackageChange; //导入依赖的package包/类
private void prepareRenamePackageChange(
List<ChangeInfo> changesInfo, ChangeInfo changeInfo, Change ch) {
changeInfo.setName(ChangeInfo.ChangeName.RENAME_PACKAGE);
RenamePackageChange renameChange = (RenamePackageChange) ch;
IPath oldPackageName = new Path(renameChange.getOldName().replace('.', IPath.SEPARATOR));
IPath newPackageName = new Path(renameChange.getNewName().replace('.', IPath.SEPARATOR));
changeInfo.setOldPath(
renameChange
.getResourcePath()
.removeLastSegments(oldPackageName.segmentCount())
.append(newPackageName)
.toString());
changeInfo.setPath(renameChange.getResourcePath().toString());
Set<IResource> compilationUnits = renameChange.getFCompilationUnitStamps().keySet();
for (IResource iResource : compilationUnits) {
ChangeInfo change = DtoFactory.newDto(ChangeInfo.class);
change.setName(ChangeInfo.ChangeName.UPDATE);
IPath fullPathOldPath = iResource.getFullPath();
IPath newPath = renameChange.getResourcePath().append(fullPathOldPath.toFile().getName());
change.setOldPath(fullPathOldPath.toString());
change.setPath(newPath.toString());
changesInfo.add(change);
}
}