Search in sources :

Example 1 with AddedFileInfo

use of com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo in project intellij-community by JetBrains.

the class AddedFileCellRenderer method getTreeCellRendererComponent.

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    if (!(value instanceof AddedFileInfo)) {
        setIcon(null);
        setFile(null);
    } else {
        AddedFileInfo treeNode = (AddedFileInfo) value;
        setShowIcon(false);
        final File file = new File(treeNode.getPresentableText());
        setFile(file);
        setIcon(treeNode.getIcon());
        int prefWidth = getIconWidth() + getFontMetrics(getFont()).stringWidth(getFilePath(file)) + 30;
        setPreferredSize(new Dimension(prefWidth, getPreferredSize().height));
    }
    return this;
}
Also used : AddedFileInfo(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo) File(java.io.File)

Example 2 with AddedFileInfo

use of com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo in project intellij-community by JetBrains.

the class CommandCvsHandler method createAddFilesHandler.

public static CvsHandler createAddFilesHandler(final Project project, Collection<AddedFileInfo> addedRoots) {
    final AddFilesOperation operation = new AddFilesOperation();
    final ArrayList<AddedFileInfo> addedFileInfo = new ArrayList<>();
    for (final AddedFileInfo info : addedRoots) {
        info.clearAllCvsAdminDirectoriesInIncludedDirectories();
        addedFileInfo.addAll(info.collectAllIncludedFiles());
    }
    final ArrayList<VirtualFile> addedFiles = new ArrayList<>();
    for (AddedFileInfo info : addedFileInfo) {
        addedFiles.add(info.getFile());
        operation.addFile(info.getFile(), info.getKeywordSubstitution());
    }
    return new CommandCvsHandler(CvsBundle.message("action.name.add"), operation, FileSetToBeUpdated.selectedFiles(VfsUtilCore.toVirtualFileArray(addedFiles)), VcsConfiguration.getInstance(project).getAddRemoveOption());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AddedFileInfo(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo) AddFilesOperation(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddFilesOperation)

Example 3 with AddedFileInfo

use of com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo in project intellij-community by JetBrains.

the class AddMultipleFilesOptionsDialog method createTree.

private void createTree() {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    for (AddedFileInfo myRoot : myRoots) {
        root.add(myRoot);
    }
    myModel = new ListTreeTableModelOnColumns(root, COLUMNS);
    myTreeTable = new TreeTableView(myModel);
    int comboHeight = new JComboBox().getPreferredSize().height;
    int checkBoxHeight = new JCheckBox().getPreferredSize().height;
    myTreeTable.setMinRowHeight(Math.max(comboHeight, checkBoxHeight) + 2);
    myTreeTable.setRootVisible(false);
    final JTableHeader tableHeader = myTreeTable.getTableHeader();
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(false);
    final TreeTableTree tree = myTreeTable.getTree();
    myTreeTable.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            final int keyCode = e.getKeyCode();
            if (keyCode == KeyEvent.VK_SPACE) {
                final int selectedColumn = myTreeTable.getSelectedColumn();
                if (selectedColumn == 0) {
                    return;
                }
                final int[] selectedRows = myTreeTable.getSelectedRows();
                if (selectedRows.length == 0) {
                    return;
                }
                final boolean included = !((AddedFileInfo) myTreeTable.getValueAt(selectedRows[0], 1)).included();
                for (int selectedRow : selectedRows) {
                    final AddedFileInfo addedFileInfo = (AddedFileInfo) myTreeTable.getValueAt(selectedRow, 1);
                    addedFileInfo.setIncluded(included);
                    myModel.nodeChanged(addedFileInfo);
                }
            }
        }
    });
    tree.setCellRenderer(new AddedFileCellRenderer());
    TreeUtil.installActions(tree);
}
Also used : ListTreeTableModelOnColumns(com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) KeyAdapter(java.awt.event.KeyAdapter) JTableHeader(javax.swing.table.JTableHeader) TreeTableView(com.intellij.ui.dualView.TreeTableView) KeyEvent(java.awt.event.KeyEvent) TreeTableTree(com.intellij.ui.treeStructure.treetable.TreeTableTree) AddedFileInfo(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo)

Aggregations

AddedFileInfo (com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo)3 AddFilesOperation (com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddFilesOperation)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 TreeTableView (com.intellij.ui.dualView.TreeTableView)1 ListTreeTableModelOnColumns (com.intellij.ui.treeStructure.treetable.ListTreeTableModelOnColumns)1 TreeTableTree (com.intellij.ui.treeStructure.treetable.TreeTableTree)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 File (java.io.File)1 JTableHeader (javax.swing.table.JTableHeader)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1