<add-to-group group-id="XDebugger.ValueGroup" anchor="after" relative-to-action="Debugger.Tree.AddToWatches"/>
</action>
- <action id="PyConvertModuleToPackage" class="com.jetbrains.python.refactoring.convert.PyConvertModuleToPackageAction"
+ <action id="PyConvertModuleToPackage" class="com.jetbrains.python.refactoring.convertModulePackage.PyConvertModuleToPackageAction"
text="Convert to Python Package"
description="Create package with the same name and move content of the module to its __init__.py">
<add-to-group group-id="RefactoringMenu" anchor="last" />
</action>
- <action id="PyConvertPackageToModuleAction" class="com.jetbrains.python.refactoring.convert.PyConvertPackageToModuleAction"
+ <action id="PyConvertPackageToModuleAction" class="com.jetbrains.python.refactoring.convertModulePackage.PyConvertPackageToModuleAction"
text="Convert to Python Module"
description="Create module with the same name and move content of __init__.py to that module">
<add-to-group group-id="RefactoringMenu" anchor="last" />
--- /dev/null
+/*
+ * Copyright 2000-2015 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.
+ */
+package com.jetbrains.python.refactoring;
+
+import com.intellij.lang.Language;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.refactoring.actions.BaseRefactoringAction;
+import com.jetbrains.python.PythonLanguage;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Mikhail Golubev
+ */
+public abstract class PyBaseRefactoringAction extends BaseRefactoringAction {
+ @Override
+ protected boolean isAvailableOnElementInEditorAndFile(@NotNull PsiElement element,
+ @NotNull Editor editor,
+ @NotNull PsiFile file,
+ @NotNull DataContext context) {
+ return false;
+ }
+
+ @Override
+ protected final boolean isAvailableForLanguage(Language language) {
+ return language.isKindOf(PythonLanguage.getInstance());
+ }
+
+ @Override
+ protected boolean isAvailableForFile(PsiFile file) {
+ return isAvailableForLanguage(file.getLanguage());
+ }
+}
-package com.jetbrains.python.refactoring.convert;
+package com.jetbrains.python.refactoring.convertModulePackage;
-import com.intellij.lang.Language;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
import com.intellij.refactoring.RefactoringBundle;
-import com.intellij.refactoring.actions.BaseRefactoringAction;
import com.intellij.refactoring.util.CommonRefactoringUtil;
import com.jetbrains.python.PyBundle;
-import com.jetbrains.python.PythonLanguage;
+import com.jetbrains.python.refactoring.PyBaseRefactoringAction;
import org.jetbrains.annotations.NotNull;
/**
* @author Mikhail Golubev
*/
-public abstract class PyBaseConvertRefactoringAction extends BaseRefactoringAction {
+public abstract class PyBaseConvertModulePackageAction extends PyBaseRefactoringAction {
@Override
protected final boolean isAvailableInEditorOnly() {
return false;
}
- @Override
- protected boolean isAvailableOnElementInEditorAndFile(@NotNull PsiElement element,
- @NotNull Editor editor,
- @NotNull PsiFile file,
- @NotNull DataContext context) {
- return false;
- }
-
- @Override
- protected final boolean isAvailableForLanguage(Language language) {
- return language.isKindOf(PythonLanguage.getInstance());
- }
-
- @Override
- protected boolean isAvailableForFile(PsiFile file) {
- return isAvailableForLanguage(file.getLanguage());
- }
-
/**
* Show standard error dialog containing message about unexpected presense of given file or directory.
*
-package com.jetbrains.python.refactoring.convert;
+package com.jetbrains.python.refactoring.convertModulePackage;
import com.google.common.annotations.VisibleForTesting;
import com.intellij.openapi.actionSystem.DataContext;
/**
* @author Mikhail Golubev
*/
-public class PyConvertModuleToPackageAction extends PyBaseConvertRefactoringAction {
+public class PyConvertModuleToPackageAction extends PyBaseConvertModulePackageAction {
public static final String ID = "py.refactoring.convert.module.to.package";
private static final Logger LOG = Logger.getInstance(PyConvertModuleToPackageAction.class);
-package com.jetbrains.python.refactoring.convert;
+package com.jetbrains.python.refactoring.convertModulePackage;
import com.google.common.annotations.VisibleForTesting;
import com.intellij.openapi.actionSystem.DataContext;
/**
* @author Mikhail Golubev
*/
-public class PyConvertPackageToModuleAction extends PyBaseConvertRefactoringAction {
+public class PyConvertPackageToModuleAction extends PyBaseConvertModulePackageAction {
private static final Logger LOG = Logger.getInstance(PyConvertPackageToModuleAction.class);
private static final String ID = "py.refactoring.convert.package.to.module";
import com.intellij.testFramework.PlatformTestUtil;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.PyFile;
-import com.jetbrains.python.refactoring.convert.PyConvertModuleToPackageAction;
+import com.jetbrains.python.refactoring.convertModulePackage.PyConvertModuleToPackageAction;
/**
* @author Mikhail Golubev
import com.intellij.psi.PsiManager;
import com.intellij.testFramework.PlatformTestUtil;
import com.jetbrains.python.fixtures.PyTestCase;
-import com.jetbrains.python.refactoring.convert.PyConvertPackageToModuleAction;
+import com.jetbrains.python.refactoring.convertModulePackage.PyConvertPackageToModuleAction;
/**
* @author Mikhail Golubev