當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。