mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
warn about default value for new parameter non-modal (IDEA-85333)
This commit is contained in:
@@ -258,7 +258,7 @@ class JavaChangeInfoImpl implements JavaChangeInfo {
|
||||
}
|
||||
|
||||
protected void setupPropagationEnabled(final PsiParameter[] parameters, final ParameterInfoImpl[] newParms) {
|
||||
if (parameters.length >= newParms.length) {
|
||||
if (parameters.length != newParms.length) {
|
||||
isPropagationEnabled = false;
|
||||
}
|
||||
else {
|
||||
|
||||
+19
-5
@@ -29,6 +29,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -593,12 +594,10 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
|
||||
String def = item.parameter.defaultValue;
|
||||
def = def.trim();
|
||||
if (!(type instanceof PsiEllipsisType)) {
|
||||
if (def.length() == 0) {
|
||||
return RefactoringBundle.message("changeSignature.no.default.value", item.parameter.getName());
|
||||
}
|
||||
|
||||
try {
|
||||
factory.createExpressionFromText(def, null);
|
||||
if (!StringUtil.isEmpty(def)) {
|
||||
factory.createExpressionFromText(def, null);
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
return e.getMessage();
|
||||
@@ -661,6 +660,21 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ValidationInfo doValidate() {
|
||||
for (final ParameterTableModelItemBase<ParameterInfoImpl> item : myParametersTableModel.getItems()) {
|
||||
if (item.parameter.oldParameterIndex < 0) {
|
||||
if (StringUtil.isEmpty(item.defaultValueCodeFragment.getText())) return new ValidationInfo("Default value is missed. In the method call place new parameter value would be leaved blank");
|
||||
}
|
||||
}
|
||||
return super.doValidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean postponeValidation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String calculateSignature() {
|
||||
return doCalculateSignature(myMethod.getMethod());
|
||||
|
||||
Reference in New Issue
Block a user