當前位置: 首頁>>代碼示例>>Java>>正文


Java MoveMethodDescriptor類代碼示例

本文整理匯總了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();
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:4,代碼來源:RefactoringSignatureDescriptorFactory.java

示例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();
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:48,代碼來源:MoveInstanceMethodProcessor.java


注:本文中的org.eclipse.jdt.core.refactoring.descriptors.MoveMethodDescriptor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。