當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。