本文整理汇总了Java中com.intellij.ui.SpeedSearchComparator类的典型用法代码示例。如果您正苦于以下问题:Java SpeedSearchComparator类的具体用法?Java SpeedSearchComparator怎么用?Java SpeedSearchComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpeedSearchComparator类属于com.intellij.ui包,在下文中一共展示了SpeedSearchComparator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: TemplateKindCombo
import com.intellij.ui.SpeedSearchComparator; //导入依赖的package包/类
public TemplateKindCombo() {
//noinspection unchecked
getComboBox().setRenderer(new ListCellRendererWrapper() {
@Override
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean cellHasFocus) {
if (value instanceof Trinity) {
setText((String)((Trinity)value).first);
setIcon ((Icon)((Trinity)value).second);
}
}
});
new ComboboxSpeedSearch(getComboBox()) {
@Override
protected String getElementText(Object element) {
if (element instanceof Trinity) {
return (String)((Trinity)element).first;
}
return null;
}
}.setComparator(new SpeedSearchComparator(true));
setButtonListener(null);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TemplateKindCombo.java
示例2: createComponent
import com.intellij.ui.SpeedSearchComparator; //导入依赖的package包/类
private void createComponent() {
setLayout(new BorderLayout());
myRepositoryTree = new Tree();
myRepositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
myRepositoryTree.setRootVisible(false);
myRepositoryTree.setShowsRootHandles(true);
JScrollPane scrollPane =
ScrollPaneFactory.createScrollPane(myRepositoryTree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
add(scrollPane, BorderLayout.CENTER);
myRepositoryTree.setCellRenderer(new SvnRepositoryTreeCellRenderer());
TreeSpeedSearch search = new TreeSpeedSearch(myRepositoryTree, new Convertor<TreePath, String>() {
@Override
public String convert(TreePath o) {
Object component = o.getLastPathComponent();
if (component instanceof RepositoryTreeNode) {
return ((RepositoryTreeNode)component).getURL().toDecodedString();
}
return null;
}
});
search.setComparator(new SpeedSearchComparator(false, true));
EditSourceOnDoubleClickHandler.install(myRepositoryTree);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryBrowserComponent.java
示例3: ThreadDumpPanel
import com.intellij.ui.SpeedSearchComparator; //导入依赖的package包/类
public ThreadDumpPanel(Project project, final ConsoleView consoleView, final DefaultActionGroup toolbarActions, final List<ThreadState> threadDump) {
super(new BorderLayout());
final ThreadState[] data = threadDump.toArray(new ThreadState[threadDump.size()]);
DefaultListModel model = new DefaultListModel();
for (ThreadState threadState : data) {
model.addElement(threadState);
}
myThreadList = new JBList(model);
myThreadList.setCellRenderer(new ThreadListCellRenderer());
myThreadList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myThreadList.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(final ListSelectionEvent e) {
int index = myThreadList.getSelectedIndex();
if (index >= 0) {
ThreadState selection = (ThreadState)myThreadList.getModel().getElementAt(index);
AnalyzeStacktraceUtil.printStacktrace(consoleView, selection.getStackTrace());
}
else {
AnalyzeStacktraceUtil.printStacktrace(consoleView, "");
}
myThreadList.repaint();
}
});
toolbarActions.add(new CopyToClipboardAction(threadDump, project));
toolbarActions.add(new SortThreadsAction());
//toolbarActions.add(new ShowRecentlyChanged());
add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false).getComponent(), BorderLayout.WEST);
final Splitter splitter = new Splitter(false, 0.3f);
splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myThreadList, SideBorder.LEFT | SideBorder.RIGHT));
splitter.setSecondComponent(consoleView.getComponent());
add(splitter, BorderLayout.CENTER);
new ListSpeedSearch(myThreadList).setComparator(new SpeedSearchComparator(false, true));
}
开发者ID:consulo,项目名称:consulo-java,代码行数:37,代码来源:ThreadDumpPanel.java
示例4: chooseAndOverrideOrImplementMethods
import com.intellij.ui.SpeedSearchComparator; //导入依赖的package包/类
public static void chooseAndOverrideOrImplementMethods(@NotNull final Project project,
@NotNull final Editor editor,
@NotNull final PyClass pyClass,
@NotNull final Collection<PyFunction> superFunctions,
@NotNull final String title, final boolean implement) {
List<PyMethodMember> elements = new ArrayList<PyMethodMember>();
for (PyFunction function : superFunctions) {
final String name = function.getName();
if (name == null || PyUtil.isClassPrivateName(name)) {
continue;
}
if (pyClass.findMethodByName(name, false) == null) {
final PyMethodMember member = new PyMethodMember(function);
elements.add(member);
}
}
if (elements.size() == 0) {
return;
}
final MemberChooser<PyMethodMember> chooser =
new MemberChooser<PyMethodMember>(elements.toArray(new PyMethodMember[elements.size()]), false, true, project) {
@Override
protected SpeedSearchComparator getSpeedSearchComparator() {
return new SpeedSearchComparator(false) {
@Nullable
@Override
public Iterable<TextRange> matchingFragments(@NotNull String pattern, @NotNull String text) {
return super.matchingFragments(PyMethodMember.trimUnderscores(pattern), text);
}
};
}
};
chooser.setTitle(title);
chooser.setCopyJavadocVisible(false);
chooser.show();
if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return;
}
List<PyMethodMember> membersToOverride = chooser.getSelectedElements();
overrideMethods(editor, pyClass, membersToOverride, implement);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:PyOverrideImplementUtil.java
示例5: createCenterPanel
import com.intellij.ui.SpeedSearchComparator; //导入依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
final TestFindResult closest = jasmineFile.getClosestTestFromCaret(caretOffset);
// Build the tree.
TreeNode root = jasmineFile.getTreeNode();
tree = new Tree(root);
tree.setVisibleRowCount(VISIBLE_ROW_COUNT);
tree.setCellRenderer(new CustomTreeCellRenderer());
// Check if there are multiple describes in the file.
if (root.getUserObject() instanceof String) {
tree.setRootVisible(false);
}
TreeUtil.expandAll(tree);
// Add search, make it case insensitive.
new TreeSpeedSearch(tree) {
@Override
protected boolean compare(String text, String pattern) {
return super.compare(text.toLowerCase(), pattern.toLowerCase());
}
}.setComparator(new SpeedSearchComparator(false));
// Perform the OK action on enter.
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent keyEvent) {
if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
// Set the selected node when you click OK.
DefaultMutableTreeNode lastPathComponent =
(DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent();
selectedTest = (TestFindResult) lastPathComponent.getUserObject();
doOKAction();
}
}
});
// Jump to code on double click.
tree.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1 && e.getClickCount() == 2) {
goToTest(tree.getPathForLocation(e.getX(), e.getY()));
}
}
});
JBScrollPane scrollPane = new JBScrollPane(tree);
selectClosestTest(root, closest);
JPanel panel = new JPanel(new BorderLayout());
panel.add(BorderLayout.CENTER, scrollPane);
panel.add(BorderLayout.SOUTH, createPanelWithLabels());
return panel;
}
开发者ID:andresdominguez,项目名称:ddescriber,代码行数:61,代码来源:DescriberDialog.java
注:本文中的com.intellij.ui.SpeedSearchComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论