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


Java Sdk.getName方法代碼示例

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


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

示例1: addDetectedSdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private static Sdk addDetectedSdk(@NotNull Sdk sdk, @NotNull Project project) {
  final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
  final String name = sdk.getName();
  VirtualFile sdkHome = WriteAction.compute(() -> LocalFileSystem.getInstance().refreshAndFindFileByPath(name));
  sdk = SdkConfigurationUtil.createAndAddSDK(sdkHome.getPath(), PythonSdkType.getInstance());
  if (sdk != null) {
    PythonSdkUpdater.updateOrShowError(sdk, null, project, null);
  }

  model.addSdk(sdk);
  try {
    model.apply();
  }
  catch (ConfigurationException exception) {
    LOG.error("Error adding detected python interpreter " + exception.getMessage());
  }
  return sdk;
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:19,代碼來源:PyStudyDirectoryProjectGenerator.java

示例2: reloadModel

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private void reloadModel() {
  myFreeze = true;
  final Sdk projectJdk = myJdksModel.getProjectSdk();
  myCbProjectJdk.reloadModel(new JdkComboBox.NoneJdkComboBoxItem(), myProject);
  final String sdkName = projectJdk == null ? ProjectRootManager.getInstance(myProject).getProjectSdkName() : projectJdk.getName();
  if (sdkName != null) {
    final Sdk jdk = myJdksModel.findSdk(sdkName);
    if (jdk != null) {
      myCbProjectJdk.setSelectedJdk(jdk);
    } else {
      myCbProjectJdk.setInvalidJdk(sdkName);
      clearCaches();
    }
  } else {
    myCbProjectJdk.setSelectedJdk(null);
  }
  myFreeze = false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ProjectJdkConfigurable.java

示例3: jdkNameChanged

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public void jdkNameChanged(final Sdk jdk, final String previousName) {
  mergeRootsChangesDuring(new Runnable() {
    @Override
    public void run() {
      for (ProjectJdkTable.Listener listener : getListeners()) {
        listener.jdkNameChanged(jdk, previousName);
      }
    }
  });
  String currentName = getProjectSdkName();
  if (previousName != null && previousName.equals(currentName)) {
    // if already had jdk name and that name was the name of the jdk just changed
    myProjectSdkName = jdk.getName();
    myProjectSdkType = jdk.getSdkType().getName();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ProjectRootManagerImpl.java

示例4: generateBuiltinSkeletons

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public void generateBuiltinSkeletons(@NotNull Sdk sdk) throws InvalidSdkException {
  //noinspection ResultOfMethodCallIgnored
  new File(mySkeletonsPath).mkdirs();
  String binaryPath = sdk.getHomePath();
  if (binaryPath == null) throw new InvalidSdkException("Broken home path for " + sdk.getName());

  long startTime = System.currentTimeMillis();
  final ProcessOutput runResult = getProcessOutput(
    new File(binaryPath).getParent(),
    new String[]{
      binaryPath,
      PythonHelpersLocator.getHelperPath(GENERATOR3),
      "-d", mySkeletonsPath, // output dir
      "-b", // for builtins
    },
    PythonSdkType.getVirtualEnvExtraEnv(binaryPath), MINUTE * 5
  );
  runResult.checkSuccess(LOG);
  LOG.info("Rebuilding builtin skeletons took " + (System.currentTimeMillis() - startTime) + " ms");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:PySkeletonGenerator.java

示例5: forSdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@NotNull
public synchronized PyPackageManager forSdk(Sdk sdk) {
  final String name = sdk.getName();
  PyPackageManagerImpl manager = myInstances.get(name);
  if (manager == null) {
    if (PythonSdkType.isRemote(sdk)) {
      manager = new PyRemotePackageManagerImpl(sdk);
    }
    else if (PyCondaPackageManagerImpl.isCondaVEnv(sdk) && PyCondaPackageService.getCondaExecutable() != null) {
      manager = new PyCondaPackageManagerImpl(sdk);
    }
    else {
      manager = new PyPackageManagerImpl(sdk);
    }
    myInstances.put(name, manager);
  }
  return manager;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PyPackageManagersImpl.java

示例6: isDuplicateSdkName

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private boolean isDuplicateSdkName(String s, Sdk sdk) {
  for (Sdk existingSdk : myProjectSdksModel.getSdks()) {
    if (existingSdk == sdk) {
      continue;
    }
    String existingName;
    if (myModificators.containsKey(existingSdk)) {
      existingName = myModificators.get(existingSdk).getName();
    }
    else {
      existingName = existingSdk.getName();
    }
    if (existingName.equals(s)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:PythonSdkDetailsDialog.java

示例7: init

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public void init(@Nullable Sdk jdk, Sdk androidSdk, IAndroidTarget buildTarget) {
  updateJdks();

  final String jdkName = jdk != null ? jdk.getName() : null;

  if (androidSdk != null) {
    for (int i = 0; i < myJdksModel.getSize(); i++) {
      if (Comparing.strEqual(((Sdk)myJdksModel.getElementAt(i)).getName(), jdkName)) {
        myInternalJdkComboBox.setSelectedIndex(i);
        break;
      }
    }
  }

  mySdkLocation = androidSdk != null ? androidSdk.getHomePath() : null;
  AndroidSdkData androidSdkData = mySdkLocation != null ? AndroidSdkData.getSdkData(mySdkLocation) : null;

  myFreeze = true;
  updateBuildTargets(androidSdkData, buildTarget);
  myFreeze = false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:AndroidSdkConfigurableForm.java

示例8: getState

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    LuaCommandLineState state = null;

    Sdk sdk = getSdk();
    final boolean isDebugger = executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID);

    if(sdk != null && sdk.getSdkType() instanceof LuaSdkType) {
        if (sdk.getName().equals(KahluaSdk.NAME)) {
            state = new KahluaCommandLineState(this, env);
        }
        else if (sdk.getName().equals(LuaJSdk.NAME)) {
            state = new LuaJExternalCommandLineState(this, env);
        }

        if ((state != null) && isDebugger)
            throw new ExecutionException("Debugging not supported for SDK " + sdk.getName() + ". Please configure a real Lua SDK.");
    }

    if (state == null) {
        if (isDebugger)
            state = new LuaDebugCommandlineState(this, env);
        else
            state = new LuaCommandLineState(this, env);
    }

    TextConsoleBuilder textConsoleBuilder = new LuaTextConsoleBuilder(getProject());
    textConsoleBuilder.addFilter(new LuaLineErrorFilter(getProject()));

    state.setConsoleBuilder(textConsoleBuilder);
    return state;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:32,代碼來源:LuaRunConfiguration.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: getProjectSdkName

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
@Nullable
public String getProjectSdkName(final Project project) {
  final String projectJdkName = ProjectRootManager.getInstance(project).getProjectSdkName();
  final Sdk projectJdk = getProjectSdk(project);
  if (projectJdk != null) {
    return projectJdk.getName();
  }
  else {
    final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel();
    return projectJdksModel.findSdk(projectJdkName) == null ? projectJdkName : null;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:UIRootConfigurationAccessor.java

示例11: setProjectSdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public void setProjectSdk(Sdk sdk) {
  ApplicationManager.getApplication().assertWriteAccessAllowed();
  if (sdk == null) {
    myProjectSdkName = null;
    myProjectSdkType = null;
  }
  else {
    myProjectSdkName = sdk.getName();
    myProjectSdkType = sdk.getSdkType().getName();
  }
  projectJdkChanged();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ProjectRootManagerImpl.java

示例12: getJdkName

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
@Nullable
public String getJdkName() {
  if (myJdkName != null) return myJdkName;
  Sdk jdk = getJdk();
  if (jdk != null) {
    return jdk.getName();
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ModuleJdkOrderEntryImpl.java

示例13: configureJdk

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
private static void configureJdk(Element cfg, @NotNull Module module) {
  String jdkName = cfg.getChildTextTrim("jdkName");
  if (StringUtil.isEmptyOrSpaces(jdkName)) return;

  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);

  String currentSdkName = null;
  Sdk sdk = rootManager.getSdk();
  if (sdk != null) {
    currentSdkName = sdk.getName();
  }

  if (!jdkName.equals(currentSdkName)) {
    ModifiableRootModel model = rootManager.getModifiableModel();

    if (jdkName.equals(ProjectRootManager.getInstance(model.getProject()).getProjectSdkName())) {
      model.inheritSdk();
    }
    else {
      Sdk jdk = ProjectJdkTable.getInstance().findJdk(jdkName);
      if (jdk != null) {
        model.setSdk(jdk);
      }
      else {
        model.setInvalidSdk(jdkName, JavaSdk.getInstance().getName());
      }
    }

    model.commit();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:MavenIdeaPluginConfigurer.java

示例14: customize

import com.intellij.openapi.projectRoots.Sdk; //導入方法依賴的package包/類
@Override
public void customize(JList list, Object item, int index, boolean selected, boolean hasFocus) {
  if (item instanceof Sdk) {
    Sdk sdk = (Sdk)item;
    final PythonSdkFlavor flavor = PythonSdkFlavor.getPlatformIndependentFlavor(sdk.getHomePath());
    final Icon icon = flavor != null ? flavor.getIcon() : ((SdkType)sdk.getSdkType()).getIcon();

    String name;
    if (mySdkModifiers != null && mySdkModifiers.containsKey(sdk)) {
      name = mySdkModifiers.get(sdk).getName();
    }
    else {
      name = sdk.getName();
    }
    if (name.startsWith("Remote")) {
      final String trimmedRemote = StringUtil.trim(name.substring("Remote".length()));
      if (!trimmedRemote.isEmpty())
        name = trimmedRemote;
    }
    final String flavorName = flavor == null ? "Python" : flavor.getName();
    if (name.startsWith(flavorName)) name = StringUtil.trim(name.substring(flavorName.length()));

    if (isShortVersion){
      name = shortenName(name);
    }

    if (PythonSdkType.isInvalid(sdk)) {
      setText("[invalid] " + name);
      setIcon(wrapIconWithWarningDecorator(icon));
    }
    else if (PythonSdkType.isIncompleteRemote(sdk)) {
      setText("[incomplete] " + name);
      setIcon(wrapIconWithWarningDecorator(icon));
    }
    else if (PythonSdkType.hasInvalidRemoteCredentials(sdk)) {
      setText("[invalid] " + name);
      setIcon(wrapIconWithWarningDecorator(icon));
    }
    else if (sdk instanceof PyDetectedSdk) {
      setText(name);
      setIcon(IconLoader.getTransparentIcon(icon));
    }
    else {
      setText(name);
      setIcon(icon);
    }
  }
  else if (SEPARATOR.equals(item))
    setSeparator();
  else if (item == null)
    setText(myNullText);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:53,代碼來源:PySdkListCellRenderer.java

示例15: 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


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