本文整理汇总了Java中com.intellij.ui.ListScrollingUtil类的典型用法代码示例。如果您正苦于以下问题:Java ListScrollingUtil类的具体用法?Java ListScrollingUtil怎么用?Java ListScrollingUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListScrollingUtil类属于com.intellij.ui包,在下文中一共展示了ListScrollingUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showDialog
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
private static Sdk showDialog(final Project project, String title, final Component parent, Sdk jdkToSelect) {
final JdkChooserPanel jdkChooserPanel = new JdkChooserPanel(project);
jdkChooserPanel.fillList(null, null);
final MyDialog dialog = jdkChooserPanel.new MyDialog(parent);
if (title != null) {
dialog.setTitle(title);
}
if (jdkToSelect != null) {
jdkChooserPanel.selectJdk(jdkToSelect);
} else {
ListScrollingUtil.ensureSelectionExists(jdkChooserPanel.myList);
}
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
dialog.clickDefaultButton();
return true;
}
}.installOn(jdkChooserPanel.myList);
dialog.show();
return dialog.isOK() ? jdkChooserPanel.getChosenJdk() : null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:JdkChooserPanel.java
示例2: autoSelectUsingStatistics
import com.intellij.ui.ListScrollingUtil; //导入依赖的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) {
ListScrollingUtil.selectItem(myList, mostUsedValue);
return true;
}
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:ListPopupImpl.java
示例3: executeUpOrDown
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
private static void executeUpOrDown(LookupImpl lookup, boolean up) {
if (!lookup.isFocused()) {
boolean semiFocused = lookup.getFocusDegree() == LookupImpl.FocusDegree.SEMI_FOCUSED;
lookup.setFocusDegree(LookupImpl.FocusDegree.FOCUSED);
if (!up && !semiFocused) {
return;
}
}
if (up) {
ListScrollingUtil.moveUp(lookup.getList(), 0);
} else {
ListScrollingUtil.moveDown(lookup.getList(), 0);
}
lookup.markSelectionTouched();
lookup.refreshUi(false, true);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:LookupActionHandler.java
示例4: setSelectedItem
import com.intellij.ui.ListScrollingUtil; //导入依赖的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) {
ListScrollingUtil.selectItem(myOptionsList, i);
}
return true;
}
}
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ClickNavigator.java
示例5: fillOptionsList
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
private void fillOptionsList() {
int selIndex = myOptionsList.getSelectedIndex();
DefaultListModel listModel = (DefaultListModel)myOptionsList.getModel();
listModel.removeAllElements();
EditorSchemeAttributeDescriptor[] descriptions = myOptions.getCurrentDescriptions();
for (EditorSchemeAttributeDescriptor description : descriptions) {
if (description.getGroup().equals(myCategoryName)) {
listModel.addElement(description);
}
}
if (selIndex >= 0) {
myOptionsList.setSelectedIndex(selIndex);
}
ListScrollingUtil.ensureSelectionExists(myOptionsList);
Object selected = myOptionsList.getSelectedValue();
if (selected instanceof EditorSchemeAttributeDescriptor) {
myDispatcher.getMulticaster().selectedOptionChanged(selected);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:OptionsPanelImpl.java
示例6: showOption
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@Override
public Runnable showOption(final String option) {
final String lowerCaseOption = option.toLowerCase();
DefaultListModel model = (DefaultListModel)myOptionsList.getModel();
for (int i = 0; i < model.size(); i++) {
Object o = model.get(i);
if (o instanceof EditorSchemeAttributeDescriptor) {
String type = ((EditorSchemeAttributeDescriptor)o).getType();
if (type.toLowerCase().contains(lowerCaseOption) ||
o.toString().toLowerCase().contains(lowerCaseOption)) {
final int i1 = i;
return new Runnable() {
@Override
public void run() {
ListScrollingUtil.selectItem(myOptionsList, i1);
}
};
}
}
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:OptionsPanelImpl.java
示例7: GroupList
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public GroupList(PsiClass[] classes)
{
super(new BorderLayout());
SortedListModel<String> model = new SortedListModel<String>(new Comparator<String>()
{
public int compare(String s1, String s2) {
return s1.compareTo(s2);
}
});
list = new JBList(model);
Set<String> groups = TestNGUtil.getAnnotationValues("groups", classes);
String[] array = ArrayUtil.toStringArray(groups);
Arrays.sort(array);
model.addAll(array);
add(ScrollPaneFactory.createScrollPane(list));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListScrollingUtil.ensureSelectionExists(list);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:GroupList.java
示例8: addAddManyFacility
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public void addAddManyFacility(JButton button, final Factory<List<T>> factory) {
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
List<T> items = factory.create();
getList().requestFocusInWindow();
if (items == null || items.size() == 0) {
return;
}
for (final T item : items) {
getModel().addElement(item);
ListScrollingUtil.selectItem(getList(), item);
}
}
});
addComponent(button);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:UIPropertyBinding.java
示例9: addExcludePackage
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public void addExcludePackage(String packageName) {
if (packageName == null) {
return;
}
int index = -Arrays.binarySearch(myExcludePackagesModel.toArray(), packageName) - 1;
if (index < 0) return;
myExcludePackagesModel.add(index, packageName);
myExcludePackagesList.setSelectedValue(packageName, true);
ListScrollingUtil.ensureIndexIsVisible(myExcludePackagesList, index, 0);
IdeFocusManager.getGlobalInstance().requestFocus(myExcludePackagesList, false);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:JavaAutoImportOptions.java
示例10: selectPath
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@NotNull
public static ActionCallback selectPath(@NotNull final JTree tree, final TreePath path, boolean center) {
tree.makeVisible(path);
if (center) {
return showRowCentred(tree, tree.getRowForPath(path));
} else {
final int row = tree.getRowForPath(path);
return showAndSelect(tree, row - ListScrollingUtil.ROW_PADDING, row + ListScrollingUtil.ROW_PADDING, row, -1);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:TreeUtil.java
示例11: tryToAutoSelect
import com.intellij.ui.ListScrollingUtil; //导入依赖的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) {
ListScrollingUtil.ensureIndexIsVisible(myList, indices[0], 0);
myList.setSelectedIndices(indices);
selected = true;
}
}
else {
final int defaultIndex = listStep.getDefaultOptionIndex();
if (defaultIndex >= 0 && defaultIndex < myList.getModel().getSize()) {
ListScrollingUtil.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:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:ListPopupImpl.java
示例12: execute
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@Override
public void execute(Editor editor, DataContext dataContext){
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
if (lookup == null || !lookup.isFocused()) {
myOriginalHandler.execute(editor, dataContext);
return;
}
lookup.markSelectionTouched();
ListScrollingUtil.moveEnd(lookup.getList());
lookup.refreshUi(false, true);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:EndHandler.java
示例13: execute
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@Override
public void execute(Editor editor, DataContext dataContext){
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
if (lookup == null || !lookup.isFocused()) {
myOriginalHandler.execute(editor, dataContext);
return;
}
lookup.markSelectionTouched();
ListScrollingUtil.moveHome(lookup.getList());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:HomeHandler.java
示例14: selectOption
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@Override
public void selectOption(final String typeToSelect) {
DefaultListModel model = (DefaultListModel)myOptionsList.getModel();
for (int i = 0; i < model.size(); i++) {
Object o = model.get(i);
if (o instanceof EditorSchemeAttributeDescriptor) {
if (typeToSelect.equals(((EditorSchemeAttributeDescriptor)o).getType())) {
ListScrollingUtil.selectItem(myOptionsList, i);
return;
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:OptionsPanelImpl.java
示例15: NavBarListWrapper
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public NavBarListWrapper(final JList list) {
super(list);
list.addMouseMotionListener(new MouseMotionAdapter() {
boolean myIsEngaged = false;
@Override
public void mouseMoved(MouseEvent e) {
if (myIsEngaged && !UIUtil.isSelectionButtonDown(e)) {
final Point point = e.getPoint();
final int index = list.locationToIndex(point);
list.setSelectedIndex(index);
} else {
myIsEngaged = true;
}
}
});
ListScrollingUtil.installActions(list);
final int modelSize = list.getModel().getSize();
setBorder(BorderFactory.createEmptyBorder());
if (modelSize > 0 && modelSize <= MAX_SIZE) {
list.setVisibleRowCount(0);
getViewport().setPreferredSize(list.getPreferredSize());
} else {
list.setVisibleRowCount(MAX_SIZE);
}
myList = list;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:NavBarListWrapper.java
示例16: setItems
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public void setItems(Collection<T> items) {
DefaultListModel model = myForm.getListModel();
model.removeAllElements();
for (T item : items) {
model.addElement(item);
}
ListScrollingUtil.ensureSelectionExists(getList());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:AnActionListEditor.java
示例17: select
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public void select(T item) {
if (item != null) {
ListScrollingUtil.selectItem(myList, item);
}
else {
ListScrollingUtil.ensureSelectionExists(myList);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:AnActionListEditor.java
示例18: loadValues
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
public void loadValues(AbstractProperty.AbstractPropertyContainer container) {
DefaultListModel model = getModel();
model.clear();
Iterator iterator = getProperty().getIterator(container);
while (iterator.hasNext()) {
Object item = iterator.next();
model.addElement(item);
}
ListScrollingUtil.ensureSelectionExists(getList());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:UIPropertyBinding.java
示例19: MyListWrapper
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
private MyListWrapper(final JList list) {
super(UIUtil.isUnderAquaLookAndFeel() ? 0 : -1);
JBViewport viewport = new JBViewport() {
@Override
protected LayoutManager createLayoutManager() {
return new ViewportLayout() {
@Override
public Dimension preferredLayoutSize(Container parent) {
int size = list.getModel().getSize();
if (size >= 0 && size <= 20) {
return list.getPreferredSize();
} else {
final Dimension sz = super.preferredLayoutSize(parent);
final Point p = RelativePoint.getNorthWestOf(myList).getScreenPoint();
final Rectangle screen = ScreenUtil.getScreenRectangle(p);
final int bordersEtc = 20;
final int maxWidth = Math.abs(screen.x + screen.width - p.x) - 2 * bordersEtc;
return new Dimension(Math.min(maxWidth, sz.width) + bordersEtc, sz.height + list.getCellBounds(0, 0).height / 2);
}
}
};
}
};
list.setVisibleRowCount(15);
setViewport(viewport);
setViewportView(list);
if (myAutoselectOnMouseMove) {
list.addMouseMotionListener(new MouseMotionAdapter() {
boolean myIsEngaged = false;
public void mouseMoved(MouseEvent e) {
if (myIsEngaged && !UIUtil.isSelectionButtonDown(e)) {
Point point = e.getPoint();
int index = list.locationToIndex(point);
list.putClientProperty(SELECTED_BY_MOUSE_EVENT, Boolean.TRUE);
list.setSelectedIndex(index);
list.putClientProperty(SELECTED_BY_MOUSE_EVENT, Boolean.FALSE);
}
else {
myIsEngaged = true;
}
}
});
}
ListScrollingUtil.installActions(list);
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
myList = list;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:PopupChooserBuilder.java
示例20: executeInLookup
import com.intellij.ui.ListScrollingUtil; //导入依赖的package包/类
@Override
protected void executeInLookup(final LookupImpl lookup, DataContext context) {
lookup.setFocusDegree(LookupImpl.FocusDegree.FOCUSED);
ListScrollingUtil.movePageDown(lookup.getList());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:LookupActionHandler.java
注:本文中的com.intellij.ui.ListScrollingUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论