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


Java AndroidFacet.getConfiguration方法代码示例

本文整理汇总了Java中org.jetbrains.android.facet.AndroidFacet.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidFacet.getConfiguration方法的具体用法?Java AndroidFacet.getConfiguration怎么用?Java AndroidFacet.getConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.android.facet.AndroidFacet的用法示例。


在下文中一共展示了AndroidFacet.getConfiguration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addAndroidFacet

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@NotNull
public static AndroidFacet addAndroidFacet(final Module module, @NotNull VirtualFile contentRoot,
                                           boolean library) {
  final FacetManager facetManager = FacetManager.getInstance(module);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  AndroidFacet facet = model.getFacetByType(AndroidFacet.ID);

  if (facet == null) {
    facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null);
    AndroidFacetConfiguration configuration = facet.getConfiguration();
    configuration.init(module, contentRoot);
    if (library) {
      configuration.getState().LIBRARY_PROJECT = true;
    }
    model.addFacet(facet);
  }
  model.commit();

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

示例2: getState

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Override
public AndroidRunningState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException {
  final AndroidRunningState state = super.getState(executor, env);

  if (state == null) {
    return null;
  }

  final AndroidFacet facet = state.getFacet();
  final AndroidFacetConfiguration configuration = facet.getConfiguration();

  if (!facet.isGradleProject() && !configuration.getState().PACK_TEST_CODE) {
    final Module module = facet.getModule();
    final int count = getTestSourceRootCount(module);
    
    if (count > 0) {
      final String message = "Code and resources under test source " + (count > 1 ? "roots" : "root") +
                             " aren't included into debug APK.\nWould you like to include them and recompile " +
                             module.getName() + " module?" + "\n(You may change this option in Android facet settings later)";
      final int result =
        Messages.showYesNoCancelDialog(getProject(), message, "Test code not included into APK", Messages.getQuestionIcon());
      
      if (result == Messages.YES) {
        configuration.getState().PACK_TEST_CODE = true;
      }
      else if (result == Messages.CANCEL) {
        return null;
      }
    }
  }
  return state;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AndroidTestRunConfiguration.java

示例3: importExternalApklibArtifact

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Nullable
private static Module importExternalApklibArtifact(Project project,
                                                   Module apklibModule,
                                                   IdeModifiableModelsProvider modelsProvider,
                                                   MavenProject mavenProject,
                                                   MavenProjectsTree mavenTree,
                                                   MavenId artifactMavenId,
                                                   String artifactFilePath,
                                                   ModifiableModuleModel moduleModel,
                                                   Map<MavenProject, String> mavenProject2ModuleName) {
  final String genModuleName = AndroidMavenUtil.getModuleNameForExtApklibArtifact(artifactMavenId);
  String genExternalApklibsDirPath = null;
  String targetDirPath = null;

  if (apklibModule == null) {
    genExternalApklibsDirPath =
      AndroidMavenUtil.computePathForGenExternalApklibsDir(artifactMavenId, mavenProject, mavenTree.getProjects());

    targetDirPath = genExternalApklibsDirPath != null
                    ? genExternalApklibsDirPath + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId)
                    : null;
  }
  else {
    final VirtualFile[] contentRoots = ModuleRootManager.getInstance(apklibModule).getContentRoots();
    if (contentRoots.length == 1) {
      targetDirPath = contentRoots[0].getPath();
    }
    else {
      final String moduleDir = new File(apklibModule.getModuleFilePath()).getParent();
      if (moduleDir != null) {
        targetDirPath = moduleDir + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId);
      }
    }
  }

  if (targetDirPath == null) {
    return null;
  }

  if (!extractArtifact(artifactFilePath, targetDirPath, project, genModuleName)){
    return null;
  }
  final AndroidExternalApklibDependenciesManager adm = AndroidExternalApklibDependenciesManager.getInstance(project);
  adm.setArtifactFilePath(artifactMavenId, FileUtil.toSystemIndependentName(artifactFilePath));

  final VirtualFile vApklibDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(targetDirPath);
  if (vApklibDir == null) {
    LOG.error("Cannot find file " + targetDirPath + " in VFS");
    return null;
  }

  if (apklibModule == null) {
    final String genModuleFilePath = genExternalApklibsDirPath + '/' + genModuleName + ModuleFileType.DOT_DEFAULT_EXTENSION;
    apklibModule = moduleModel.newModule(genModuleFilePath, StdModuleTypes.JAVA.getId());
  }

  final ModifiableRootModel apklibModuleModel = modelsProvider.getModifiableRootModel(apklibModule);
  final ContentEntry contentEntry = apklibModuleModel.addContentEntry(vApklibDir);

  final VirtualFile sourceRoot = vApklibDir.findChild(AndroidMavenUtil.APK_LIB_ARTIFACT_SOURCE_ROOT);
  if (sourceRoot != null) {
    contentEntry.addSourceFolder(sourceRoot, false);
  }
  final AndroidFacet facet = AndroidUtils.addAndroidFacet(apklibModuleModel.getModule(), vApklibDir, true);

  final AndroidFacetConfiguration configuration = facet.getConfiguration();
  String s = AndroidRootUtil.getPathRelativeToModuleDir(apklibModule, vApklibDir.getPath());
  if (s != null) {
    s = s.length() > 0 ? '/' + s + '/' : "/";
    configuration.getState().RES_FOLDER_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_RES_DIR;
    configuration.getState().LIBS_FOLDER_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_NATIVE_LIBS_DIR;
    configuration.getState().MANIFEST_FILE_RELATIVE_PATH = s + AndroidMavenUtil.APK_LIB_ARTIFACT_MANIFEST_FILE;
  }

  importSdkAndDependenciesForApklibArtifact(project, apklibModuleModel, modelsProvider, mavenTree,
                                            artifactMavenId, mavenProject2ModuleName);
  return apklibModule;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:79,代码来源:AndroidFacetImporterBase.java

示例4: _init

import org.jetbrains.android.facet.AndroidFacet; //导入方法依赖的package包/类
@Override
public void _init() {
  if (myInited) return;
  final AndroidFacet facet = myWizard.getFacet();
  Module module = facet.getModule();

  PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
  String lastModule = properties.getValue(ChooseModuleStep.MODULE_PROPERTY);
  String lastApkPath = properties.getValue(getApkPathPropertyName());
  if (lastApkPath != null && module.getName().equals(lastModule)) {
    myApkPathField.setText(FileUtil.toSystemDependentName(lastApkPath));
  }
  else {
    String contentRootPath = getContentRootPath(module);
    if (contentRootPath != null) {
      String defaultPath = FileUtil.toSystemDependentName(contentRootPath + "/" + module.getName() + ".apk");
      myApkPathField.setText(defaultPath);
    }
  }

  final String runProguardPropValue = properties.getValue(RUN_PROGUARD_PROPERTY);
  boolean selected;

  if (runProguardPropValue != null) {
    selected = Boolean.parseBoolean(runProguardPropValue);
  }
  else {
    selected = facet.getProperties().RUN_PROGUARD;
  }
  myProguardCheckBox.setSelected(selected);
  myProGuardConfigFilesPanel.setEnabled(selected);

  final String proguardCfgPathsStr = properties.getValue(PROGUARD_CFG_PATHS_PROPERTY);
  final String[] proguardCfgPaths = proguardCfgPathsStr != null
                                    ? parseAndCheckProguardCfgPaths(proguardCfgPathsStr)
                                    : null;
  if (proguardCfgPaths != null && proguardCfgPaths.length > 0) {
    myProGuardConfigFilesPanel.setOsPaths(Arrays.asList(proguardCfgPaths));
  }
  else {
    final AndroidFacetConfiguration configuration = facet.getConfiguration();
    if (configuration.getState().RUN_PROGUARD) {
      myProGuardConfigFilesPanel.setUrls(facet.getProperties().myProGuardCfgFiles);
    }
    else {
      final List<String> urls = new ArrayList<String>();
      urls.add(AndroidCommonUtils.PROGUARD_SYSTEM_CFG_FILE_URL);
      final Pair<VirtualFile, Boolean> pair = AndroidCompileUtil.getDefaultProguardConfigFile(facet);

      if (pair != null) {
        urls.add(pair.getFirst().getUrl());
      }
      myProGuardConfigFilesPanel.setUrls(urls);
    }
  }

  myInited = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:ApkStep.java


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