本文整理匯總了Java中com.intellij.ui.components.JBList.setModel方法的典型用法代碼示例。如果您正苦於以下問題:Java JBList.setModel方法的具體用法?Java JBList.setModel怎麽用?Java JBList.setModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.ui.components.JBList
的用法示例。
在下文中一共展示了JBList.setModel方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
示例2: CustomFoldingRegionsPopup
import com.intellij.ui.components.JBList; //導入方法依賴的package包/類
CustomFoldingRegionsPopup(@NotNull Collection<FoldingDescriptor> descriptors,
@NotNull final Editor editor,
@NotNull final Project project) {
myEditor = editor;
myRegionsList = new JBList();
//noinspection unchecked
myRegionsList.setModel(new MyListModel(orderByPosition(descriptors)));
myRegionsList.setSelectedIndex(0);
final PopupChooserBuilder popupBuilder = JBPopupFactory.getInstance().createListPopupBuilder(myRegionsList);
myPopup = popupBuilder
.setTitle(IdeBundle.message("goto.custom.region.command"))
.setResizable(false)
.setMovable(false)
.setItemChoosenCallback(new Runnable() {
@Override
public void run() {
PsiElement navigationElement = getNavigationElement();
if (navigationElement != null) {
navigateTo(editor, navigationElement);
IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation();
}
}
}).createPopup();
}
示例3: createCourseSpecificTab
import com.intellij.ui.components.JBList; //導入方法依賴的package包/類
public void createCourseSpecificTab(
ObjectFinder finder,
ProjectOpener opener,
String course,
JTabbedPane tabbedPaneBase,
CourseAndExerciseManager courseAndExerciseManager) {
logger.info("Creating course specific tab. @CourseTabFactory");
final JBScrollPane panel = new JBScrollPane();
final JBList list = new JBList();
list.setCellRenderer(new ProjectListRenderer());
DefaultListModel defaultListModel = new DefaultListModel();
panel.setBorder(BorderFactory.createTitledBorder(""));
ProjectListManagerHolder.get()
.addExercisesToList(finder, course, defaultListModel, courseAndExerciseManager);
if (defaultListModel.getSize() <= 0) {
return;
}
list.setName(course);
list.setModel(defaultListModel);
MouseListener mouseListener = createMouseListenerForWindow(opener, panel, list);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addMouseListener(mouseListener);
panel.setName(course);
panel.setViewportView(list);
ProjectListManagerHolder.get().addList(list);
tabbedPaneBase.addTab(course, panel);
tabbedPaneBase.addMouseListener(tabMouseListener(tabbedPaneBase));
setScrollBarToBottom(course, tabbedPaneBase, panel);
}
示例4: ColumnFilteringStrategy
import com.intellij.ui.components.JBList; //導入方法依賴的package包/類
public ColumnFilteringStrategy(final ChangeListColumn column,
final Class<? extends CommittedChangesProvider> providerClass) {
myModel = new MyListModel();
myValueList = new JBList();
myScrollPane = ScrollPaneFactory.createScrollPane(myValueList);
myValueList.setModel(myModel);
myValueList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(final ListSelectionEvent e) {
for (ChangeListener listener : myListeners) {
listener.stateChanged(new ChangeEvent(this));
}
}
});
myValueList.setCellRenderer(new ColoredListCellRenderer() {
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (index == 0) {
append(value.toString(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
else if (value.toString().length() == 0) {
append(VcsBundle.message("committed.changes.filter.none"), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
else {
append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
});
myColumn = column;
myProviderClass = providerClass;
}
示例5: createCenterPanel
import com.intellij.ui.components.JBList; //導入方法依賴的package包/類
@Nullable
@Override
protected JComponent createCenterPanel() {
final JBList list = new JBList();
list.setModel(getListModel(myFiles));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
myChosenFile = (FileListItem)list.getSelectedValue();
}
});
return ListWithFilter.wrap(list);
}
示例6: NamedObjectPanel
import com.intellij.ui.components.JBList; //導入方法依賴的package包/類
public NamedObjectPanel(@NotNull Project project, @NotNull String moduleName, @NotNull BuildFileKey buildFileKey,
@NotNull String newItemName, @NotNull PanelGroup panelGroup) {
super(project, moduleName);
myBuildFileKey = buildFileKey;
myNewItemName = newItemName;
myPanelGroup = panelGroup;
myListModel = new SortedListModel();
myObjectName.getDocument().addDocumentListener(this);
myList = new JBList();
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myList.addListSelectionListener(this);
myList.setModel(myListModel);
myList.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList jList, Object o, int i, boolean b, boolean b2) {
return super.getListCellRendererComponent(jList, ((NamedObject)o).getName(), i, b, b2);
}
});
ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myList);
decorator.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
updateCurrentObjectFromUi();
addObject();
}
});
decorator.setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
removeObject();
}
});
decorator.setRemoveActionUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
NamedObject selectedObject = getSelectedObject();
return selectedObject != null && !(selectedObject instanceof UndeletableNamedObject);
}
});
decorator.disableUpDownActions();
mySplitPane.setLeftComponent(decorator.createPanel());
mySplitPane.setDividerLocation(200);
myRightPane.setBorder(IdeBorderFactory.createBorder());
myNameWarning.setForeground(JBColor.RED);
}