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


Java SortedComboBoxModel类代码示例

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


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

示例1: ConfigurationModuleSelector

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
/**
 * @deprecated use {@link #ConfigurationModuleSelector(Project, ModulesComboBox, String)} instead
 */
public ConfigurationModuleSelector(final Project project, final JComboBox modulesList, final String noModule) {
  myProject = project;
  myModulesList = modulesList;
  new ComboboxSpeedSearch(modulesList){
    protected String getElementText(Object element) {
      if (element instanceof Module){
        return ((Module)element).getName();
      } else if (element == null) {
        return noModule;
      }
      return super.getElementText(element);
    }
  };
  myModulesList.setModel(new SortedComboBoxModel<Module>(ModulesAlphaComparator.INSTANCE));
  myModulesList.setRenderer(new ModuleListCellRenderer(noModule));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ConfigurationModuleSelector.java

示例2: ModulesComboBox

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private ModulesComboBox(final SortedComboBoxModel<Module> model) {
  super(model);
  myModel = model;
  new ComboboxSpeedSearch(this){
    @Override
    protected String getElementText(Object element) {
      if (element instanceof Module) {
        return ((Module)element).getName();
      } else if (element == null) {
        return "";
      }
      return super.getElementText(element);
    }
  };
  setRenderer(new ModuleListCellRenderer());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModulesComboBox.java

示例3: createRemoteBranchDropdownModel

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private ComboBoxModel createRemoteBranchDropdownModel() {
    final SortedComboBoxModel<GitRemoteBranch> sortedRemoteBranches
            = new SortedComboBoxModel<GitRemoteBranch>(new TfGitHelper.BranchComparator());
    final GitRemoteBranch remoteTrackingBranch = this.getRemoteTrackingBranch();

    // only show valid remote branches
    sortedRemoteBranches.addAll(Collections2.filter(getInfo().getRemoteBranches(),
                    new Predicate<GitRemoteBranch>() {
                        @Override
                        public boolean apply(final GitRemoteBranch remoteBranch) {
                    /* two conditions:
                     *   1. remote must be a vso/tfs remote
                     *   2. this isn't the remote tracking branch of current local branch
                     */
                            return tfGitRemotes.contains(remoteBranch.getRemote())
                                    && !remoteBranch.equals(remoteTrackingBranch);
                        }
                    })
    );
    sortedRemoteBranches.setSelectedItem(TfGitHelper.getDefaultBranch(sortedRemoteBranches.getItems(), tfGitRemotes));

    return sortedRemoteBranches;
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:24,代码来源:CreatePullRequestModel.java

示例4: createRemoteBranchDropdownModel

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private SortedComboBoxModel<GitRemoteBranch> createRemoteBranchDropdownModel() {
    logger.info("CreateBranchModel.createRemoteBranchDropdownModel");
    final SortedComboBoxModel<GitRemoteBranch> sortedRemoteBranches
            = new SortedComboBoxModel<GitRemoteBranch>(new TfGitHelper.BranchComparator());

    // TODO: add option to retrieve more branches in case the branch they are looking for is missing local
    // only show valid remote branches
    sortedRemoteBranches.addAll(Collections2.filter(gitRepository.getInfo().getRemoteBranches(), new Predicate<GitRemoteBranch>() {
                @Override
                public boolean apply(final GitRemoteBranch remoteBranch) {
                    //  condition: remote must be a vso/tfs remote
                    return tfGitRemotes.contains(remoteBranch.getRemote());
                }
            })
    );
    sortedRemoteBranches.setSelectedItem(TfGitHelper.getDefaultBranch(sortedRemoteBranches.getItems(), tfGitRemotes));
    return sortedRemoteBranches;
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:19,代码来源:CreateBranchModel.java

示例5: ConfigurationModuleSelector

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public ConfigurationModuleSelector(final Project project, final JComboBox<Module> modulesList, final String noModule) {
    myProject = project;
    myModulesList = modulesList;
    new ComboboxSpeedSearch(modulesList) {
        protected String getElementText(Object element) {
            if (element instanceof Module) {
                return ((Module) element).getName();
            } else if (element == null) {
                return noModule;
            }
            return super.getElementText(element);
        }
    };
    myModulesList.setModel(new SortedComboBoxModel<>(ModulesAlphaComparator.INSTANCE));
    myModulesList.setRenderer(new ModuleListCellRenderer(noModule));
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:17,代码来源:ConfigurationModuleSelector.java

示例6: createProfilesModel

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private SortedComboBoxModel createProfilesModel() {
	// noinspection unchecked
	SortedComboBoxModel settingsSortedComboBoxModel = new SortedComboBoxModel(new Comparator<Settings>() {
		@Override
		public int compare(Settings o1, Settings o2) {
			if (o1.isProjectSpecific()) {
				return -1;
			}
			if (o2.isProjectSpecific()) {
				return 1;
			}
			return o1.getName().compareTo(o2.getName());
		}
	});
	refreshProfilesModel(settingsSortedComboBoxModel);
	return settingsSortedComboBoxModel;
}
 
开发者ID:krasa,项目名称:EclipseCodeFormatter,代码行数:18,代码来源:ProjectSettingsForm.java

示例7: ModuleDescriptionsComboBox

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public ModuleDescriptionsComboBox() {
  myModel = new SortedComboBoxModel<>(Comparator.comparing(description -> description != null ? description.getName() : "",
                                                           String.CASE_INSENSITIVE_ORDER));
  setModel(myModel);
  new ComboboxSpeedSearch(this){
    @Override
    protected String getElementText(Object element) {
      if (element instanceof ModuleDescription) {
        return ((ModuleDescription)element).getName();
      }
      else {
        return "";
      }
    }
  };
  setRenderer(new ModuleDescriptionListCellRenderer());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:ModuleDescriptionsComboBox.java

示例8: ConfigurationModuleSelector

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
/**
 * @deprecated use {@link #ConfigurationModuleSelector(Project, ModulesComboBox, String)} instead
 */
public ConfigurationModuleSelector(final Project project, final JComboBox<Module> modulesList, final String noModule)
{
	myProject = project;
	myModulesList = modulesList;
	myModulesDescriptionsComboBox = null;
	new ComboboxSpeedSearch(modulesList)
	{
		protected String getElementText(Object element)
		{
			if(element instanceof Module)
			{
				return ((Module) element).getName();
			}
			else if(element == null)
			{
				return noModule;
			}
			return super.getElementText(element);
		}
	};
	myModulesList.setModel(new SortedComboBoxModel<>(ModulesAlphaComparator.INSTANCE));
	myModulesList.setRenderer(new ModuleListCellRenderer(noModule));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:ConfigurationModuleSelector.java

示例9: setModules

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private void setModules(final Collection<Module> modules)
{
	if(myModulesDescriptionsComboBox != null)
	{
		myModulesDescriptionsComboBox.setModules(modules);
	}
	else if(myModulesList instanceof ModulesComboBox)
	{
		((ModulesComboBox) myModulesList).setModules(modules);
	}
	else
	{
		SortedComboBoxModel<Module> model = (SortedComboBoxModel<Module>) myModulesList.getModel();
		model.setAll(modules);
		model.add(null);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:ConfigurationModuleSelector.java

示例10: setModules

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private void setModules(final Collection<Module> modules) {
  if (myModulesList instanceof ModulesComboBox) {
    ((ModulesComboBox)myModulesList).setModules(modules);
  }
  else {
    SortedComboBoxModel<Module> model = (SortedComboBoxModel<Module>)myModulesList.getModel();
    model.setAll(modules);
    model.add(null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ConfigurationModuleSelector.java

示例11: GithubCreatePullRequestPanel

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public GithubCreatePullRequestPanel() {
  myDescriptionTextArea.setBorder(BorderFactory.createEtchedBorder());

  myBranchModel = new SortedComboBoxModel<BranchInfo>(new Comparator<BranchInfo>() {
    @Override
    public int compare(BranchInfo o1, BranchInfo o2) {
      return StringUtil.naturalCompare(o1.getRemoteName(), o2.getRemoteName());
    }
  });
  myBranchComboBox.setModel(myBranchModel);

  myForkModel = new SortedComboBoxModel<ForkInfo>(new Comparator<ForkInfo>() {
    @Override
    public int compare(ForkInfo o1, ForkInfo o2) {
      return StringUtil.naturalCompare(o1.getPath().getUser(), o2.getPath().getUser());
    }
  });
  myForkComboBox.setModel(myForkModel);

  DocumentListener userModifiedDocumentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      myTitleDescriptionUserModified = true;
    }
  };
  myTitleTextField.getDocument().addDocumentListener(userModifiedDocumentListener);
  myDescriptionTextArea.getDocument().addDocumentListener(userModifiedDocumentListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GithubCreatePullRequestPanel.java

示例12: GithubSelectForkPanel

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public GithubSelectForkPanel() {
  myModel = new SortedComboBoxModel<String>(new Comparator<String>() {
    @Override
    public int compare(String o1, String o2) {
      return StringUtil.naturalCompare(o1, o2);
    }
  });

  myComboBox.setModel(myModel);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GithubSelectForkPanel.java

示例13: ChooseAndEditComboBoxController

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public ChooseAndEditComboBoxController(ComboboxWithBrowseButton combobox,
                                       Convertor<Item, Ref> toRef,
                                       Comparator<Ref> comparator) {
  myCombobox = combobox;
  myToString = toRef;
  myCombobox.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      resetList(openConfigureDialog(myItems.get(getSelectedString()), getCombobox()));
    }
  });
  getCombobox().setModel(new SortedComboBoxModel<Ref>(comparator));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ChooseAndEditComboBoxController.java

示例14: resetList

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
public void resetList(Item selection) {
  Ref selectedItem = getSelectedString();
  myItems.clear();
  myItems.putAll(ContainerUtil.newMapFromValues(getAllListItems(), myToString));
  SortedComboBoxModel<Ref> model = getModel();
  model.setAll(myItems.keySet());
  if (selection != null) model.setSelectedItem(myToString.convert(selection));
  else model.setSelectedItem(selectedItem);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ChooseAndEditComboBoxController.java

示例15: ModulesCombobox

import com.intellij.ui.SortedComboBoxModel; //导入依赖的package包/类
private ModulesCombobox(final SortedComboBoxModel<Module> model) {
  super(model);
  myModel = model;
  new ComboboxSpeedSearch(this){
    @Override
    protected String getElementText(Object element) {
      if (element instanceof Module) {
        return ((Module)element).getName();
      } else if (element == null) {
        return "";
      }
      return super.getElementText(element);
    }
  };
  setRenderer(new ListCellRendererWrapper<Module>() {
    @Override
    public void customize(JList list, Module value, int index, boolean selected, boolean hasFocus) {
      if (value != null) {
        setText(value.getName());
        setIcon(ModuleType.get(value).getIcon());
      }
      else {
        setText("[none]");
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:ModulesCombobox.java


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