PY-17265 Remove wrong message in the dialog for making function top-level
[idea/community.git] / python / src / com / jetbrains / python / refactoring / move / makeFunctionTopLevel / PyMakeFunctionTopLevelDialog.java
1 /*
2  * Copyright 2000-2015 JetBrains s.r.o.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package com.jetbrains.python.refactoring.move.makeFunctionTopLevel;
17
18 import com.intellij.openapi.project.Project;
19 import com.jetbrains.python.PyBundle;
20 import com.jetbrains.python.psi.PyFunction;
21 import com.jetbrains.python.refactoring.move.PyBaseMoveDialog;
22 import com.jetbrains.python.refactoring.move.PyMoveRefactoringUtil;
23 import org.jetbrains.annotations.NotNull;
24 import org.jetbrains.annotations.Nullable;
25
26 /**
27  * @author Mikhail Golubev
28  */
29 public class PyMakeFunctionTopLevelDialog extends PyBaseMoveDialog {
30
31   public PyMakeFunctionTopLevelDialog(@NotNull Project project,
32                                       @NotNull PyFunction function, 
33                                       @NotNull String sourcePath,
34                                       @NotNull String destinationPath) {
35     super(project, sourcePath, destinationPath);
36     final String functionName = PyMoveRefactoringUtil.getCompactPresentableName(function);
37     if (function.getContainingClass() != null) {
38       setTitle(PyBundle.message("refactoring.make.method.top.level.dialog.title"));
39       myDescription.setText(PyBundle.message("refactoring.make.method.top.level.dialog.description", functionName));
40     }
41     else {
42       setTitle(PyBundle.message("refactoring.make.local.function.top.level.dialog.title"));
43       myDescription.setText(PyBundle.message("refactoring.make.local.function.top.level.dialog.description", functionName));
44     }
45     myExtraPanel.setVisible(false);
46     init();
47   }
48
49   @Override
50   protected String getHelpId() {
51     return "python.reference.makeFunctionTopLevel";
52   }
53
54   @Nullable
55   @Override
56   protected String getDimensionServiceKey() {
57     return "#com.jetbrains.python.refactoring.move.PyMakeFunctionTopLevelDialog";
58   }
59 }