本文整理匯總了Java中com.intellij.ui.components.JBList類的典型用法代碼示例。如果您正苦於以下問題:Java JBList類的具體用法?Java JBList怎麽用?Java JBList使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JBList類屬於com.intellij.ui.components包,在下文中一共展示了JBList類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ContentChooser
import com.intellij.ui.components.JBList; //導入依賴的package包/類
public ContentChooser(Project project, String title, boolean useIdeaEditor, boolean allowMultipleSelections) {
super(project, true);
myProject = project;
myUseIdeaEditor = useIdeaEditor;
myAllowMultipleSelections = allowMultipleSelections;
myUpdateAlarm = new Alarm(getDisposable());
mySplitter = new JBSplitter(true, 0.3f);
mySplitter.setSplitterProportionKey(getDimensionServiceKey() + ".splitter");
myList = new JBList(new CollectionListModel<Item>());
myList.setExpandableItemsEnabled(false);
setOKButtonText(CommonBundle.getOkButtonText());
setTitle(title);
init();
}
示例2: refreshCourse
import com.intellij.ui.components.JBList; //導入依賴的package包/類
public void refreshCourse(String course) {
logger.info("Refreshing course {}. @ProjectListManager", course);
List<JBList> list = currentListElements.get(course);
if (list == null) {
return;
}
for (JBList jbList : list) {
if (jbList == null || !jbList.getName().equals(course)) {
continue;
}
DefaultListModel model = (DefaultListModel) jbList.getModel();
model.removeAllElements();
addExercisesToList(new ObjectFinder(), course, model, new CourseAndExerciseManager());
jbList.setModel(model);
}
refreshAllCourses();
}
示例3: addRightMouseButtonFunctionality
import com.intellij.ui.components.JBList; //導入依賴的package包/類
private void addRightMouseButtonFunctionality(MouseEvent mouseEvent,
final JBList list,
JBScrollPane panel) {
logger.info("Adding functionality for right mouse button. @CourseTabFactory");
if (!SwingUtilities.isRightMouseButton(mouseEvent)) {
return;
}
int index = list.locationToIndex(mouseEvent.getPoint());
list.setSelectedIndex(index);
PopUpMenu menu = new PopUpMenu();
JBMenuItem openInExplorer = new JBMenuItem("Open path");
final Object selectedItem = list.getSelectedValue();
JBMenuItem deleteFolder = new JBMenuItem("Delete folder");
openInExplorer.addActionListener(createOpenInExploreListener(list, selectedItem));
deleteFolder.addActionListener(createDeleteButtonActionListener(list, selectedItem));
menu.add(openInExplorer);
menu.add(deleteFolder);
menu.show(panel, mouseEvent.getX(), mouseEvent.getY());
menu.setLocation(mouseEvent.getXOnScreen(), mouseEvent.getYOnScreen());
}
示例4: chooseAnnotation
import com.intellij.ui.components.JBList; //導入依賴的package包/類
private void chooseAnnotation(String title, JBList list) {
final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject)
.createNoInnerClassesScopeChooser("Choose " + title + " annotation", GlobalSearchScope.allScope(myProject), new ClassFilter() {
@Override
public boolean isAccepted(PsiClass aClass) {
return aClass.isAnnotationType();
}
}, null);
chooser.showDialog();
final PsiClass selected = chooser.getSelected();
if (selected == null) {
return;
}
final String qualifiedName = selected.getQualifiedName();
final DefaultListModel model = (DefaultListModel)list.getModel();
final int index = model.indexOf(qualifiedName);
if (index < 0) {
model.addElement(qualifiedName);
} else {
myList.setSelectedIndex(index);
}
}
示例5: createCenterPanel
import com.intellij.ui.components.JBList; //導入依賴的package包/類
@Override
protected JComponent createCenterPanel() {
final DefaultListModel model = new DefaultListModel ();
for (PsiField member : myFields) {
model.addElement(member);
}
myList = new JBList(model);
myList.setCellRenderer(new MyListCellRenderer());
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
if (myList.getSelectedValues().length > 0) {
doOKAction();
return true;
}
return false;
}
}.installOn(myList);
myList.setPreferredSize(JBUI.size(300, 400));
return myList;
}
示例6: createCenterPanel
import com.intellij.ui.components.JBList; //導入依賴的package包/類
@Override
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
myList = new JBList(myNamedElements);
myList.setCellRenderer(new FQNameCellRenderer());
panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);
panel.add(new JBLabel(myContainsClassesOnly ?
CodeInsightBundle.message("dialog.paste.on.import.text") :
CodeInsightBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), BorderLayout.NORTH);
final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
final JButton okButton = new JButton(CommonBundle.getOkButtonText());
getRootPane().setDefaultButton(okButton);
buttonPanel.add(okButton);
final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
buttonPanel.add(cancelButton);
panel.setPreferredSize(JBUI.size(500, 400));
return panel;
}
示例7: invoke
import com.intellij.ui.components.JBList; //導入依賴的package包/類
@Override
public void invoke(@NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
final List<String> fqns = getPossibleFqns(myRef);
myEditorComponent = editor.getComponent();
if (fqns.size() > 1) {
final JBList listOfFqns = new JBList(fqns);
JBPopupFactory.getInstance()
.createListPopupBuilder(listOfFqns)
.setTitle("Select Qualified Name")
.setItemChoosenCallback(new Runnable() {
@Override
public void run() {
final Object value = listOfFqns.getSelectedValue();
if (value instanceof String) {
findJarsForFqn(((String)value), editor);
}
}
}).createPopup().showInBestPositionFor(editor);
}
else if (fqns.size() == 1) {
findJarsForFqn(fqns.get(0), editor);
}
}
示例8: AddSourceToProjectDialog
import com.intellij.ui.components.JBList; //導入依賴的package包/類
AddSourceToProjectDialog(Project project, List<TargetInfo> targets) {
super(project, /* canBeParent */ true, IdeModalityType.MODELESS);
this.project = project;
mainPanel = new JPanel(new VerticalLayout(12));
@SuppressWarnings({"rawtypes", "unchecked"}) // #api171: generify JBList usage
JList<TargetInfo> targetsComponent = new JBList(targets);
if (targets.size() == 1) {
targetsComponent.setSelectedIndex(0);
}
this.targetsComponent = targetsComponent;
setTitle("Add Source File to Project");
setupUi();
init();
}
示例9: show
import com.intellij.ui.components.JBList; //導入依賴的package包/類
public void show() {
List<RecentChange> cc = myVcs.getRecentChanges(myGateway.createTransientRootEntry());
if (cc.isEmpty()) {
Messages.showInfoMessage(myProject, LocalHistoryBundle.message("recent.changes.to.changes"), getTitle());
return;
}
final JList list = new JBList(createModel(cc));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new RecentChangesListCellRenderer());
Runnable selectAction = new Runnable() {
public void run() {
RecentChange c = (RecentChange)list.getSelectedValue();
showRecentChangeDialog(c);
}
};
showList(list, selectAction);
}
示例10: show
import com.intellij.ui.components.JBList; //導入依賴的package包/類
public void show(Collection<T> schemes) {
if (schemes.isEmpty()) {
Messages.showMessageDialog("There are no available schemes to import", "Import", Messages.getWarningIcon());
return;
}
final JList list = new JBList(new CollectionListModel<T>(schemes));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new SchemesToImportListCellRenderer());
Runnable selectAction = new Runnable() {
@Override
public void run() {
onSchemeSelected((T)list.getSelectedValue());
}
};
showList(list, selectAction);
}
示例11: createList
import com.intellij.ui.components.JBList; //導入依賴的package包/類
protected JBList createList() {
final JBList list = new JBList(myListModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setEmptyText(getListEmptyText());
list.setCellRenderer(createListCellRenderer());
installListActions(list);
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
if (event.getValueIsAdjusting()) return;
if (isMergeListItemsRunning()) return;
if (myUpdateSelectedPathModeActive.get()) return;
updateRightComponent(true);
}
});
ScrollingUtil.installActions(list);
// installSpeedSearch(list); // TODO
installEditOnDoubleClick(list);
return list;
}
示例12: GroupList
import com.intellij.ui.components.JBList; //導入依賴的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);
}
示例13: go
import com.intellij.ui.components.JBList; //導入依賴的package包/類
public void go(boolean forward) {
JBList selected = getSelectedList();
JList list = selected;
int index = list.getSelectedIndex();
if (forward) index++; else index--;
if ((forward && index >= list.getModel().getSize()) || (!forward && index < 0)) {
if (isFilesVisible()) {
list = isFilesSelected() ? toolWindows : files;
}
index = forward ? 0 : list.getModel().getSize() - 1;
}
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
if (selected != list) {
IdeFocusManager.findInstanceByComponent(list).requestFocus(list, true);
}
}
示例14: createPositionAdjuster
import com.intellij.ui.components.JBList; //導入依賴的package包/類
@Nullable
private static PositionAdjuster createPositionAdjuster() {
final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (focusOwner == null) return null;
if (focusOwner instanceof JBList) {
return new PositionAdjuster(SwingUtilities.getWindowAncestor(focusOwner));
}
final Component existing = discoverPopup(LangDataKeys.POSITION_ADJUSTER_POPUP, focusOwner);
if (existing != null) {
return new PositionAdjuster2(existing, discoverPopup(LangDataKeys.PARENT_POPUP, focusOwner));
}
//final Window window = SwingUtilities.getWindowAncestor(focusOwner);
//return window == null ? null : new PositionAdjuster(window);
return null;
}
示例15: chooseAndImport
import com.intellij.ui.components.JBList; //導入依賴的package包/類
private void chooseAndImport(Editor editor) {
final JList list = new JBList(getCandidates().toArray(new PsiMethod[getCandidates().size()]));
list.setCellRenderer(new MethodCellRenderer(true));
new PopupChooserBuilder(list).
setTitle(QuickFixBundle.message("static.import.method.choose.method.to.import")).
setMovable(true).
setItemChoosenCallback(new Runnable() {
@Override
public void run() {
PsiMethod selectedValue = (PsiMethod)list.getSelectedValue();
if (selectedValue == null) return;
LOG.assertTrue(selectedValue.isValid());
doImport(selectedValue);
}
}).createPopup().
showInBestPositionFor(editor);
}