2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 package com
.intellij
.codeInsight
.daemon
.impl
.quickfix
;
22 import com
.intellij
.codeInsight
.daemon
.QuickFixBundle
;
23 import com
.intellij
.psi
.PsiClass
;
24 import com
.intellij
.psi
.PsiElement
;
25 import com
.intellij
.psi
.PsiMethodCallExpression
;
26 import com
.intellij
.psi
.PsiTypeParameter
;
27 import com
.intellij
.psi
.util
.PsiTreeUtil
;
28 import org
.jetbrains
.annotations
.NotNull
;
30 import java
.util
.Collections
;
31 import java
.util
.List
;
33 public class CreateConstructorFromThisFix
extends CreateConstructorFromThisOrSuperFix
{
35 public CreateConstructorFromThisFix(PsiMethodCallExpression methodCall
) {
39 protected String
getSyntheticMethodName() {
44 protected List
<PsiClass
> getTargetClasses(PsiElement element
) {
45 PsiElement e
= element
;
47 e
= PsiTreeUtil
.getParentOfType(e
, PsiClass
.class);
48 } while (e
instanceof PsiTypeParameter
);
49 if (e
!= null && e
.isValid() && e
.getManager().isInProject(e
)) {
50 return Collections
.singletonList((PsiClass
)e
);
53 return Collections
.emptyList();
58 public String
getFamilyName() {
59 return QuickFixBundle
.message("create.constructor.from.this.call.family");