2 * Copyright 2000-2015 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.
16 package com.jetbrains.python.refactoring.move.makeFunctionTopLevel;
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;
27 * @author Mikhail Golubev
29 public class PyMakeFunctionTopLevelDialog extends PyBaseMoveDialog {
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));
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));
45 if (function.getContainingClass() != null) {
46 myDescription.setText("Make top-level function from method ");
48 myExtraPanel.setVisible(false);
53 protected String getHelpId() {
54 return "python.reference.makeFunctionTopLevel";
59 protected String getDimensionServiceKey() {
60 return "#com.jetbrains.python.refactoring.move.PyMakeFunctionTopLevelDialog";