本文整理汇总了Java中org.eclipse.ltk.core.refactoring.resource.RenameResourceChange类的典型用法代码示例。如果您正苦于以下问题:Java RenameResourceChange类的具体用法?Java RenameResourceChange怎么用?Java RenameResourceChange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RenameResourceChange类属于org.eclipse.ltk.core.refactoring.resource包,在下文中一共展示了RenameResourceChange类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createChange
import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; //导入依赖的package包/类
public Change createChange(IProgressMonitor pm) throws CoreException {
pm.beginTask("", 1); // $NON-NLS-1$
try {
RenameResourceChange change =
new RenameResourceChange(fResource.getFullPath(), getNewResourceName());
change.setDescriptor(new RefactoringChangeDescriptor(createDescriptor()));
return change;
} finally {
pm.done();
}
}
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:RenameResourceProcessor.java
示例2: createChange
import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; //导入依赖的package包/类
@Override
public List<? extends Change> createChange(IProgressMonitor monitor) throws CoreException {
List<Change> result = new ArrayList<Change>();
// rename img files with the diagram
IContainer parent = affectedDiagram.getParent();
if (parent != null) {
IFile pngFile = affectedDiagram.getProject().getFile(affectedDiagram.getProjectRelativePath().removeFileExtension().addFileExtension("png"));
if (pngFile.exists()) {
result.add(new RenameResourceChange(pngFile.getFullPath(), getTargetname(pngFile, affectedDiagram)));
}
}
return result;
}
开发者ID:umlet,项目名称:umlet,代码行数:14,代码来源:RenamePngProcessor.java
示例3: createChange
import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(RefactoringCoreMessages.RenameTypeRefactoring_creating_change, 4);
String project = null;
IJavaProject javaProject = fType.getJavaProject();
if (javaProject != null) project = javaProject.getElementName();
int flags =
JavaRefactoringDescriptor.JAR_MIGRATION
| JavaRefactoringDescriptor.JAR_REFACTORING
| RefactoringDescriptor.STRUCTURAL_CHANGE;
try {
if (!Flags.isPrivate(fType.getFlags())) flags |= RefactoringDescriptor.MULTI_CHANGE;
if (fType.isAnonymous() || fType.isLocal())
flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
} catch (JavaModelException exception) {
JavaPlugin.log(exception);
}
final String description =
Messages.format(
RefactoringCoreMessages.RenameTypeProcessor_descriptor_description_short,
BasicElementLabels.getJavaElementName(fType.getElementName()));
final String header =
Messages.format(
RefactoringCoreMessages.RenameTypeProcessor_descriptor_description,
new String[] {
JavaElementLabels.getElementLabel(fType, JavaElementLabels.ALL_FULLY_QUALIFIED),
getNewElementLabel()
});
final String comment = new JDTRefactoringDescriptorComment(project, this, header).asString();
final RenameJavaElementDescriptor descriptor =
RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(
IJavaRefactorings.RENAME_TYPE);
descriptor.setProject(project);
descriptor.setDescription(description);
descriptor.setComment(comment);
descriptor.setFlags(flags);
descriptor.setJavaElement(fType);
descriptor.setNewName(getNewElementName());
descriptor.setUpdateQualifiedNames(fUpdateQualifiedNames);
descriptor.setUpdateTextualOccurrences(fUpdateTextualMatches);
descriptor.setUpdateReferences(fUpdateReferences);
if (fUpdateQualifiedNames
&& fFilePatterns != null
&& !"".equals(fFilePatterns)) // $NON-NLS-1$
descriptor.setFileNamePatterns(fFilePatterns);
descriptor.setUpdateSimilarDeclarations(fUpdateSimilarElements);
descriptor.setMatchStrategy(fRenamingStrategy);
final DynamicValidationRefactoringChange result =
new DynamicValidationRefactoringChange(
descriptor, RefactoringCoreMessages.RenameTypeProcessor_change_name);
if (fChangeManager.containsChangesIn(fType.getCompilationUnit())) {
TextChange textChange = fChangeManager.get(fType.getCompilationUnit());
if (textChange instanceof TextFileChange) {
((TextFileChange) textChange).setSaveMode(TextFileChange.FORCE_SAVE);
}
}
result.addAll(fChangeManager.getAllChanges());
if (willRenameCU()) {
IResource resource = fType.getCompilationUnit().getResource();
if (resource != null && resource.isLinked()) {
String ext = resource.getFileExtension();
String renamedResourceName;
if (ext == null) renamedResourceName = getNewElementName();
else renamedResourceName = getNewElementName() + '.' + ext;
result.add(
new RenameResourceChange(fType.getCompilationUnit().getPath(), renamedResourceName));
} else {
String renamedCUName =
JavaModelUtil.getRenamedCUName(fType.getCompilationUnit(), getNewElementName());
result.add(new RenameCompilationUnitChange(fType.getCompilationUnit(), renamedCUName));
}
}
monitor.worked(1);
return result;
} finally {
fChangeManager = null;
}
}
开发者ID:eclipse,项目名称:che,代码行数:81,代码来源:RenameTypeProcessor.java
示例4: createChange
import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange; //导入依赖的package包/类
@Override
public Change createChange(IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(RefactoringCoreMessages.RenameTypeRefactoring_creating_change, 4);
String project= null;
IJavaProject javaProject= fType.getJavaProject();
if (javaProject != null)
project= javaProject.getElementName();
int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE;
try {
if (!Flags.isPrivate(fType.getFlags()))
flags|= RefactoringDescriptor.MULTI_CHANGE;
if (fType.isAnonymous() || fType.isLocal())
flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
} catch (JavaModelException exception) {
JavaPlugin.log(exception);
}
final String description= Messages.format(RefactoringCoreMessages.RenameTypeProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fType.getElementName()));
final String header= Messages.format(RefactoringCoreMessages.RenameTypeProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fType, JavaElementLabels.ALL_FULLY_QUALIFIED), getNewElementLabel()});
final String comment= new JDTRefactoringDescriptorComment(project, this, header).asString();
final RenameJavaElementDescriptor descriptor= RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_TYPE);
descriptor.setProject(project);
descriptor.setDescription(description);
descriptor.setComment(comment);
descriptor.setFlags(flags);
descriptor.setJavaElement(fType);
descriptor.setNewName(getNewElementName());
descriptor.setUpdateQualifiedNames(fUpdateQualifiedNames);
descriptor.setUpdateTextualOccurrences(fUpdateTextualMatches);
descriptor.setUpdateReferences(fUpdateReferences);
if (fUpdateQualifiedNames && fFilePatterns != null && !"".equals(fFilePatterns)) //$NON-NLS-1$
descriptor.setFileNamePatterns(fFilePatterns);
descriptor.setUpdateSimilarDeclarations(fUpdateSimilarElements);
descriptor.setMatchStrategy(fRenamingStrategy);
final DynamicValidationRefactoringChange result= new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.RenameTypeProcessor_change_name);
if (fChangeManager.containsChangesIn(fType.getCompilationUnit())) {
TextChange textChange= fChangeManager.get(fType.getCompilationUnit());
if (textChange instanceof TextFileChange) {
((TextFileChange) textChange).setSaveMode(TextFileChange.FORCE_SAVE);
}
}
result.addAll(fChangeManager.getAllChanges());
if (willRenameCU()) {
IResource resource= fType.getCompilationUnit().getResource();
if (resource != null && resource.isLinked()) {
String ext= resource.getFileExtension();
String renamedResourceName;
if (ext == null)
renamedResourceName= getNewElementName();
else
renamedResourceName= getNewElementName() + '.' + ext;
result.add(new RenameResourceChange(fType.getCompilationUnit().getPath(), renamedResourceName));
} else {
String renamedCUName= JavaModelUtil.getRenamedCUName(fType.getCompilationUnit(), getNewElementName());
result.add(new RenameCompilationUnitChange(fType.getCompilationUnit(), renamedCUName));
}
}
monitor.worked(1);
return result;
} finally {
fChangeManager= null;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:65,代码来源:RenameTypeProcessor.java
注:本文中的org.eclipse.ltk.core.refactoring.resource.RenameResourceChange类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论