本文整理汇总了Java中com.intellij.ui.ScrollingUtil.selectItem方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollingUtil.selectItem方法的具体用法?Java ScrollingUtil.selectItem怎么用?Java ScrollingUtil.selectItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.ScrollingUtil
的用法示例。
在下文中一共展示了ScrollingUtil.selectItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoSelectUsingStatistics
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
private boolean autoSelectUsingStatistics() {
final String filter = getSpeedSearch().getFilter();
if (!StringUtil.isEmpty(filter)) {
int maxUseCount = -1;
int mostUsedValue = -1;
int elementsCount = myListModel.getSize();
for (int i = 0; i < elementsCount; i++) {
Object value = myListModel.getElementAt(i);
final String text = getListStep().getTextFor(value);
final int count =
StatisticsManager.getInstance().getUseCount(new StatisticsInfo("#list_popup:" + myStep.getTitle() + "#" + filter, text));
if (count > maxUseCount) {
maxUseCount = count;
mostUsedValue = i;
}
}
if (mostUsedValue > 0) {
ScrollingUtil.selectItem(myList, mostUsedValue);
return true;
}
}
return false;
}
示例2: setSelectedItem
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
private boolean setSelectedItem(String type, boolean select) {
DefaultListModel model = (DefaultListModel)myOptionsList.getModel();
for (int i = 0; i < model.size(); i++) {
Object o = model.get(i);
if (o instanceof EditorSchemeAttributeDescriptor) {
if (type.equals(((EditorSchemeAttributeDescriptor)o).getType())) {
if (select) {
ScrollingUtil.selectItem(myOptionsList, i);
}
return true;
}
}
}
return false;
}
示例3: createCenterPanel
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myList.setCellRenderer(new FileTypeRenderer());
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
doOKAction();
return true;
}
}.installOn(myList);
CCLanguageManager manager = CCUtils.getStudyLanguageManager(myCourse);
if (manager != null) {
String extension = manager.getDefaultTaskFileExtension();
ScrollingUtil.selectItem(myList, FileTypeManager.getInstance().getFileTypeByExtension(extension != null ? extension : "txt"));
}
return myPanel;
}
示例4: createCenterPanel
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName));
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myList.setCellRenderer(new FileTypeRenderer());
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
doOKAction();
return true;
}
}.installOn(myList);
myList.getSelectionModel().addListSelectionListener(e -> updateButtonsState());
ScrollingUtil.selectItem(myList, PlainTextFileType.INSTANCE);
return myPanel;
}
示例5: autoSelectUsingStatistics
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
private boolean autoSelectUsingStatistics() {
final String filter = getSpeedSearch().getFilter();
if (!StringUtil.isEmpty(filter)) {
int maxUseCount = -1;
int mostUsedValue = -1;
int elementsCount = myListModel.getSize();
for (int i = 0; i < elementsCount; i++) {
Object value = myListModel.getElementAt(i);
final String text = getListStep().getTextFor(value);
final int count =
StatisticsManager.getInstance().getUseCount(new StatisticsInfo("#list_popup:" + myStep.getTitle() + "#" + filter, text));
if (count > maxUseCount) {
maxUseCount = count;
mostUsedValue = i;
}
}
if (mostUsedValue > 0) {
ScrollingUtil.selectItem(myList, mostUsedValue);
return true;
}
}
return false;
}
示例6: tryToAutoSelect
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
private boolean tryToAutoSelect(boolean handleFinalChoices) {
ListPopupStep<Object> listStep = getListStep();
boolean selected = false;
if (listStep instanceof MultiSelectionListPopupStep<?>) {
int[] indices = ((MultiSelectionListPopupStep)listStep).getDefaultOptionIndices();
if (indices.length > 0) {
ScrollingUtil.ensureIndexIsVisible(myList, indices[0], 0);
myList.setSelectedIndices(indices);
selected = true;
}
}
else {
final int defaultIndex = listStep.getDefaultOptionIndex();
if (defaultIndex >= 0 && defaultIndex < myList.getModel().getSize()) {
ScrollingUtil.selectItem(myList, defaultIndex);
selected = true;
}
}
if (!selected) {
selectFirstSelectableItem();
}
if (listStep.isAutoSelectionEnabled()) {
if (!isVisible() && getSelectableCount() == 1) {
return _handleSelect(handleFinalChoices, null);
} else if (isVisible() && hasSingleSelectableItemWithSubmenu()) {
return _handleSelect(handleFinalChoices, null);
}
}
return false;
}
示例7: select
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
public void select(T item) {
if (item != null) {
ScrollingUtil.selectItem(myList, item);
}
else {
ScrollingUtil.ensureSelectionExists(myList);
}
}
示例8: selectItem
import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
protected void selectItem(int i) {
ScrollingUtil.selectItem(myList, i);
}