本文整理汇总了Java中org.jetbrains.idea.devkit.module.PluginModuleType.isOfType方法的典型用法代码示例。如果您正苦于以下问题:Java PluginModuleType.isOfType方法的具体用法?Java PluginModuleType.isOfType怎么用?Java PluginModuleType.isOfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jetbrains.idea.devkit.module.PluginModuleType
的用法示例。
在下文中一共展示了PluginModuleType.isOfType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBuildTargetScopes
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
@NotNull
@Override
public List<TargetTypeBuildScope> getBuildTargetScopes(@NotNull CompileScope baseScope, @NotNull CompilerFilter filter,
@NotNull Project project, boolean forceBuild) {
List<String> pluginArtifactTargetIds = new ArrayList<String>();
for (Module module : baseScope.getAffectedModules()) {
if (PluginModuleType.isOfType(module)) {
pluginArtifactTargetIds.add(module.getName()+":plugin");
}
}
if (pluginArtifactTargetIds.isEmpty()) {
return Collections.emptyList();
}
return Collections.singletonList(CmdlineProtoUtil.createTargetsScope(ArtifactBuildTargetType.INSTANCE.getTypeId(), pluginArtifactTargetIds, forceBuild));
}
示例2: actionPerformed
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) return;
List<Module> pluginModules = new ArrayList<Module>();
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
if (PluginModuleType.isOfType(aModule)) {
pluginModules.add(aModule);
}
}
ChooseModulesDialog dialog = new ChooseModulesDialog(project,
pluginModules,
DevKitBundle.message("select.plugin.modules.title"),
DevKitBundle.message("select.plugin.modules.description"));
if (dialog.showAndGet()) {
doPrepare(dialog.getChosenElements(), project);
}
}
示例3: update
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void update(AnActionEvent e) {
int moduleCount = 0;
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
for (Module aModule : (ModuleManager.getInstance(project).getModules())) {
if (PluginModuleType.isOfType(aModule)) {
moduleCount++;
}
}
}
boolean enabled = false;
if (moduleCount > 1) {
enabled = true;
}
else if (moduleCount > 0) {
final Module module = e.getData(LangDataKeys.MODULE);
if (module == null || !(PluginModuleType.isOfType(module))) {
enabled = true;
}
}
e.getPresentation().setVisible(enabled);
e.getPresentation().setEnabled(enabled);
if (enabled) {
e.getPresentation().setText(DevKitBundle.message("prepare.for.deployment.all"));
}
}
示例4: update
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void update(AnActionEvent e) {
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
boolean enabled = module != null && PluginModuleType.isOfType(module);
e.getPresentation().setVisible(enabled);
e.getPresentation().setEnabled(enabled);
if (enabled) {
e.getPresentation().setText(DevKitBundle.message("prepare.for.deployment", module.getName()));
}
}
示例5: checkDependencies
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
private boolean checkDependencies(CompileContext context) {
final Module[] wrongSetDependencies = PluginBuildUtil.getWrongSetDependencies(myModule);
if (wrongSetDependencies.length != 0) {
boolean realProblems = false;
final String pluginId = DescriptorUtil.getPluginId(myModule);
for (Module dependency : wrongSetDependencies) {
if (!PluginModuleType.isOfType(dependency)) {
realProblems = true;
context.addMessage(CompilerMessageCategory.ERROR,
DevKitBundle.message("incorrect.dependency.non-plugin-module", dependency.getName(), myModule.getName()), null,
-1, -1);
}
else {
final XmlFile pluginXml = PluginModuleType.getPluginXml(dependency);
boolean isDeclared = false;
if (pluginXml != null) {
final XmlTag rootTag = pluginXml.getDocument().getRootTag();
final XmlTag[] dependencies = rootTag != null ? rootTag.findSubTags("depends") : XmlTag.EMPTY;
for (XmlTag dep : dependencies) {
if (dep.getValue().getTrimmedText().equals(pluginId)) {
isDeclared = true;
break;
}
}
}
if (!isDeclared) {
// make this a warning instead?
realProblems = true;
context.addMessage(CompilerMessageCategory.ERROR,
DevKitBundle.message("incorrect.dependency.not-declared", dependency.getName(), myModule.getName()), null, -1,
-1);
}
}
}
if (realProblems) return false;
}
return true;
}
示例6: patchJavaParameters
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final String sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
vm.defineProperty("idea.home.path", sandboxHome + File.separator + "test");
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", sandboxHome + File.separator + "plugins");
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例7: isPlugins
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
private static boolean isPlugins(final Module[] modules) {
return modules.length == 1 && PluginModuleType.isOfType(modules[0]);
}
示例8: actionPerformed
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
if (module != null && PluginModuleType.isOfType(module)) {
doPrepare(Arrays.asList(module), CommonDataKeys.PROJECT.getData(e.getDataContext()));
}
}
示例9: patchJavaParameters
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable final Module module, JavaParameters javaParameters) {
if (module != null && PsiUtil.isIdeaProject(module.getProject()) &&
!javaParameters.getVMParametersList().hasParameter(JAVA_SYSTEM_CLASS_LOADER_PROPERTY)) {
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(module.getProject());
final String qualifiedName = UrlClassLoader.class.getName();
final PsiClass urlLoaderClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@Override
public PsiClass compute() {
return psiFacade.findClass(qualifiedName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
}
});
if (urlLoaderClass != null) {
javaParameters.getVMParametersList().add("-D" + JAVA_SYSTEM_CLASS_LOADER_PROPERTY + "=" + UrlClassLoader.class.getName());
}
}
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final File sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
File homeDir = new File(sandboxHome, "test");
FileUtil.createDirectory(homeDir);
vm.defineProperty("idea.home.path", homeDir.getAbsolutePath());
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", new File(sandboxHome, "plugins").getAbsolutePath());
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例10: applyFix
import org.jetbrains.idea.devkit.module.PluginModuleType; //导入方法依赖的package包/类
public void applyFix(@NotNull final Project project, @NotNull ProblemDescriptor descriptor) {
if (!FileModificationService.getInstance().preparePsiElementForWrite(descriptor.getPsiElement())) return;
final PsiFile psiFile = myClass.getContainingFile();
LOG.assertTrue(psiFile != null);
final Module module = ModuleUtil.findModuleForFile(psiFile.getVirtualFile(), project);
Runnable command = new Runnable() {
public void run() {
try {
if (PluginModuleType.isOfType(module)) {
final XmlFile pluginXml = PluginModuleType.getPluginXml(module);
if (pluginXml != null) {
DescriptorUtil.patchPluginXml(AbstractRegisterFix.this, myClass, pluginXml);
}
}
else {
List<Module> modules = PluginModuleType.getCandidateModules(module);
if (modules.size() > 1) {
final ChooseModulesDialog dialog = new ChooseModulesDialog(project, modules, getName());
dialog.show();
if (!dialog.isOK()) {
return;
}
modules = dialog.getSelectedModules();
}
final XmlFile[] pluginXmls = new XmlFile[modules.size()];
for (int i = 0; i < pluginXmls.length; i++) {
pluginXmls[i] = PluginModuleType.getPluginXml(modules.get(i));
}
DescriptorUtil.patchPluginXml(AbstractRegisterFix.this, myClass, pluginXmls);
}
CommandProcessor.getInstance().markCurrentCommandAsGlobal(project);
}
catch (IncorrectOperationException e) {
Messages.showMessageDialog(project, filterMessage(e.getMessage()),
DevKitBundle.message("inspections.component.not.registered.quickfix.error", getType()),
Messages.getErrorIcon());
}
}
};
CommandProcessor.getInstance().executeCommand(project, command, getName(), null);
}