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


Java FixCorrectionProposal类代码示例

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


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

示例1: getUnnecessaryNLSTagProposals

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void getUnnecessaryNLSTagProposals(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals)
    throws CoreException {
  IProposableFix fix = StringFix.createFix(context.getASTRoot(), problem, true, false);
  if (fix != null) {
    Image image =
        JavaPluginImages.get(
            JavaPluginImages
                .IMG_TOOL_DELETE); // JavaPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE);
    Map<String, String> options = new Hashtable<String, String>();
    options.put(CleanUpConstants.REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new StringCleanUp(options),
            IProposalRelevance.UNNECESSARY_NLS_TAG,
            image,
            context);
    proposal.setCommandId(REMOVE_UNNECESSARY_NLS_TAG_ID);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:LocalCorrectionsSubProcessor.java

示例2: addUnnecessaryCastProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addUnnecessaryCastProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  IProposableFix fix = UnusedCodeFix.createRemoveUnusedCastFix(context.getASTRoot(), problem);
  if (fix != null) {
    Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    Map<String, String> options = new Hashtable<String, String>();
    options.put(CleanUpConstants.REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new UnnecessaryCodeCleanUp(options),
            IProposalRelevance.REMOVE_UNUSED_CAST,
            image,
            context);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:LocalCorrectionsSubProcessor.java

示例3: addUnqualifiedFieldAccessProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addUnqualifiedFieldAccessProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  IProposableFix fix = CodeStyleFix.createAddFieldQualifierFix(context.getASTRoot(), problem);
  if (fix != null) {
    Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    Map<String, String> options = new HashMap<String, String>();
    options.put(CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.TRUE);
    options.put(
        CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new CodeStyleCleanUp(options),
            IProposalRelevance.ADD_FIELD_QUALIFIER,
            image,
            context);
    proposal.setCommandId(ADD_FIELD_QUALIFICATION_ID);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:LocalCorrectionsSubProcessor.java

示例4: addRemoveRedundantTypeArgumentsProposals

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addRemoveRedundantTypeArgumentsProposals(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  IProposableFix fix =
      TypeParametersFix.createRemoveRedundantTypeArgumentsFix(context.getASTRoot(), problem);
  if (fix != null) {
    Image image =
        JavaPluginImages.get(
            JavaPluginImages
                .IMG_TOOL_DELETE); // JavaPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_DELETE);
    Map<String, String> options = new HashMap<String, String>();
    options.put(CleanUpConstants.USE_TYPE_ARGUMENTS, CleanUpOptions.TRUE);
    options.put(CleanUpConstants.REMOVE_REDUNDANT_TYPE_ARGUMENTS, CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new TypeParametersCleanUp(options),
            IProposalRelevance.REMOVE_REDUNDANT_TYPE_ARGUMENTS,
            image,
            context);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:LocalCorrectionsSubProcessor.java

示例5: addRemoveRedundantAnnotationProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addRemoveRedundantAnnotationProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  NullAnnotationsFix fix =
      NullAnnotationsFix.createRemoveRedundantNullAnnotationsFix(context.getASTRoot(), problem);
  if (fix == null) return;

  Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
  Map<String, String> options = new Hashtable<String, String>();
  FixCorrectionProposal proposal =
      new FixCorrectionProposal(
          fix,
          new NullAnnotationsCleanUp(options, problem.getProblemId()),
          IProposalRelevance.REMOVE_REDUNDANT_NULLNESS_ANNOTATION,
          image,
          context);
  proposals.add(proposal);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:NullAnnotationsCorrectionProcessor.java

示例6: addMakeTypeAbstractProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static void addMakeTypeAbstractProposal(
    IInvocationContext context,
    TypeDeclaration parentTypeDecl,
    Collection<ICommandAccess> proposals) {
  MakeTypeAbstractOperation operation =
      new UnimplementedCodeFix.MakeTypeAbstractOperation(parentTypeDecl);

  String label =
      Messages.format(
          CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description,
          BasicElementLabels.getJavaElementName(parentTypeDecl.getName().getIdentifier()));
  UnimplementedCodeFix fix =
      new UnimplementedCodeFix(
          label, context.getASTRoot(), new CompilationUnitRewriteOperation[] {operation});

  Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
  FixCorrectionProposal proposal =
      new FixCorrectionProposal(
          fix, null, IProposalRelevance.MAKE_TYPE_ABSTRACT_FIX, image, context);
  proposals.add(proposal);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ModifierCorrectionSubProcessor.java

示例7: addOverrideAnnotationProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addOverrideAnnotationProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  IProposableFix fix = Java50Fix.createAddOverrideAnnotationFix(context.getASTRoot(), problem);
  if (fix != null) {
    Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    Map<String, String> options = new Hashtable<String, String>();
    options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
    options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
    options.put(
        CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION,
        CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new Java50CleanUp(options),
            IProposalRelevance.ADD_OVERRIDE_ANNOTATION,
            image,
            context);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ModifierCorrectionSubProcessor.java

示例8: addDeprecatedAnnotationProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
public static void addDeprecatedAnnotationProposal(
    IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {
  IProposableFix fix = Java50Fix.createAddDeprectatedAnnotation(context.getASTRoot(), problem);
  if (fix != null) {
    Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
    Map<String, String> options = new Hashtable<String, String>();
    options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
    options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
    FixCorrectionProposal proposal =
        new FixCorrectionProposal(
            fix,
            new Java50CleanUp(options),
            IProposalRelevance.ADD_DEPRECATED_ANNOTATION,
            image,
            context);
    proposals.add(proposal);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ModifierCorrectionSubProcessor.java

示例9: getRemoveBlockProposals

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getRemoveBlockProposals(
    IInvocationContext context,
    ASTNode coveringNode,
    Collection<ICommandAccess> resultingCollections) {
  IProposableFix[] fixes =
      ControlStatementsFix.createRemoveBlockFix(context.getASTRoot(), coveringNode);
  if (fixes != null) {
    if (resultingCollections == null) {
      return true;
    }
    Map<String, String> options = new Hashtable<String, String>();
    options.put(CleanUpConstants.CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.TRUE);
    options.put(CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.TRUE);
    ICleanUp cleanUp = new ControlStatementsCleanUp(options);
    for (int i = 0; i < fixes.length; i++) {
      IProposableFix fix = fixes[i];
      Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
      FixCorrectionProposal proposal =
          new FixCorrectionProposal(
              fix, cleanUp, IProposalRelevance.REMOVE_BLOCK_FIX, image, context);
      resultingCollections.add(proposal);
    }
    return true;
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:QuickAssistProcessor.java

示例10: getConvertForLoopProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getConvertForLoopProposal(
    IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
  ForStatement forStatement = getEnclosingForStatementHeader(node);
  if (forStatement == null) return false;

  if (resultingCollections == null) return true;

  IProposableFix fix =
      ConvertLoopFix.createConvertForLoopToEnhancedFix(context.getASTRoot(), forStatement);
  if (fix == null) return false;

  Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
  Map<String, String> options = new HashMap<String, String>();
  options.put(
      CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
  ICleanUp cleanUp = new ConvertLoopCleanUp(options);
  FixCorrectionProposal proposal =
      new FixCorrectionProposal(
          fix, cleanUp, IProposalRelevance.CONVERT_FOR_LOOP_TO_ENHANCED, image, context);
  proposal.setCommandId(CONVERT_FOR_LOOP_ID);

  resultingCollections.add(proposal);
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:QuickAssistProcessor.java

示例11: getConvertIterableLoopProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getConvertIterableLoopProposal(
    IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
  ForStatement forStatement = getEnclosingForStatementHeader(node);
  if (forStatement == null) return false;

  if (resultingCollections == null) return true;

  IProposableFix fix =
      ConvertLoopFix.createConvertIterableLoopToEnhancedFix(context.getASTRoot(), forStatement);
  if (fix == null) return false;

  Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
  Map<String, String> options = new HashMap<String, String>();
  options.put(
      CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
  ICleanUp cleanUp = new ConvertLoopCleanUp(options);
  FixCorrectionProposal proposal =
      new FixCorrectionProposal(
          fix, cleanUp, IProposalRelevance.CONVERT_ITERABLE_LOOP_TO_ENHANCED, image, context);
  proposal.setCommandId(CONVERT_FOR_LOOP_ID);

  resultingCollections.add(proposal);
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:QuickAssistProcessor.java

示例12: getRemoveBlockProposals

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getRemoveBlockProposals(IInvocationContext context, ASTNode coveringNode, Collection<ICommandAccess> resultingCollections) {
	IProposableFix[] fixes= ControlStatementsFix.createRemoveBlockFix(context.getASTRoot(), coveringNode);
	if (fixes != null) {
		if (resultingCollections == null) {
			return true;
		}
		Map<String, String> options= new Hashtable<String, String>();
		options.put(CleanUpConstants.CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.TRUE);
		options.put(CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.TRUE);
		ICleanUp cleanUp= new ControlStatementsCleanUp(options);
		for (int i= 0; i < fixes.length; i++) {
			IProposableFix fix= fixes[i];
			Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
			FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.REMOVE_BLOCK_FIX, image, context);
			resultingCollections.add(proposal);
		}
		return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:QuickAssistProcessor.java

示例13: getConvertForLoopProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getConvertForLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	ForStatement forStatement= getEnclosingForStatementHeader(node);
	if (forStatement == null)
		return false;

	if (resultingCollections == null)
		return true;

	IProposableFix fix= ConvertLoopFix.createConvertForLoopToEnhancedFix(context.getASTRoot(), forStatement);
	if (fix == null)
		return false;

	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	Map<String, String> options= new HashMap<String, String>();
	options.put(CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
	ICleanUp cleanUp= new ConvertLoopCleanUp(options);
	FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.CONVERT_FOR_LOOP_TO_ENHANCED, image, context);
	proposal.setCommandId(CONVERT_FOR_LOOP_ID);

	resultingCollections.add(proposal);
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:QuickAssistProcessor.java

示例14: getConvertIterableLoopProposal

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getConvertIterableLoopProposal(IInvocationContext context, ASTNode node, Collection<ICommandAccess> resultingCollections) {
	ForStatement forStatement= getEnclosingForStatementHeader(node);
	if (forStatement == null)
		return false;

	if (resultingCollections == null)
		return true;

	IProposableFix fix= ConvertLoopFix.createConvertIterableLoopToEnhancedFix(context.getASTRoot(), forStatement);
	if (fix == null)
		return false;

	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	Map<String, String> options= new HashMap<String, String>();
	options.put(CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.TRUE);
	ICleanUp cleanUp= new ConvertLoopCleanUp(options);
	FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.CONVERT_ITERABLE_LOOP_TO_ENHANCED, image, context);
	proposal.setCommandId(CONVERT_FOR_LOOP_ID);

	resultingCollections.add(proposal);
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:QuickAssistProcessor.java

示例15: getMakeVariableDeclarationFinalProposals

import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal; //导入依赖的package包/类
private static boolean getMakeVariableDeclarationFinalProposals(IInvocationContext context, Collection<ICommandAccess> resultingCollections) {
	SelectionAnalyzer analyzer= new SelectionAnalyzer(Selection.createFromStartLength(context.getSelectionOffset(), context.getSelectionLength()), false);
	context.getASTRoot().accept(analyzer);
	ASTNode[] selectedNodes= analyzer.getSelectedNodes();
	if (selectedNodes.length == 0)
		return false;

	IProposableFix fix= VariableDeclarationFix.createChangeModifierToFinalFix(context.getASTRoot(), selectedNodes);
	if (fix == null)
		return false;

	if (resultingCollections == null)
		return true;

	Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
	Map<String, String> options= new Hashtable<String, String>();
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.TRUE);
	options.put(CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
	VariableDeclarationCleanUp cleanUp= new VariableDeclarationCleanUp(options);
	FixCorrectionProposal proposal= new FixCorrectionProposal(fix, cleanUp, IProposalRelevance.MAKE_VARIABLE_DECLARATION_FINAL, image, context);
	resultingCollections.add(proposal);
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:QuickAssistProcessor.java


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