当前位置: 首页>>代码示例>>Java>>正文


Java RefactoringContribution.retrieveArgumentMap方法代码示例

本文整理汇总了Java中org.eclipse.ltk.core.refactoring.RefactoringContribution.retrieveArgumentMap方法的典型用法代码示例。如果您正苦于以下问题:Java RefactoringContribution.retrieveArgumentMap方法的具体用法?Java RefactoringContribution.retrieveArgumentMap怎么用?Java RefactoringContribution.retrieveArgumentMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ltk.core.refactoring.RefactoringContribution的用法示例。


在下文中一共展示了RefactoringContribution.retrieveArgumentMap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRefactoringDescriptor

import org.eclipse.ltk.core.refactoring.RefactoringContribution; //导入方法依赖的package包/类
private IntroduceParameterDescriptor getRefactoringDescriptor() {
	ChangeMethodSignatureDescriptor extended= (ChangeMethodSignatureDescriptor) fChangeSignatureProcessor.createDescriptor();
	RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(IJavaRefactorings.CHANGE_METHOD_SIGNATURE);

	Map<String, String> argumentsMap= contribution.retrieveArgumentMap(extended);

	final Map<String, String> arguments= new HashMap<String, String>();
	arguments.put(ATTRIBUTE_ARGUMENT, fParameter.getNewName());
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
	arguments.putAll(argumentsMap);
	String signature= fChangeSignatureProcessor.getMethodName();
	try {
		signature= fChangeSignatureProcessor.getOldMethodSignature();
	} catch (JavaModelException exception) {
		JavaPlugin.log(exception);
	}
	final String description= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fChangeSignatureProcessor.getMethod().getElementName()));
	final String header= Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(fParameter.getNewName()), signature, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))});
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(extended.getProject(), this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_original_pattern, JavaElementLabels.getTextLabel(fChangeSignatureProcessor.getMethod(),
			JavaElementLabels.ALL_FULLY_QUALIFIED)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_expression_pattern, BasicElementLabels.getJavaCodeString(ASTNodes.asString(fSelectedExpression))));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceParameterRefactoring_parameter_pattern, BasicElementLabels.getJavaElementName(getAddedParameterInfo().getNewName())));
	return RefactoringSignatureDescriptorFactory.createIntroduceParameterDescriptor(extended.getProject(), description, comment.asString(), arguments, extended.getFlags());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:IntroduceParameterRefactoring.java

示例2: executionNotification

import org.eclipse.ltk.core.refactoring.RefactoringContribution; //导入方法依赖的package包/类
@Override
public void executionNotification(RefactoringExecutionEvent event) {
	refactoringName = getRefactoringID(event);
	int refactoringEventType = event.getEventType();
	RefactoringDescriptor refactoringDescriptor = getRefactoringDescriptorFromEvent(event);
	RefactoringContribution refactoringContribution = RefactoringCore.getRefactoringContribution(refactoringName);
	Map argumentMap = refactoringContribution.retrieveArgumentMap(refactoringDescriptor);
	
	if (refactoringEventType == RefactoringExecutionEvent.ABOUT_TO_PERFORM || refactoringEventType == RefactoringExecutionEvent.ABOUT_TO_REDO) {
		isRefactoringInProgress = true;
		clientRecorder.recordRefactoring(refactoringName, argumentMap);
	}
	
	if (refactoringEventType == RefactoringExecutionEvent.ABOUT_TO_UNDO) {
		isRefactoringInProgress = true;
		clientRecorder.recordRefactoringUndo(refactoringName, argumentMap);
	}
	
	if (refactoringEventType == RefactoringExecutionEvent.PERFORMED || refactoringEventType == RefactoringExecutionEvent.REDONE || refactoringEventType == RefactoringExecutionEvent.UNDONE) {
		isRefactoringInProgress = false;
		clientRecorder.recordRefactoringEnd(refactoringName, argumentMap);
		refactoringName = "";
	}
}
 
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:25,代码来源:RefactoringExecutionListener.java

示例3: getArgumentMap

import org.eclipse.ltk.core.refactoring.RefactoringContribution; //导入方法依赖的package包/类
/**
 * Returns the argument map of the specified descriptor.
 *
 * @param descriptor the refactoring descriptor
 * @return the argument map, or <code>null</code>
 */
public static Map getArgumentMap(final RefactoringDescriptor descriptor) {
  Map arguments = null;
  final RefactoringContribution contribution =
      RefactoringContributionManager.getInstance().getRefactoringContribution(descriptor.getID());
  if (contribution != null) arguments = contribution.retrieveArgumentMap(descriptor);
  else if (descriptor instanceof DefaultRefactoringDescriptor)
    arguments = ((DefaultRefactoringDescriptor) descriptor).getArguments();
  return arguments;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:RefactoringHistoryManager.java

示例4: createRefactoringContext

import org.eclipse.ltk.core.refactoring.RefactoringContribution; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected RefactoringContext createRefactoringContext(RefactoringDescriptor descriptor, RefactoringStatus status, IProgressMonitor monitor) throws CoreException {
	Assert.isNotNull(descriptor);

	createNecessarySourceCode(monitor);

	if (descriptor instanceof JavaRefactoringDescriptor) {
		JavaRefactoringDescriptor javaDescriptor= (JavaRefactoringDescriptor) descriptor;
		RefactoringContribution contribution= RefactoringCore.getRefactoringContribution(javaDescriptor.getID());

		Map<String, String> map= contribution.retrieveArgumentMap(descriptor);
		if (fJavaProject == null) {
			status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments));
			return null;
		}

		String name= fJavaProject.getElementName();

		String handle= map.get(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT);
		if (handle != null && handle.length() > 0)
			map.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, getTransformedHandle(name, handle));

		int count= 1;
		String attribute= JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + count;
		while ((handle= map.get(attribute)) != null) {
			if (handle.length() > 0)
				map.put(attribute, getTransformedHandle(name, handle));
			count++;
			attribute= JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + count;
		}

		// create adapted descriptor
		try {
			descriptor= contribution.createDescriptor(descriptor.getID(), name, descriptor.getDescription(), descriptor.getComment(), map, descriptor.getFlags());
		} catch (IllegalArgumentException e) {
			status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.InitializableRefactoring_inacceptable_arguments));
			return null;
		}
	}
	return descriptor.createRefactoringContext(status);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:BinaryRefactoringHistoryWizard.java


注:本文中的org.eclipse.ltk.core.refactoring.RefactoringContribution.retrieveArgumentMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。