Skip to content

Commit

Permalink
新增功能:
Browse files Browse the repository at this point in the history
  检查XML增加快速修复对应方法,包括创建方法,入参和返回类型检测 / 快速修复
  • Loading branch information
Sealin committed May 22, 2018
1 parent a99e463 commit 5700dc0
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.wuzhizhan.mybatis.inspection;

import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.util.xml.GenericDomValue;
import com.wuzhizhan.mybatis.generate.MethodGenerator;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

/**
* @author Sealin
* Created by Sealin on 2018-05-19.
*/
public class MapperMethodQuickFix {
static class MethodFixer extends GenericQuickFix {
private GenericDomValue domValue;
private boolean fixMode;

/**
* @param domValue domNode
*/
public MethodFixer(GenericDomValue domValue) {
this.domValue = domValue;
}

@Nls
@NotNull
@Override
public String getName() {
return "Create method";
}

@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
MethodGenerator.generateMethod(domValue);
}
}


static class ParameterFixer extends GenericQuickFix {
private GenericDomValue domValue;

public ParameterFixer(GenericDomValue domValue) {
this.domValue = domValue;
}

@Nls
@NotNull
@Override
public String getName() {
return "Fix error type";
}

@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
MethodGenerator.generateParameter(domValue);
}
}
}

0 comments on commit 5700dc0

Please sign in to comment.