• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProjectJdkImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.projectRoots.impl.ProjectJdkImpl的典型用法代码示例。如果您正苦于以下问题:Java ProjectJdkImpl类的具体用法?Java ProjectJdkImpl怎么用?Java ProjectJdkImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ProjectJdkImpl类属于com.intellij.openapi.projectRoots.impl包,在下文中一共展示了ProjectJdkImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createMockSdk

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public static Sdk createMockSdk(String jdkHome, final String versionName) {
    File jdkHomeFile = new File(jdkHome);
    // if (!jdkHomeFile.exists()) return null;

    final Sdk jdk = new ProjectJdkImpl(versionName, LuaSdkType.getInstance());
    final SdkModificator sdkModificator = jdk.getSdkModificator();

    String path = jdkHome.replace(File.separatorChar, '/');
    sdkModificator.setHomePath(path);
    sdkModificator.setVersionString(
            versionName); // must be set after home path, otherwise setting home path clears the version string
    sdkModificator.addRoot(StdLibrary.getStdFileLocation(), OrderRootType.SOURCES);
    sdkModificator.commitChanges();

    return jdk;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:17,代码来源:LuaJSdk.java


示例2: reset

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Override
public void reset() {
  super.reset();

  myProjectJdksModel.reset(myProject);

  myRoot.removeAllChildren();
  final Map<Sdk, Sdk> sdks = myProjectJdksModel.getProjectSdks();
  for (Sdk sdk : sdks.keySet()) {
    final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject);
    addNode(new MyNode(configurable), myRoot);
  }
  selectJdk(myProjectJdksModel.getProjectSdk()); //restore selection

  JBSplitter splitter = extractSplitter();
  if (splitter != null) {
    splitter.setAndLoadSplitterProportionKey("project.jdk.splitter");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ProjectJdksConfigurable.java


示例3: createActions

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  if (myProjectJdksModel == null) {
    return null;
  }
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ProjectJdksConfigurable.java


示例4: doAdd

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public void doAdd(JComponent parent, final SdkType type, final Consumer<Sdk> callback) {
  myModified = true;
  if (type.supportsCustomCreateUI()) {
    type.showCustomCreateUI(this, parent, new Consumer<Sdk>() {
      @Override
      public void consume(Sdk sdk) {
        setupSdk(sdk, callback);
      }
    });
  }
  else {
    SdkConfigurationUtil.selectSdkHome(type, new Consumer<String>() {
      @Override
      public void consume(final String home) {
        String newSdkName = SdkConfigurationUtil.createUniqueSdkName(type, home, myProjectSdks.values());
        final ProjectJdkImpl newJdk = new ProjectJdkImpl(newSdkName, type);
        newJdk.setHomePath(home);
        setupSdk(newJdk, callback);
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ProjectSdksModel.java


示例5: getVEnvCallback

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的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


示例6: apply

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public void apply() throws ConfigurationException {
  /*if (mySandboxHome.getText() == null || mySandboxHome.getText().length() == 0) {
    throw new ConfigurationException(DevKitBundle.message("sandbox.specification"));
  }*/
  mySandboxHome.addCurrentTextToHistory();
  final Sandbox additionalData = (Sandbox)myIdeaJdk.getSdkAdditionalData();
  if (additionalData != null) {
    additionalData.cleanupWatchedRoots();
  }
  Sandbox sandbox = new Sandbox(mySandboxHome.getText(), (Sdk)myInternalJres.getSelectedItem(), myIdeaJdk);
  final SdkModificator modificator = myIdeaJdk.getSdkModificator();
  modificator.setSdkAdditionalData(sandbox);
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      modificator.commitChanges();
    }
  });
  ((ProjectJdkImpl) myIdeaJdk).resetVersionString();
  myModified = false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IdeaJdkConfigurable.java


示例7: reset

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Override
public void reset() {
  super.reset();

  myProjectJdksModel.reset(myProject);

  myRoot.removeAllChildren();
  final Map<Sdk, Sdk> sdks = myProjectJdksModel.getProjectSdks();
  for (Sdk sdk : sdks.keySet()) {
    final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject);
    addNode(new MyNode(configurable), myRoot);
  }
  selectJdk(myProjectJdksModel.getProjectSdk()); //restore selection
  final String value = PropertiesComponent.getInstance().getValue(SPLITTER_PROPORTION);
  if (value != null) {
    try {
      final Splitter splitter = extractSplitter();
      if (splitter != null) {
        (splitter).setProportion(Float.parseFloat(value));
      }
    }
    catch (NumberFormatException e) {
      //do not set proportion
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:ProjectJdksConfigurable.java


示例8: createActions

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(final boolean fromPopup) {
  final ArrayList<AnAction> actions = new ArrayList<AnAction>();
  DefaultActionGroup group = new DefaultActionGroup(ProjectBundle.message("add.new.jdk.text"), true);
  group.getTemplatePresentation().setIcon(IconUtil.getAddIcon());
  myProjectJdksModel.createAddActions(group, myTree, new Consumer<Sdk>() {
    @Override
    public void consume(final Sdk projectJdk) {
      addNode(new MyNode(new JdkConfigurable(((ProjectJdkImpl)projectJdk), myProjectJdksModel, TREE_UPDATER, myHistory, myProject), false), myRoot);
      selectNodeInTree(findNodeByObject(myRoot, projectJdk));
    }
  });
  actions.add(new MyActionGroupWrapper(group));
  actions.add(new MyDeleteAction(Conditions.<Object[]>alwaysTrue()));
  return actions;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ProjectJdksConfigurable.java


示例9: getLanguageSettingsComponent

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
  final Project project = ProjectManager.getInstance().getDefaultProject();
  PyConfigurableInterpreterList instance = PyConfigurableInterpreterList.getInstance(project);
  if (instance == null) {
    return null;
  }
  final List<Sdk> sdks = instance.getAllPythonSdks();
  VirtualEnvProjectFilter.removeAllAssociated(sdks);
  // by default we create new virtual env in project, we need to add this non-existing sdk to sdk list
  ProjectJdkImpl fakeSdk = createFakeSdk(selectedCourse);
  if (fakeSdk != null) {
    sdks.add(0, fakeSdk);
  }
  PythonSdkChooserCombo combo = new PythonSdkChooserCombo(project, sdks, sdk -> true);
  if (fakeSdk != null) {
    patchRenderer(fakeSdk, combo);
    combo.getComboBox().setSelectedItem(fakeSdk);
  }
  if (SystemInfo.isMac && !UIUtil.isUnderDarcula()) {
    combo.putClientProperty("JButton.buttonType", null);
  }
  combo.setButtonIcon(PythonIcons.Python.InterpreterGear);
  combo.addChangedListener(e -> {
    Sdk selectedSdk = (Sdk)combo.getComboBox().getSelectedItem();
    mySettings.setSdk(selectedSdk == fakeSdk ? null : selectedSdk);
  });
  return LabeledComponent.create(combo, "Interpreter", BorderLayout.WEST);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:31,代码来源:PyStudyDirectoryProjectGenerator.java


示例10: createFakeSdk

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Nullable
private static ProjectJdkImpl createFakeSdk(@NotNull Course selectedCourse) {
  String fakeSdkPath = getBaseSdk(selectedCourse);
  if (fakeSdkPath == null) {
    return null;
  }
  PythonSdkFlavor flavor = PythonSdkFlavor.getApplicableFlavors(false).get(0);
  String prefix = flavor.getName() + " ";
  String versionString = flavor.getVersionString(fakeSdkPath);
  if (versionString == null || !versionString.contains(prefix)) {
    return null;
  }
  String name = "new virtual env " + versionString.substring(prefix.length());
  return new ProjectJdkImpl(name, PythonSdkType.getInstance());
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:16,代码来源:PyStudyDirectoryProjectGenerator.java


示例11: patchRenderer

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
private static void patchRenderer(@NotNull ProjectJdkImpl fakeSdk, @NotNull PythonSdkChooserCombo combo) {
  combo.getComboBox().setRenderer(new PySdkListCellRenderer(true) {
    @Override
    public void customize(JList list, Object item, int index, boolean selected, boolean hasFocus) {
      super.customize(list, item, index, selected, hasFocus);
      if (item == fakeSdk) {
        setIcon(IconLoader.getTransparentIcon(PythonIcons.Python.Virtualenv));
      }
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:12,代码来源:PyStudyDirectoryProjectGenerator.java


示例12: createAndAddVirtualEnv

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的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());
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:40,代码来源:PyStudyDirectoryProjectGenerator.java


示例13: createMockSdk

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
private static Sdk createMockSdk(String jdkHome, final String versionName) {
    File jdkHomeFile = new File(jdkHome);
    // if (!jdkHomeFile.exists()) return null;

    final Sdk jdk = new ProjectJdkImpl(versionName, LuaSdkType.getInstance());
    final SdkModificator sdkModificator = jdk.getSdkModificator();

    String path = jdkHome.replace(File.separatorChar, '/');
    sdkModificator.setHomePath(path);
    sdkModificator.setVersionString(versionName); // must be set after home path, otherwise setting home path clears the version string
    sdkModificator.addRoot(StdLibrary.getStdFileLocation(), OrderRootType.SOURCES);
    sdkModificator.commitChanges();

    return jdk;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:16,代码来源:KahluaSdk.java


示例14: getTestJdk

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public static Sdk getTestJdk() {
  try {
    ProjectJdkImpl jdk = (ProjectJdkImpl)JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().clone();
    jdk.setName(TEST_JDK_NAME);
    return jdk;
  }
  catch (CloneNotSupportedException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaTestUtil.java


示例15: SdkEditor

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public SdkEditor(SdkModel sdkModel, History history, final ProjectJdkImpl sdk) {
  mySdkModel = sdkModel;
  myHistory = history;
  mySdk = sdk;
  createMainPanel();
  initSdk(sdk);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SdkEditor.java


示例16: doSetHomePath

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
private void doSetHomePath(final String homePath, final SdkType sdkType) {
  if (homePath == null){
    return;
  }
  setHomePathValue(homePath.replace('/', File.separatorChar));

  final String newSdkName = suggestSdkName(homePath);
  ((ProjectJdkImpl)mySdk).setName(newSdkName);

  try {
    final Sdk dummySdk = (Sdk)mySdk.clone();
    SdkModificator sdkModificator = dummySdk.getSdkModificator();
    sdkModificator.setHomePath(homePath);
    sdkModificator.removeAllRoots();
    sdkModificator.commitChanges();

    sdkType.setupSdkPaths(dummySdk, mySdkModel);

    clearAllPaths();
    myVersionString = dummySdk.getVersionString();
    if (myVersionString == null) {
      Messages.showMessageDialog(ProjectBundle.message("sdk.java.corrupt.error", homePath),
                               ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon());
    }
    sdkModificator = dummySdk.getSdkModificator();
    for (OrderRootType type : myPathEditors.keySet()) {
      SdkPathEditor pathEditor = myPathEditors.get(type);
      pathEditor.setAddBaseDir(dummySdk.getHomeDirectory());
      pathEditor.addPaths(sdkModificator.getRoots(type));
    }
    mySdkModel.getMulticaster().sdkHomeSelected(dummySdk, homePath);
  }
  catch (CloneNotSupportedException e) {
    LOG.error(e); // should not happen in normal program
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:SdkEditor.java


示例17: JdkConfigurable

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public JdkConfigurable(final ProjectJdkImpl projectJdk,
                       final ProjectSdksModel sdksModel,
                       final Runnable updateTree, @NotNull History history, Project project) {
  super(true, updateTree);
  myProjectJdk = projectJdk;
  mySdkEditor = createSdkEditor(sdksModel, history, myProjectJdk);
  final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(project).getContext();
  myProjectStructureElement = new SdkProjectStructureElement(context, myProjectJdk);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JdkConfigurable.java


示例18: loadTree

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
@Override
protected void loadTree() {
  final Map<Sdk,Sdk> sdks = myJdksTreeModel.getProjectSdks();
  for (Sdk sdk : sdks.keySet()) {
    final JdkConfigurable configurable = new JdkConfigurable((ProjectJdkImpl)sdks.get(sdk), myJdksTreeModel, TREE_UPDATER, myHistory,
                                                             myProject);
    addNode(new MyNode(configurable), myRoot);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JdkListConfigurable.java


示例19: addJdkNode

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public boolean addJdkNode(final Sdk jdk, final boolean selectInTree) {
  if (!myUiDisposed) {
    myContext.getDaemonAnalyzer().queueUpdate(new SdkProjectStructureElement(myContext, jdk));
    addNode(new MyNode(new JdkConfigurable((ProjectJdkImpl)jdk, myJdksTreeModel, TREE_UPDATER, myHistory, myProject)), myRoot);
    if (selectInTree) {
      selectNodeInTree(MasterDetailsComponent.findNodeByObject(myRoot, jdk));
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JdkListConfigurable.java


示例20: create

import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl; //导入依赖的package包/类
public static Sdk create(final String version, @NotNull final VirtualFile ... additionalRoots) {
  final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/";

  String sdkHome = new File(mock_path, "bin/python"+version).getPath();
  SdkType sdkType = PythonSdkType.getInstance();


  final Sdk sdk = new ProjectJdkImpl(MOCK_SDK_NAME + " " + version, sdkType) {
    @Override
    public String getVersionString() {
      return "Python " + version + " Mock SDK";
    }
  };
  final SdkModificator sdkModificator = sdk.getSdkModificator();
  sdkModificator.setHomePath(sdkHome);

  File libPath = new File(mock_path, "Lib");
  if (libPath.exists()) {
    sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(libPath), OrderRootType.CLASSES);
  }

  PyUserSkeletonsUtil.addUserSkeletonsRoot(PySdkUpdater.fromSdkModificator(sdk, sdkModificator));

  String mock_stubs_path = mock_path + PythonSdkType.SKELETON_DIR_NAME;
  sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByPath(mock_stubs_path), PythonSdkType.BUILTIN_ROOT_TYPE);

  for (final VirtualFile root : additionalRoots) {
    sdkModificator.addRoot(root, OrderRootType.CLASSES);
  }

  sdkModificator.commitChanges();

  final FileBasedIndex index = FileBasedIndex.getInstance();
  index.requestRebuild(StubUpdatingIndex.INDEX_ID);
  index.requestRebuild(PyModuleNameIndex.NAME);

  return sdk;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:PythonMockSdk.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SOAPStyle类代码示例发布时间:2022-05-23
下一篇:
Java StrutsConstants类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap