From 1caa0d503b0ef580aeee8c6bc986379aa84f9f35 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Tue, 17 Oct 2017 21:01:43 +0300 Subject: [PATCH] Add ability to create python stub in new python file dialog. --- .../fileTemplates/internal/Python Stub.pyi.ft | 0 .../actions/CreatePythonFileAction.java | 20 ++++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) create mode 100644 python/resources/fileTemplates/internal/Python Stub.pyi.ft diff --git a/python/resources/fileTemplates/internal/Python Stub.pyi.ft b/python/resources/fileTemplates/internal/Python Stub.pyi.ft new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/src/com/jetbrains/python/actions/CreatePythonFileAction.java b/python/src/com/jetbrains/python/actions/CreatePythonFileAction.java index 8faaee33cbe8..d458bbcd5490 100644 --- a/python/src/com/jetbrains/python/actions/CreatePythonFileAction.java +++ b/python/src/com/jetbrains/python/actions/CreatePythonFileAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2014 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-2017 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.jetbrains.python.actions; import com.intellij.ide.actions.CreateFileFromTemplateAction; @@ -21,6 +7,7 @@ import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiDirectory; import com.jetbrains.python.PythonFileType; +import com.jetbrains.python.pyi.PyiFileType; /** * @author yole @@ -35,7 +22,8 @@ public class CreatePythonFileAction extends CreateFileFromTemplateAction impleme builder .setTitle("New Python file") .addKind("Python file", PythonFileType.INSTANCE.getIcon(), "Python Script") - .addKind("Python unit test", PythonFileType.INSTANCE.getIcon(), "Python Unit Test"); + .addKind("Python unit test", PythonFileType.INSTANCE.getIcon(), "Python Unit Test") + .addKind("Python stub", PyiFileType.INSTANCE.getIcon(), "Python Stub"); } @Override