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


Java ScrollingUtil.selectItem方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ListPopupImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ClickNavigator.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CreateTaskFileDialog.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:FileTypeChooser.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ListPopupImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ListPopupImpl.java

示例7: select

import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
public void select(T item) {
  if (item != null) {
    ScrollingUtil.selectItem(myList, item);
  }
  else {
    ScrollingUtil.ensureSelectionExists(myList);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AnActionListEditor.java

示例8: selectItem

import com.intellij.ui.ScrollingUtil; //导入方法依赖的package包/类
protected void selectItem(int i) {
  ScrollingUtil.selectItem(myList, i);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AbstractListBuilder.java


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