' contributed by ' <插件 >' has been disabled because it does not honor any options."?-6ren"> ' contributed by ' <插件 >' has been disabled because it does not honor any options."?-我正在为 java 编辑器创建一个保存后操作 this guide 。到目前为止,我的清理代码如下所示: public class CheckFileCleanUp implements IClean-6ren">
gpt4 book ai didi

java - 如何解决 "The clean up ' ' contributed by ' <插件 >' has been disabled because it does not honor any options."?

转载 作者:行者123 更新时间:2023-11-30 08:03:57 25 4
gpt4 key购买 nike

我正在为 java 编辑器创建一个保存后操作 this guide 。到目前为止,我的清理代码如下所示:

public class CheckFileCleanUp implements ICleanUp {

@Override
public ICleanUpFix createFix(final CleanUpContext cleanUpContext) throws CoreException {

final ICompilationUnit compilationUnit = cleanUpContext.getCompilationUnit();
IPath path = compilationUnit.getPath();
IFile[] files = compilationUnit.getJavaProject().getProject().getWorkspace().getRoot().findFilesForLocation(path);
RunCheckstyleOnFilesJob job = new RunCheckstyleOnFilesJob(Arrays.asList(files));
job.setRule(job);
job.schedule();
return new ICleanUpFix() {
@Override
public CompilationUnitChange createChange(final IProgressMonitor progressMonitor) throws CoreException {
return new CompilationUnitChange("", compilationUnit);
}
};
}

@Override
public CleanUpRequirements getRequirements() {
return new CleanUpRequirements(false, false, true, Collections.<String, String> emptyMap());
}

@Override
public String[] getStepDescriptions() {
return new String[] { "Run checkstyle" };
}

@Override
public void setOptions(final CleanUpOptions cleanUpOptions) {
}

public RefactoringStatus checkPreConditions(final IJavaProject paramIJavaProject, final ICompilationUnit[] paramArrayOfICompilationUnit,
final IProgressMonitor paramIProgressMonitor) throws CoreException {
return new RefactoringStatus();
}

public RefactoringStatus checkPostConditions(final IProgressMonitor paramIProgressMonitor) throws CoreException {
return new RefactoringStatus();
}
}

扩展配置是:

<extension point="org.eclipse.jdt.ui.cleanUps">
<cleanUp id="eclipsecs.saveaction" class="eclipsecs.saveaction.CheckFileCleanUp" />
</extension>

清理不需要任何其他选项,因此我跳过了指南的这些部分。

但是,当我第一次简单地编辑 java 源文件并保存它时,我在错误日志中收到以下消息:

The clean up 'eclipsecs.saveaction' contributed by 'eclipse-cs-save-action' has been disabled because it does not honor any options.

如何使我的清理符合所需选项以及哪些选项是这些必需选项?

最佳答案

您收到此消息是因为您没有遵守启用的清理选项。

您必须记住 setOption 给您的 CleanUpOptions 并在 getStepDescriptions 中测试 isEnabled("your id") code>, createFix, ... 如果未启用清理功能,则不执行任何操作。

关于java - 如何解决 "The clean up ' <cleanUpName >' contributed by ' <插件 >' has been disabled because it does not honor any options."?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31447149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com