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


Java ICleanUp类代码示例

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


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

示例1: getRemoveBlockProposals

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

示例2: getConvertForLoopProposal

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

示例3: getConvertIterableLoopProposal

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

示例4: showSlowCleanUpsWarning

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private void showSlowCleanUpsWarning(HashSet<ICleanUp> slowCleanUps) {

		final StringBuffer cleanUpNames= new StringBuffer();
		for (Iterator<ICleanUp> iterator= slowCleanUps.iterator(); iterator.hasNext();) {
			ICleanUp cleanUp= iterator.next();
			String[] descriptions= cleanUp.getStepDescriptions();
			if (descriptions != null) {
				for (int i= 0; i < descriptions.length; i++) {
					if (cleanUpNames.length() > 0)
						cleanUpNames.append('\n');

					cleanUpNames.append(descriptions[i]);
				}
			}
		}

		if (Display.getCurrent() != null) {
			showSlowCleanUpDialog(cleanUpNames);
		} else {
			Display.getDefault().asyncExec(new Runnable() {
				public void run() {
					showSlowCleanUpDialog(cleanUpNames);
				}
			});
		}
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CleanUpPostSaveListener.java

示例5: CleanUpFixpointIterator

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
public CleanUpFixpointIterator(CleanUpTarget[] targets, ICleanUp[] cleanUps) {
	fSolutions= new Hashtable<ICompilationUnit, List<CleanUpChange>>(targets.length);
	fWorkingCopies= new Hashtable<ICompilationUnit, ICompilationUnit>();

	fParseList= new ArrayList<ParseListElement>(targets.length);
	for (int i= 0; i < targets.length; i++) {
		fParseList.add(new ParseListElement(targets[i], cleanUps));
	}

	fCleanUpOptions= new Hashtable<String, String>();
	for (int i= 0; i < cleanUps.length; i++) {
		ICleanUp cleanUp= cleanUps[i];
		Map<String, String> currentCleanUpOption= cleanUp.getRequirements().getCompilerOptions();
		if (currentCleanUpOption != null)
			fCleanUpOptions.putAll(currentCleanUpOption);
	}

	fSize= targets.length;
	fIndex= 1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:CleanUpRefactoring.java

示例6: cleanUpProject

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private Change[] cleanUpProject(IJavaProject project, CleanUpTarget[] targets, ICleanUp[] cleanUps, IProgressMonitor monitor) throws CoreException {
	CleanUpFixpointIterator iter= new CleanUpFixpointIterator(targets, cleanUps);

	SubProgressMonitor subMonitor= new SubProgressMonitor(monitor, 2 * targets.length * cleanUps.length);
	subMonitor.beginTask("", targets.length); //$NON-NLS-1$
	subMonitor.subTask(Messages.format(FixMessages.CleanUpRefactoring_Parser_Startup_message, BasicElementLabels.getResourceName(project.getProject())));
	try {
		while (iter.hasNext()) {
			iter.next(subMonitor);
		}

		return iter.getResult();
	} finally {
		iter.dispose();
		subMonitor.done();
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:CleanUpRefactoring.java

示例7: checkPreConditions

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private RefactoringStatus checkPreConditions(IJavaProject javaProject, CleanUpTarget[] targets, IProgressMonitor monitor) throws CoreException {
	RefactoringStatus result= new RefactoringStatus();

	ICompilationUnit[] compilationUnits= new ICompilationUnit[targets.length];
	for (int i= 0; i < targets.length; i++) {
		compilationUnits[i]= targets[i].getCompilationUnit();
	}

	ICleanUp[] cleanUps= getCleanUps();
	monitor.beginTask("", compilationUnits.length * cleanUps.length); //$NON-NLS-1$
	monitor.subTask(Messages.format(FixMessages.CleanUpRefactoring_Initialize_message, BasicElementLabels.getResourceName(javaProject.getProject())));
	try {
		for (int j= 0; j < cleanUps.length; j++) {
			result.merge(cleanUps[j].checkPreConditions(javaProject, compilationUnits, new SubProgressMonitor(monitor, compilationUnits.length)));
			if (result.hasFatalError())
				return result;
		}
	} finally {
		monitor.done();
	}

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

示例8: run

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private void run(ICompilationUnit cu) {
	if (!ActionUtil.isEditable(fEditor, getShell(), cu))
		return;

	ICleanUp[] cleanUps= getCleanUps(new ICompilationUnit[] {
		cu
	});
	if (cleanUps == null)
		return;

	if (!ElementValidator.check(cu, getShell(), getActionName(), fEditor != null))
		return;

	try {
		performRefactoring(new ICompilationUnit[] {
			cu
		}, cleanUps);
	} catch (InvocationTargetException e) {
		JavaPlugin.log(e);
		if (e.getCause() instanceof CoreException)
			showUnexpectedError((CoreException)e.getCause());
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:CleanUpAction.java

示例9: getCleanUps

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected ICleanUp[] getCleanUps(ICompilationUnit[] units) {
	try {
        if (!hasMembersToSort(units)) {
			MessageDialog.openInformation(getShell(), ActionMessages.MultiSortMembersAction_noElementsToSortDialog_title, ActionMessages.MultiSortMembersAction_noElementsToSortDialog_message);
        	return null;
        }
       } catch (JavaModelException e) {
       	JavaPlugin.log(e);
        return null;
       }

	Map<String, String> settings= getSettings();
	if (settings == null)
		return null;

	return new ICleanUp[] {
		new SortMembersCleanUp(settings)
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:MultiSortMembersAction.java

示例10: getRemoveBlockProposals

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

示例11: getConvertForLoopProposal

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

示例12: getConvertIterableLoopProposal

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

示例13: getSelectedCleanUpsInfo

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private String getSelectedCleanUpsInfo(ICleanUp[] cleanUps) {
	if (cleanUps.length == 0)
		return ""; //$NON-NLS-1$

	StringBuffer buf= new StringBuffer();

	boolean first= true;
	for (int i= 0; i < cleanUps.length; i++) {
     String[] descriptions= cleanUps[i].getStepDescriptions();
     if (descriptions != null) {
	        for (int j= 0; j < descriptions.length; j++) {
	        	if (first) {
	        		first= false;
	        	} else {
	        		buf.append('\n');
	        	}
	            buf.append(descriptions[j]);
            }
     }
    }

	return buf.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:CleanUpConfigurationBlock.java

示例14: getSelectedCleanUpsText

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private String getSelectedCleanUpsText(CleanUpOptions options) {
	StringBuffer buf= new StringBuffer();

	final ICleanUp[] cleanUps= JavaPlugin.getDefault().getCleanUpRegistry().createCleanUps();
	for (int i= 0; i < cleanUps.length; i++) {
		cleanUps[i].setOptions(options);
		String[] descriptions= cleanUps[i].getStepDescriptions();
		if (descriptions != null) {
			for (int j= 0; j < descriptions.length; j++) {
				if (buf.length() > 0) {
					buf.append('\n');
				}
				buf.append(descriptions[j]);
			}
        }
       }
	String string= buf.toString();
	return string;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:CleanUpSaveParticipantPreferenceConfiguration.java

示例15: showCustomSettings

import org.eclipse.jdt.ui.cleanup.ICleanUp; //导入依赖的package包/类
private void showCustomSettings(BulletListBlock bulletListBlock) {
StringBuffer buf= new StringBuffer();

final ICleanUp[] cleanUps= JavaPlugin.getDefault().getCleanUpRegistry().createCleanUps();
CleanUpOptions options= new MapCleanUpOptions(fCustomSettings);
  	for (int i= 0; i < cleanUps.length; i++) {
  		cleanUps[i].setOptions(options);
       String[] descriptions= cleanUps[i].getStepDescriptions();
       if (descriptions != null) {
  	        for (int j= 0; j < descriptions.length; j++) {
  	        	if (buf.length() > 0) {
  	        		buf.append('\n');
  	        	}
  	            buf.append(descriptions[j]);
              }
       }
      }
  	bulletListBlock.setText(buf.toString());
     }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:CleanUpRefactoringWizard.java


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