mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
prevent possible NPE
This commit is contained in:
+4
-3
@@ -200,12 +200,13 @@ public class InplaceIntroduceParameterPopup extends AbstractJavaInplaceIntroduce
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateTitle(PsiVariable variable) {
|
||||
protected void updateTitle(@Nullable PsiVariable variable) {
|
||||
if (variable == null) return;
|
||||
updateTitle(variable, variable.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateTitle(PsiVariable variable, String value) {
|
||||
protected void updateTitle(@Nullable PsiVariable variable, String value) {
|
||||
final PsiElement declarationScope = variable != null ? ((PsiParameter)variable).getDeclarationScope() : null;
|
||||
if (declarationScope instanceof PsiMethod) {
|
||||
final PsiMethod psiMethod = (PsiMethod)declarationScope;
|
||||
@@ -226,8 +227,8 @@ public class InplaceIntroduceParameterPopup extends AbstractJavaInplaceIntroduce
|
||||
myLabel.append(variable == parameter ? value : parameter.getName(), attr);
|
||||
}
|
||||
myLabel.append(")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
revalidate();
|
||||
}
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-3
@@ -72,7 +72,7 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
protected String myConstantName;
|
||||
public static final Key<AbstractInplaceIntroducer> ACTIVE_INTRODUCE = Key.create("ACTIVE_INTRODUCE");
|
||||
|
||||
protected SimpleColoredComponent myLabel = new SimpleColoredComponent();
|
||||
protected final SimpleColoredComponent myLabel = new SimpleColoredComponent();
|
||||
private DocumentAdapter myDocumentAdapter;
|
||||
protected final JPanel myWholePanel;
|
||||
|
||||
@@ -190,13 +190,15 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
return result.get();
|
||||
}
|
||||
|
||||
protected void updateTitle(V variable, String value) {
|
||||
protected void updateTitle(@Nullable V variable, String value) {
|
||||
if (variable == null) return;
|
||||
myLabel.clear();
|
||||
myLabel.append(variable.getText().replace(variable.getName(), value), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
protected void updateTitle(V variable) {
|
||||
protected void updateTitle(@Nullable V variable) {
|
||||
if (variable == null) return;
|
||||
myLabel.clear();
|
||||
myLabel.append(variable.getText(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
|
||||
revalidate();
|
||||
|
||||
Reference in New Issue
Block a user