Static constructors has been added for ReplaceCallFix.

This commit is contained in:
Sergey Lukjanov
2012-06-20 11:27:02 +04:00
parent a4584e96d7
commit 80485cbee1
2 changed files with 26 additions and 4 deletions
@@ -133,9 +133,9 @@ public class QuickFixes {
actions.put(VAL_WITH_SETTER, changeVariableMutabilityFix);
actions.put(VAL_REASSIGNMENT, changeVariableMutabilityFix);
actions.put(UNNECESSARY_SAFE_CALL, new ReplaceCallFix(true, false));
actions.put(UNSAFE_CALL, new ReplaceCallFix(true, true));
actions.put(UNSAFE_CALL, new ReplaceCallFix(false, true));
actions.put(UNNECESSARY_SAFE_CALL, ReplaceCallFix.toDotCall());
actions.put(UNSAFE_CALL, ReplaceCallFix.toSafeCall());
actions.put(UNSAFE_CALL, ReplaceCallFix.toNonNullAssertedCall());
actions.put(UNNECESSARY_NOT_NULL_ASSERTION, new UnnecessaryNotNullAssertionFix());
@@ -29,16 +29,38 @@ import org.jetbrains.jet.plugin.JetBundle;
/**
* @author svtk
* @author slukjanov aka Frostman
*/
public class ReplaceCallFix implements IntentionAction {
private final boolean safe;
private final boolean fromDot;
public ReplaceCallFix(boolean safe, boolean fromDot) {
private ReplaceCallFix(boolean safe, boolean fromDot) {
this.safe = safe;
this.fromDot = fromDot;
}
/**
* @return quickfix for replacing dot call with safe (?.) call
*/
public static ReplaceCallFix toSafeCall() {
return new ReplaceCallFix(true, true);
}
/**
* @return quickfix for replacing dot call with non-null asserted (!!.) call
*/
public static ReplaceCallFix toNonNullAssertedCall() {
return new ReplaceCallFix(false, true);
}
/**
* @return quickfix for replacing unnecessary safe (?.) call with dot call
*/
public static ReplaceCallFix toDotCall() {
return new ReplaceCallFix(true, false);
}
@NotNull
@Override
public String getText() {