當前位置: 首頁>>代碼示例>>Java>>正文


Java JBList.setModel方法代碼示例

本文整理匯總了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();
}
 
開發者ID:testmycode,項目名稱:tmc-intellij,代碼行數:19,代碼來源:ProjectListManager.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:CustomFoldingRegionsPopup.java

示例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);
}
 
開發者ID:testmycode,項目名稱:tmc-intellij,代碼行數:37,代碼來源:CourseTabFactory.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:ColumnFilteringStrategy.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ChooseFromFileListDialog.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:48,代碼來源:NamedObjectPanel.java


注:本文中的com.intellij.ui.components.JBList.setModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。