mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
[code] "code inspections" sample stub
This commit is contained in:
parent
a7f7dc988f
commit
ef54820f3c
@ -8,16 +8,11 @@
|
|||||||
|
|
||||||
<change-notes>Initial commit</change-notes>
|
<change-notes>Initial commit</change-notes>
|
||||||
|
|
||||||
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
|
|
||||||
<idea-version since-build="131"/>
|
<idea-version since-build="131"/>
|
||||||
|
|
||||||
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products
|
|
||||||
on how to target different products -->
|
|
||||||
<!-- uncomment to enable plugin in all products
|
|
||||||
<depends>com.intellij.modules.lang</depends>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<inspectionToolProvider implementation="com.intellij.tutorials.inspection.DemoInspectionToolProvider"/>
|
||||||
|
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|
||||||
<application-components>
|
<application-components>
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/scr" isTestSource="false" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.intellij.tutorials.inspection;
|
||||||
|
|
||||||
|
import com.intellij.codeInspection.LocalInspectionTool;
|
||||||
|
import com.intellij.codeInspection.ProblemsHolder;
|
||||||
|
import org.jetbrains.annotations.Nls;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Anna Bulenkova
|
||||||
|
*/
|
||||||
|
public class DemoCodeInspection extends LocalInspectionTool {
|
||||||
|
@Nls
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return "Demo Inspection";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public DemoInspectionVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
|
||||||
|
return new DemoInspectionVisitor();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.intellij.tutorials.inspection;
|
||||||
|
|
||||||
|
import com.intellij.codeInspection.InspectionToolProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Anna Bulenkova
|
||||||
|
*/
|
||||||
|
public class DemoInspectionToolProvider implements InspectionToolProvider {
|
||||||
|
public Class[] getInspectionClasses() {
|
||||||
|
return new Class[] { DemoCodeInspection.class};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.intellij.tutorials.inspection;
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
|
import com.intellij.psi.PsiPlainTextFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Anna Bulenkova
|
||||||
|
*/
|
||||||
|
public class DemoInspectionVisitor extends PsiElementVisitor {
|
||||||
|
@Override
|
||||||
|
public void visitElement(PsiElement element) {
|
||||||
|
super.visitElement(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void visitPlainTextFile(PsiPlainTextFile file) {
|
||||||
|
super.visitPlainTextFile(file);
|
||||||
|
}
|
||||||
|
}
|
7
inspection/scr/inspectionDescriptions/DemoCode.html
Normal file
7
inspection/scr/inspectionDescriptions/DemoCode.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
Write your description here.
|
||||||
|
<!-- tooltip end -->
|
||||||
|
Text after this comment will not be shown in tooltips.
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user