本文整理汇总了Java中com.intellij.openapi.projectRoots.SdkAdditionalData类的典型用法代码示例。如果您正苦于以下问题:Java SdkAdditionalData类的具体用法?Java SdkAdditionalData怎么用?Java SdkAdditionalData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SdkAdditionalData类属于com.intellij.openapi.projectRoots包,在下文中一共展示了SdkAdditionalData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVEnvCallback
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的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);
}
};
}
示例2: parse
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的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;
}
示例3: getHaxelibPath
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
/**
* Find the path to the 'haxelib' executable, using a specific SDK.
*
* @param sdk - SDK to look up haxelib for.
* @return the configured haxelib for the SDK; "haxelib" if not specified.
*/
@NotNull
public static String getHaxelibPath(@NotNull Sdk sdk) {
String haxelibPath = "haxelib";
if (sdk != null) {
SdkAdditionalData data = sdk.getSdkAdditionalData();
if (data instanceof HaxeSdkData) {
HaxeSdkData sdkData = (HaxeSdkData)data;
String path = sdkData.getHaxelibPath();
if (!path.isEmpty()) {
haxelibPath = path;
}
}
}
return haxelibPath;
}
示例4: createAndAddVirtualEnv
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
public void createAndAddVirtualEnv(Project project, PyNewProjectSettings settings) {
final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
final String baseSdk = getBaseSdk(course);
if (baseSdk != null) {
final PyPackageManager packageManager = PyPackageManager.getInstance(new PyDetectedSdk(baseSdk));
try {
final String path = packageManager.createVirtualEnv(project.getBasePath() + "/.idea/VirtualEnvironment", false);
AbstractCreateVirtualEnvDialog.setupVirtualEnvSdk(path, true, new AbstractCreateVirtualEnvDialog.VirtualEnvCallback() {
@Override
public void virtualEnvCreated(Sdk createdSdk, boolean associateWithProject) {
settings.setSdk(createdSdk);
model.addSdk(createdSdk);
try {
model.apply();
}
catch (ConfigurationException exception) {
LOG.error("Error adding created virtual env " + exception.getMessage());
}
if (associateWithProject) {
SdkAdditionalData additionalData = createdSdk.getSdkAdditionalData();
if (additionalData == null) {
additionalData = new PythonSdkAdditionalData(PythonSdkFlavor.getFlavor(createdSdk.getHomePath()));
((ProjectJdkImpl)createdSdk).setSdkAdditionalData(additionalData);
}
((PythonSdkAdditionalData)additionalData).associateWithNewProject();
}
}
});
}
catch (ExecutionException e) {
LOG.warn("Failed to create virtual env " + e.getMessage());
}
}
}
示例5: setupSdk
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Nullable
public static Sdk setupSdk(final Sdk[] allSdks,
final VirtualFile homeDir, final SdkType sdkType, final boolean silent,
@Nullable final SdkAdditionalData additionalData,
@Nullable final String customSdkSuggestedName) {
final List<Sdk> sdksList = Arrays.asList(allSdks);
final ProjectJdkImpl sdk;
try {
String sdkPath = sdkType.sdkPath(homeDir);
final String sdkName = customSdkSuggestedName == null
? createUniqueSdkName(sdkType, sdkPath, sdksList)
: createUniqueSdkName(customSdkSuggestedName, sdksList);
sdk = new ProjectJdkImpl(sdkName, sdkType);
if (additionalData != null) {
// additional initialization.
// E.g. some ruby sdks must be initialized before
// setupSdkPaths() method invocation
sdk.setSdkAdditionalData(additionalData);
}
sdk.setHomePath(sdkPath);
sdkType.setupSdkPaths(sdk);
}
catch (Exception e) {
if (!silent) {
Messages.showErrorDialog("Error configuring SDK: " +
e.getMessage() +
".\nPlease make sure that " +
FileUtil.toSystemDependentName(homeDir.getPath()) +
" is a valid home path for this SDK type.", "Error Configuring SDK");
}
return null;
}
return sdk;
}
示例6: getFlavor
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的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());
}
示例7: getAddedPaths
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的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;
}
示例8: collectSdkAdditionalData
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
private SdkAdditionalData collectSdkAdditionalData(SdkModificator sdkModificator) {
PythonSdkAdditionalData data = (PythonSdkAdditionalData)sdkModificator.getSdkAdditionalData();
if (data == null) {
data = new PythonSdkAdditionalData(null);
}
data.setAddedPathsFromVirtualFiles(myAdded);
data.setExcludedPathsFromVirtualFiles(myExcluded);
return data;
}
示例9: checkSdk
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的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))));
}
示例10: setupSdk
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Nullable
public static Sdk setupSdk(final Sdk[] allSdks,
final VirtualFile homeDir, final SdkType sdkType, final boolean silent,
@Nullable final SdkAdditionalData additionalData,
@Nullable final String customSdkSuggestedName) {
final List<Sdk> sdksList = Arrays.asList(allSdks);
final ProjectJdkImpl sdk;
try {
final String sdkName = customSdkSuggestedName == null
? createUniqueSdkName(sdkType, homeDir.getPath(), sdksList)
: createUniqueSdkName(customSdkSuggestedName, sdksList);
sdk = new ProjectJdkImpl(sdkName, sdkType);
if (additionalData != null) {
// additional initialization.
// E.g. some ruby sdks must be initialized before
// setupSdkPaths() method invocation
sdk.setSdkAdditionalData(additionalData);
}
sdk.setHomePath(homeDir.getPath());
sdkType.setupSdkPaths(sdk);
}
catch (Exception e) {
if (!silent) {
Messages.showErrorDialog("Error configuring SDK: " +
e.getMessage() +
".\nPlease make sure that " +
FileUtil.toSystemDependentName(homeDir.getPath()) +
" is a valid home path for this SDK type.", "Error Configuring SDK");
}
return null;
}
return sdk;
}
示例11: getSdkData
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Nullable
public static HaxeSdkAdditionalDataBase getSdkData(@Nullable Sdk sdk) {
if(sdk != null) {
SdkAdditionalData sdkData = sdk.getSdkAdditionalData();
if(sdkData != null && sdkData instanceof HaxeSdkAdditionalDataBase) {
return (HaxeSdkAdditionalDataBase)sdkData;
}
}
return null;
}
示例12: setupSdkPaths
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Override
public void setupSdkPaths(Sdk sdk)
{
final SdkModificator modificator = sdk.getSdkModificator();
SdkAdditionalData data = sdk.getSdkAdditionalData();
if(data == null)
{
data = HaxeSdkUtil.testHaxeSdk(sdk.getHomePath());
modificator.setSdkAdditionalData(data);
}
VirtualFile homeDirectory = sdk.getHomeDirectory();
if(homeDirectory != null)
{
final VirtualFile stdRoot = homeDirectory.findChild("std");
if(stdRoot != null)
{
modificator.addRoot(stdRoot, BinariesOrderRootType.getInstance());
modificator.addRoot(stdRoot, SourcesOrderRootType.getInstance());
}
final VirtualFile docRoot = homeDirectory.findChild("doc");
if(docRoot != null)
{
modificator.addRoot(docRoot, DocumentationOrderRootType.getInstance());
}
}
modificator.commitChanges();
}
示例13: saveAdditionalData
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Override
public void saveAdditionalData(SdkAdditionalData additionalData, Element additional)
{
if(additionalData instanceof HaxeSdkData)
{
XmlSerializer.serializeInto(additionalData, additional);
}
}
示例14: getSdkAdditionalData
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
public SdkAdditionalData getSdkAdditionalData() {
return null;
}
示例15: saveAdditionalData
import com.intellij.openapi.projectRoots.SdkAdditionalData; //导入依赖的package包/类
@Override
public void saveAdditionalData(@NotNull SdkAdditionalData additionalData, @NotNull Element additional) {
}