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


Java CleanUpOptions类代码示例

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


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

示例1: getCleanUpOptions

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的package包/类
private static Map<String, String> getCleanUpOptions(IBinding binding, boolean removeAll) {
  Map<String, String> result = new Hashtable<String, String>();

  result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.TRUE);
  switch (binding.getKind()) {
    case IBinding.TYPE:
      result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
      break;
    case IBinding.METHOD:
      if (((IMethodBinding) binding).isConstructor()) {
        result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
      } else {
        result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
      }
      break;
    case IBinding.VARIABLE:
      if (removeAll) return null;

      result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
      result.put(CleanUpConstants.REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.TRUE);
      break;
  }

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:UnusedCodeFix.java

示例2: getUnnecessaryNLSTagProposals

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例3: addUnnecessaryCastProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例4: addUnqualifiedFieldAccessProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例5: addRemoveRedundantTypeArgumentsProposals

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例6: addOverrideAnnotationProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例7: addDeprecatedAnnotationProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例8: getRemoveBlockProposals

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例9: getConvertForLoopProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例10: getConvertIterableLoopProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例11: loadSaveParticipantOptions

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的package包/类
public static Map<String, String> loadSaveParticipantOptions(IScopeContext context) {
	IEclipsePreferences node;
	if (hasSettingsInScope(context)) {
		node= context.getNode(JavaUI.ID_PLUGIN);
	} else {
		IScopeContext instanceScope= InstanceScope.INSTANCE;
		if (hasSettingsInScope(instanceScope)) {
			node= instanceScope.getNode(JavaUI.ID_PLUGIN);
		} else {
			return JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getMap();
		}
	}

	Map<String, String> result= new HashMap<String, String>();
	Set<String> keys= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS).getKeys();
	for (Iterator<String> iterator= keys.iterator(); iterator.hasNext();) {
        String key= iterator.next();
        result.put(key, node.get(SAVE_PARTICIPANT_KEY_PREFIX + key, CleanUpOptions.FALSE));
       }

	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:CleanUpPreferenceUtil.java

示例12: getCleanUpOptions

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的package包/类
private static Map<String, String> getCleanUpOptions(IBinding binding, boolean removeAll) {
	Map<String, String> result= new Hashtable<String, String>();

	result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.TRUE);
	switch (binding.getKind()) {
		case IBinding.TYPE:
			result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
			break;
		case IBinding.METHOD:
			if (((IMethodBinding) binding).isConstructor()) {
				result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
			} else {
				result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
			}
			break;
		case IBinding.VARIABLE:
			if (removeAll)
				return null;

			result.put(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
			result.put(CleanUpConstants.REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.TRUE);
			break;
	}

	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:UnusedCodeFix.java

示例13: getRemoveBlockProposals

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例14: getConvertForLoopProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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

示例15: getConvertIterableLoopProposal

import org.eclipse.jdt.ui.cleanup.CleanUpOptions; //导入依赖的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


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