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


Java Sdk.getSdkAdditionalData方法代码示例

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


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

示例1: getVEnvCallback

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@NotNull
private AbstractCreateVirtualEnvDialog.VirtualEnvCallback getVEnvCallback() {
  return new CreateVirtualEnvDialog.VirtualEnvCallback() {
      @Override
      public void virtualEnvCreated(Sdk sdk, boolean associateWithProject) {
        if (associateWithProject) {
          SdkAdditionalData additionalData = sdk.getSdkAdditionalData();
          if (additionalData == null) {
            additionalData = new PythonSdkAdditionalData(PythonSdkFlavor.getFlavor(sdk.getHomePath()));
            ((ProjectJdkImpl)sdk).setSdkAdditionalData(additionalData);
          }
          if (myNewProject) {
            ((PythonSdkAdditionalData)additionalData).associateWithNewProject();
          }
          else {
            ((PythonSdkAdditionalData)additionalData).associateWithProject(myProject);
          }
        }
        mySdkAddedCallback.consume(sdk);
      }
    };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PythonSdkDetailsStep.java

示例2: parse

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Nullable
public static AndroidPlatform parse(@NotNull Sdk sdk) {
  if (!isAndroidSdk(sdk)) {
    return null;
  }
  AndroidSdkData sdkData = AndroidSdkData.getSdkData(sdk);
  if (sdkData != null) {
    SdkAdditionalData data = sdk.getSdkAdditionalData();
    if (data instanceof AndroidSdkAdditionalData) {
      IAndroidTarget target = ((AndroidSdkAdditionalData)data).getBuildTarget(sdkData);
      if (target != null) {
        return new AndroidPlatform(sdkData, target);
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidPlatform.java

示例3: getFlavor

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Nullable
public static PythonSdkFlavor getFlavor(Sdk sdk) {
  final SdkAdditionalData data = sdk.getSdkAdditionalData();
  if (data instanceof PythonSdkAdditionalData) {
    PythonSdkFlavor flavor = ((PythonSdkAdditionalData)data).getFlavor();
    if (flavor != null) {
      return flavor;
    }
  }
  return getFlavor(sdk.getHomePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PythonSdkFlavor.java

示例4: getAddedPaths

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
public static List<String> getAddedPaths(Sdk pythonSdk) {
  List<String> pathList = new ArrayList<String>();
  final SdkAdditionalData sdkAdditionalData = pythonSdk.getSdkAdditionalData();
  if (sdkAdditionalData instanceof PythonSdkAdditionalData) {
    final Set<VirtualFile> addedPaths = ((PythonSdkAdditionalData)sdkAdditionalData).getAddedPathFiles();
    for (VirtualFile file : addedPaths) {
      addToPythonPath(file, pathList);
    }
  }
  return pathList;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PythonCommandLineState.java

示例5: associatedWithCurrent

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
private static boolean associatedWithCurrent(Sdk o1, Project project) {
  final PythonSdkAdditionalData data = (PythonSdkAdditionalData)o1.getSdkAdditionalData();
  if (data != null) {
    final String path = data.getAssociatedProjectPath();
    final String projectBasePath = project.getBasePath();
    if (path != null && path.equals(projectBasePath)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyConfigurableInterpreterList.java

示例6: apply

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Override
public boolean apply(@Nullable final Sdk input) {
  if (input != null && PythonSdkType.isVirtualEnv(input)) {
    PythonSdkAdditionalData data = (PythonSdkAdditionalData) input.getSdkAdditionalData();
    if (data != null) {
      final String path = data.getAssociatedProjectPath();
      if (path != null && (myBasePath == null || !path.equals(myBasePath))) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:VirtualEnvProjectFilter.java

示例7: editSdk

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
private void editSdk() {
  final Sdk currentSdk = getSelectedSdk();
  if (currentSdk != null) {
    if (currentSdk.getSdkAdditionalData() instanceof RemoteSdkAdditionalData) {
      editRemoteSdk(currentSdk);
    }
    else {
      editSdk(currentSdk);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PythonSdkDetailsDialog.java

示例8: checkSdk

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
private void checkSdk(Sdk sdk, String sdkName, String buildTarget) {
  assertNotNull(sdk);
  assertEquals(sdkName, sdk.getName());
  assertTrue(FileUtil.pathsEqual(AndroidTestCase.getDefaultTestSdkPath(), sdk.getHomePath()));
  assertEquals(AndroidSdkType.getInstance(), sdk.getSdkType());
  final SdkAdditionalData additionalData = sdk.getSdkAdditionalData();
  assertNotNull(additionalData);
  assertInstanceOf(additionalData, AndroidSdkAdditionalData.class);
  final AndroidSdkAdditionalData data = (AndroidSdkAdditionalData)additionalData;
  assertEquals(buildTarget, data.getBuildTargetHashString());
  assertEquals(myJdk, data.getJavaSdk());
  final HashSet<String> urls = new HashSet<String>(Arrays.asList(sdk.getRootProvider().getUrls(OrderRootType.CLASSES)));
  assertTrue(urls.containsAll(Arrays.asList(myJdk.getRootProvider().getUrls(OrderRootType.CLASSES))));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AndroidFacetImporterTest.java

示例9: getAndroidSdkApiLevel

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
private static int getAndroidSdkApiLevel(Sdk sdk) {
  int androidSdkApiLevel = 1;
  AndroidSdkAdditionalData additionalData = (AndroidSdkAdditionalData) sdk.getSdkAdditionalData();
  if (additionalData != null) {
    AndroidPlatform androidPlatform = additionalData.getAndroidPlatform();
    if (androidPlatform != null) {
      androidSdkApiLevel = androidPlatform.getApiLevel();
    }
  }
  return androidSdkApiLevel;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:AndroidSdkFromProjectView.java

示例10: isRemote

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
public static boolean isRemote(@Nullable Sdk sdk) {
  return sdk != null && sdk.getSdkAdditionalData() instanceof RemoteSdkAdditionalData;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PySdkUtil.java

示例11: configureProject

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, Ref<Module> moduleRef) {
  // it it a virtualenv?
  final PythonSdkType sdkType = PythonSdkType.getInstance();
  //find virtualEnv in project directory
  final List<String> candidates = new ArrayList<String>();
  if (project == null) return;
  final VirtualFile rootDir = project.getBaseDir();
  if (rootDir != null)
    candidates.addAll(VirtualEnvSdkFlavor.findInDirectory(rootDir));
  if (!candidates.isEmpty()) {
    String filePath = candidates.get(0);
    if (StringUtil.startsWithChar(filePath, '~')) {
      final String home = SystemProperties.getUserHome();
      filePath = home + filePath.substring(1);
    }
    final Sdk virtualEnvSdk = SdkConfigurationUtil.createAndAddSDK(filePath, sdkType);
    if (virtualEnvSdk != null) {
      SdkConfigurationUtil.setDirectoryProjectSdk(project, virtualEnvSdk);
      SdkAdditionalData additionalData = virtualEnvSdk.getSdkAdditionalData();
      if (additionalData == null) {
        additionalData = new PythonSdkAdditionalData(PythonSdkFlavor.getFlavor(virtualEnvSdk.getHomePath()));
        ((ProjectJdkImpl)virtualEnvSdk).setSdkAdditionalData(additionalData);
      }
      ((PythonSdkAdditionalData) additionalData).associateWithProject(project);
      return;
    }
    return;
  }

  
  final Sdk existingSdk = ProjectRootManager.getInstance(project).getProjectSdk();
  if (existingSdk != null && existingSdk.getSdkType() == sdkType) return; // SdkConfigurationUtil does the same
  final File executableFile = PythonSdkType.findExecutableFile(new File(project.getBasePath(), "bin"), "python");
  if (executableFile != null) {
    final File virtualEnvRoot = PythonSdkType.getVirtualEnvRoot(executableFile.getPath());
    if (virtualEnvRoot != null) {
      // yes, an unknown virtualenv; set it up as SDK
      final Sdk sdk = SdkConfigurationUtil.createAndAddSDK(executableFile.getPath(), sdkType);
      if (sdk != null) {
        SdkConfigurationUtil.setDirectoryProjectSdk(project, sdk);
        return;
      }
    }
  }
  // default
  SdkConfigurationUtil.configureDirectoryProjectSdk(project, new PreferredSdkComparator(), sdkType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:PythonSdkConfigurator.java

示例12: consume

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Override
public void consume(@Nullable ProjectSettingsStepBase step) {
  if (!(step instanceof ProjectSpecificSettingsStep)) return;

  final ProjectSpecificSettingsStep settingsStep = (ProjectSpecificSettingsStep)step;

  Sdk sdk = settingsStep.getSdk();
  final Project project = ProjectManager.getInstance().getDefaultProject();
  final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
  if (sdk instanceof PyDetectedSdk) {
    final String name = sdk.getName();
    VirtualFile sdkHome = ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
      @Override
      public VirtualFile compute() {
        return LocalFileSystem.getInstance().refreshAndFindFileByPath(name);
      }
    });
    PySdkService.getInstance().solidifySdk(sdk);
    sdk = SdkConfigurationUtil.createAndAddSDK(sdkHome.getPath(), PythonSdkType.getInstance());
    if (sdk != null) {
      PythonSdkType.getInstance().setupSdkPathsImmediately(sdk, project);
    }

    model.addSdk(sdk);
    settingsStep.setSdk(sdk);
    try {
      model.apply();
    }
    catch (ConfigurationException exception) {
      LOG.error("Error adding detected python interpreter " + exception.getMessage());
    }
  }
  Project newProject = generateProject(project, settingsStep);
  if (newProject != null) {
    SdkConfigurationUtil.setDirectoryProjectSdk(newProject, sdk);
    final List<Sdk> sdks = PythonSdkType.getAllSdks();
    for (Sdk s : sdks) {
      final SdkAdditionalData additionalData = s.getSdkAdditionalData();
      if (additionalData instanceof PythonSdkAdditionalData) {
        ((PythonSdkAdditionalData)additionalData).reassociateWithCreatedProject(newProject);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:GenerateProjectCallback.java

示例13: getAndroidSdkAdditionalData

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Nullable
public static AndroidSdkAdditionalData getAndroidSdkAdditionalData(@NotNull Sdk sdk) {
  SdkAdditionalData sdkAdditionalData = sdk.getSdkAdditionalData();
  return sdkAdditionalData instanceof AndroidSdkAdditionalData ? (AndroidSdkAdditionalData)sdkAdditionalData : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:AndroidSdkUtils.java

示例14: patchJavaParameters

import com.intellij.openapi.projectRoots.Sdk; //导入方法依赖的package包/类
@Override
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
  if (module == null) {
    return;
  }

  AndroidFacet androidFacet = AndroidFacet.getInstance(module);
  if (androidFacet == null) {
    return;
  }

  IdeaAndroidProject ideaAndroidProject = androidFacet.getIdeaAndroidProject();
  if (ideaAndroidProject == null) {
    return;
  }

  // Modify the class path only if we're dealing with the unit test artifact.
  if (!ideaAndroidProject.getSelectedTestArtifactName().equals(AndroidProject.ARTIFACT_UNIT_TEST)) {
    return;
  }

  final PathsList classPath = javaParameters.getClassPath();

  final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
    return;
  }

  final SdkAdditionalData data = sdk.getSdkAdditionalData();
  if (!(data instanceof AndroidSdkAdditionalData)) {
    return;
  }

  final AndroidPlatform platform = ((AndroidSdkAdditionalData)data).getAndroidPlatform();
  if (platform == null) {
    return;
  }

  classPath.remove(platform.getTarget().getPath(IAndroidTarget.ANDROID_JAR));

  // Move the mockable android jar to the end.
  String mockableJarPath = null;
  for (String path : classPath.getPathList()) {
    if (new File(FileUtil.toSystemDependentName(path)).getName().startsWith("mockable-android")) {
      // PathsList stores strings - use the one that's actually stored there.
      mockableJarPath = path;
      break;
    }
  }

  if (mockableJarPath != null) {
    classPath.remove(mockableJarPath);
    classPath.addTail(mockableJarPath);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:AndroidJunitPatcher.java


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