當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginModuleType.isOfType方法代碼示例

本文整理匯總了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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:PluginModuleBuildScopeProvider.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:PrepareAllToDeployAction.java

示例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"));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PrepareAllToDeployAction.java

示例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()));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PrepareToDeployAction.java

示例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;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:40,代碼來源:PluginBuildParticipant.java

示例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));
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:31,代碼來源:JUnitDevKitPatcher.java

示例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]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:ChunkBuildPluginExtension.java

示例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()));
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:PrepareToDeployAction.java

示例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));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:47,代碼來源:JUnitDevKitPatcher.java

示例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);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:45,代碼來源:AbstractRegisterFix.java


注:本文中的org.jetbrains.idea.devkit.module.PluginModuleType.isOfType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。