本文整理汇总了Java中com.intellij.ui.ScrollingUtil类的典型用法代码示例。如果您正苦于以下问题:Java ScrollingUtil类的具体用法?Java ScrollingUtil怎么用?Java ScrollingUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScrollingUtil类属于com.intellij.ui包,在下文中一共展示了ScrollingUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addExcludePackage
import com.intellij.ui.ScrollingUtil; //导入依赖的package包/类
void addExcludePackage(String packageName) {
if (packageName == null) {
return;
}
int index = 0;
while (index < getTableView().getListTableModel().getRowCount()) {
if (getTableView().getListTableModel().getItem(index).exclude.compareTo(packageName) > 0) {
break;
}
index++;
}
getTableView().getListTableModel().insertRow(index, new Item(packageName, ExclusionScope.IDE));
getTableView().clearSelection();
getTableView().addRowSelectionInterval(index, index);
ScrollingUtil.ensureIndexIsVisible(getTableView(), index, 0);
IdeFocusManager.getGlobalInstance().requestFocus(getTableView(), false);
}
示例2: showDialog
import com.intellij.ui.ScrollingUtil; //导入依赖的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 {
ScrollingUtil.ensureSelectionExists(jdkChooserPanel.myList);
}
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
dialog.clickDefaultButton();
return true;
}
}.installOn(jdkChooserPanel.myList);
return dialog.showAndGet() ? jdkChooserPanel.getChosenJdk() : null;
}
示例3: 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;
}
示例4: executeUpOrDown
import com.intellij.ui.ScrollingUtil; //导入依赖的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) {
ScrollingUtil.moveUp(lookup.getList(), 0);
} else {
ScrollingUtil.moveDown(lookup.getList(), 0);
}
lookup.markSelectionTouched();
lookup.refreshUi(false, true);
}
示例5: 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;
}
示例6: 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;
}
示例7: GroupList
import com.intellij.ui.ScrollingUtil; //导入依赖的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);
ScrollingUtil.ensureSelectionExists(list);
}
示例8: addAddManyFacility
import com.intellij.ui.ScrollingUtil; //导入依赖的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);
ScrollingUtil.selectItem(getList(), item);
}
}
});
addComponent(button);
}
示例9: 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;
}
示例10: 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;
}
示例11: addExcludePackage
import com.intellij.ui.ScrollingUtil; //导入依赖的package包/类
void addExcludePackage(String packageName)
{
if(packageName == null)
{
return;
}
int index = 0;
while(index < getTableView().getListTableModel().getRowCount())
{
if(getTableView().getListTableModel().getItem(index).exclude.compareTo(packageName) > 0)
{
break;
}
index++;
}
getTableView().getListTableModel().insertRow(index, new Item(packageName, ExclusionScope.IDE));
getTableView().clearSelection();
getTableView().addRowSelectionInterval(index, index);
ScrollingUtil.ensureIndexIsVisible(getTableView(), index, 0);
IdeFocusManager.getGlobalInstance().requestFocus(getTableView(), false);
}
示例12: selectPath
import com.intellij.ui.ScrollingUtil; //导入依赖的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 - ScrollingUtil.ROW_PADDING, row + ScrollingUtil.ROW_PADDING, row, -1);
}
}
示例13: 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;
}
示例14: doExecute
import com.intellij.ui.ScrollingUtil; //导入依赖的package包/类
@Override
public void doExecute(Editor editor, Caret caret, DataContext dataContext){
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
if (lookup == null || !lookup.isFocused()) {
myOriginalHandler.execute(editor, caret, dataContext);
return;
}
lookup.markSelectionTouched();
ScrollingUtil.moveEnd(lookup.getList());
lookup.refreshUi(false, true);
}
示例15: doExecute
import com.intellij.ui.ScrollingUtil; //导入依赖的package包/类
@Override
public void doExecute(Editor editor, Caret caret, DataContext dataContext){
LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
if (lookup == null || !lookup.isFocused()) {
myOriginalHandler.execute(editor, caret, dataContext);
return;
}
lookup.markSelectionTouched();
ScrollingUtil.moveHome(lookup.getList());
}