本文整理汇总了Java中org.eclipse.jdt.core.refactoring.descriptors.MoveMethodDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java MoveMethodDescriptor类的具体用法?Java MoveMethodDescriptor怎么用?Java MoveMethodDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MoveMethodDescriptor类属于org.eclipse.jdt.core.refactoring.descriptors包,在下文中一共展示了MoveMethodDescriptor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMoveMethodDescriptor
import org.eclipse.jdt.core.refactoring.descriptors.MoveMethodDescriptor; //导入依赖的package包/类
public static MoveMethodDescriptor createMoveMethodDescriptor() {
return new MoveMethodDescriptor();
}
示例2: createChange
import org.eclipse.jdt.core.refactoring.descriptors.MoveMethodDescriptor; //导入依赖的package包/类
@Override
public final Change createChange(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
Assert.isNotNull(monitor);
try {
monitor.beginTask("", 6); //$NON-NLS-1$
monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_creating);
final TextChange[] changes= fChangeManager.getAllChanges();
if (changes.length == 1)
return changes[0];
final List<TextChange> list= new ArrayList<TextChange>(changes.length);
list.addAll(Arrays.asList(changes));
final Map<String, String> arguments= new HashMap<String, String>();
String project= null;
final IJavaProject javaProject= fMethod.getJavaProject();
if (javaProject != null)
project= javaProject.getElementName();
int flags= JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
final IType declaring= fMethod.getDeclaringType();
try {
if (declaring.isAnonymous() || declaring.isLocal())
flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
} catch (JavaModelException exception) {
JavaPlugin.log(exception);
}
final String description= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fMethod.getElementName()));
final String header= Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED) });
final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_moved_element_pattern, RefactoringCoreMessages.JavaRefactoringDescriptor_not_available));
comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_target_element_pattern, BindingLabelProvider.getBindingLabel(fTarget, JavaElementLabels.ALL_FULLY_QUALIFIED)));
comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_method_name_pattern, BasicElementLabels.getJavaElementName(getMethodName())));
if (needsTargetNode())
comment.addSetting(Messages.format(RefactoringCoreMessages.MoveInstanceMethodProcessor_parameter_name_pattern, BasicElementLabels.getJavaElementName(getTargetName())));
final MoveMethodDescriptor descriptor= RefactoringSignatureDescriptorFactory.createMoveMethodDescriptor(project, description, comment.asString(), arguments, flags);
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fMethod));
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fMethodName);
arguments.put(ATTRIBUTE_TARGET_NAME, fTargetName);
arguments.put(ATTRIBUTE_DEPRECATE, Boolean.valueOf(fDelegateDeprecation).toString());
arguments.put(ATTRIBUTE_REMOVE, Boolean.valueOf(fRemove).toString());
arguments.put(ATTRIBUTE_INLINE, Boolean.valueOf(fInline).toString());
arguments.put(ATTRIBUTE_USE_GETTER, Boolean.valueOf(fUseGetters).toString());
arguments.put(ATTRIBUTE_USE_SETTER, Boolean.valueOf(fUseSetters).toString());
arguments.put(ATTRIBUTE_TARGET_INDEX, new Integer(getTargetIndex()).toString());
return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.MoveInstanceMethodRefactoring_name, list.toArray(new Change[list.size()]));
} finally {
monitor.done();
}
}