当前位置: 首页>>代码示例>>Java>>正文


Java PluginModuleType类代码示例

本文整理汇总了Java中org.jetbrains.idea.devkit.module.PluginModuleType的典型用法代码示例。如果您正苦于以下问题:Java PluginModuleType类的具体用法?Java PluginModuleType怎么用?Java PluginModuleType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PluginModuleType类属于org.jetbrains.idea.devkit.module包,在下文中一共展示了PluginModuleType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPluginProject

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
public void testPluginProject() throws Exception {
  createSdk("devkit", IdeaJdk.getInstance());
  Project project = createProjectFromTemplate(PluginModuleType.getInstance().getName(), null, null);
  VirtualFile baseDir = project.getBaseDir();
  VirtualFile virtualFile = VfsUtilCore.findRelativeFile("resources/META-INF/plugin.xml", baseDir);
  assertNotNull(virtualFile);

  RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
  assertNotNull(configuration);
  ConfigurationType type = configuration.getType();
  assertNotNull(type);
  assertEquals(DevKitBundle.message("run.configuration.title"), type.getDisplayName());

  VirtualFile[] files = FileEditorManager.getInstance(project).getOpenFiles();
  assertEquals(1, files.length);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PluginProjectWizardTest.java

示例2: 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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PluginModuleBuildScopeProvider.java

示例3: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PrepareAllToDeployAction.java

示例4: 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"));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PrepareAllToDeployAction.java

示例5: actionPerformed

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
  final Project project = e.getData(PlatformDataKeys.PROJECT);
  if ( project == null ) return;

  List<Module> pluginModules = new ArrayList<Module>();
  for (Module aModule : ModuleManager.getInstance(project).getModules()) {
    if (ModuleType.get(aModule) instanceof PluginModuleType) {
      pluginModules.add(aModule);
    }
  }

  //TODO replace with com.intellij.openapi.roots.ui.configuration.libraryEditor.ChooseModulesDialog
  ChooseModulesDialog dialog = new ChooseModulesDialog(project, pluginModules, DevKitBundle.message("select.plugin.modules.title"),
                                                       DevKitBundle.message("select.plugin.modules.description"));
  dialog.show();
  if (dialog.isOK()) {
    doPrepare(dialog.getSelectedModules(), project);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:PrepareAllToDeployAction.java

示例6: update

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
public void update(AnActionEvent e) {
  int moduleCount = 0;
  final Project project = e.getData(PlatformDataKeys.PROJECT);
  if (project != null) {
    for (Module aModule : (ModuleManager.getInstance(project).getModules())) {
      if (ModuleType.get(aModule) instanceof PluginModuleType) {
        moduleCount++;
      }
    }
  }
  boolean enabled = false;
  if (moduleCount > 1) {
    enabled = true;
  }
  else if (moduleCount > 0) {
    final Module module = e.getData(LangDataKeys.MODULE);
    if (module == null || !(ModuleType.get(module) instanceof PluginModuleType)) {
      enabled = true;
    }
  }
  e.getPresentation().setVisible(enabled);
  e.getPresentation().setEnabled(enabled);
  if (enabled) {
    e.getPresentation().setText(DevKitBundle.message("prepare.for.deployment.all"));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:PrepareAllToDeployAction.java

示例7: getProjectDescriptor

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
  return new DefaultLightProjectDescriptor() {
    @NotNull
    @Override
    public ModuleType getModuleType() {
      return PluginModuleType.getInstance();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PluginModuleTestCase.java

示例8: testProjectWithoutSdk

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
public void testProjectWithoutSdk() throws Exception {
  try {
    createProjectFromTemplate(PluginModuleType.getInstance().getName(), null, null);
    fail("Exception should be thrown");
  }
  catch (Exception e) {
    assertEquals(IdeBundle.message("prompt.confirm.project.no.jdk"), e.getMessage());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PluginProjectWizardTest.java

示例9: update

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
public void update(final AnActionEvent e) {
  super.update(e);

  final Presentation presentation = e.getPresentation();
  if (presentation.isEnabled()) {
    final DataContext context = e.getDataContext();
    final Module module = LangDataKeys.MODULE.getData(context);
    if (PluginModuleType.isPluginModuleOrDependency(module)) {
      final IdeView view = LangDataKeys.IDE_VIEW.getData(e.getDataContext());
      final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
      if (view != null && project != null) {
        // from com.intellij.ide.actions.CreateClassAction.update()
        ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
        PsiDirectory[] dirs = view.getDirectories();
        for (PsiDirectory dir : dirs) {
          if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
              JavaDirectoryService.getInstance().getPackage(dir) != null) {
            return;
          }
        }
      }
    }

    presentation.setEnabled(false);
    presentation.setVisible(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GeneratePluginClassAction.java

示例10: checkModule

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
@Nullable
private static Set<PsiClass> checkModule(Module module, PsiClass psiClass, @Nullable Set<PsiClass> types, boolean includeActions) {
  final XmlFile pluginXml = PluginModuleType.getPluginXml(module);
  if (pluginXml == null) return null;
  final DomFileElement<IdeaPlugin> fileElement = DescriptorUtil.getIdeaPlugin(pluginXml);
  if (fileElement == null) return null;

  final String qualifiedName = psiClass.getQualifiedName();
  if (qualifiedName != null) {
    final RegistrationTypeFinder finder = new RegistrationTypeFinder(psiClass, types);

    // "main" plugin.xml
    processPluginXml(pluginXml, finder, includeActions);

    // <depends> plugin.xml files
    for (Dependency dependency : fileElement.getRootElement().getDependencies()) {
      final GenericAttributeValue<PathReference> configFileAttribute = dependency.getConfigFile();
      if (!DomUtil.hasXml(configFileAttribute)) continue;

      final PathReference configFile = configFileAttribute.getValue();
      if (configFile != null) {
        final PsiElement resolve = configFile.resolve();
        if (!(resolve instanceof XmlFile)) continue;
        final XmlFile depPluginXml = (XmlFile)resolve;
        if (DescriptorUtil.isPluginXml(depPluginXml)) {
          processPluginXml(depPluginXml, finder, includeActions);
        }
      }
    }

    types = finder.getTypes();
  }

  return types;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:DevKitInspectionBase.java

示例11: isAllowed

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
private boolean isAllowed(ProblemsHolder holder) {
  if (PsiUtil.isIdeaProject(holder.getProject())) {
    return true;
  }

  Module module = ModuleUtilCore.findModuleForPsiElement(holder.getFile());
  if (PluginModuleType.isPluginModuleOrDependency(module)) {
    return true;
  }

  //seems that internal inspection tests should test in most cases the inspection 
  //and not that internal inspections are not available in non-idea non-plugin projects 
  return isAllowedByDefault();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:InternalInspection.java

示例12: canFix

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
private static boolean canFix(PsiClass psiClass) {
  final Project project = psiClass.getProject();
  final PsiFile psiFile = psiClass.getContainingFile();
  LOG.assertTrue(psiFile != null);
  final Module module = ModuleUtilCore.findModuleForFile(psiFile.getVirtualFile(), project);
  return PluginModuleType.isPluginModuleOrDependency(module);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ComponentNotRegisteredInspection.java

示例13: collectJpsPluginModules

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
@NotNull
private static Map<Module, String> collectJpsPluginModules(@NotNull Module module) {
  XmlFile pluginXml = PluginModuleType.getPluginXml(module);
  if (pluginXml == null) return Collections.emptyMap();

  DomFileElement<IdeaPlugin> fileElement = DomManager.getDomManager(module.getProject()).getFileElement(pluginXml, IdeaPlugin.class);
  if (fileElement == null) return Collections.emptyMap();

  Map<Module, String> jpsPluginToOutputPath = new HashMap<Module, String>();
  IdeaPlugin plugin = fileElement.getRootElement();
  List<Extensions> extensions = plugin.getExtensions();
  for (Extensions extensionGroup : extensions) {
    XmlTag extensionsTag = extensionGroup.getXmlTag();
    String defaultExtensionNs = extensionsTag.getAttributeValue("defaultExtensionNs");
    for (XmlTag tag : extensionsTag.getSubTags()) {
      String name = tag.getLocalName();
      String qualifiedName = defaultExtensionNs != null ? defaultExtensionNs + "." + name : name;
      if (CompileServerPlugin.EP_NAME.getName().equals(qualifiedName)) {
        String classpath = tag.getAttributeValue("classpath");
        if (classpath != null) {
          for (String path : StringUtil.split(classpath, ";")) {
            String moduleName = FileUtil.getNameWithoutExtension(PathUtil.getFileName(path));
            Module jpsModule = ModuleManager.getInstance(module.getProject()).findModuleByName(moduleName);
            if (jpsModule != null) {
              jpsPluginToOutputPath.put(jpsModule, path);
            }
          }
        }
      }
    }
  }
  return jpsPluginToOutputPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PrepareToDeployAction.java

示例14: 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()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PrepareToDeployAction.java

示例15: createEditor

import org.jetbrains.idea.devkit.module.PluginModuleType; //导入依赖的package包/类
@Override
@NotNull
public JComponent createEditor() {
  myModules.fillModules(myPRC.getProject(), PluginModuleType.getInstance());
  JPanel wholePanel = new JPanel(new GridBagLayout());
  myVMParameters.setText(DevKitBundle.message("vm.parameters"));
  myVMParameters.setComponent(new RawCommandLineEditor());
  myVMParameters.getComponent().setDialogCaption(myVMParameters.getRawText());
  myVMParameters.setLabelLocation(BorderLayout.WEST);

  myProgramParameters.setText(DevKitBundle.message("program.parameters"));
  myProgramParameters.setComponent(new RawCommandLineEditor());
  myProgramParameters.getComponent().setDialogCaption(myProgramParameters.getRawText());
  myProgramParameters.setLabelLocation(BorderLayout.WEST);

  GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 0, 0), UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP);
  wholePanel.add(myVMParameters, gc);
  wholePanel.add(myProgramParameters, gc);
  gc.gridwidth = 1;
  gc.gridy = 3;
  gc.weightx = 0;
  wholePanel.add(myModuleLabel, gc);
  gc.weighty = 1;
  gc.gridx = 1;
  gc.weightx = 1;
  wholePanel.add(myModules, gc);
  gc.gridx = 0;
  gc.gridy = 4;
  gc.gridwidth = 2;

  wholePanel.add(myJrePathEditor, gc);
  gc.gridy = 5;
  wholePanel.add(myShowLogs, gc);
  return wholePanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:PluginRunConfigurationEditor.java


注:本文中的org.jetbrains.idea.devkit.module.PluginModuleType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。