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


Java RefactoringDescriptor.MULTI_CHANGE属性代码示例

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


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

示例1: getDescriptor

public final ChangeDescriptor getDescriptor() {
	final Map<String, String> arguments= new HashMap<String, String>();
	final int length= fPackageFragments.length;
	final String description= length == 1 ? getDescriptionSingular() : getDescriptionPlural();
	final IProject resource= getSingleProject();
	final String project= resource != null ? resource.getName() : null;
	final String header= length == 1
			? Messages.format(getHeaderPatternSingular(), new String[] { (fPackageFragments[0]).getElementName(), getDestinationLabel() })
			: Messages.format(getHeaderPatternPlural(), new String[] { String.valueOf(length), getDestinationLabel() });
	int flags= JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_MIGRATION | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	arguments.put(ATTRIBUTE_POLICY, getPolicyId());
	arguments.put(ATTRIBUTE_FRAGMENTS, new Integer(fPackageFragments.length).toString());
	for (int offset= 0; offset < fPackageFragments.length; offset++)
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fPackageFragments[offset]));
	arguments.putAll(getRefactoringArguments(project));
	final JavaRefactoringDescriptor descriptor= createRefactoringDescriptor(comment, arguments, description, project, flags);
	return new RefactoringChangeDescriptor(descriptor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:ReorgPolicyFactory.java

示例2: createChange

@Override
public Change createChange(IProgressMonitor pm) throws CoreException {
	// TODO: update for fSelectionStart == -1
	final Map<String, String> arguments= new HashMap<String, String>();
	String project= null;
	IJavaProject javaProject= fSelectionTypeRoot.getJavaProject();
	if (javaProject != null)
		project= javaProject.getElementName();
	final IMethodBinding binding= fSourceProvider.getDeclaration().resolveBinding();
	int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	if (!Modifier.isPrivate(binding.getModifiers()))
		flags|= RefactoringDescriptor.MULTI_CHANGE;
	final String description= Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(binding.getName()));
	final String header= Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_descriptor_description, new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringClass(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.ReplaceInvocationsRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	if (!fTargetProvider.isSingle())
		comment.addSetting(RefactoringCoreMessages.ReplaceInvocationsRefactoring_replace_references);
	final JavaRefactoringDescriptor descriptor= new JavaRefactoringDescriptor(ID_REPLACE_INVOCATIONS, project, description, comment.asString(), arguments, flags){}; //REVIEW Unregistered ID!
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fSelectionTypeRoot));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
	arguments.put(ATTRIBUTE_MODE, new Integer(fTargetProvider.isSingle() ? 0 : 1).toString());
	return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.ReplaceInvocationsRefactoring_change_name, fChangeManager.getAllChanges());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:ReplaceInvocationsRefactoring.java

示例3: createRefactoringDescriptor

private RenameJavaElementDescriptor createRefactoringDescriptor() {
	String project= null;
	IJavaProject javaProject= fPackage.getJavaProject();
	if (javaProject != null)
		project= javaProject.getElementName();
	final int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
	final String description= Messages.format(RefactoringCoreMessages.RenamePackageProcessor_descriptor_description_short, getElementLabel(fPackage));
	final String header= Messages.format(RefactoringCoreMessages.RenamePackageProcessor_descriptor_description, new String[] { getElementLabel(fPackage), getNewElementName()});
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	if (fRenameSubpackages)
		comment.addSetting(RefactoringCoreMessages.RenamePackageProcessor_rename_subpackages);
	final RenameJavaElementDescriptor descriptor= RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_PACKAGE);
	descriptor.setProject(project);
	descriptor.setDescription(description);
	descriptor.setComment(comment.asString());
	descriptor.setFlags(flags);
	descriptor.setJavaElement(fPackage);
	descriptor.setNewName(getNewElementName());
	descriptor.setUpdateReferences(fUpdateReferences);
	descriptor.setUpdateTextualOccurrences(fUpdateTextualMatches);
	descriptor.setUpdateQualifiedNames(fUpdateQualifiedNames);
	if (fUpdateQualifiedNames && fFilePatterns != null && !"".equals(fFilePatterns)) //$NON-NLS-1$
		descriptor.setFileNamePatterns(fFilePatterns);
	descriptor.setUpdateHierarchy(fRenameSubpackages);
	return descriptor;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:RenamePackageProcessor.java

示例4: getDescriptor

public final ChangeDescriptor getDescriptor() {
	final Map<String, String> arguments= new HashMap<String, String>();
	final int length= fPackageFragmentRoots.length;
	final String description= length == 1 ? getDescriptionSingular() : getDescriptionPlural();
	final IProject resource= getSingleProject();
	final String project= resource != null ? resource.getName() : null;
	final String header= length == 1 ? Messages.format(getHeaderPatternSingular(), new String[] { fPackageFragmentRoots[0].getElementName(), getDestinationLabel() }) : Messages.format(
			getHeaderPatternPlural(), new String[] { String.valueOf(length), getDestinationLabel() });
	int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	arguments.put(ATTRIBUTE_POLICY, getPolicyId());
	arguments.put(ATTRIBUTE_ROOTS, new Integer(fPackageFragmentRoots.length).toString());
	for (int offset= 0; offset < fPackageFragmentRoots.length; offset++)
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + 1), JavaRefactoringDescriptorUtil.elementToHandle(project, fPackageFragmentRoots[offset]));
	arguments.putAll(getRefactoringArguments(project));
	final JavaRefactoringDescriptor descriptor= createRefactoringDescriptor(comment, arguments, description, project, flags);
	return new RefactoringChangeDescriptor(descriptor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ReorgPolicyFactory.java

示例5: getDescriptorFlags

protected int getDescriptorFlags() {
  int flags =
      JavaRefactoringDescriptor.JAR_MIGRATION
          | JavaRefactoringDescriptor.JAR_REFACTORING
          | RefactoringDescriptor.STRUCTURAL_CHANGE;
  try {
    if (!Flags.isPrivate(fMethod.getFlags())) flags |= RefactoringDescriptor.MULTI_CHANGE;
    final IType declaring = fMethod.getDeclaringType();
    if (declaring.isAnonymous() || declaring.isLocal())
      flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
  } catch (JavaModelException exception) {
    JavaPlugin.log(exception);
  }
  return flags;
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:ChangeSignatureProcessor.java

示例6: createRefactoringDescriptor

private RenameJavaElementDescriptor createRefactoringDescriptor() {
  String project = null;
  IJavaProject javaProject = fPackage.getJavaProject();
  if (javaProject != null) project = javaProject.getElementName();
  final int flags =
      JavaRefactoringDescriptor.JAR_MIGRATION
          | JavaRefactoringDescriptor.JAR_REFACTORING
          | RefactoringDescriptor.STRUCTURAL_CHANGE
          | RefactoringDescriptor.MULTI_CHANGE;
  final String description =
      Messages.format(
          RefactoringCoreMessages.RenamePackageProcessor_descriptor_description_short,
          getElementLabel(fPackage));
  final String header =
      Messages.format(
          RefactoringCoreMessages.RenamePackageProcessor_descriptor_description,
          new String[] {getElementLabel(fPackage), getNewElementName()});
  final JDTRefactoringDescriptorComment comment =
      new JDTRefactoringDescriptorComment(project, this, header);
  if (fRenameSubpackages)
    comment.addSetting(RefactoringCoreMessages.RenamePackageProcessor_rename_subpackages);
  final RenameJavaElementDescriptor descriptor =
      RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(
          IJavaRefactorings.RENAME_PACKAGE);
  descriptor.setProject(project);
  descriptor.setDescription(description);
  descriptor.setComment(comment.asString());
  descriptor.setFlags(flags);
  descriptor.setJavaElement(fPackage);
  descriptor.setNewName(getNewElementName());
  descriptor.setUpdateReferences(fUpdateReferences);
  descriptor.setUpdateTextualOccurrences(fUpdateTextualMatches);
  descriptor.setUpdateQualifiedNames(fUpdateQualifiedNames);
  if (fUpdateQualifiedNames && fFilePatterns != null && !"".equals(fFilePatterns)) // $NON-NLS-1$
  descriptor.setFileNamePatterns(fFilePatterns);
  descriptor.setUpdateHierarchy(fRenameSubpackages);
  return descriptor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:38,代码来源:RenamePackageProcessor.java

示例7: getDescriptor

public final ChangeDescriptor getDescriptor() {
  final Map<String, String> arguments = new HashMap<String, String>();
  final int length = fPackageFragmentRoots.length;
  final String description = length == 1 ? getDescriptionSingular() : getDescriptionPlural();
  final IProject resource = getSingleProject();
  final String project = resource != null ? resource.getName() : null;
  final String header =
      length == 1
          ? Messages.format(
              getHeaderPatternSingular(),
              new String[] {fPackageFragmentRoots[0].getElementName(), getDestinationLabel()})
          : Messages.format(
              getHeaderPatternPlural(),
              new String[] {String.valueOf(length), getDestinationLabel()});
  int flags = RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
  final JDTRefactoringDescriptorComment comment =
      new JDTRefactoringDescriptorComment(project, this, header);
  arguments.put(ATTRIBUTE_POLICY, getPolicyId());
  arguments.put(ATTRIBUTE_ROOTS, new Integer(fPackageFragmentRoots.length).toString());
  for (int offset = 0; offset < fPackageFragmentRoots.length; offset++)
    arguments.put(
        JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + (offset + 1),
        JavaRefactoringDescriptorUtil.elementToHandle(project, fPackageFragmentRoots[offset]));
  arguments.putAll(getRefactoringArguments(project));
  final JavaRefactoringDescriptor descriptor =
      createRefactoringDescriptor(comment, arguments, description, project, flags);
  return new RefactoringChangeDescriptor(descriptor);
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:ReorgPolicyFactory.java

示例8: JavaRefactoringDescriptor

/**
 * Creates a new java refactoring descriptor.
 *
 * @param id the unique id of the refactoring
 */
protected JavaRefactoringDescriptor(final String id) {
  this(
      id,
      null,
      DescriptorMessages.JavaRefactoringDescriptor_not_available,
      null,
      new HashMap(),
      RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:JavaRefactoringDescriptor.java

示例9: DeleteResourcesDescriptor

/**
 * Creates a new refactoring descriptor.
 *
 * <p>Clients should not instantiated this class but use {@link
 * RefactoringCore#getRefactoringContribution(String)} with {@link #ID} to get the contribution
 * that can create the descriptor.
 */
public DeleteResourcesDescriptor() {
  super(
      ID,
      null,
      RefactoringCoreMessages.RenameResourceDescriptor_unnamed_descriptor,
      null,
      RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
  fDeleteContents = false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:DeleteResourcesDescriptor.java

示例10: RenameResourceDescriptor

/**
 * Creates a new refactoring descriptor.
 *
 * <p>Clients should not instantiated this class but use {@link
 * RefactoringCore#getRefactoringContribution(String)} with {@link #ID} to get the contribution
 * that can create the descriptor.
 */
public RenameResourceDescriptor() {
  super(
      ID,
      null,
      RefactoringCoreMessages.RenameResourceDescriptor_unnamed_descriptor,
      null,
      RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
  fResourcePath = null;
  fNewName = null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:RenameResourceDescriptor.java

示例11: MoveResourcesDescriptor

/**
 * Creates a new refactoring descriptor.
 *
 * <p>Clients should not instantiated this class but use {@link
 * RefactoringCore#getRefactoringContribution(String)} with {@link #ID} to get the contribution
 * that can create the descriptor.
 */
public MoveResourcesDescriptor() {
  super(
      ID,
      null,
      RefactoringCoreMessages.MoveResourcesDescriptor_unnamed_descriptor,
      null,
      RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
  fResourcePathsToMove = null;
  fDestinationPath = null;
  fUpdateReferences = true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:MoveResourcesDescriptor.java

示例12: getDescriptorFlags

protected int getDescriptorFlags() {
	int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE;
	try {
		if (!Flags.isPrivate(fMethod.getFlags()))
			flags|= RefactoringDescriptor.MULTI_CHANGE;
		final IType declaring= fMethod.getDeclaringType();
		if (declaring.isAnonymous() || declaring.isLocal())
			flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	} catch (JavaModelException exception) {
		JavaPlugin.log(exception);
	}
	return flags;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:ChangeSignatureProcessor.java

示例13: createChange

@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	final Map<String, String> arguments= new HashMap<String, String>();
	String project= null;
	IJavaProject javaProject= fTargetMethod.getJavaProject();
	if (javaProject != null)
		project= javaProject.getElementName();
	int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
	final IType declaring= fTargetMethod.getDeclaringType();
	try {
		if (declaring.isLocal() || declaring.isAnonymous())
			flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	} catch (JavaModelException exception) {
		JavaPlugin.log(exception);
	}
	final String description= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fTargetMethod.getElementName()));
	final String header= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description, new String[] { JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(declaring, JavaElementLabels.ALL_FULLY_QUALIFIED)});
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern, JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern, BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryClass, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	if (fUpdateReferences)
		comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
	final IntroduceIndirectionDescriptor descriptor= RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(project, description, comment.asString(), arguments, flags);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryClass));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
	return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection, fTextChangeManager.getAllChanges());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:30,代码来源:IntroduceIndirectionRefactoring.java

示例14: createChange

@Override
public Change createChange(IProgressMonitor pm) throws CoreException {
	try {
		pm.beginTask(RefactoringCoreMessages.InlineConstantRefactoring_preview, 2);
		final Map<String, String> arguments= new HashMap<String, String>();
		String project= null;
		IJavaProject javaProject= fSelectionCu.getJavaProject();
		if (javaProject != null)
			project= javaProject.getElementName();
		int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
		try {
			if (!Flags.isPrivate(fField.getFlags()))
				flags|= RefactoringDescriptor.MULTI_CHANGE;
		} catch (JavaModelException exception) {
			JavaPlugin.log(exception);
		}
		final String description= Messages.format(RefactoringCoreMessages.InlineConstantRefactoring_descriptor_description_short, JavaElementLabels.getElementLabel(fField, JavaElementLabels.ALL_DEFAULT));
		final String header= Messages.format(RefactoringCoreMessages.InlineConstantRefactoring_descriptor_description, new String[] { JavaElementLabels.getElementLabel(fField, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getElementLabel(fField.getParent(), JavaElementLabels.ALL_FULLY_QUALIFIED)});
		final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
		comment.addSetting(Messages.format(RefactoringCoreMessages.InlineConstantRefactoring_original_pattern, JavaElementLabels.getElementLabel(fField, JavaElementLabels.ALL_FULLY_QUALIFIED)));
		if (fRemoveDeclaration)
			comment.addSetting(RefactoringCoreMessages.InlineConstantRefactoring_remove_declaration);
		if (fReplaceAllReferences)
			comment.addSetting(RefactoringCoreMessages.InlineConstantRefactoring_replace_references);
		final InlineConstantDescriptor descriptor= RefactoringSignatureDescriptorFactory.createInlineConstantDescriptor(project, description, comment.asString(), arguments, flags);
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fSelectionCu));
		arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$
		arguments.put(ATTRIBUTE_REMOVE, Boolean.valueOf(fRemoveDeclaration).toString());
		arguments.put(ATTRIBUTE_REPLACE, Boolean.valueOf(fReplaceAllReferences).toString());
		return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.InlineConstantRefactoring_inline, fChanges);
	} finally {
		pm.done();
		fChanges= null;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:35,代码来源:InlineConstantRefactoring.java

示例15: createChange

@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
	final Map<String, String> arguments= new HashMap<String, String>();
	String project= null;
	IJavaProject javaProject= fTargetMethod.getJavaProject();
	if (javaProject != null)
		project= javaProject.getElementName();
	int flags= JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE;
	final IType declaring= fTargetMethod.getDeclaringType();
	try {
		if (declaring.isLocal() || declaring.isAnonymous())
			flags|= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	} catch (JavaModelException exception) {
		JavaPlugin.log(exception);
	}
	final String description= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description_short, BasicElementLabels.getJavaElementName(fTargetMethod.getElementName()));
	final String header= Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_descriptor_description, new String[] { JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(declaring, JavaElementLabels.ALL_FULLY_QUALIFIED)});
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern, JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern, BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	if (fUpdateReferences)
		comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
	final IntroduceIndirectionDescriptor descriptor= RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(project, description, comment.asString(), arguments, flags);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryType));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
	return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection, fTextChangeManager.getAllChanges());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:IntroduceIndirectionRefactoring.java


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