public Component getTableCellEditorComponent( final JTable table, Object value, boolean isSelected, final int row, int column) { ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { final FileChooserDescriptor d = getFileChooserDescriptor(); VirtualFile initialFile = LocalFileSystem.getInstance().findFileByPath((String) getCellEditorValue()); VirtualFile[] files = FileChooser.chooseFiles(table, d, initialFile); if (files.length == 1 && files[0] != null) { String path = files[0].getPresentableUrl(); if (SystemInfo.isWindows && path.length() == 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { path += "\\"; // make path absolute } myComponent.getChildComponent().setText(path); } } }; myComponent = new CellEditorComponentWithBrowseButton<JTextField>( new TextFieldWithBrowseButton(listener), this); myComponent.getChildComponent().setText((String) value); return myComponent; }
public Object getCellEditorValue() { return myComponent.getChildComponent().getText(); }