1 19 package org.netbeans.modules.subversion.ui.wizards.importstep; 20 21 import java.awt.BorderLayout ; 22 import java.io.File ; 23 import java.util.ArrayList ; 24 import java.util.Map ; 25 import javax.swing.JComponent ; 26 27 import org.netbeans.modules.subversion.*; 28 import org.netbeans.modules.subversion.ui.commit.CommitTable; 29 import org.netbeans.modules.subversion.ui.commit.CommitTableModel; 30 import org.netbeans.modules.subversion.ui.wizards.AbstractStep; 31 import org.netbeans.modules.subversion.util.Context; 32 import org.openide.util.HelpCtx; 33 34 37 public class ImportPreviewStep extends AbstractStep { 38 39 private PreviewPanel previewPanel; 40 private Context context; 41 private CommitTable table; 42 43 public ImportPreviewStep(Context context) { 44 this.context = context; 45 } 46 47 public HelpCtx getHelp() { 48 return new HelpCtx(ImportStep.class); 49 } 50 51 protected JComponent createComponent() { 52 if (previewPanel == null) { 53 previewPanel = new PreviewPanel(); 54 55 table = new CommitTable(previewPanel.tableLabel, CommitTable.IMPORT_COLUMNS, new String [] { CommitTableModel.COLUMN_NAME_PATH }); 58 62 JComponent component = table.getComponent(); 63 previewPanel.tablePanel.setLayout(new BorderLayout ()); 64 previewPanel.tablePanel.add(component, BorderLayout.CENTER); 65 } 66 return previewPanel; 67 } 68 69 protected void validateBeforeNext() { 70 validateUserInput(); 71 } 72 73 public void validateUserInput() { 74 if(table != null && table.getCommitFiles().size() > 0) { 75 valid(); 76 } else { 77 invalid(org.openide.util.NbBundle.getMessage(ImportPreviewStep.class, "CTL_Import_NothingToImport")); } 79 } 80 81 public void setup(String repositoryPath, String rootLocalPath) { 82 FileStatusCache cache = Subversion.getInstance().getStatusCache(); 83 File [] files = cache.listFiles(context, FileInformation.STATUS_LOCAL_CHANGE); 84 85 if (files.length == 0) { 86 return; 87 } 88 89 if(repositoryPath != null) { 90 table.setRootFile(repositoryPath, rootLocalPath); 91 } 92 93 SvnFileNode[] nodes; 94 ArrayList <SvnFileNode> nodesList = new ArrayList <SvnFileNode>(files.length); 95 96 for (int i = 0; i<files.length; i++) { 97 File file = files[i]; 98 SvnFileNode node = new SvnFileNode(file); 99 nodesList.add(node); 100 } 101 nodes = nodesList.toArray(new SvnFileNode[files.length]); 102 table.setNodes(nodes); 103 104 validateUserInput(); 105 } 106 107 public Map getCommitFiles() { 108 return table.getCommitFiles(); 109 } 110 111 public void storeTableSorter() { 112 } 114 115 } 116 117 | Popular Tags |