当前位置: 首页>>代码示例>>Java>>正文


Java CollectionComboBoxModel类代码示例

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


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

示例1: initAsyncComboBoxModel

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
public static void initAsyncComboBoxModel(@NotNull final JComboBox jComboBox,
                                          @NotNull final String groupId,
                                          final URL... localUrls) {
  final List<Object> items = new ArrayList<Object>();

  new UiNotifyConnector.Once(jComboBox, new Activatable() {
    @Override
    public void showNotify() {
      loadItems(jComboBox, items, groupId, localUrls);
    }

    @Override
    public void hideNotify() {
    }
  });

  items.add("loading...");
  jComboBox.setModel(new CollectionComboBoxModel(items, items.get(0)));
  jComboBox.setEnabled(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibrariesDownloadUiUtil.java

示例2: RestConfigurationEditor

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
public RestConfigurationEditor(final Project project,
                               AbstractPythonRunConfiguration configuration,
                               CollectionComboBoxModel model) {
  myCommonOptionsForm = PyCommonOptionsFormFactory.getInstance().createForm(configuration.getCommonOptionsFormData());
  myCommonOptionsPlaceholder.add(myCommonOptionsForm.getMainPanel());
  myProject = project;
  myTasks.setModel(model);
  myTasks.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      Object task = myTasks.getSelectedItem();
      if (task != null &&
          (task.toString().equals("rst2latex") ||
           task.toString().equals("rst2odt")))
        myOpenInBrowser.setEnabled(false);
      else
        myOpenInBrowser.setEnabled(true);
    }
  });
  myOpenInBrowser.setSelected(false);

  setAnchor(myCommonOptionsForm.getAnchor());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RestConfigurationEditor.java

示例3: showOptions

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的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

示例4: initVersionKindSelector

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private void initVersionKindSelector() {
  List<String> versionKinds = Arrays.asList(
    ProjectBundle.message("maven.version.kind.selector.release"),
    ProjectBundle.message("maven.version.kind.selector.latest"),
    ProjectBundle.message("maven.version.kind.selector.select"));
  CollectionComboBoxModel<String> versionKindSelectorModel = new CollectionComboBoxModel<String>(versionKinds);
  //noinspection unchecked
  versionKindSelector.setModel(versionKindSelectorModel);
  versionKindSelector.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      VersionKind newVersionKind = getSelectedVersionKind();
      if (newVersionKind != versionKind) {
        versionKind = newVersionKind;
        versionKindChanged();
      }
    }
  });
  setSelectedVersionKind(getVersionKind(model.getVersion()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RepositoryLibraryPropertiesEditor.java

示例5: OCamlToolWindowSettingsForm

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
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);
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:24,代码来源:OCamlToolWindowSettingsForm.java

示例6: NewDefracSdkDialog

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
public NewDefracSdkDialog(@Nullable final Project project,
                          @NotNull final List<Sdk> jdks,
                          @NotNull final Sdk selectedJdk,
                          @NotNull final List<DefracVersion> defracVersions,
                          @NotNull final DefracVersion selectedDefracVersion) {
  super(project);

  setTitle("Create New Defrac SDK");

  jdkLabel.setLabelFor(jdkComboBox);
  defracVersionLabel.setLabelFor(defracVersionComboBox);

  //noinspection unchecked
  jdkComboBox.setModel(new CollectionComboBoxModel(jdks, selectedJdk));
  jdkComboBox.setRenderer(new SdkRenderer());

  //noinspection unchecked
  defracVersionComboBox.setModel(new CollectionComboBoxModel(defracVersions, selectedDefracVersion));
  defracVersionComboBox.setRenderer(new DefracVersionRenderer());

  init();
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:23,代码来源:NewDefracSdkDialog.java

示例7: loadAvailableCodeStyleSchemes

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private void loadAvailableCodeStyleSchemes() {
    final CodeStyleSchemes schemes = PersistableCodeStyleSchemes.getInstance();
    if (schemes != null) {
        final List<String> schemesList = new ArrayList<String>(schemes.getSchemes().length);

        String selectedCodeStyleSchemeName = getModuleCodeStyleSchemeName();
        boolean schemeExists = false;
        for (CodeStyleScheme scheme : schemes.getSchemes()) {
            schemesList.add(scheme.getName());
            if (scheme.getName().equals(selectedCodeStyleSchemeName))
                schemeExists = true;
        }

        if (!schemeExists)
            selectedCodeStyleSchemeName = ModuleCodeStyleState.defaultState().getCodeStyleSchemeName();

        final ComboBoxModel model = new CollectionComboBoxModel(schemesList, selectedCodeStyleSchemeName);
        codeStyleSchemesComboBox.setModel(model);
    } else {
        mainPanel.setEnabled(false);
    }
}
 
开发者ID:idanmo,项目名称:module-code-style,代码行数:23,代码来源:ModuleCodeStyleConfigurable.java

示例8: createCombo

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private JComboBox createCombo(List<Language> languages) {
  JComboBox jComboBox = new ComboBox(new CollectionComboBoxModel(languages));
  jComboBox.setRenderer(new ListCellRendererWrapper<Language>() {
    @Override
    public void customize(JList list, Language lang, int index, boolean selected, boolean hasFocus) {
      if (lang != null) {
        setText(lang.getDisplayName());
        LanguageFileType associatedLanguage = lang.getAssociatedFileType();
        if (associatedLanguage != null) setIcon(associatedLanguage.getIcon());
      }
    }
  });
  new ComboboxSpeedSearch(jComboBox) {
    @Override
    protected String getElementText(Object element) {
      return element instanceof Language ? ((Language) element).getDisplayName() : null;
    }
  };
  Language previous = myProject != null ? myProject.getUserData(SCRATCH_LANGUAGE) : null;
  if (previous != null) {
    jComboBox.setSelectedItem(previous);
  }

  return jComboBox;
}
 
开发者ID:ignatov,项目名称:intellij-scratch,代码行数:26,代码来源:NewScratchFileAction.java

示例9: SaveProjectAsTemplateDialog

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
protected SaveProjectAsTemplateDialog(@NotNull Project project, @Nullable VirtualFile descriptionFile) {
  super(project);
  myProject = project;

  setTitle("Save Project As Template");
  myName.setText(project.getName());

  Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length < 2) {
    myModuleLabel.setVisible(false);
    myModuleCombo.setVisible(false);
  }
  else {
    List<String> items = new ArrayList<String>(ContainerUtil.map(modules, new Function<Module, String>() {
      @Override
      public String fun(Module module) {
        return module.getName();
      }
    }));
    items.add(WHOLE_PROJECT);
    myModuleCombo.setModel(new CollectionComboBoxModel(items, WHOLE_PROJECT));
  }
  myDescription.setFileType(FileTypeManager.getInstance().getFileTypeByExtension(".html"));
  if (descriptionFile != null) {
    try {
      String s = VfsUtilCore.loadText(descriptionFile);
      myDescription.setText(s);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:SaveProjectAsTemplateDialog.java

示例10: createComboBox

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private JComboBox createComboBox(String ri) {
  final JComboBox comboBox = new JComboBox();

  List<Artifact> versions = getSupportedVersions(ri);
  comboBox.setModel(new CollectionComboBoxModel(versions, null));

  comboBox.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      updateCurrentVersion(comboBox);
    }
  });

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

示例11: getEditor

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
@Override
public TableCellEditor getEditor(DetectedRootData o) {
  final ComboBox comboBox = new ComboBox(new CollectionComboBoxModel(Arrays.asList(o.getAllRoots()), o.getSelectedRoot()));
  comboBox.setRenderer(new ListCellRendererWrapper<DetectedProjectRoot>() {
    @Override
    public void customize(JList list, DetectedProjectRoot value, int index, boolean selected, boolean hasFocus) {
      setText(value.getRootTypeName());
    }
  });
  return new DefaultCellEditor(comboBox);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DetectedRootsChooser.java

示例12: FileTypeChooser

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private FileTypeChooser(@NotNull List<String> patterns, @NotNull String fileName) {
  super(true);
  myFileName = fileName;

  myOpenInIdea.setText("Open matching files in " + ApplicationNamesInfo.getInstance().getFullProductName() + ":");

  FileType[] fileTypes = FileTypeManager.getInstance().getRegisteredFileTypes();
  Arrays.sort(fileTypes, new Comparator<FileType>() {
    @Override
    public int compare(final FileType fileType1, final FileType fileType2) {
      if (fileType1 == null) {
        return 1;
      }
      if (fileType2 == null) {
        return -1;
      }
      return fileType1.getDescription().compareToIgnoreCase(fileType2.getDescription());
    }
  });

  final DefaultListModel model = new DefaultListModel();
  for (FileType type : fileTypes) {
    if (!type.isReadOnly() && type != FileTypes.UNKNOWN && !(type instanceof NativeFileType)) {
      model.addElement(type);
    }
  }
  myList.setModel(model);
  myPattern.setModel(new CollectionComboBoxModel(ContainerUtil.map(patterns, FunctionUtil.<String>id()), patterns.get(0)));

  setTitle(FileTypesBundle.message("filetype.chooser.title"));
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:FileTypeChooser.java

示例13: loadItems

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
private static void loadItems(@NotNull final JComboBox jComboBox,
                              final List<Object> items,
                              final String groupId,
                              final URL... localUrls) {
  final ModalityState state = ModalityState.current();
  ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      final List<Object> newItems = new ArrayList<Object>();
      newItems.addAll(Arrays.asList(LibrariesDownloadAssistant.getVersions(groupId, localUrls)));

      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          items.clear();
          if (!newItems.isEmpty()) {
            items.addAll(newItems);
            final CollectionComboBoxModel model = (CollectionComboBoxModel)jComboBox.getModel();
            model.update();
            jComboBox.setSelectedIndex(0);
          }
          jComboBox.setEnabled(true);
        }
      }, state);
    }
  }

  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:LibrariesDownloadUiUtil.java

示例14: setSdkHome

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
public void setSdkHome(String sdkHome) {
  List<Sdk> sdkList = new ArrayList<Sdk>();
  sdkList.add(null);
  final List<Sdk> allSdks = PythonSdkType.getAllSdks();
  Collections.sort(allSdks, new PreferredSdkComparator());
  Sdk selection = null;
  for (Sdk sdk : allSdks) {
    String homePath = sdk.getHomePath();
    if (homePath != null && sdkHome != null && FileUtil.pathsEqual(homePath, sdkHome)) selection = sdk;
    sdkList.add(sdk);
  }

  myInterpreterComboBox.setModel(new CollectionComboBoxModel(sdkList, selection));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PyPluginCommonOptionsForm.java

示例15: reset

import com.intellij.ui.CollectionComboBoxModel; //导入依赖的package包/类
public void reset() {
  final List<File> scriptFiles = BuildoutFacet.getScripts(BuildoutFacet.getInstance(myModule), myModule.getProject().getBaseDir());
  final List<String> scripts = ContainerUtil.map(scriptFiles, new Function<File, String>() {
    @Override
    public String fun(File file) {
      return file.getPath();
    }
  });
  myScript.getComboBox().setModel(new CollectionComboBoxModel(scripts, myConfiguration.getScriptName()));
  myScript.getComboBox().getEditor().setItem(myConfiguration.getScriptName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BuildoutConfigPanel.java


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