當前位置: 首頁>>代碼示例>>Java>>正文


Java Sdk.getSdkType方法代碼示例

本文整理匯總了Java中com.intellij.openapi.projectRoots.Sdk.getSdkType方法的典型用法代碼示例。如果您正苦於以下問題:Java Sdk.getSdkType方法的具體用法?Java Sdk.getSdkType怎麽用?Java Sdk.getSdkType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.projectRoots.Sdk的用法示例。


在下文中一共展示了Sdk.getSdkType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initArtifacts

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) {
  final Collection<? extends Artifact> artifacts =
    ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance());
  if (artifacts.isEmpty()) return;
  final Sdk[] jdks = BuildProperties.getUsedJdks(project);
  Sdk javaSdk = null;
  for (Sdk jdk : jdks) {
    if (jdk.getSdkType() instanceof JavaSdkType) {
      javaSdk = jdk;
      break;
    }
  }
  if (javaSdk != null) {
    final Tag taskdef = new Tag("taskdef",
                                Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"),
                                Couple.of("uri", "javafx:com.sun.javafx.tools.ant"),
                                Couple.of("classpath",
                                          BuildProperties
                                            .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
                                          "/lib/ant-javafx.jar"));
    generator.add(taskdef);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:JavaFxChunkBuildExtension.java

示例2: generateCommandLine

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
protected GeneralCommandLine generateCommandLine() {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    final LuaRunConfiguration cfg = (LuaRunConfiguration) runConfiguration;

    if (cfg.isOverrideSDKInterpreter()) {
        if (!StringUtil.isEmptyOrSpaces(cfg.getInterpreterPath()))
            commandLine.setExePath(cfg.getInterpreterPath());
    } else {
        final Sdk sdk = cfg.getSdk();

        if (sdk == null) {
            fillInterpreterCommandLine(commandLine);
        } else if (sdk.getSdkType() instanceof LuaSdkType) {
            String sdkHomePath = StringUtil.notNullize(sdk.getHomePath());
            String sdkInterpreter = getTopLevelExecutable(sdkHomePath).getAbsolutePath();
            commandLine.setExePath(sdkInterpreter);
        }
    }

    commandLine.getEnvironment().putAll(cfg.getEnvs());
    commandLine.setPassParentEnvironment(cfg.isPassParentEnvs());

    return configureCommandLine(commandLine);
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:25,代碼來源:LuaCommandLineState.java

示例3: isInAndroidSdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private static boolean isInAndroidSdk(@NonNull PsiElement element) {
  PsiFile file = element.getContainingFile();

  if (file == null) {
    return false;
  }
  VirtualFile virtualFile = file.getVirtualFile();

  if (virtualFile == null) {
    return false;
  }
  ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
  List<OrderEntry> entries = projectFileIndex.getOrderEntriesForFile(virtualFile);

  for (OrderEntry entry : entries) {
    if (entry instanceof JdkOrderEntry) {
      Sdk sdk = ((JdkOrderEntry)entry).getJdk();

      if (sdk != null && sdk.getSdkType() instanceof AndroidSdkType) {
        return true;
      }
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:AndroidFacet.java

示例4: excludeSdkTestsScope

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Nullable
public static GlobalSearchScope excludeSdkTestsScope(Project project, Sdk sdk) {
  if (sdk != null && sdk.getSdkType() instanceof PythonSdkType) {
    VirtualFile libDir = findLibDir(sdk);
    if (libDir != null) {
      // superset of test dirs found in Python 2.5 to 3.1
      List<VirtualFile> testDirs = findTestDirs(libDir, "test", "bsddb/test", "ctypes/test", "distutils/tests", "email/test",
                                                "importlib/test", "json/tests", "lib2to3/tests", "sqlite3/test", "tkinter/test",
                                                "idlelib/testcode.py");
      if (!testDirs.isEmpty()) {
        GlobalSearchScope scope = buildUnionScope(project, testDirs);
        return GlobalSearchScope.notScope(scope);
      }
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:PyProjectScopeBuilder.java

示例5: run

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public void run() {
  final Set<String> sdkNames = getSdkNamesFromModules(myProblemModules);
  if (sdkNames.size() == 1) {
    final Sdk sdk = ProjectJdkTable.getInstance().findJdk(sdkNames.iterator().next());
    if (sdk != null && sdk.getSdkType() instanceof AndroidSdkType) {
      final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
      if (ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
        @Override
        public void run() {
          config.select(sdk, true);
        }
      })) {
        askAndRebuild(myProject);
      }
      return;
    }
  }

  final String moduleToSelect = myProblemModules.size() > 0
                                ? myProblemModules.iterator().next().getName()
                                : null;
  if (ModulesConfigurator.showDialog(myProject, moduleToSelect, ClasspathEditor.NAME)) {
    askAndRebuild(myProject);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:RenderErrorPanel.java

示例6: addJavaHome

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public static void addJavaHome(@NotNull JavaParameters params, @NotNull Module module) {
  final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) {
    String path = StringUtil.trimEnd(sdk.getHomePath(), File.separator);
    if (StringUtil.isNotEmpty(path)) {
      params.addEnv("JAVA_HOME", FileUtil.toSystemDependentName(path));
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:MvcFramework.java

示例7: getJavaLanguageLevel

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
/**
 * Returns null if the SDK is not a java JDK, or doesn't have a recognized java langauge level.
 */
@Nullable
private static LanguageLevel getJavaLanguageLevel(Sdk sdk) {
  if (!(sdk.getSdkType() instanceof JavaSdk)) {
    return null;
  }
  JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
  return version != null ? version.getMaxLanguageLevel() : null;
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:12,代碼來源:Jdks.java

示例8: setupExeParams

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private void setupExeParams(final Sdk jdk, GeneralCommandLine cmdLine) throws ExecutionException {
  final String jdkPath =
    jdk != null && jdk.getSdkType() instanceof JavaSdkType ? ((JavaSdkType)jdk.getSdkType()).getBinPath(jdk) : null;
  if (jdkPath == null) {
    throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path"));
  }
  JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
  if (myConfiguration.HEAP_SIZE != null && myConfiguration.HEAP_SIZE.trim().length() != 0) {
    if (version == null || version.isAtLeast(JavaSdkVersion.JDK_1_2)) {
      cmdLine.getParametersList().prepend("-J-Xmx" + myConfiguration.HEAP_SIZE + "m");
    }
    else {
      cmdLine.getParametersList().prepend("-J-mx" + myConfiguration.HEAP_SIZE + "m");
    }
  }
  cmdLine.setWorkDirectory((File)null);
  @NonNls final String javadocExecutableName = File.separator + (SystemInfo.isWindows ? "javadoc.exe" : "javadoc");
  @NonNls String exePath = jdkPath.replace('/', File.separatorChar) + javadocExecutableName;
  if (new File(exePath).exists()) {
    cmdLine.setExePath(exePath);
  }
  else { //try to use wrapper jdk
    exePath = new File(jdkPath).getParent().replace('/', File.separatorChar) + javadocExecutableName;
    if (!new File(exePath).exists()) {
      final File parent = new File(System.getProperty("java.home")).getParentFile(); //try system jre
      exePath = parent.getPath() + File.separator + "bin" + javadocExecutableName;
      if (!new File(exePath).exists()) {
        throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path"));
      }
    }
    cmdLine.setExePath(exePath);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:JavadocGeneratorRunProfile.java

示例9: forJdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@NotNull
@Override
public CellAppearanceEx forJdk(@Nullable final Sdk jdk, final boolean isInComboBox, final boolean selected, final boolean showVersion) {
  if (jdk == null) {
    return FileAppearanceService.getInstance().forInvalidUrl(NO_JDK);
  }

  String name = jdk.getName();
  CompositeAppearance appearance = new CompositeAppearance();
  SdkType sdkType = (SdkType)jdk.getSdkType();
  appearance.setIcon(sdkType.getIcon());
  SimpleTextAttributes attributes = getTextAttributes(sdkType.sdkHasValidPath(jdk), selected);
  CompositeAppearance.DequeEnd ending = appearance.getEnding();
  ending.addText(name, attributes);

  if (showVersion) {
    String versionString = jdk.getVersionString();
    if (versionString != null && !versionString.equals(name)) {
      SimpleTextAttributes textAttributes = isInComboBox && !selected ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES :
                                            SystemInfo.isMac && selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, 
                                                                                                    Color.WHITE): SimpleTextAttributes.GRAY_ATTRIBUTES;
      ending.addComment(versionString, textAttributes);
    }
  }

  return ending.getAppearance();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:OrderEntryAppearanceServiceImpl.java

示例10: getSdksOfType

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public List<Sdk> getSdksOfType(SdkTypeId type) {
  List<Sdk> result = new ArrayList<Sdk>();
  synchronized (mySdks) {
    for (Sdk sdk : mySdks) {
      if (sdk.getSdkType() == type) {
        result.add(sdk);
      }
    }
  }
  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:CoreProjectJdkTable.java

示例11: isJdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public boolean isJdk() {
  if (myNode instanceof NamedLibraryElementNode) {
    NamedLibraryElement value = ((NamedLibraryElementNode)myNode).getValue();
    assertNotNull(value);
    LibraryOrSdkOrderEntry orderEntry = value.getOrderEntry();
    if (orderEntry instanceof JdkOrderEntry) {
      Sdk sdk = ((JdkOrderEntry)orderEntry).getJdk();
      return sdk.getSdkType() instanceof JavaSdk;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ProjectViewFixture.java

示例12: getPythonSdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
/** Find a python SDK associated with a blaze project, or its workspace module. */
@Nullable
public static Sdk getPythonSdk(Project project) {
  Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();
  if (projectSdk != null && projectSdk.getSdkType() instanceof PythonSdkType) {
    return projectSdk;
  }
  // look for a SDK associated with a python facet instead.
  return PythonSdkType.findPythonSdk(
      ModuleManager.getInstance(project)
          .findModuleByName(BlazeDataStorage.WORKSPACE_MODULE_NAME));
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:13,代碼來源:PySdkUtils.java

示例13: getAllPythonSdks

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public List<Sdk> getAllPythonSdks(@Nullable final Project project) {
  List<Sdk> result = new ArrayList<Sdk>();
  for (Sdk sdk : getModel().getSdks()) {
    if (sdk.getSdkType() instanceof PythonSdkType) {
      result.add(sdk);
    }
  }
  Collections.sort(result, new PyInterpreterComparator(project));
  addDetectedSdks(result);

  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:PyConfigurableInterpreterList.java

示例14: getSkeletonFile

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Nullable
public static PyFile getSkeletonFile(final @NotNull Project project, @NotNull Sdk sdk, @NotNull String name) {
  SdkTypeId sdkType = sdk.getSdkType();
  if (sdkType instanceof PythonSdkType) {
    // dig out the builtins file, create an instance based on it
    final String[] urls = sdk.getRootProvider().getUrls(PythonSdkType.BUILTIN_ROOT_TYPE);
    for (String url : urls) {
      if (url.contains(PythonSdkType.SKELETON_DIR_NAME)) {
        final String builtins_url = url + "/" + name;
        File builtins = new File(VfsUtilCore.urlToPath(builtins_url));
        if (builtins.isFile() && builtins.canRead()) {
          final VirtualFile builtins_vfile = LocalFileSystem.getInstance().findFileByIoFile(builtins);
          if (builtins_vfile != null) {
            final Ref<PyFile> result = Ref.create();
            ApplicationManager.getApplication().runReadAction(new Runnable() {
              @Override
              public void run() {
                PsiFile file = PsiManager.getInstance(project).findFile(builtins_vfile);
                if (file instanceof PyFile) {
                  result.set((PyFile)file);
                }
              }
            });
            return result.get();

          }
        }
      }
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:PyBuiltinCache.java

示例15: getResolveScope

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的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


注:本文中的com.intellij.openapi.projectRoots.Sdk.getSdkType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。