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


Java ConvertAnonymousDescriptor类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.refactoring.descriptors.ConvertAnonymousDescriptor的典型用法代码示例。如果您正苦于以下问题:Java ConvertAnonymousDescriptor类的具体用法?Java ConvertAnonymousDescriptor怎么用?Java ConvertAnonymousDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createRefactoringDescriptor

import org.eclipse.jdt.core.refactoring.descriptors.ConvertAnonymousDescriptor; //导入依赖的package包/类
private RefactoringChangeDescriptor createRefactoringDescriptor() {
	final ITypeBinding binding= fAnonymousInnerClassNode.resolveBinding();
	final String[] labels= new String[] { BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)};
	final Map<String, String> arguments= new HashMap<String, String>();
	final String projectName= fCu.getJavaProject().getElementName();
	final int flags= RefactoringDescriptor.STRUCTURAL_CHANGE | JavaRefactoringDescriptor.JAR_REFACTORING | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
	final String description= RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description_short;
	final String header= Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description, labels);
	final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(projectName, this, header);
	comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_original_pattern, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
	comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_class_name_pattern, BasicElementLabels.getJavaElementName(fClassName)));
	String visibility= JdtFlags.getVisibilityString(fVisibility);
	if (visibility.length() == 0)
		visibility= RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_default_visibility;
	comment.addSetting(Messages.format(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_visibility_pattern, visibility));
	if (fDeclareFinal && fDeclareStatic)
		comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final_static);
	else if (fDeclareFinal)
		comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final);
	else if (fDeclareStatic)
		comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_static);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(projectName, fCu));
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fClassName);
	arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + ' ' + new Integer(fSelectionLength).toString());
	arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString());
	arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString());
	arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString());

	ConvertAnonymousDescriptor descriptor= RefactoringSignatureDescriptorFactory.createConvertAnonymousDescriptor(projectName, description, comment.asString(), arguments, flags);
	return new RefactoringChangeDescriptor(descriptor);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ConvertAnonymousToNestedRefactoring.java

示例2: createRefactoringDescriptor

import org.eclipse.jdt.core.refactoring.descriptors.ConvertAnonymousDescriptor; //导入依赖的package包/类
private RefactoringChangeDescriptor createRefactoringDescriptor() {
  final ITypeBinding binding = fAnonymousInnerClassNode.resolveBinding();
  final String[] labels =
      new String[] {
        BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED),
        BindingLabelProvider.getBindingLabel(
            binding.getDeclaringMethod(), JavaElementLabels.ALL_FULLY_QUALIFIED)
      };
  final Map<String, String> arguments = new HashMap<String, String>();
  final String projectName = fCu.getJavaProject().getElementName();
  final int flags =
      RefactoringDescriptor.STRUCTURAL_CHANGE
          | JavaRefactoringDescriptor.JAR_REFACTORING
          | JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;
  final String description =
      RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description_short;
  final String header =
      Messages.format(
          RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_descriptor_description,
          labels);
  final JDTRefactoringDescriptorComment comment =
      new JDTRefactoringDescriptorComment(projectName, this, header);
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_original_pattern,
          BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED)));
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_class_name_pattern,
          BasicElementLabels.getJavaElementName(fClassName)));
  String visibility = JdtFlags.getVisibilityString(fVisibility);
  if (visibility.length() == 0)
    visibility = RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_default_visibility;
  comment.addSetting(
      Messages.format(
          RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_visibility_pattern,
          visibility));
  if (fDeclareFinal && fDeclareStatic)
    comment.addSetting(
        RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final_static);
  else if (fDeclareFinal)
    comment.addSetting(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_final);
  else if (fDeclareStatic)
    comment.addSetting(
        RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_declare_static);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT,
      JavaRefactoringDescriptorUtil.elementToHandle(projectName, fCu));
  arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fClassName);
  arguments.put(
      JavaRefactoringDescriptorUtil.ATTRIBUTE_SELECTION,
      new Integer(fSelectionStart).toString() + ' ' + new Integer(fSelectionLength).toString());
  arguments.put(ATTRIBUTE_FINAL, Boolean.valueOf(fDeclareFinal).toString());
  arguments.put(ATTRIBUTE_STATIC, Boolean.valueOf(fDeclareStatic).toString());
  arguments.put(ATTRIBUTE_VISIBILITY, new Integer(fVisibility).toString());

  ConvertAnonymousDescriptor descriptor =
      RefactoringSignatureDescriptorFactory.createConvertAnonymousDescriptor(
          projectName, description, comment.asString(), arguments, flags);
  return new RefactoringChangeDescriptor(descriptor);
}
 
开发者ID:eclipse,项目名称:che,代码行数:62,代码来源:ConvertAnonymousToNestedRefactoring.java

示例3: createConvertAnonymousDescriptor

import org.eclipse.jdt.core.refactoring.descriptors.ConvertAnonymousDescriptor; //导入依赖的package包/类
public static ConvertAnonymousDescriptor createConvertAnonymousDescriptor() {
  return new ConvertAnonymousDescriptor();
}
 
开发者ID:eclipse,项目名称:che,代码行数:4,代码来源:RefactoringSignatureDescriptorFactory.java


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