mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use PluginModuleType.isOfType
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog;
|
||||
import org.jetbrains.idea.devkit.DevKitBundle;
|
||||
@@ -37,7 +36,7 @@ public class PrepareAllToDeployAction extends PrepareToDeployAction {
|
||||
|
||||
List<Module> pluginModules = new ArrayList<Module>();
|
||||
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
|
||||
if (ModuleType.get(aModule) instanceof PluginModuleType) {
|
||||
if (PluginModuleType.isOfType(aModule)) {
|
||||
pluginModules.add(aModule);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +56,7 @@ public class PrepareAllToDeployAction extends PrepareToDeployAction {
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null) {
|
||||
for (Module aModule : (ModuleManager.getInstance(project).getModules())) {
|
||||
if (ModuleType.get(aModule) instanceof PluginModuleType) {
|
||||
if (PluginModuleType.isOfType(aModule)) {
|
||||
moduleCount++;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +67,7 @@ public class PrepareAllToDeployAction extends PrepareToDeployAction {
|
||||
}
|
||||
else if (moduleCount > 0) {
|
||||
final Module module = e.getData(LangDataKeys.MODULE);
|
||||
if (module == null || !(ModuleType.get(module) instanceof PluginModuleType)) {
|
||||
if (module == null || !(PluginModuleType.isOfType(module))) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.compiler.make.ManifestBuilder;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -75,7 +74,7 @@ public class PrepareToDeployAction extends AnAction {
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
|
||||
if (module != null && ModuleType.get(module) instanceof PluginModuleType) {
|
||||
if (module != null && PluginModuleType.isOfType(module)) {
|
||||
doPrepare(Arrays.asList(module), CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
}
|
||||
}
|
||||
@@ -398,7 +397,7 @@ public class PrepareToDeployAction extends AnAction {
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
|
||||
boolean enabled = module != null && ModuleType.get(module) instanceof PluginModuleType;
|
||||
boolean enabled = module != null && PluginModuleType.isOfType(module);
|
||||
e.getPresentation().setVisible(enabled);
|
||||
e.getPresentation().setEnabled(enabled);
|
||||
if (enabled) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -72,6 +72,7 @@ abstract class AbstractRegisterFix implements LocalQuickFix, DescriptorUtil.Patc
|
||||
final PsiFile psiFile = myClass.getContainingFile();
|
||||
LOG.assertTrue(psiFile != null);
|
||||
final Module module = ModuleUtil.findModuleForFile(psiFile.getVirtualFile(), project);
|
||||
assert module != null;
|
||||
|
||||
Runnable command = new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class PluginModuleType extends ModuleType<PluginModuleBuilder> {
|
||||
return (PluginModuleType) ModuleTypeManager.getInstance().findByID(ID);
|
||||
}
|
||||
|
||||
public static boolean isOfType(Module module) {
|
||||
public static boolean isOfType(@NotNull Module module) {
|
||||
return get(module) instanceof PluginModuleType;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class PluginModuleType extends ModuleType<PluginModuleBuilder> {
|
||||
@Nullable
|
||||
public static XmlFile getPluginXml(Module module) {
|
||||
if (module == null) return null;
|
||||
if (!(get(module) instanceof PluginModuleType)) return null;
|
||||
if (!isOfType(module)) return null;
|
||||
|
||||
final PluginBuildConfiguration buildConfiguration = PluginBuildConfiguration.getInstance(module);
|
||||
if (buildConfiguration == null) return null;
|
||||
|
||||
Reference in New Issue
Block a user