Java 类com.intellij.openapi.projectRoots.impl.SdkListCellRenderer 实例源码

项目:intellij-ocaml    文件:OCamlToolWindowSettingsForm.java   
public OCamlToolWindowSettingsForm(@NotNull final Project project) {
    myProject = project;

    final List<Sdk> allSdks = ProjectJdkTable.getInstance().getSdksOfType(OCamlSdkType.getInstance());
    allSdks.add(0, null);
    mySdkComboBox.setModel(new CollectionComboBoxModel(allSdks, null));
    mySdkComboBox.setRenderer(new SdkListCellRenderer("<Project Default>"));

    myConfigureButton.addActionListener(new ActionListener() {
        public void actionPerformed(@NotNull final ActionEvent e) {
            final ProjectJdksEditor editor = new ProjectJdksEditor((Sdk) mySdkComboBox.getSelectedItem(),
                myProject, mySdkComboBox);
            editor.show();
            if (editor.isOK()) {
                setSelectedSdk(editor.getSelectedJdk());
            }
        }
    });

    final FileChooserDescriptor workingDirChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false);
    workingDirChooserDescriptor.setRoot(myProject.getBaseDir());
    myWorkingDirectoryEditor.addBrowseFolderListener("Select Working Directory", "", myProject, workingDirChooserDescriptor);
}
项目:intellij-ce-playground    文件:PyPluginCommonOptionsForm.java   
public PyPluginCommonOptionsForm(PyCommonOptionsFormData data) {
  // setting modules
  myProject = data.getProject();
  final List<Module> validModules = data.getValidModules();
  Collections.sort(validModules, new ModulesAlphaComparator());
  Module selection = validModules.size() > 0 ? validModules.get(0) : null;
  myModuleComboBox.setModules(validModules);
  myModuleComboBox.setSelectedModule(selection);

  myInterpreterComboBox.setRenderer(new SdkListCellRenderer("<Project Default>"));
  myWorkingDirectoryTextField.addBrowseFolderListener("Select Working Directory", "", data.getProject(),
                                                FileChooserDescriptorFactory.createSingleFolderDescriptor());

  ActionListener listener = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      updateControls();
    }
  };
  myUseSpecifiedSdkRadioButton.addActionListener(listener);
  myUseModuleSdkRadioButton.addActionListener(listener);
  myInterpreterComboBox.addActionListener(listener);
  myModuleComboBox.addActionListener(listener);

  setAnchor(myEnvsComponent.getLabel());


  myDecorator = new HideableDecorator(myHideablePanel, "Environment", false) {
    @Override
    protected void on() {
      super.on();
      storeState();
    }

    @Override
    protected void off() {
      super.off();
      storeState();
    }
    private void storeState() {
      PropertiesComponent.getInstance().setValue(EXPAND_PROPERTY_KEY, String.valueOf(isExpanded()), "true");
    }
  };
  myDecorator.setOn(PropertiesComponent.getInstance().getBoolean(EXPAND_PROPERTY_KEY, true));
  myDecorator.setContentComponent(myMainPanel);
  myPathMappingsComponent.setAnchor(myEnvsComponent.getLabel());
  updateControls();
}
项目:intellij-ce-playground    文件:PyIdeCommonOptionsForm.java   
private void updateDefaultInterpreter(Module module) {
  final Sdk sdk = module == null ? null : ModuleRootManager.getInstance(module).getSdk();
  String projectSdkName = sdk == null ? "none" : sdk.getName();
  myInterpreterComboBox.setRenderer(new SdkListCellRenderer("Project Default (" + projectSdkName + ")"));
}