• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProjectFacetManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: configureProject

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void configureProject(Project project, @NotNull VirtualFile baseDir, Ref<Module> moduleRef) {
  final Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length > 0) {
    final Module module = modules[0];
    if (BuildoutFacet.getInstance(module) == null) {
      baseDir.refresh(false, false);
      final VirtualFile runner = BuildoutFacet.getRunner(baseDir);
      if (runner != null) {
        // TODO parse buildout.cfg and find out the part to use for the default script
        final File script = BuildoutFacet.findScript(null, "buildout", project.getBaseDir());
        if (script != null) {
          final ProjectFacetManager facetManager = ProjectFacetManager.getInstance(module.getProject());
          final BuildoutFacetConfiguration config = facetManager.createDefaultConfiguration(BuildoutFacetType.getInstance());
          config.setScriptName(script.getPath());
          setupFacet(module, config);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BuildoutFacetConfigurator.java


示例2: isMyContext

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
private static boolean isMyContext(@NotNull final PsiElement element, @NotNull final Project project) {
  if (element instanceof PsiClass) {
    return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
      @Override
      public Boolean compute() {
        PsiFile file = element.getContainingFile();
        if (file == null) {
          return false;
        }
        VirtualFile vFile = file.getVirtualFile();
        if (vFile == null) {
          return false;
        }
        String path = FileUtil.toSystemIndependentName(vFile.getPath());
        if (path.toLowerCase(Locale.US).contains("/" + SdkConstants.FN_FRAMEWORK_LIBRARY + "!/")) {
          if (ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).size() > 0) {
            VirtualFile jarFile = JarFileSystem.getInstance().getVirtualFileForJar(vFile);
            return jarFile != null && SdkConstants.FN_FRAMEWORK_LIBRARY.equals(jarFile.getName());
          }
        }
        return false;
      }
    });
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidDocumentationProvider.java


示例3: handleError

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public boolean handleError(@NotNull List<String> message,
                           @NotNull ExternalSystemException error,
                           @NotNull NotificationData notification,
                           @NotNull Project project) {
  String lastLine = message.get(message.size() - 1);

  if (lastLine.contains(INSTALL_ANDROID_SUPPORT_REPO)) {
    List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
    NotificationHyperlink[] hyperlinks = EMPTY;
    if (!facets.isEmpty()) {
      // We can only open SDK manager if the project has an Android facet. Android facet has a reference to the Android SDK manager.
      hyperlinks = new NotificationHyperlink[] {new OpenAndroidSdkManagerHyperlink()};
    }
    updateNotification(notification, project, error.getMessage(), hyperlinks);
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MissingAndroidSupportRepoErrorHandler.java


示例4: decorate

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
  if (!(node instanceof PsiDirectoryNode)) {
    return;
  }

  final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
  PsiDirectory psiDirectory = psiDirectoryNode.getValue();

  Project project = psiDirectory.getProject();
  if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
    return;
  }

  VirtualFile folder = psiDirectory.getVirtualFile();
  Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
  if (module != null && ModuleUtilCore.isModuleDir(module, folder)) {
    data.setIcon(GradleUtil.getModuleIcon(module));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleNodeIconDecorator.java


示例5: update

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
  final Project project = e.getProject();
  e.getPresentation().setEnabledAndVisible(
    project != null && ProjectFacetManager.getInstance(project).hasFacets(AppEngineFacet.ID));

  if (project != null) {
    String text;
    RunnerAndConfigurationSettings configurationToRun = getConfigurationToRun(project);
    if (configurationToRun == null) {
      text = getTemplatePresentation().getText();
    }
    else {
      text = "Upload App Engine Application '" + configurationToRun.getName() + "'";
    }
    e.getPresentation().setText(text);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:UploadApplicationAction.java


示例6: isMuleModule

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
public static boolean isMuleModule(Module module) {
    boolean muleModule = false;
    ProjectFacetManager manager = ProjectFacetManager.getInstance(module.getProject());
    final List<MuleFacet> facets = manager.getFacets(MuleFacetType.TYPE_ID, new Module[]{module});
    muleModule = (facets != null && !facets.isEmpty());
    if (!muleModule) { //Check for src/main/apps too, since not all modules may have facet added
        VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
        for (VirtualFile f : contentRoots) {
            VirtualFile deployProperties = f.findFileByRelativePath("src/main/app/mule-deploy.properties");
            if (deployProperties != null && deployProperties.exists() && deployProperties.isValid())
                return true;
        }
    }
    return muleModule;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:16,代码来源:MuleConfigUtils.java


示例7: FacetTypeEditor

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
public <C extends FacetConfiguration> FacetTypeEditor(@NotNull Project project, final StructureConfigurableContext context, @NotNull FacetType<?, C> facetType) {
  myProject = project;
  myContext = context;
  myFacetType = facetType;

  if (!(facetType instanceof InvalidFacetType)) {
    C configuration = ProjectFacetManager.getInstance(project).createDefaultConfiguration(facetType);
    DefaultFacetSettingsEditor defaultSettingsEditor = facetType.createDefaultConfigurationEditor(project, configuration);
    if (defaultSettingsEditor != null) {
      myDefaultSettingsConfigurable = new DefaultFacetSettingsConfigurable<C>(facetType, project, defaultSettingsEditor, configuration);
      add(myDefaultSettingsConfigurable);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FacetTypeEditor.java


示例8: getDataSourceTemplates

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@NotNull
@Override
public List<DataSourceTemplate> getDataSourceTemplates() {
  if (ProjectFacetManager.getInstance(myDbFacade.getProject()).hasFacets(AndroidFacet.ID)) {
    return Collections.singletonList(DEFAULT_TEMPLATE);
  }
  else {
    return Collections.emptyList();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidDbManager.java


示例9: projectClosed

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void projectClosed() {
  if (!ProjectFacetManager.getInstance(myProject).hasFacets(AndroidFacet.ID)) {
    return;
  }
  final String basePath = FileUtil.toCanonicalPath(myProject.getBasePath());

  if (basePath != null) {
    final Set<AndroidRemoteDbInfo> infos = collectAllUsedDatabases();
    AndroidRemoteDataBaseManager.getInstance().updateDbUsagesForProject(basePath, infos);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidDataSourceProjectComponent.java


示例10: findClasses

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@NotNull
@Override
public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
  Project project = scope.getProject();
  if (project == null || !ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
    return PsiClass.EMPTY_ARRAY;
  }

  if (INTERNAL_R_CLASS_QNAME.equals(qualifiedName)) {
    CommonProcessors.CollectUniquesProcessor<PsiClass> processor = new CommonProcessors.CollectUniquesProcessor<PsiClass>();
    processInternalRClasses(project, scope, processor);
    Collection<PsiClass> results = processor.getResults();
    return results.isEmpty() ? PsiClass.EMPTY_ARRAY : results.toArray(new PsiClass[results.size()]);
  }

  final int lastDot = qualifiedName.lastIndexOf('.');
  if (lastDot < 0) {
    return PsiClass.EMPTY_ARRAY;
  }
  final String shortName = qualifiedName.substring(lastDot + 1);
  final String parentName = qualifiedName.substring(0, lastDot);

  if (shortName.length() == 0 || !parentName.endsWith(".R")) {
    return PsiClass.EMPTY_ARRAY;
  }
  List<PsiClass> result = new SmartList<PsiClass>();
  for (PsiClass parentClass : JavaPsiFacade.getInstance(project).findClasses(parentName, scope)) {
    ContainerUtil.addIfNotNull(result, parentClass.findInnerClassByName(shortName, false));
  }
  return result.isEmpty() ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:AndroidPsiElementFinder.java


示例11: projectOpened

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void projectOpened() {
  final CompilerManager manager = CompilerManager.getInstance(myProject);
  manager.addBeforeTask(new AndroidPrecompileTask());

  myDisposable = new Disposable() {
    @Override
    public void dispose() {
    }
  };

  if (!ApplicationManager.getApplication().isUnitTestMode() &&
      !ApplicationManager.getApplication().isHeadlessEnvironment()) {

    if (ProjectFacetManager.getInstance(myProject).hasFacets(AndroidFacet.ID)) {
      createAndroidSpecificComponents();
    }
    else {
      final MessageBusConnection connection = myProject.getMessageBus().connect(myDisposable);

      connection.subscribe(FacetManager.FACETS_TOPIC, new FacetManagerAdapter() {
        @Override
        public void facetAdded(@NotNull Facet facet) {
          if (facet instanceof AndroidFacet) {
            createAndroidSpecificComponents();
            connection.disconnect();
          }
        }
      });
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AndroidProjectComponent.java


示例12: getResolveScope

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Nullable
@Override
public GlobalSearchScope getResolveScope(@NotNull VirtualFile file, Project project) {
  if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) return null;

  ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
  JdkOrderEntry entry = ContainerUtil.findInstance(index.getOrderEntriesForFile(file), JdkOrderEntry.class);
  final Sdk sdk = entry == null ? null : entry.getJdk();
  if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
    return null;
  }

  return new MyJdkScope(project, entry, index.isInLibrarySource(file));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AndroidSdkResolveScopeProvider.java


示例13: update

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
  super.update(e);
  final Project project = e.getData(CommonDataKeys.PROJECT);
  e.getPresentation().setVisible(project != null &&
                                 ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).size() > 0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidConnectDebuggerAction.java


示例14: collectAllProcessNames

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@NotNull
private static Set<String> collectAllProcessNames(Project project) {
  final List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
  final Set<String> result = new HashSet<String>();

  for (AndroidFacet facet : facets) {
    final String packageName = AndroidCompileUtil.getAaptManifestPackage(facet);

    if (packageName != null) {
      result.add(packageName.toLowerCase());
    }
    final Manifest manifest = facet.getManifest();

    if (manifest != null) {
      final XmlElement xmlElement = manifest.getXmlElement();

      if (xmlElement != null) {
        collectProcessNames(xmlElement, result);
      }
    }
    final IdeaAndroidProject androidProject = facet.getIdeaAndroidProject();
    if (androidProject != null) {
      collectApplicationIds(androidProject, result);
    }
  }

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


示例15: update

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
  final Project project = e.getProject();
  e.getPresentation().setEnabledAndVisible(
    project != null &&
    !ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID).isEmpty() &&
    AndroidSdkUtils.isAndroidSdkAvailable());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RunAndroidAvdManagerAction.java


示例16: getApplicationFacets

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@NotNull
public static List<AndroidFacet> getApplicationFacets(@NotNull Project project) {
  final List<AndroidFacet> result = new ArrayList<AndroidFacet>();

  for (AndroidFacet facet : ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID)) {
    if (!facet.isLibraryProject()) {
      result.add(facet);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AndroidUtils.java


示例17: getFirstAndroidModuleSdkData

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Nullable
private static AndroidSdkData getFirstAndroidModuleSdkData(Project project) {
  List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
  for (AndroidFacet facet : facets) {
    AndroidPlatform androidPlatform = facet.getConfiguration().getAndroidPlatform();
    if (androidPlatform != null) {
      return androidPlatform.getSdkData();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AndroidSdkUtils.java


示例18: execute

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public boolean execute(CompileContext context) {
  final Project project = context.getProject();

  if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
    return true;
  }
  BuildManager.forceModelLoading(context);

  // in out-of-process mode gen roots will be excluded by AndroidExcludedJavaSourceRootProvider
  // we do it here for internal mode and also to make there roots 'visibly excluded' in IDE settings
  createGenModulesAndSourceRoots(project);

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


示例19: canProcessElement

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Override
public boolean canProcessElement(@NotNull PsiElement element) {
  if (element instanceof PsiPackage) {
    // possibly renaming application package
    return ProjectFacetManager.getInstance(element.getProject()).hasFacets(AndroidFacet.ID);
  }
  return AndroidRenameHandler.isPackageAttributeInManifest(element.getProject(), element);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidApplicationPackageRenameProcessor.java


示例20: getPlatform

import com.intellij.facet.ProjectFacetManager; //导入依赖的package包/类
@Nullable
private AndroidPlatform getPlatform() {
  AndroidPlatform newPlatform = null;
  final List<AndroidFacet> facets = ProjectFacetManager.getInstance(myProject).getFacets(AndroidFacet.ID);
  if (facets.size() > 0) {
    final AndroidFacet facet = facets.get(0);
    newPlatform = facet.getConfiguration().getAndroidPlatform();
  }
  return newPlatform;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidToolWindowFactory.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JSONListAdapter类代码示例发布时间:2022-05-23
下一篇:
Java DelaunayTriangulationBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap