public void init() { final TreeNode root = createRoot(myProject); myModel = new DefaultTreeModel(root, true); myTree = new Tree(myModel); add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER); myTree.getSelectionModel().setSelectionMode(mySelectionMode); myTree.setCellRenderer(new Cvs2Renderer()); addSelectionListener(); final TreeUIHelper uiHelper = TreeUIHelper.getInstance(); uiHelper.installTreeSpeedSearch(myTree); TreeUtil.installActions(myTree); myTree.requestFocus(); }
public BrowserPanel(CvsRootConfiguration configuration, Project project, Consumer<VcsException> errorCallback) { super(new BorderLayout(2, 0)); setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); myProject = project; myCvsRootConfiguration = configuration; myTree = new CvsTree(project, false, TreeSelectionModel.SINGLE_TREE_SELECTION, true, true, errorCallback); add(myTree, BorderLayout.CENTER); myTree.init(); myTree.setCvsRootConfiguration(configuration); myCheckoutHelper = new CheckoutHelper(configuration, this); TreeUIHelper uiHelper = TreeUIHelper.getInstance(); uiHelper.installEditSourceOnDoubleClick(myTree.getTree()); TreeUtil.installActions(myTree.getTree()); ActionGroup group = getActionGroup(); PopupHandler.installPopupHandler(myTree.getTree(), group, ActionPlaces.CHECKOUT_POPUP, ActionManager.getInstance()); }
@Override protected void configureUiHelper(TreeUIHelper helper) { final Convertor<TreePath, String> convertor = new Convertor<TreePath, String>() { @Override public String convert(final TreePath path) { final SimpleNode node = getNodeFor(path); if (node instanceof PackagingElementNode) { return ((PackagingElementNode<?>)node).getElementPresentation().getSearchName(); } return ""; } }; new TreeSpeedSearch(this, convertor, true); }
@Override @Nullable protected JComponent createCenterPanel() { AbstractListModel model = new AbstractListModel() { @Override public int getSize() { return myCharsets.length; } @Override public Object getElementAt(int i) { return myCharsets[i]; } }; myList.setModel(model); TreeUIHelper.getInstance().installListSpeedSearch(myList); myList.setCellRenderer(new DefaultListCellRenderer(){ @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Charset charset = (Charset)value; setText(charset.displayName()); return component; } }); if (myDefaultCharset != null) { myList.setSelectedValue(myDefaultCharset, true); } return myPanel; }
@Override protected void setUp() throws Exception { super.setUp(); myTree = new SimpleTree() { @Override protected void configureUiHelper(final TreeUIHelper helper) { } }; myFilter = new MyFilter(); myRoot = new Node(null, "/"); myStructure = new SimpleTreeStructure.Impl(myRoot); }
public MethodListDlg(final PsiClass psiClass, final Condition<PsiMethod> filter, final JComponent parent) { super(parent, false); myClass = psiClass; createList(psiClass.getAllMethods(), filter); myWholePanel.add(ScrollPaneFactory.createScrollPane(myList)); myList.setCellRenderer(new ColoredListCellRenderer() { protected void customizeCellRenderer(@NotNull final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) { final PsiMethod psiMethod = (PsiMethod) value; append(PsiFormatUtil.formatMethod(psiMethod, PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME, 0), StructureNodeRenderer.applyDeprecation(psiMethod, SimpleTextAttributes .REGULAR_ATTRIBUTES)); final PsiClass containingClass = psiMethod.getContainingClass(); if(!myClass.equals(containingClass)) { append(" (" + containingClass.getQualifiedName() + ")", StructureNodeRenderer.applyDeprecation(containingClass, SimpleTextAttributes.GRAY_ATTRIBUTES)); } } }); myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { MethodListDlg.this.close(OK_EXIT_CODE); return true; } }.installOn(myList); ScrollingUtil.ensureSelectionExists(myList); TreeUIHelper.getInstance().installListSpeedSearch(myList); setTitle(ExecutionBundle.message("choose.test.method.dialog.title")); init(); }
protected void configureUiHelper(final TreeUIHelper helper) { helper.installTreeSpeedSearch(this); }