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;
}
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());
}
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);
}
Aggregations