Commit 60199511 authored by Artem Khvastunov's avatar Artem Khvastunov
Browse files

add default implementation to ChangeSignatureHandler#findTargetMember(Editor)

parent 6f22a0b1
Branches unavailable Tags unavailable
No related merge requests found
Showing with 6 additions and 38 deletions
+6 -38
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.changeSignature;
import com.intellij.codeInsight.JavaTargetElementEvaluator;
......@@ -165,13 +151,6 @@ public class JavaChangeSignatureHandler implements ChangeSignatureHandler {
//}
}
@Override
@Nullable
public PsiElement findTargetMember(@NotNull PsiFile file, @NotNull Editor editor) {
PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
return findTargetMember(element);
}
@Override
public PsiElement findTargetMember(PsiElement element) {
if (PsiTreeUtil.getParentOfType(element, PsiParameterList.class) != null) {
......
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.changeSignature;
import com.intellij.openapi.actionSystem.DataContext;
......@@ -32,7 +18,10 @@ public interface ChangeSignatureHandler extends RefactoringActionHandler {
String REFACTORING_NAME = RefactoringBundle.message("changeSignature.refactoring.name");
@Nullable
PsiElement findTargetMember(@NotNull PsiFile file, @NotNull Editor editor);
default PsiElement findTargetMember(@NotNull PsiFile file, @NotNull Editor editor) {
PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
return element != null ? findTargetMember(element) : null;
}
@Nullable
PsiElement findTargetMember(PsiElement element);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment