當前位置: 首頁>>代碼示例>>Java>>正文


Java StringCleanUp類代碼示例

本文整理匯總了Java中org.eclipse.jdt.internal.ui.fix.StringCleanUp的典型用法代碼示例。如果您正苦於以下問題:Java StringCleanUp類的具體用法?Java StringCleanUp怎麽用?Java StringCleanUp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StringCleanUp類屬於org.eclipse.jdt.internal.ui.fix包,在下文中一共展示了StringCleanUp類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getUnnecessaryNLSTagProposals

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的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: addNLSProposals

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的package包/類
public static void addNLSProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException {
	final ICompilationUnit cu= context.getCompilationUnit();
	if (cu == null || !cu.exists()){
		return;
	}
	String name= CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_description;

	ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, IProposalRelevance.EXTERNALIZE_STRINGS, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)) {
		@Override
		public void apply(IDocument document) {
			ExternalizeWizard.open(cu, JavaPlugin.getActiveWorkbenchShell());
		}
		@Override
		public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
			return CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_additional_info;
		}

	};
	proposals.add(proposal);

	IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, false, true);
	if (fix != null) {
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE);
		Map<String, String> options= new Hashtable<String, String>();
		options.put(CleanUpConstants.ADD_MISSING_NLS_TAGS, CleanUpOptions.TRUE);
		FixCorrectionProposal addNLS= new FixCorrectionProposal(fix, new StringCleanUp(options), IProposalRelevance.ADD_MISSING_NLS_TAGS, image, context);
		addNLS.setCommandId(ADD_NON_NLS_ID);
		proposals.add(addNLS);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:31,代碼來源:LocalCorrectionsSubProcessor.java

示例3: getUnnecessaryNLSTagProposals

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的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= 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:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:12,代碼來源:LocalCorrectionsSubProcessor.java

示例4: createPreviewCleanUps

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的package包/類
@Override
protected AbstractCleanUp[] createPreviewCleanUps(Map<String, String> values) {
	return new AbstractCleanUp[] {
       		new UnusedCodeCleanUp(values),
       		new UnnecessaryCodeCleanUp(values),
       		new StringCleanUp(values)
       };
   }
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:9,代碼來源:UnnecessaryCodeTabPage.java

示例5: addNLSProposals

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的package包/類
public static void addNLSProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) throws CoreException {
	final ICompilationUnit cu= context.getCompilationUnit();
	if (cu == null || !cu.exists()){
		return;
	}
	String name= CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_description;

	ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, 4, JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE)) {
		@Override
		public void apply(IDocument document) {
			ExternalizeWizard.open(cu, JavaPlugin.getActiveWorkbenchShell());
		}
		@Override
		public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
			return CorrectionMessages.LocalCorrectionsSubProcessor_externalizestrings_additional_info;
		}

	};
	proposals.add(proposal);

	IProposableFix fix= StringFix.createFix(context.getASTRoot(), problem, false, true);
	if (fix != null) {
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE);
		Map<String, String> options= new Hashtable<String, String>();
		options.put(CleanUpConstants.ADD_MISSING_NLS_TAGS, CleanUpOptions.TRUE);
		FixCorrectionProposal addNLS= new FixCorrectionProposal(fix, new StringCleanUp(options), 5, image, context);
		addNLS.setCommandId(ADD_NON_NLS_ID);
		proposals.add(addNLS);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:31,代碼來源:LocalCorrectionsSubProcessor.java

示例6: getUnnecessaryNLSTagProposals

import org.eclipse.jdt.internal.ui.fix.StringCleanUp; //導入依賴的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= 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), 6, image, context);
		proposal.setCommandId(REMOVE_UNNECESSARY_NLS_TAG_ID);
		proposals.add(proposal);
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:12,代碼來源:LocalCorrectionsSubProcessor.java


注:本文中的org.eclipse.jdt.internal.ui.fix.StringCleanUp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。