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

Java ProjectSdksModel类代码示例

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

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



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

示例1: addDetectedSdk

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的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.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void reloadModel(JdkComboBoxItem firstItem, @Nullable Project project) {
  final DefaultComboBoxModel model = ((DefaultComboBoxModel)getModel());
  if (project == null) {
    model.addElement(firstItem);
    return;
  }
  model.removeAllElements();
  model.addElement(firstItem);
  final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(project).getProjectJdksModel();
  List<Sdk> projectJdks = new ArrayList<Sdk>(projectJdksModel.getProjectSdks().values());
  if (myFilter != null) {
    projectJdks = ContainerUtil.filter(projectJdks, getSdkFilter(myFilter));
  }
  Collections.sort(projectJdks, new Comparator<Sdk>() {
    @Override
    public int compare(final Sdk o1, final Sdk o2) {
      return o1.getName().compareToIgnoreCase(o2.getName());
    }
  });
  for (Sdk projectJdk : projectJdks) {
    model.addElement(new JdkComboBox.JdkComboBoxItem(projectJdk));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JdkComboBox.java


示例3: JdkComboBoxModel

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public JdkComboBoxModel(final ProjectSdksModel jdksModel, Condition<Sdk> sdkFilter) {
  Sdk[] jdks = jdksModel.getSdks();
  if (sdkFilter != null) {
    final List<Sdk> filtered = ContainerUtil.filter(jdks, sdkFilter);
    jdks = filtered.toArray(new Sdk[filtered.size()]); 
  }
  Arrays.sort(jdks, new Comparator<Sdk>() {
    @Override
    public int compare(final Sdk s1, final Sdk s2) {
      return s1.getName().compareToIgnoreCase(s2.getName());
    }
  });
  for (Sdk jdk : jdks) {
    addElement(new JdkComboBoxItem(jdk));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JdkComboBox.java


示例4: ProjectConfigurable

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public ProjectConfigurable(Project project,
                           final StructureConfigurableContext context,
                           ModulesConfigurator configurator,
                           ProjectSdksModel model) {
  myProject = project;
  myContext = context;
  myModulesConfigurator = configurator;
  mySettingsElement = new GeneralProjectSettingsElement(context);
  final ProjectStructureDaemonAnalyzer daemonAnalyzer = context.getDaemonAnalyzer();
  myModulesConfigurator.addAllModuleChangeListener(new ModuleEditor.ChangeListener() {
    @Override
    public void moduleStateChanged(ModifiableRootModel moduleRootModel) {
      daemonAnalyzer.queueUpdate(mySettingsElement);
    }
  });
  init(model);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ProjectConfigurable.java


示例5: fillList

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void fillList(final @Nullable SdkType type, final @Nullable Sdk[] globalSdks) {
  myListModel.clear();
  final Sdk[] jdks;
  if (myProject == null || myProject.isDefault()) {
    final Sdk[] allJdks = globalSdks != null ? globalSdks : ProjectJdkTable.getInstance().getAllJdks();
    jdks = getCompatibleJdks(type, Arrays.asList(allJdks));
  }
  else {
    final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel();
    if (!projectJdksModel.isInitialized()){ //should be initialized
      projectJdksModel.reset(myProject);
    }
    final Collection<Sdk> collection = projectJdksModel.getProjectSdks().values();
    jdks = getCompatibleJdks(type, collection);
  }
  Arrays.sort(jdks, new Comparator<Sdk>() {
    public int compare(final Sdk o1, final Sdk o2) {
      return o1.getName().compareToIgnoreCase(o2.getName());
    }
  });
  for (Sdk jdk : jdks) {
    myListModel.addElement(jdk);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JdkChooserPanel.java


示例6: showOptions

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
private void showOptions(final Project project) {
  final PyConfigurableInterpreterList interpreterList = PyConfigurableInterpreterList.getInstance(project);
  final Sdk[] sdks = interpreterList.getModel().getSdks();
  PythonSdkDetailsStep.show(project, sdks, null, this, getButton().getLocationOnScreen(), new NullableConsumer<Sdk>() {
    @Override
    public void consume(@Nullable Sdk sdk) {
      if (sdk == null) return;
      final PySdkService sdkService = PySdkService.getInstance();
      sdkService.restoreSdk(sdk);

      final ProjectSdksModel projectSdksModel = interpreterList.getModel();
      if (projectSdksModel.findSdk(sdk) == null) {
        projectSdksModel.addSdk(sdk);
        try {
          projectSdksModel.apply();
        }
        catch (ConfigurationException e) {
          LOG.error("Error adding new python interpreter " + e.getMessage());
        }
      }
      //noinspection unchecked
      getComboBox().setModel(new CollectionComboBoxModel(interpreterList.getAllPythonSdks(), sdk));
    }
  }, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PythonSdkChooserCombo.java


示例7: testSatisfied

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void testSatisfied() throws Exception {
  ProjectSdksModel model = new ProjectSdksModel();
  model.addSdk(IdeaTestUtil.getMockJdk17());
  ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
  Sdk sdk = jdkTable.createSdk("a", AndroidSdkType.getInstance());
  mySdks.add(sdk);
  jdkTable.addJdk(sdk);
  AnAction action = getAddAction(model);
  try {
    action.actionPerformed(new TestActionEvent(action));
    fail("Exception should be thrown");
  }
  catch (Exception e) {
    assertEquals(AndroidBundle.message("cannot.parse.sdk.error"), e.getMessage());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidSdkTypeNewProjectWizardTest.java


示例8: BlazeIntellijPluginConfigurationSettingsEditor

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public BlazeIntellijPluginConfigurationSettingsEditor(
    Iterable<Label> javaLabels,
    RunConfigurationStateEditor blazeFlagsEditor,
    RunConfigurationStateEditor exeFlagsEditor) {
  targetCombo =
      new ComboBox<>(
          new DefaultComboBoxModel<>(
              Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
  targetCombo.setRenderer(
      new ListCellRendererWrapper<Label>() {
        @Override
        public void customize(
            JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
          setText(value == null ? null : value.toString());
        }
      });
  this.blazeFlagsEditor = blazeFlagsEditor;
  this.exeFlagsEditor = exeFlagsEditor;
  ProjectSdksModel sdksModel = new ProjectSdksModel();
  sdksModel.reset(null);
  sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);

  keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
  keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:26,代码来源:BlazeIntellijPluginConfiguration.java


示例9: initComponents

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
@Override
protected void initComponents()
{
	myModuleBox = new ComboBox();
	myModuleBox.setRenderer(new ModuleListCellRenderer());

	myVmParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM arguments");
	myVmParametersComponent.setLabelLocation(BorderLayout.WEST);
	copyDialogCaption(myVmParametersComponent);

	myUseAlternativeBundleCheckBox = new JCheckBox("Use alternative bundle: ");
	ProjectSdksModel projectSdksModel = new ProjectSdksModel();
	projectSdksModel.reset();

	myAlternativeBundleComboBox = new SdkComboBox(projectSdksModel, Conditions.<SdkTypeId>is(NodeJSBundleType.getInstance()), true);
	myAlternativeBundleComboBox.setEnabled(false);
	myUseAlternativeBundleCheckBox.addItemListener(new ItemListener()
	{
		@Override
		public void itemStateChanged(ItemEvent e)
		{
			myAlternativeBundleComboBox.setEnabled(myUseAlternativeBundleCheckBox.isSelected());
		}
	});
	super.initComponents();
}
 
开发者ID:consulo,项目名称:consulo-nodejs,代码行数:27,代码来源:NodeJSConfigurationPanelBase.java


示例10: createEditor

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
@NotNull
@Override
protected JComponent createEditor()
{
	JPanel verticalLayout = new JPanel(new VerticalFlowLayout(0, 0));

	ProjectSdksModel model = new ProjectSdksModel();
	model.reset();

	myBundleBox = new SdkComboBox(model, Conditions.equalTo(myBundleType), true);
	verticalLayout.add(LabeledComponent.left(myBundleBox, J2EEBundle.message("label.run.configuration.properties.application.server")));

	JPanel openBrowserPanel = new JPanel();
	openBrowserPanel.setBorder(IdeBorderFactory.createTitledBorder("Open browser"));
	verticalLayout.add(openBrowserPanel);

	if(myBundleType.isJreCustomizable())
	{
		AlternativeJREPanel panel = new AlternativeJREPanel();
		verticalLayout.add(panel);
	}

	verticalLayout.add(mySettingsWrapper);

	return verticalLayout;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:27,代码来源:JavaEEServerConfigurationEditor.java


示例11: reloadModel

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void reloadModel(SdkComboBoxItem firstItem, @Nullable Project project) {
  final DefaultComboBoxModel model = ((DefaultComboBoxModel)getModel());
  if (project == null) {
    model.addElement(firstItem);
    return;
  }
  model.removeAllElements();
  model.addElement(firstItem);
  final ProjectSdksModel projectSdksModel = ProjectStructureConfigurable.getInstance(project).getProjectSdksModel();
  List<Sdk> sdks = new ArrayList<Sdk>(projectSdksModel.getProjectSdks().values());
  if (myFilter != null) {
    sdks = ContainerUtil.filter(sdks, getSdkFilter(myFilter));
  }
  Collections.sort(sdks, new Comparator<Sdk>() {
    @Override
    public int compare(final Sdk o1, final Sdk o2) {
      return o1.getName().compareToIgnoreCase(o2.getName());
    }
  });
  for (Sdk sdk : sdks) {
    model.addElement(new SdkComboBoxItem(sdk));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:SdkComboBox.java


示例12: createAndAddVirtualEnv

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的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: setSetupButton

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void setSetupButton(final JButton setUpButton,
                              @Nullable final Project project,
                              final ProjectSdksModel jdksModel,
                              final JdkComboBoxItem firstItem,
                              @Nullable final Condition<Sdk> additionalSetup,
                              final boolean moduleJdkSetup) {
  setSetupButton(setUpButton, project, jdksModel, firstItem, additionalSetup,
                 ProjectBundle.message("project.roots.set.up.jdk.title", moduleJdkSetup ? 1 : 2));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JdkComboBox.java


示例14: getProjectSdkName

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的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


示例15: ProjectJdksConfigurable

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public ProjectJdksConfigurable(Project project, ProjectSdksModel sdksModel) {
  myProject = project;
  myProjectJdksModel = sdksModel;
  initTree();
  myToReInitWholePanel = true;
  reInitWholePanelIfNeeded();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProjectJdksConfigurable.java


示例16: SdkSettingsStep

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public SdkSettingsStep(WizardContext context,
                       @NotNull ModuleBuilder moduleBuilder,
                       @NotNull Condition<SdkTypeId> sdkFilter) {
  myModuleBuilder = moduleBuilder;

  myWizardContext = context;
  myModel = new ProjectSdksModel();
  Project project = myWizardContext.getProject();
  myModel.reset(project);

  myJdkComboBox = new JdkComboBox(myModel, sdkFilter);
  myJdkPanel = new JPanel(new BorderLayout(4, 0));

  final PropertiesComponent component = project == null ? PropertiesComponent.getInstance() : PropertiesComponent.getInstance(project);
  ModuleType moduleType = moduleBuilder.getModuleType();
  final String selectedJdkProperty = "jdk.selected." + (moduleType == null ? "" : moduleType.getId());
  myJdkComboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      Sdk jdk = myJdkComboBox.getSelectedJdk();
      if (jdk != null) {
        component.setValue(selectedJdkProperty, jdk.getName());
      }
      onSdkSelected(jdk);
    }
  });

  Sdk sdk = getPreselectedSdk(project, component.getValue(selectedJdkProperty), sdkFilter);
  myJdkComboBox.setSelectedJdk(sdk);

  JButton button = new JButton("Ne\u001Bw...");
  myJdkComboBox.setSetupButton(button, project, myModel,
                               project == null ? new JdkComboBox.NoneJdkComboBoxItem() : new JdkComboBox.ProjectJdkComboBoxItem(),
                               null,
                               false);

  myJdkPanel.add(myJdkComboBox);
  myJdkPanel.add(myJdkComboBox.getSetUpButton(), BorderLayout.EAST);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:SdkSettingsStep.java


示例17: subscribe

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
@Override
public void subscribe() {
  PyConfigurableInterpreterList myInterpreterList = PyConfigurableInterpreterList.getInstance(myProject);
  ProjectSdksModel myProjectSdksModel = myInterpreterList.getModel();
  myProjectSdksModel.addListener(new MyListener(this, myInterpreterList));
  updateSdkList(true, myInterpreterList);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyIdeCommonOptionsForm.java


示例18: createUIComponents

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
private void createUIComponents() {
  mySdksModel = new ProjectSdksModel();
  mySdksModel.reset(null);
  myJavaSdkCombo = new JdkComboBox(mySdksModel, new Condition<SdkTypeId>() {
    @Override
    public boolean value(SdkTypeId id) {
      return JavaSdk.getInstance().equals(id);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ChooseAndroidAndJavaSdkStep.java


示例19: testUnsatisfied

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
public void testUnsatisfied() throws Exception {
  ProjectSdksModel model = new ProjectSdksModel();
  AnAction action = getAddAction(model);
  try {
    action.actionPerformed(new TestActionEvent(action));
    fail("Exception should be thrown");
  }
  catch (Exception e) {
    e.printStackTrace();
    assertEquals(AndroidSdkType.getInstance().getUnsatisfiedDependencyMessage(), e.getMessage());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidSdkTypeNewProjectWizardTest.java


示例20: getAddAction

import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel; //导入依赖的package包/类
private static AnAction getAddAction(ProjectSdksModel model) {
  DefaultActionGroup group = new DefaultActionGroup();
  model.createAddActions(group, new JPanel(), null, new Condition<SdkTypeId>() {
    @Override
    public boolean value(SdkTypeId id) {
      return id == AndroidSdkType.getInstance();
    }
  });
  AnAction[] children = group.getChildren(null);
  assertEquals(1, children.length);
  return children[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidSdkTypeNewProjectWizardTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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