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


Java JBList類代碼示例

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

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

示例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());

}
 
開發者ID:testmycode,項目名稱:tmc-intellij,代碼行數:27,代碼來源:CourseTabFactory.java

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

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

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

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

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

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

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

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

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

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

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

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


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