本文整理汇总了Java中com.intellij.codeInsight.CodeSmellInfo.getSeverity方法的典型用法代码示例。如果您正苦于以下问题:Java CodeSmellInfo.getSeverity方法的具体用法?Java CodeSmellInfo.getSeverity怎么用?Java CodeSmellInfo.getSeverity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.CodeSmellInfo
的用法示例。
在下文中一共展示了CodeSmellInfo.getSeverity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectErrors
import com.intellij.codeInsight.CodeSmellInfo; //导入方法依赖的package包/类
private static int collectErrors(final List<CodeSmellInfo> codeSmells) {
int result = 0;
for (CodeSmellInfo codeSmellInfo : codeSmells) {
if (codeSmellInfo.getSeverity() == HighlightSeverity.ERROR) result++;
}
return result;
}
示例2: executeMakeInUIThread
import com.intellij.codeInsight.CodeSmellInfo; //导入方法依赖的package包/类
private void executeMakeInUIThread(final VirtualFileEvent event) {
if(project.isInitialized() && !project.isDisposed() && project.isOpen()) {
final CompilerManager compilerManager = CompilerManager.getInstance(project);
if(!compilerManager.isCompilationActive() &&
!compilerManager.isExcludedFromCompilation(event.getFile()) // &&
) {
// Check first if there are no errors in the code
CodeSmellDetector codeSmellDetector = CodeSmellDetector.getInstance(project);
boolean isOk = true;
if(codeSmellDetector != null) {
List<CodeSmellInfo> codeSmellInfoList = codeSmellDetector.findCodeSmells(Arrays.asList(event.getFile()));
for(CodeSmellInfo codeSmellInfo: codeSmellInfoList) {
if(codeSmellInfo.getSeverity() == HighlightSeverity.ERROR) {
isOk = false;
break;
}
}
}
if(isOk) {
// Changed file found in module. Make it.
final ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
final boolean isShown = tw != null && tw.isVisible();
compilerManager.compile(
new VirtualFile[]{event.getFile()},
new CompileStatusNotification() {
@Override
public void finished(boolean b, int i, int i1, CompileContext compileContext) {
if (tw != null && tw.isVisible()) {
// Close / Hide the Build Message Window after we did the build if it wasn't shown
if(!isShown) {
tw.hide(null);
}
}
}
}
);
} else {
MessageManager messageManager = ComponentProvider.getComponent(project, MessageManager.class);
if(messageManager != null) {
messageManager.sendErrorNotification(
"server.update.file.change.with.error",
event.getFile()
);
}
}
}
}
}