1.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsCustomizer.java Tue Apr 25 12:55:38 2000 +0000
1.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsCustomizer.java Tue Apr 25 14:04:53 2000 +0000
1.3 @@ -34,1143 +34,1143 @@
1.4 */
1.5
1.6 public class CvsCustomizer extends javax.swing.JPanel implements Customizer {
1.7 - private Debug E=new Debug("CvsCustomizer", true); // NOI18N
1.8 - private Debug D=new Debug("CvsCustomizer", true); // NOI18N
1.9 - private javax.swing.ButtonGroup bg;
1.10 -
1.11 - static final long serialVersionUID =-4163355905662053542L;
1.12 - /** Creates new panel CvsCustomizer */
1.13 - public CvsCustomizer() {
1.14 - D.deb("constructor called");
1.15 - changeSupport=new PropertyChangeSupport(this);
1.16 - initComponents ();
1.17 - javax.swing.ButtonGroup bg = new javax.swing.ButtonGroup ();
1.18 - bg.add (localRadioButton);
1.19 - bg.add (serverRadioButton);
1.20 - bg.add (pserverRadioButton);
1.21 - loginButton.setMnemonic(KeyEvent.VK_G);
1.22 - browseButton.setMnemonic(KeyEvent.VK_W);
1.23 - repositoryButton.setMnemonic(KeyEvent.VK_R);
1.24 - localRadioButton.setMnemonic(KeyEvent.VK_L);
1.25 - serverRadioButton.setMnemonic(KeyEvent.VK_S);
1.26 - pserverRadioButton.setMnemonic(KeyEvent.VK_P);
1.27 - moduleSelectButton.setMnemonic(KeyEvent.VK_M);
1.28 - cvsExeButton.setMnemonic(KeyEvent.VK_E);
1.29 - cygwinCheckBox.setMnemonic(KeyEvent.VK_U);
1.30 - cygwinButton.setMnemonic(KeyEvent.VK_B);
1.31 - localRadioButton.requestFocus ();
1.32 - D.deb("constructor update ...");
1.33 - updateEnabledComponents ();
1.34 - D.deb("constructor localize ...");
1.35 - localizeComponents();
1.36 - D.deb("constructor help ...");
1.37 - HelpCtx.setHelpIDString (this, CvsCustomizer.class.getName ());
1.38 - D.deb("constructor done");
1.39 - }
1.40 + private Debug E=new Debug("CvsCustomizer", true); // NOI18N
1.41 + private Debug D=new Debug("CvsCustomizer", true); // NOI18N
1.42 + private javax.swing.ButtonGroup bg;
1.43
1.44 - /** This method is called from within the constructor to
1.45 - * initialize the form.
1.46 - * WARNING: Do NOT modify this code. The content of this method is
1.47 - * always regenerated by the FormEditor.
1.48 - */
1.49 - private void initComponents () {//GEN-BEGIN:initComponents
1.50 - connectionPanel = new javax.swing.JPanel ();
1.51 - localRadioButton = new javax.swing.JRadioButton ();
1.52 - serverRadioButton = new javax.swing.JRadioButton ();
1.53 - pserverRadioButton = new javax.swing.JRadioButton ();
1.54 - userNameLabel = new javax.swing.JLabel ();
1.55 - userTextField = new javax.swing.JTextField ();
1.56 - propsPanel = new javax.swing.JPanel ();
1.57 - serverTextField = new javax.swing.JTextField ();
1.58 - serverLabel = new javax.swing.JLabel ();
1.59 - repositoryLabel = new javax.swing.JLabel ();
1.60 - repositoryTextField = new javax.swing.JTextField ();
1.61 - repositoryButton = new javax.swing.JButton ();
1.62 - rootDirLabel = new javax.swing.JLabel ();
1.63 - rootDirTextField = new javax.swing.JTextField ();
1.64 - browseButton = new javax.swing.JButton ();
1.65 - moduleLabel = new javax.swing.JLabel ();
1.66 - moduleTextField = new javax.swing.JTextField ();
1.67 - moduleSelectButton = new javax.swing.JButton ();
1.68 - relMountLabel = new javax.swing.JLabel ();
1.69 - relMountTextField = new javax.swing.JTextField ();
1.70 - cvsExeLabel = new javax.swing.JLabel ();
1.71 - cvsExeTextField = new javax.swing.JTextField ();
1.72 - cvsExeButton = new javax.swing.JButton ();
1.73 - cygwinCheckBox = new javax.swing.JCheckBox ();
1.74 - cygwinLabel = new javax.swing.JLabel ();
1.75 - cygwinTextField = new javax.swing.JTextField ();
1.76 - cygwinButton = new javax.swing.JButton ();
1.77 - refreshLabel = new javax.swing.JLabel ();
1.78 - refreshTextField = new javax.swing.JTextField ();
1.79 - jLabel10 = new javax.swing.JLabel ();
1.80 - loginButton = new javax.swing.JButton ();
1.81 - setLayout (new java.awt.GridBagLayout ());
1.82 - java.awt.GridBagConstraints gridBagConstraints1;
1.83 - setOpaque (false);
1.84 + static final long serialVersionUID =-4163355905662053542L;
1.85 + /** Creates new panel CvsCustomizer */
1.86 + public CvsCustomizer() {
1.87 + D.deb("constructor called");
1.88 + changeSupport=new PropertyChangeSupport(this);
1.89 + initComponents ();
1.90 + javax.swing.ButtonGroup bg = new javax.swing.ButtonGroup ();
1.91 + bg.add (localRadioButton);
1.92 + bg.add (serverRadioButton);
1.93 + bg.add (pserverRadioButton);
1.94 + loginButton.setMnemonic(KeyEvent.VK_G);
1.95 + browseButton.setMnemonic(KeyEvent.VK_W);
1.96 + repositoryButton.setMnemonic(KeyEvent.VK_R);
1.97 + localRadioButton.setMnemonic(KeyEvent.VK_L);
1.98 + serverRadioButton.setMnemonic(KeyEvent.VK_S);
1.99 + pserverRadioButton.setMnemonic(KeyEvent.VK_P);
1.100 + moduleSelectButton.setMnemonic(KeyEvent.VK_M);
1.101 + cvsExeButton.setMnemonic(KeyEvent.VK_E);
1.102 + cygwinCheckBox.setMnemonic(KeyEvent.VK_U);
1.103 + cygwinButton.setMnemonic(KeyEvent.VK_B);
1.104 + localRadioButton.requestFocus ();
1.105 + D.deb("constructor update ...");
1.106 + updateEnabledComponents ();
1.107 + D.deb("constructor localize ...");
1.108 + localizeComponents();
1.109 + D.deb("constructor help ...");
1.110 + HelpCtx.setHelpIDString (this, CvsCustomizer.class.getName ());
1.111 + D.deb("constructor done");
1.112 + }
1.113
1.114 - connectionPanel.setLayout (new java.awt.GridBagLayout ());
1.115 - java.awt.GridBagConstraints gridBagConstraints2;
1.116 - connectionPanel.setBorder (new javax.swing.border.TitledBorder(
1.117 - new javax.swing.border.EtchedBorder(), "CVS Connection Type"));
1.118 + /** This method is called from within the constructor to
1.119 + * initialize the form.
1.120 + * WARNING: Do NOT modify this code. The content of this method is
1.121 + * always regenerated by the FormEditor.
1.122 + */
1.123 + private void initComponents () {//GEN-BEGIN:initComponents
1.124 + connectionPanel = new javax.swing.JPanel ();
1.125 + localRadioButton = new javax.swing.JRadioButton ();
1.126 + serverRadioButton = new javax.swing.JRadioButton ();
1.127 + pserverRadioButton = new javax.swing.JRadioButton ();
1.128 + userNameLabel = new javax.swing.JLabel ();
1.129 + userTextField = new javax.swing.JTextField ();
1.130 + propsPanel = new javax.swing.JPanel ();
1.131 + serverTextField = new javax.swing.JTextField ();
1.132 + serverLabel = new javax.swing.JLabel ();
1.133 + repositoryLabel = new javax.swing.JLabel ();
1.134 + repositoryTextField = new javax.swing.JTextField ();
1.135 + repositoryButton = new javax.swing.JButton ();
1.136 + rootDirLabel = new javax.swing.JLabel ();
1.137 + rootDirTextField = new javax.swing.JTextField ();
1.138 + browseButton = new javax.swing.JButton ();
1.139 + moduleLabel = new javax.swing.JLabel ();
1.140 + moduleTextField = new javax.swing.JTextField ();
1.141 + moduleSelectButton = new javax.swing.JButton ();
1.142 + relMountLabel = new javax.swing.JLabel ();
1.143 + relMountTextField = new javax.swing.JTextField ();
1.144 + cvsExeLabel = new javax.swing.JLabel ();
1.145 + cvsExeTextField = new javax.swing.JTextField ();
1.146 + cvsExeButton = new javax.swing.JButton ();
1.147 + cygwinCheckBox = new javax.swing.JCheckBox ();
1.148 + cygwinLabel = new javax.swing.JLabel ();
1.149 + cygwinTextField = new javax.swing.JTextField ();
1.150 + cygwinButton = new javax.swing.JButton ();
1.151 + refreshLabel = new javax.swing.JLabel ();
1.152 + refreshTextField = new javax.swing.JTextField ();
1.153 + jLabel10 = new javax.swing.JLabel ();
1.154 + loginButton = new javax.swing.JButton ();
1.155 + setLayout (new java.awt.GridBagLayout ());
1.156 + java.awt.GridBagConstraints gridBagConstraints1;
1.157 + setOpaque (false);
1.158
1.159 - localRadioButton.setSelected (true);
1.160 - localRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.localRadioButton.text"));
1.161 - localRadioButton.setNextFocusableComponent (serverRadioButton);
1.162 - localRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.163 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.164 - localRadioButtonActionPerformed (evt);
1.165 + connectionPanel.setLayout (new java.awt.GridBagLayout ());
1.166 + java.awt.GridBagConstraints gridBagConstraints2;
1.167 + connectionPanel.setBorder (new javax.swing.border.TitledBorder(
1.168 + new javax.swing.border.EtchedBorder(), "CVS Connection Type"));
1.169 +
1.170 + localRadioButton.setSelected (true);
1.171 + localRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.localRadioButton.text"));
1.172 + localRadioButton.setNextFocusableComponent (serverRadioButton);
1.173 + localRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.174 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.175 + localRadioButtonActionPerformed (evt);
1.176 + }
1.177 + }
1.178 + );
1.179 +
1.180 + gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.181 + gridBagConstraints2.gridwidth = 2;
1.182 + gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.183 + gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.184 + gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.185 + gridBagConstraints2.weightx = 1.0;
1.186 + connectionPanel.add (localRadioButton, gridBagConstraints2);
1.187 +
1.188 + serverRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverRadioButton.text"));
1.189 + serverRadioButton.setNextFocusableComponent (pserverRadioButton);
1.190 + serverRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.191 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.192 + serverRadioButtonActionPerformed (evt);
1.193 + }
1.194 + }
1.195 + );
1.196 +
1.197 + gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.198 + gridBagConstraints2.gridx = 0;
1.199 + gridBagConstraints2.gridy = 1;
1.200 + gridBagConstraints2.gridwidth = 2;
1.201 + gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.202 + gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.203 + gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.204 + gridBagConstraints2.weightx = 1.0;
1.205 + connectionPanel.add (serverRadioButton, gridBagConstraints2);
1.206 +
1.207 + pserverRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.pserverRadioButton.text"));
1.208 + pserverRadioButton.setNextFocusableComponent (userTextField);
1.209 + pserverRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.210 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.211 + pserverRadioButtonActionPerformed (evt);
1.212 + }
1.213 + }
1.214 + );
1.215 +
1.216 + gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.217 + gridBagConstraints2.gridx = 0;
1.218 + gridBagConstraints2.gridy = 2;
1.219 + gridBagConstraints2.gridwidth = 2;
1.220 + gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.221 + gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.222 + gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.223 + gridBagConstraints2.weightx = 1.0;
1.224 + connectionPanel.add (pserverRadioButton, gridBagConstraints2);
1.225 +
1.226 + userNameLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.userNameLabel.text"));
1.227 +
1.228 + gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.229 + gridBagConstraints2.gridx = 0;
1.230 + gridBagConstraints2.gridy = 3;
1.231 + gridBagConstraints2.insets = new java.awt.Insets (8, 32, 8, 8);
1.232 + gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.233 + connectionPanel.add (userNameLabel, gridBagConstraints2);
1.234 +
1.235 + userTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.userTextField.toolTipText"));
1.236 + userTextField.setText ("");
1.237 + userTextField.setNextFocusableComponent (serverTextField);
1.238 + userTextField.addActionListener (new java.awt.event.ActionListener () {
1.239 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.240 + userTextFieldActionPerformed (evt);
1.241 + }
1.242 + }
1.243 + );
1.244 + userTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.245 + public void focusLost (java.awt.event.FocusEvent evt) {
1.246 + userTextFieldFocusLost (evt);
1.247 + }
1.248 + }
1.249 + );
1.250 +
1.251 + gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.252 + gridBagConstraints2.gridx = 1;
1.253 + gridBagConstraints2.gridy = 3;
1.254 + gridBagConstraints2.gridwidth = 0;
1.255 + gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.256 + gridBagConstraints2.insets = new java.awt.Insets (8, 0, 8, 8);
1.257 + gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.258 + gridBagConstraints2.weightx = 1.0;
1.259 + connectionPanel.add (userTextField, gridBagConstraints2);
1.260 +
1.261 +
1.262 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
1.263 + gridBagConstraints1.gridx = 0;
1.264 + gridBagConstraints1.gridy = 0;
1.265 + gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
1.266 + gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
1.267 + gridBagConstraints1.weightx = 1.0;
1.268 + gridBagConstraints1.weighty = 0.4;
1.269 + add (connectionPanel, gridBagConstraints1);
1.270 +
1.271 + propsPanel.setLayout (new java.awt.GridBagLayout ());
1.272 + java.awt.GridBagConstraints gridBagConstraints3;
1.273 + propsPanel.setBorder (new javax.swing.border.TitledBorder(
1.274 + new javax.swing.border.EtchedBorder(), "CVS Settings"));
1.275 +
1.276 + serverTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverTextField.toolTipText"));
1.277 + serverTextField.setPreferredSize (new java.awt.Dimension(150, 20));
1.278 + serverTextField.setMinimumSize (new java.awt.Dimension(150, 20));
1.279 + serverTextField.setNextFocusableComponent (repositoryTextField);
1.280 + serverTextField.addActionListener (new java.awt.event.ActionListener () {
1.281 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.282 + serverTextFieldActionPerformed (evt);
1.283 + }
1.284 + }
1.285 + );
1.286 + serverTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.287 + public void focusLost (java.awt.event.FocusEvent evt) {
1.288 + serverTextFieldFocusLost (evt);
1.289 + }
1.290 + }
1.291 + );
1.292 +
1.293 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.294 + gridBagConstraints3.gridx = 1;
1.295 + gridBagConstraints3.gridy = 0;
1.296 + gridBagConstraints3.gridwidth = 2;
1.297 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.298 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.299 + gridBagConstraints3.weightx = 0.8;
1.300 + propsPanel.add (serverTextField, gridBagConstraints3);
1.301 +
1.302 + serverLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverLabel.text"));
1.303 +
1.304 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.305 + gridBagConstraints3.gridx = 0;
1.306 + gridBagConstraints3.gridy = 0;
1.307 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.308 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.309 + propsPanel.add (serverLabel, gridBagConstraints3);
1.310 +
1.311 + repositoryLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryLabel.text"));
1.312 +
1.313 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.314 + gridBagConstraints3.gridx = 0;
1.315 + gridBagConstraints3.gridy = 1;
1.316 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.317 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.318 + propsPanel.add (repositoryLabel, gridBagConstraints3);
1.319 +
1.320 + repositoryTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryTextField.toolTipText"));
1.321 + repositoryTextField.setNextFocusableComponent (rootDirTextField);
1.322 + repositoryTextField.addActionListener (new java.awt.event.ActionListener () {
1.323 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.324 + repositoryTextFieldActionPerformed (evt);
1.325 + }
1.326 + }
1.327 + );
1.328 + repositoryTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.329 + public void focusLost (java.awt.event.FocusEvent evt) {
1.330 + repositoryTextFieldFocusLost (evt);
1.331 + }
1.332 + }
1.333 + );
1.334 +
1.335 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.336 + gridBagConstraints3.gridx = 1;
1.337 + gridBagConstraints3.gridy = 1;
1.338 + gridBagConstraints3.gridwidth = 2;
1.339 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.340 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.341 + gridBagConstraints3.weightx = 0.8;
1.342 + propsPanel.add (repositoryTextField, gridBagConstraints3);
1.343 +
1.344 + repositoryButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryButton.text"));
1.345 + repositoryButton.setNextFocusableComponent (rootDirTextField);
1.346 + repositoryButton.addActionListener (new java.awt.event.ActionListener () {
1.347 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.348 + repositoryButtonActionPerformed (evt);
1.349 + }
1.350 + }
1.351 + );
1.352 +
1.353 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.354 + gridBagConstraints3.gridx = 3;
1.355 + gridBagConstraints3.gridy = 1;
1.356 + gridBagConstraints3.gridwidth = 0;
1.357 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.358 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.359 + propsPanel.add (repositoryButton, gridBagConstraints3);
1.360 +
1.361 + rootDirLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.rootDirLabel.text"));
1.362 +
1.363 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.364 + gridBagConstraints3.gridx = 0;
1.365 + gridBagConstraints3.gridy = 2;
1.366 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.367 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.368 + propsPanel.add (rootDirLabel, gridBagConstraints3);
1.369 +
1.370 + rootDirTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.rootDirTextField.toolTipText"));
1.371 + rootDirTextField.setNextFocusableComponent (moduleTextField);
1.372 + rootDirTextField.addActionListener (new java.awt.event.ActionListener () {
1.373 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.374 + rootDirTextFieldActionPerformed (evt);
1.375 + }
1.376 + }
1.377 + );
1.378 + rootDirTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.379 + public void focusLost (java.awt.event.FocusEvent evt) {
1.380 + rootDirTextFieldFocusLost (evt);
1.381 + }
1.382 + }
1.383 + );
1.384 +
1.385 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.386 + gridBagConstraints3.gridx = 1;
1.387 + gridBagConstraints3.gridy = 2;
1.388 + gridBagConstraints3.gridwidth = 2;
1.389 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.390 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.391 + gridBagConstraints3.weightx = 0.8;
1.392 + propsPanel.add (rootDirTextField, gridBagConstraints3);
1.393 +
1.394 + browseButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.browseButton.text"));
1.395 + browseButton.setNextFocusableComponent (refreshTextField);
1.396 + browseButton.addActionListener (new java.awt.event.ActionListener () {
1.397 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.398 + browseButtonActionPerformed (evt);
1.399 + }
1.400 + }
1.401 + );
1.402 +
1.403 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.404 + gridBagConstraints3.gridx = 3;
1.405 + gridBagConstraints3.gridy = 2;
1.406 + gridBagConstraints3.gridwidth = 0;
1.407 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.408 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.409 + propsPanel.add (browseButton, gridBagConstraints3);
1.410 +
1.411 + moduleLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleLabel.text"));
1.412 +
1.413 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.414 + gridBagConstraints3.gridx = 0;
1.415 + gridBagConstraints3.gridy = 3;
1.416 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.417 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.418 + propsPanel.add (moduleLabel, gridBagConstraints3);
1.419 +
1.420 + moduleTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleTextField.toolTipText"));
1.421 + moduleTextField.setNextFocusableComponent (relMountTextField);
1.422 + moduleTextField.addActionListener (new java.awt.event.ActionListener () {
1.423 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.424 + moduleTextFieldActionPerformed (evt);
1.425 + }
1.426 + }
1.427 + );
1.428 + moduleTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.429 + public void focusLost (java.awt.event.FocusEvent evt) {
1.430 + moduleTextFieldFocusLost (evt);
1.431 + }
1.432 + }
1.433 + );
1.434 +
1.435 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.436 + gridBagConstraints3.gridx = 1;
1.437 + gridBagConstraints3.gridy = 3;
1.438 + gridBagConstraints3.gridwidth = 2;
1.439 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.440 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.441 + gridBagConstraints3.weightx = 0.8;
1.442 + propsPanel.add (moduleTextField, gridBagConstraints3);
1.443 +
1.444 + moduleSelectButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleSelectButton.text"));
1.445 + moduleSelectButton.addActionListener (new java.awt.event.ActionListener () {
1.446 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.447 + moduleSelectButtonActionPerformed (evt);
1.448 + }
1.449 + }
1.450 + );
1.451 +
1.452 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.453 + gridBagConstraints3.gridx = 3;
1.454 + gridBagConstraints3.gridy = 3;
1.455 + gridBagConstraints3.gridwidth = 0;
1.456 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.457 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.458 + propsPanel.add (moduleSelectButton, gridBagConstraints3);
1.459 +
1.460 + relMountLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.relMountLabel.text"));
1.461 +
1.462 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.463 + gridBagConstraints3.gridx = 0;
1.464 + gridBagConstraints3.gridy = 4;
1.465 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.466 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.467 + propsPanel.add (relMountLabel, gridBagConstraints3);
1.468 +
1.469 + relMountTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.relMountTextField.toolTipText"));
1.470 + relMountTextField.setNextFocusableComponent (cvsExeTextField);
1.471 + relMountTextField.addActionListener (new java.awt.event.ActionListener () {
1.472 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.473 + relMountTextFieldActionPerformed (evt);
1.474 + }
1.475 + }
1.476 + );
1.477 + relMountTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.478 + public void focusLost (java.awt.event.FocusEvent evt) {
1.479 + relMountTextFieldFocusLost (evt);
1.480 + }
1.481 + }
1.482 + );
1.483 +
1.484 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.485 + gridBagConstraints3.gridx = 1;
1.486 + gridBagConstraints3.gridy = 4;
1.487 + gridBagConstraints3.gridwidth = 2;
1.488 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.489 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.490 + gridBagConstraints3.weightx = 1.0;
1.491 + propsPanel.add (relMountTextField, gridBagConstraints3);
1.492 +
1.493 + cvsExeLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeLabel.text"));
1.494 +
1.495 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.496 + gridBagConstraints3.gridx = 0;
1.497 + gridBagConstraints3.gridy = 5;
1.498 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.499 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.500 + propsPanel.add (cvsExeLabel, gridBagConstraints3);
1.501 +
1.502 + cvsExeTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeTextField.toolTipText"));
1.503 + cvsExeTextField.setNextFocusableComponent (cygwinCheckBox);
1.504 + cvsExeTextField.addActionListener (new java.awt.event.ActionListener () {
1.505 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.506 + cvsExeTextFieldActionPerformed (evt);
1.507 + }
1.508 + }
1.509 + );
1.510 + cvsExeTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.511 + public void focusLost (java.awt.event.FocusEvent evt) {
1.512 + cvsExeTextFieldFocusLost (evt);
1.513 + }
1.514 + }
1.515 + );
1.516 +
1.517 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.518 + gridBagConstraints3.gridx = 1;
1.519 + gridBagConstraints3.gridy = 5;
1.520 + gridBagConstraints3.gridwidth = 2;
1.521 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.522 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.523 + gridBagConstraints3.weightx = 1.0;
1.524 + propsPanel.add (cvsExeTextField, gridBagConstraints3);
1.525 +
1.526 + cvsExeButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeButton.text"));
1.527 + cvsExeButton.addActionListener (new java.awt.event.ActionListener () {
1.528 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.529 + cvsExeButtonActionPerformed (evt);
1.530 + }
1.531 + }
1.532 + );
1.533 +
1.534 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.535 + gridBagConstraints3.gridx = 3;
1.536 + gridBagConstraints3.gridy = 5;
1.537 + gridBagConstraints3.gridwidth = 0;
1.538 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.539 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.540 + propsPanel.add (cvsExeButton, gridBagConstraints3);
1.541 +
1.542 + cygwinCheckBox.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinCheckBox.toolTipText"));
1.543 + cygwinCheckBox.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinCheckBox.text"));
1.544 + cygwinCheckBox.setNextFocusableComponent (cygwinTextField);
1.545 + cygwinCheckBox.addActionListener (new java.awt.event.ActionListener () {
1.546 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.547 + cygwinCheckBoxActionPerformed (evt);
1.548 + }
1.549 + }
1.550 + );
1.551 +
1.552 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.553 + gridBagConstraints3.gridx = 0;
1.554 + gridBagConstraints3.gridy = 6;
1.555 + gridBagConstraints3.gridwidth = 3;
1.556 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.557 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.558 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.559 + gridBagConstraints3.weightx = 1.0;
1.560 + propsPanel.add (cygwinCheckBox, gridBagConstraints3);
1.561 +
1.562 + cygwinLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinLabel.text"));
1.563 +
1.564 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.565 + gridBagConstraints3.gridx = 0;
1.566 + gridBagConstraints3.gridy = 7;
1.567 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.568 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.569 + propsPanel.add (cygwinLabel, gridBagConstraints3);
1.570 +
1.571 + cygwinTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinTextField.toolTipText"));
1.572 + cygwinTextField.setNextFocusableComponent (refreshTextField);
1.573 + cygwinTextField.addActionListener (new java.awt.event.ActionListener () {
1.574 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.575 + cygwinTextFieldActionPerformed (evt);
1.576 + }
1.577 + }
1.578 + );
1.579 + cygwinTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.580 + public void focusLost (java.awt.event.FocusEvent evt) {
1.581 + cygwinTextFieldFocusLost (evt);
1.582 + }
1.583 + }
1.584 + );
1.585 +
1.586 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.587 + gridBagConstraints3.gridx = 1;
1.588 + gridBagConstraints3.gridy = 7;
1.589 + gridBagConstraints3.gridwidth = 2;
1.590 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.591 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.592 + gridBagConstraints3.weightx = 1.0;
1.593 + propsPanel.add (cygwinTextField, gridBagConstraints3);
1.594 +
1.595 + cygwinButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinButton.text"));
1.596 + cygwinButton.addActionListener (new java.awt.event.ActionListener () {
1.597 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.598 + cygwinButtonActionPerformed (evt);
1.599 + }
1.600 + }
1.601 + );
1.602 +
1.603 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.604 + gridBagConstraints3.gridx = 3;
1.605 + gridBagConstraints3.gridy = 7;
1.606 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.607 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.608 + propsPanel.add (cygwinButton, gridBagConstraints3);
1.609 +
1.610 + refreshLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.refreshLabel.text"));
1.611 +
1.612 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.613 + gridBagConstraints3.gridx = 0;
1.614 + gridBagConstraints3.gridy = 8;
1.615 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.616 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.617 + propsPanel.add (refreshLabel, gridBagConstraints3);
1.618 +
1.619 + refreshTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.refreshTextField.toolTipText"));
1.620 + refreshTextField.setPreferredSize (new java.awt.Dimension(50, 20));
1.621 + refreshTextField.setMinimumSize (new java.awt.Dimension(50, 20));
1.622 + refreshTextField.setText ("0");
1.623 + refreshTextField.setNextFocusableComponent (loginButton);
1.624 + refreshTextField.addActionListener (new java.awt.event.ActionListener () {
1.625 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.626 + refreshTextFieldActionPerformed (evt);
1.627 + }
1.628 + }
1.629 + );
1.630 + refreshTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.631 + public void focusLost (java.awt.event.FocusEvent evt) {
1.632 + refreshTextFieldFocusLost (evt);
1.633 + }
1.634 + }
1.635 + );
1.636 +
1.637 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.638 + gridBagConstraints3.gridx = 1;
1.639 + gridBagConstraints3.gridy = 8;
1.640 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.641 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.642 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.643 + gridBagConstraints3.weightx = 0.4;
1.644 + propsPanel.add (refreshTextField, gridBagConstraints3);
1.645 +
1.646 + jLabel10.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.jLabel10.text"));
1.647 +
1.648 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.649 + gridBagConstraints3.gridx = 2;
1.650 + gridBagConstraints3.gridy = 8;
1.651 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.652 + gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.653 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.654 + gridBagConstraints3.weightx = 0.6;
1.655 + propsPanel.add (jLabel10, gridBagConstraints3);
1.656 +
1.657 + loginButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.loginButton.text"));
1.658 + loginButton.addActionListener (new java.awt.event.ActionListener () {
1.659 + public void actionPerformed (java.awt.event.ActionEvent evt) {
1.660 + loginButtonActionPerformed (evt);
1.661 + }
1.662 + }
1.663 + );
1.664 +
1.665 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.666 + gridBagConstraints3.gridx = 0;
1.667 + gridBagConstraints3.gridy = 9;
1.668 + gridBagConstraints3.insets = new java.awt.Insets (8, 8, 8, 8);
1.669 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.670 + propsPanel.add (loginButton, gridBagConstraints3);
1.671 +
1.672 +
1.673 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
1.674 + gridBagConstraints1.gridx = 0;
1.675 + gridBagConstraints1.gridy = 1;
1.676 + gridBagConstraints1.gridwidth = 2;
1.677 + gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
1.678 + gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
1.679 + gridBagConstraints1.weightx = 1.0;
1.680 + gridBagConstraints1.weighty = 0.5;
1.681 + add (propsPanel, gridBagConstraints1);
1.682 +
1.683 + }//GEN-END:initComponents
1.684 +
1.685 + private void relMountTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_relMountTextFieldFocusLost
1.686 + // Add your handling code here:
1.687 + fileSystem.setCvsModule (relMountTextField.getText ());
1.688 + rootDirChanged(false);
1.689 + }//GEN-LAST:event_relMountTextFieldFocusLost
1.690 +
1.691 + private void relMountTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relMountTextFieldActionPerformed
1.692 + // Add your handling code here:
1.693 + fileSystem.setCvsModule (relMountTextField.getText ());
1.694 + rootDirChanged(false);
1.695 + }//GEN-LAST:event_relMountTextFieldActionPerformed
1.696 +
1.697 + private void moduleSelectButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleSelectButtonActionPerformed
1.698 + // Add your handling code here:
1.699 + VcsConfigVariable var = (VcsConfigVariable) fileSystem.getVariablesByName().get ("MODULE_NAME");
1.700 + if (var == null) return;
1.701 + String exec = var.getCustomSelector();
1.702 + OutputContainer container = new OutputContainer(g("MSG_VariableSelector"));
1.703 + final ExecuteSelector es = new ExecuteSelector(fileSystem, exec, "MODULE_NAME",
1.704 + fileSystem.getVariablesAsHashtable());
1.705 + es.setErrorNoRegexListener(container);
1.706 + es.setOutputNoRegexListener(container);
1.707 + es.setErrorContainer(container);
1.708 + //javax.swing.SwingUtilities.invokeLater(new Runnable() {
1.709 + //public void run() {
1.710 + new Thread ("CVS-ModuleSelection") {
1.711 + public void run() {
1.712 + es.start();
1.713 + try {
1.714 + es.join();
1.715 + } catch (InterruptedException e) {
1.716 + return;
1.717 + }
1.718 + String selection = es.getSelection();
1.719 + if (selection != null && selection.length() > 0) {
1.720 + moduleTextField.setText(selection);
1.721 + fileSystem.setCvsModuleName(selection);
1.722 + //rootDirChanged(false);
1.723 + }
1.724 + }
1.725 + }.start();
1.726 + //}
1.727 + //});
1.728 +
1.729 + }//GEN-LAST:event_moduleSelectButtonActionPerformed
1.730 +
1.731 + private void localizeComponents() {
1.732 + javax.swing.border.TitledBorder border = (javax.swing.border.TitledBorder) connectionPanel.getBorder();
1.733 + border.setTitle(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.connectionPanel.borderTitle"));
1.734 + border = (javax.swing.border.TitledBorder) propsPanel.getBorder();
1.735 + border.setTitle(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.propsPanel.borderTitle"));
1.736 + }
1.737 +
1.738 + private void cvsExeTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cvsExeTextFieldActionPerformed
1.739 + // Add your handling code here:
1.740 + fileSystem.setCvsExePath (cvsExeTextField.getText());
1.741 + }//GEN-LAST:event_cvsExeTextFieldActionPerformed
1.742 +
1.743 + private void cygwinTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinTextFieldActionPerformed
1.744 + // Add your handling code here:
1.745 + fileSystem.setCygwinPath (cygwinTextField.getText());
1.746 + }//GEN-LAST:event_cygwinTextFieldActionPerformed
1.747 +
1.748 + private void cygwinTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cygwinTextFieldFocusLost
1.749 + // Add your handling code here:
1.750 + fileSystem.setCygwinPath (cygwinTextField.getText());
1.751 + }//GEN-LAST:event_cygwinTextFieldFocusLost
1.752 +
1.753 + private void cvsExeTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cvsExeTextFieldFocusLost
1.754 + // Add your handling code here:
1.755 + fileSystem.setCvsExePath (cvsExeTextField.getText());
1.756 + }//GEN-LAST:event_cvsExeTextFieldFocusLost
1.757 +
1.758 + private void cygwinCheckBoxActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinCheckBoxActionPerformed
1.759 + // Add your handling code here:
1.760 + fileSystem.setUseUnixShell(cygwinCheckBox.isSelected());
1.761 + updateEnabledComponents ();
1.762 + }//GEN-LAST:event_cygwinCheckBoxActionPerformed
1.763 +
1.764 + private void cygwinButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinButtonActionPerformed
1.765 + // Add your handling code here:
1.766 + ChooseFileDialog chooseFile=new ChooseFileDialog(new JFrame(), new File(cygwinTextField.getText ()), false);
1.767 + MiscStuff.centerWindow (chooseFile);
1.768 + HelpCtx.setHelpIDString (chooseFile.getRootPane (), CvsCustomizer.class.getName ());
1.769 + chooseFile.show();
1.770 + String selected=chooseFile.getSelectedFile();
1.771 + if( selected==null ){
1.772 + //D.deb("no directory selected"); // NOI18N
1.773 + return ;
1.774 }
1.775 - }
1.776 - );
1.777 -
1.778 - gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.779 - gridBagConstraints2.gridwidth = 2;
1.780 - gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.781 - gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.782 - gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.783 - gridBagConstraints2.weightx = 1.0;
1.784 - connectionPanel.add (localRadioButton, gridBagConstraints2);
1.785 -
1.786 - serverRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverRadioButton.text"));
1.787 - serverRadioButton.setNextFocusableComponent (pserverRadioButton);
1.788 - serverRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.789 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.790 - serverRadioButtonActionPerformed (evt);
1.791 + cygwinTextField.setText (selected);
1.792 + fileSystem.setCygwinPath (selected);
1.793 + }//GEN-LAST:event_cygwinButtonActionPerformed
1.794 +
1.795 + private void cvsExeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cvsExeButtonActionPerformed
1.796 + // Add your handling code here:
1.797 + ChooseFileDialog chooseFile=new ChooseFileDialog(new JFrame(), new File(cvsExeTextField.getText ()), false);
1.798 + MiscStuff.centerWindow (chooseFile);
1.799 + HelpCtx.setHelpIDString (chooseFile.getRootPane (), CvsCustomizer.class.getName ());
1.800 + chooseFile.show();
1.801 + String selected=chooseFile.getSelectedFile();
1.802 + if( selected==null ){
1.803 + //D.deb("no directory selected"); // NOI18N
1.804 + return ;
1.805 }
1.806 - }
1.807 - );
1.808 -
1.809 - gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.810 - gridBagConstraints2.gridx = 0;
1.811 - gridBagConstraints2.gridy = 1;
1.812 - gridBagConstraints2.gridwidth = 2;
1.813 - gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.814 - gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.815 - gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.816 - gridBagConstraints2.weightx = 1.0;
1.817 - connectionPanel.add (serverRadioButton, gridBagConstraints2);
1.818 -
1.819 - pserverRadioButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.pserverRadioButton.text"));
1.820 - pserverRadioButton.setNextFocusableComponent (userTextField);
1.821 - pserverRadioButton.addActionListener (new java.awt.event.ActionListener () {
1.822 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.823 - pserverRadioButtonActionPerformed (evt);
1.824 + cvsExeTextField.setText (selected);
1.825 + fileSystem.setCvsExePath (selected);
1.826 + }//GEN-LAST:event_cvsExeButtonActionPerformed
1.827 +
1.828 + private void moduleTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_moduleTextFieldFocusLost
1.829 + // Add your handling code here:
1.830 + fileSystem.setCvsModuleName (moduleTextField.getText ());
1.831 + }//GEN-LAST:event_moduleTextFieldFocusLost
1.832 +
1.833 + private void moduleTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleTextFieldActionPerformed
1.834 + // Add your handling code here:
1.835 + fileSystem.setCvsModuleName (moduleTextField.getText ());
1.836 + }//GEN-LAST:event_moduleTextFieldActionPerformed
1.837 +
1.838 + private void userTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userTextFieldFocusLost
1.839 + // Add your handling code here:
1.840 + fileSystem.setCvsUserName (userTextField.getText ());
1.841 + }//GEN-LAST:event_userTextFieldFocusLost
1.842 +
1.843 + private void userTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userTextFieldActionPerformed
1.844 + // Add your handling code here:
1.845 + fileSystem.setCvsUserName (userTextField.getText ());
1.846 + }//GEN-LAST:event_userTextFieldActionPerformed
1.847 +
1.848 + private void loginButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
1.849 + // Add your handling code here:
1.850 + String messageLabel = org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.loginHOWTO");
1.851 + String messageText = "cvs -d :" + fileSystem.getCvsServerType () + ":" +fileSystem.getCvcRootForServerType ()+" login";
1.852 + JDialog dlg = notifyMessageTF(messageLabel, messageText);
1.853 + dlg.setVisible(true);
1.854 + //NotifyDescriptor nd = new NotifyDescriptor.Message (message);
1.855 + //TopManager.getDefault ().notify (nd);
1.856 + }//GEN-LAST:event_loginButtonActionPerformed
1.857 +
1.858 + private void pserverRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pserverRadioButtonActionPerformed
1.859 + // Add your handling code here:
1.860 + if(pserverRadioButton.isSelected ()) {
1.861 + fileSystem.setCvsServerType (fileSystem.CVS_SERVER_PSERVER);
1.862 }
1.863 - }
1.864 - );
1.865 -
1.866 - gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.867 - gridBagConstraints2.gridx = 0;
1.868 - gridBagConstraints2.gridy = 2;
1.869 - gridBagConstraints2.gridwidth = 2;
1.870 - gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.871 - gridBagConstraints2.insets = new java.awt.Insets (8, 8, 0, 0);
1.872 - gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.873 - gridBagConstraints2.weightx = 1.0;
1.874 - connectionPanel.add (pserverRadioButton, gridBagConstraints2);
1.875 -
1.876 - userNameLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.userNameLabel.text"));
1.877 -
1.878 - gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.879 - gridBagConstraints2.gridx = 0;
1.880 - gridBagConstraints2.gridy = 3;
1.881 - gridBagConstraints2.insets = new java.awt.Insets (8, 32, 8, 8);
1.882 - gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.883 - connectionPanel.add (userNameLabel, gridBagConstraints2);
1.884 -
1.885 - userTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.userTextField.toolTipText"));
1.886 - userTextField.setText ("");
1.887 - userTextField.setNextFocusableComponent (serverTextField);
1.888 - userTextField.addActionListener (new java.awt.event.ActionListener () {
1.889 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.890 - userTextFieldActionPerformed (evt);
1.891 + updateEnabledComponents ();
1.892 + }//GEN-LAST:event_pserverRadioButtonActionPerformed
1.893 +
1.894 + private void serverRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverRadioButtonActionPerformed
1.895 + // Add your handling code here:
1.896 + if(serverRadioButton.isSelected ()) {
1.897 + fileSystem.setCvsServerType (fileSystem.CVS_SERVER_SERVER);
1.898 }
1.899 - }
1.900 - );
1.901 - userTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.902 - public void focusLost (java.awt.event.FocusEvent evt) {
1.903 - userTextFieldFocusLost (evt);
1.904 + updateEnabledComponents ();
1.905 + }//GEN-LAST:event_serverRadioButtonActionPerformed
1.906 +
1.907 + private void localRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localRadioButtonActionPerformed
1.908 + // Add your handling code here:
1.909 + if(localRadioButton.isSelected ()) {
1.910 + fileSystem.setCvsServerType (fileSystem.CVS_SERVER_LOCAL);
1.911 }
1.912 - }
1.913 - );
1.914 -
1.915 - gridBagConstraints2 = new java.awt.GridBagConstraints ();
1.916 - gridBagConstraints2.gridx = 1;
1.917 - gridBagConstraints2.gridy = 3;
1.918 - gridBagConstraints2.gridwidth = 0;
1.919 - gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.920 - gridBagConstraints2.insets = new java.awt.Insets (8, 0, 8, 8);
1.921 - gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST;
1.922 - gridBagConstraints2.weightx = 1.0;
1.923 - connectionPanel.add (userTextField, gridBagConstraints2);
1.924 -
1.925 + updateEnabledComponents ();
1.926 + }//GEN-LAST:event_localRadioButtonActionPerformed
1.927
1.928 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
1.929 - gridBagConstraints1.gridx = 0;
1.930 - gridBagConstraints1.gridy = 0;
1.931 - gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
1.932 - gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
1.933 - gridBagConstraints1.weightx = 1.0;
1.934 - gridBagConstraints1.weighty = 0.4;
1.935 - add (connectionPanel, gridBagConstraints1);
1.936
1.937 - propsPanel.setLayout (new java.awt.GridBagLayout ());
1.938 - java.awt.GridBagConstraints gridBagConstraints3;
1.939 - propsPanel.setBorder (new javax.swing.border.TitledBorder(
1.940 - new javax.swing.border.EtchedBorder(), "CVS Settings"));
1.941
1.942 - serverTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverTextField.toolTipText"));
1.943 - serverTextField.setPreferredSize (new java.awt.Dimension(150, 20));
1.944 - serverTextField.setMinimumSize (new java.awt.Dimension(150, 20));
1.945 - serverTextField.setNextFocusableComponent (repositoryTextField);
1.946 - serverTextField.addActionListener (new java.awt.event.ActionListener () {
1.947 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.948 - serverTextFieldActionPerformed (evt);
1.949 + private void serverTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_serverTextFieldFocusLost
1.950 + // Add your handling code here:
1.951 + fileSystem.setCvsServer (serverTextField.getText ());
1.952 + }//GEN-LAST:event_serverTextFieldFocusLost
1.953 +
1.954 + private void serverTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverTextFieldActionPerformed
1.955 + // Add your handling code here:
1.956 + fileSystem.setCvsServer (serverTextField.getText ());
1.957 + }//GEN-LAST:event_serverTextFieldActionPerformed
1.958 +
1.959 + private void repositoryTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_repositoryTextFieldFocusLost
1.960 + // Add your handling code here:
1.961 + fileSystem.setCvsRoot (repositoryTextField.getText ());
1.962 + }//GEN-LAST:event_repositoryTextFieldFocusLost
1.963 +
1.964 + private void repositoryTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repositoryTextFieldActionPerformed
1.965 + // Add your handling code here:
1.966 + fileSystem.setCvsRoot (repositoryTextField.getText ());
1.967 + }//GEN-LAST:event_repositoryTextFieldActionPerformed
1.968 +
1.969 + private void repositoryButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repositoryButtonActionPerformed
1.970 + // Add your handling code here:
1.971 + ChooseDirDialog chooseDir=new ChooseDirDialog(new JFrame(), new File(repositoryTextField.getText ()));
1.972 + MiscStuff.centerWindow (chooseDir);
1.973 + HelpCtx.setHelpIDString (chooseDir.getRootPane (), CvsCustomizer.class.getName ());
1.974 + chooseDir.show();
1.975 + String selected=chooseDir.getSelectedDir();
1.976 + if( selected==null ){
1.977 + //D.deb("no directory selected"); // NOI18N
1.978 + return ;
1.979 }
1.980 - }
1.981 - );
1.982 - serverTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.983 - public void focusLost (java.awt.event.FocusEvent evt) {
1.984 - serverTextFieldFocusLost (evt);
1.985 + File dir=new File(selected);
1.986 + if( !dir.isDirectory() ){
1.987 + E.err("not directory "+dir); // NOI18N
1.988 + return ;
1.989 }
1.990 - }
1.991 - );
1.992 -
1.993 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.994 - gridBagConstraints3.gridx = 1;
1.995 - gridBagConstraints3.gridy = 0;
1.996 - gridBagConstraints3.gridwidth = 2;
1.997 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.998 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.999 - gridBagConstraints3.weightx = 0.8;
1.1000 - propsPanel.add (serverTextField, gridBagConstraints3);
1.1001 -
1.1002 - serverLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.serverLabel.text"));
1.1003 -
1.1004 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1005 - gridBagConstraints3.gridx = 0;
1.1006 - gridBagConstraints3.gridy = 0;
1.1007 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1008 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1009 - propsPanel.add (serverLabel, gridBagConstraints3);
1.1010 -
1.1011 - repositoryLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryLabel.text"));
1.1012 -
1.1013 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1014 - gridBagConstraints3.gridx = 0;
1.1015 - gridBagConstraints3.gridy = 1;
1.1016 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1017 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1018 - propsPanel.add (repositoryLabel, gridBagConstraints3);
1.1019 -
1.1020 - repositoryTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryTextField.toolTipText"));
1.1021 - repositoryTextField.setNextFocusableComponent (rootDirTextField);
1.1022 - repositoryTextField.addActionListener (new java.awt.event.ActionListener () {
1.1023 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1024 - repositoryTextFieldActionPerformed (evt);
1.1025 + repositoryTextField.setText(selected);
1.1026 + fileSystem.setCvsRoot (selected);
1.1027 + }//GEN-LAST:event_repositoryButtonActionPerformed
1.1028 +
1.1029 + private void advancedButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedButtonActionPerformed
1.1030 + // Add your handling code here:
1.1031 + }//GEN-LAST:event_advancedButtonActionPerformed
1.1032 +
1.1033 + private void refreshTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_refreshTextFieldFocusLost
1.1034 + // Add your handling code here:
1.1035 + refreshChanged ();
1.1036 + }//GEN-LAST:event_refreshTextFieldFocusLost
1.1037 +
1.1038 + private void rootDirTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_rootDirTextFieldFocusLost
1.1039 + // Add your handling code here:
1.1040 + if (isRootChanged() && !browseButton.isSelected()) rootDirChanged (true);
1.1041 + }//GEN-LAST:event_rootDirTextFieldFocusLost
1.1042 +
1.1043 + private void refreshTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTextFieldActionPerformed
1.1044 + // Add your handling code here:
1.1045 + refreshChanged ();
1.1046 + }//GEN-LAST:event_refreshTextFieldActionPerformed
1.1047 +
1.1048 + private void browseButtonAction() {
1.1049 + ChooseDirDialog chooseDir=new ChooseDirDialog(new JFrame(), new File(rootDirTextField.getText ()));
1.1050 + MiscStuff.centerWindow (chooseDir);
1.1051 + HelpCtx.setHelpIDString (chooseDir.getRootPane (), CvsCustomizer.class.getName ());
1.1052 + chooseDir.show();
1.1053 + String selected=chooseDir.getSelectedDir();
1.1054 + if( selected==null ){
1.1055 + //D.deb("no directory selected"); // NOI18N
1.1056 + return ;
1.1057 }
1.1058 - }
1.1059 - );
1.1060 - repositoryTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1061 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1062 - repositoryTextFieldFocusLost (evt);
1.1063 + //String module = moduleTextField.getText ();
1.1064 + //String moduleDir = module.equals ("") ? selected : selected + java.io.File.separator + module; // NOI18N
1.1065 + File dir=new File(selected);
1.1066 + /*
1.1067 + if( !dir.isDirectory() ){
1.1068 + E.err("not directory "+dir); // NOI18N
1.1069 + return ;
1.1070 + }
1.1071 + */
1.1072 + try{
1.1073 + rootDirTextField.setText(selected);
1.1074 + fileSystem.setRootDirectory(dir);
1.1075 }
1.1076 - }
1.1077 - );
1.1078 -
1.1079 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1080 - gridBagConstraints3.gridx = 1;
1.1081 - gridBagConstraints3.gridy = 1;
1.1082 - gridBagConstraints3.gridwidth = 2;
1.1083 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1084 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1085 - gridBagConstraints3.weightx = 0.8;
1.1086 - propsPanel.add (repositoryTextField, gridBagConstraints3);
1.1087 -
1.1088 - repositoryButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.repositoryButton.text"));
1.1089 - repositoryButton.setNextFocusableComponent (rootDirTextField);
1.1090 - repositoryButton.addActionListener (new java.awt.event.ActionListener () {
1.1091 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1092 - repositoryButtonActionPerformed (evt);
1.1093 + catch (PropertyVetoException veto){
1.1094 + fileSystem.debug(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.canNotChangeWD"));
1.1095 + //E.err(veto,"setRootDirectory() failed"); // NOI18N
1.1096 }
1.1097 - }
1.1098 - );
1.1099 -
1.1100 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1101 - gridBagConstraints3.gridx = 3;
1.1102 - gridBagConstraints3.gridy = 1;
1.1103 - gridBagConstraints3.gridwidth = 0;
1.1104 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1105 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1106 - propsPanel.add (repositoryButton, gridBagConstraints3);
1.1107 -
1.1108 - rootDirLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.rootDirLabel.text"));
1.1109 -
1.1110 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1111 - gridBagConstraints3.gridx = 0;
1.1112 - gridBagConstraints3.gridy = 2;
1.1113 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1114 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1115 - propsPanel.add (rootDirLabel, gridBagConstraints3);
1.1116 -
1.1117 - rootDirTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.rootDirTextField.toolTipText"));
1.1118 - rootDirTextField.setNextFocusableComponent (moduleTextField);
1.1119 - rootDirTextField.addActionListener (new java.awt.event.ActionListener () {
1.1120 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1121 - rootDirTextFieldActionPerformed (evt);
1.1122 + catch (IOException e){
1.1123 + E.err(e,"setRootDirectory() failed"); // NOI18N
1.1124 + } finally {
1.1125 + if (rootNotSetDlg != null) rootNotSetDlg.setVisible(false);
1.1126 }
1.1127 - }
1.1128 - );
1.1129 - rootDirTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1130 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1131 - rootDirTextFieldFocusLost (evt);
1.1132 + }
1.1133 +
1.1134 + private void browseButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
1.1135 + // Add your handling code here:
1.1136 + D.deb("browseButtonActionPerformed()");
1.1137 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1138 + public void run () {
1.1139 + browseButtonAction();
1.1140 + }
1.1141 + });
1.1142 +
1.1143 + }//GEN-LAST:event_browseButtonActionPerformed
1.1144 +
1.1145 + private void rootDirTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rootDirTextFieldActionPerformed
1.1146 + // Add your handling code here:
1.1147 + rootDirChanged (true);
1.1148 + }//GEN-LAST:event_rootDirTextFieldActionPerformed
1.1149 +
1.1150 + private void removeConfigButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeConfigButtonActionPerformed
1.1151 + // Add your handling code here:
1.1152 + }//GEN-LAST:event_removeConfigButtonActionPerformed
1.1153 +
1.1154 + private void saveAsButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsButtonActionPerformed
1.1155 + // Add your handling code here:
1.1156 + }//GEN-LAST:event_saveAsButtonActionPerformed
1.1157 +
1.1158 + private void configComboItemStateChanged (java.awt.event.ItemEvent evt) {//GEN-FIRST:event_configComboItemStateChanged
1.1159 + // Add your handling code here:
1.1160 + }//GEN-LAST:event_configComboItemStateChanged
1.1161 +
1.1162 +
1.1163 + // Variables declaration - do not modify//GEN-BEGIN:variables
1.1164 + private javax.swing.JPanel connectionPanel;
1.1165 + private javax.swing.JRadioButton localRadioButton;
1.1166 + private javax.swing.JRadioButton serverRadioButton;
1.1167 + private javax.swing.JRadioButton pserverRadioButton;
1.1168 + private javax.swing.JLabel userNameLabel;
1.1169 + private javax.swing.JTextField userTextField;
1.1170 + private javax.swing.JPanel propsPanel;
1.1171 + private javax.swing.JTextField serverTextField;
1.1172 + private javax.swing.JLabel serverLabel;
1.1173 + private javax.swing.JLabel repositoryLabel;
1.1174 + private javax.swing.JTextField repositoryTextField;
1.1175 + private javax.swing.JButton repositoryButton;
1.1176 + private javax.swing.JLabel rootDirLabel;
1.1177 + private javax.swing.JTextField rootDirTextField;
1.1178 + private javax.swing.JButton browseButton;
1.1179 + private javax.swing.JLabel moduleLabel;
1.1180 + private javax.swing.JTextField moduleTextField;
1.1181 + private javax.swing.JButton moduleSelectButton;
1.1182 + private javax.swing.JLabel relMountLabel;
1.1183 + private javax.swing.JTextField relMountTextField;
1.1184 + private javax.swing.JLabel cvsExeLabel;
1.1185 + private javax.swing.JTextField cvsExeTextField;
1.1186 + private javax.swing.JButton cvsExeButton;
1.1187 + private javax.swing.JCheckBox cygwinCheckBox;
1.1188 + private javax.swing.JLabel cygwinLabel;
1.1189 + private javax.swing.JTextField cygwinTextField;
1.1190 + private javax.swing.JButton cygwinButton;
1.1191 + private javax.swing.JLabel refreshLabel;
1.1192 + private javax.swing.JTextField refreshTextField;
1.1193 + private javax.swing.JLabel jLabel10;
1.1194 + private javax.swing.JButton loginButton;
1.1195 + // End of variables declaration//GEN-END:variables
1.1196 +
1.1197 + private CvsFileSystem fileSystem=null;
1.1198 + private PropertyChangeSupport changeSupport=null;
1.1199 + private volatile boolean isRootNotSetDlg = true;
1.1200 + private String lastRootValue = "";
1.1201 + private volatile JDialog rootNotSetDlg = null;
1.1202 +
1.1203 + //-------------------------------------------
1.1204 + public static void main(java.lang.String[] args) {
1.1205 + JDialog dialog=new JDialog(new Frame (), true );
1.1206 + CvsCustomizer customizer= new CvsCustomizer();
1.1207 + dialog.getContentPane().add(customizer);
1.1208 + dialog.pack ();
1.1209 + dialog.show();
1.1210 + }
1.1211 +
1.1212 +
1.1213 + //-------------------------------------------
1.1214 + public void addPropertyChangeListener(PropertyChangeListener l) {
1.1215 + //D.deb("addPropertyChangeListener()"); // NOI18N
1.1216 + changeSupport.addPropertyChangeListener(l);
1.1217 + }
1.1218 +
1.1219 + //-------------------------------------------
1.1220 + public void removePropertyChangeListener(PropertyChangeListener l) {
1.1221 + //D.deb("removePropertyChangeListener()"); // NOI18N
1.1222 + changeSupport.removePropertyChangeListener(l);
1.1223 + }
1.1224 +
1.1225 + //-------------------------------------------
1.1226 + public void setObject(Object bean){
1.1227 + E.deb("setObject("+bean+")"); // NOI18N
1.1228 + fileSystem=(CvsFileSystem)bean;
1.1229 + /*
1.1230 + if (fileSystem.isValid()) {
1.1231 + D.deb("Filesystem valid, bud customized. SETTING TO NOT VALID !!");
1.1232 + fileSystem.setValidFS(false);
1.1233 + }
1.1234 + */
1.1235 + String module = fileSystem.getCvsModule();
1.1236 + relMountTextField.setText(module);
1.1237 + moduleTextField.setText(fileSystem.getCvsModuleName());
1.1238 + rootDirTextField.setText(VcsFileSystem.substractRootDir(fileSystem.getRootDirectory().toString(), module));
1.1239 + refreshTextField.setText (""+fileSystem.getCustomRefreshTime ()); // NOI18N
1.1240 + serverTextField.setText (fileSystem.getCvsServer ());
1.1241 + userTextField.setText (fileSystem.getCvsUserName ());
1.1242 + repositoryTextField.setText (fileSystem.getCvsRoot());
1.1243 + String st = fileSystem.getCvsServerType ();
1.1244 + if(st.equals (fileSystem.CVS_SERVER_LOCAL)) localRadioButton.setSelected (true);
1.1245 + else if (st.equals (fileSystem.CVS_SERVER_SERVER)) serverRadioButton.setSelected (true);
1.1246 + else if (st.equals (fileSystem.CVS_SERVER_PSERVER)) pserverRadioButton.setSelected (true);
1.1247 + cvsExeTextField.setText (fileSystem.getCvsExePath ());
1.1248 + cygwinCheckBox.setSelected (fileSystem.isUseUnixShell ());
1.1249 + cygwinTextField.setText (fileSystem.getCygwinPath ());
1.1250 + updateEnabledComponents();
1.1251 + }
1.1252 +
1.1253 + /**
1.1254 + * @return true when the root directory textfield was changed, false if not.
1.1255 + */
1.1256 + boolean isRootChanged() {
1.1257 + boolean ch;
1.1258 + String selected = rootDirTextField.getText ();
1.1259 + ch = !selected.equals(lastRootValue);
1.1260 + lastRootValue = selected;
1.1261 + return ch;
1.1262 + }
1.1263 +
1.1264 + private JDialog notifyMessage(String message) {
1.1265 + JOptionPane pane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE);
1.1266 + JDialog presenter = pane.createDialog(this,
1.1267 + NbBundle.getBundle (NotifyDescriptor.class).getString("NTF_InformationTitle"));
1.1268 + return presenter;
1.1269 + }
1.1270 +
1.1271 + private JDialog notifyMessageTF(String messageLabel, String messageText) {
1.1272 + JOptionPane pane = new JOptionPane(messageLabel, JOptionPane.INFORMATION_MESSAGE);
1.1273 + JTextField text = new JTextField(messageText);
1.1274 + text.setEditable(false);
1.1275 + pane.add(text, 1);
1.1276 + JDialog presenter = pane.createDialog(this,
1.1277 + NbBundle.getBundle (NotifyDescriptor.class).getString("NTF_InformationTitle"));
1.1278 + return presenter;
1.1279 + }
1.1280 +
1.1281 + /**
1.1282 + * Change the root directory of the filesystem. Get the directory from the text field
1.1283 + * and perform the change in the filesystem. If the root directory does not exists and
1.1284 + * <code>info</code> is <code>true</code>, nothing is changed.
1.1285 + * @param info whether to inform the user of nonexistent root directory.
1.1286 + */
1.1287 + private void rootDirChanged (boolean info) {
1.1288 + // root dir set by hand
1.1289 + String selected = rootDirTextField.getText ();
1.1290 + /*
1.1291 + String module = moduleTextField.getText ();
1.1292 + String moduleDir = module.equals ("") ? selected : selected + java.io.File.separator + module; // NOI18N
1.1293 + File dir=new File(moduleDir);
1.1294 + */
1.1295 + File root = new File(selected);
1.1296 + if( info && !root.isDirectory() ){
1.1297 + //E.err("not directory "+root); // NOI18N
1.1298 + final String badDir = root.toString();
1.1299 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1300 + public void run () {
1.1301 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1302 + public void run () {
1.1303 + if (browseButton.hasFocus()) {
1.1304 + try {
1.1305 + Thread.sleep(200);
1.1306 + } catch(InterruptedException e) {
1.1307 + // Ignoring interruption
1.1308 + }
1.1309 + }
1.1310 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1311 + public void run () {
1.1312 + if (isRootNotSetDlg) {
1.1313 + isRootNotSetDlg = false;
1.1314 + rootNotSetDlg = notifyMessage(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.notDirectory"), new Object[] { badDir } ));
1.1315 + rootNotSetDlg.setVisible(true);
1.1316 + //TopManager.getDefault ().notify (new NotifyDescriptor.Message(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.notDirectory"), new Object[] { badDir } )));
1.1317 + isRootNotSetDlg = true;
1.1318 + }
1.1319 + }
1.1320 + });
1.1321 + }
1.1322 + });
1.1323 + }
1.1324 + });
1.1325 + return ;
1.1326 }
1.1327 - }
1.1328 - );
1.1329 -
1.1330 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1331 - gridBagConstraints3.gridx = 1;
1.1332 - gridBagConstraints3.gridy = 2;
1.1333 - gridBagConstraints3.gridwidth = 2;
1.1334 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1335 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1336 - gridBagConstraints3.weightx = 0.8;
1.1337 - propsPanel.add (rootDirTextField, gridBagConstraints3);
1.1338 -
1.1339 - browseButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.browseButton.text"));
1.1340 - browseButton.setNextFocusableComponent (refreshTextField);
1.1341 - browseButton.addActionListener (new java.awt.event.ActionListener () {
1.1342 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1343 - browseButtonActionPerformed (evt);
1.1344 + try{
1.1345 + fileSystem.setRootDirectory(root);
1.1346 + rootDirTextField.setText(selected);
1.1347 }
1.1348 - }
1.1349 - );
1.1350 -
1.1351 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1352 - gridBagConstraints3.gridx = 3;
1.1353 - gridBagConstraints3.gridy = 2;
1.1354 - gridBagConstraints3.gridwidth = 0;
1.1355 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1356 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1357 - propsPanel.add (browseButton, gridBagConstraints3);
1.1358 -
1.1359 - moduleLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleLabel.text"));
1.1360 -
1.1361 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1362 - gridBagConstraints3.gridx = 0;
1.1363 - gridBagConstraints3.gridy = 3;
1.1364 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1365 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1366 - propsPanel.add (moduleLabel, gridBagConstraints3);
1.1367 -
1.1368 - moduleTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleTextField.toolTipText"));
1.1369 - moduleTextField.setNextFocusableComponent (relMountTextField);
1.1370 - moduleTextField.addActionListener (new java.awt.event.ActionListener () {
1.1371 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1372 - moduleTextFieldActionPerformed (evt);
1.1373 + catch (PropertyVetoException veto){
1.1374 + fileSystem.debug(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.canNotChangeWD"));
1.1375 + //E.err(veto,"setRootDirectory() failed"); // NOI18N
1.1376 }
1.1377 - }
1.1378 - );
1.1379 - moduleTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1380 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1381 - moduleTextFieldFocusLost (evt);
1.1382 + catch (IOException e){
1.1383 + E.err(e,"setRootDirectory() failed"); // NOI18N
1.1384 + final String badDir = root.toString();
1.1385 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1386 + public void run () {
1.1387 + if (isRootNotSetDlg) {
1.1388 + isRootNotSetDlg = false;
1.1389 + TopManager.getDefault ().notify (new NotifyDescriptor.Message(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cannotSetDirectory"), new Object[] { badDir } )));
1.1390 + isRootNotSetDlg = true;
1.1391 + }
1.1392 + }
1.1393 + });
1.1394 }
1.1395 - }
1.1396 - );
1.1397 -
1.1398 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1399 - gridBagConstraints3.gridx = 1;
1.1400 - gridBagConstraints3.gridy = 3;
1.1401 - gridBagConstraints3.gridwidth = 2;
1.1402 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1403 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1404 - gridBagConstraints3.weightx = 0.8;
1.1405 - propsPanel.add (moduleTextField, gridBagConstraints3);
1.1406 -
1.1407 - moduleSelectButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.moduleSelectButton.text"));
1.1408 - moduleSelectButton.addActionListener (new java.awt.event.ActionListener () {
1.1409 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1410 - moduleSelectButtonActionPerformed (evt);
1.1411 + }
1.1412 +
1.1413 + private void updateEnabledComponents () {
1.1414 + if(localRadioButton.isSelected ()) {
1.1415 + userTextField.setEnabled (false);
1.1416 + serverTextField.setEnabled (false);
1.1417 + loginButton.setEnabled (false);
1.1418 + userNameLabel.setEnabled (false);
1.1419 + repositoryButton.setEnabled (true);
1.1420 + serverLabel.setEnabled (false);
1.1421 + } else {
1.1422 + userTextField.setEnabled (true);
1.1423 + serverTextField.setEnabled (true);
1.1424 + loginButton.setEnabled (true);
1.1425 + userNameLabel.setEnabled (true);
1.1426 + repositoryButton.setEnabled (false);
1.1427 + serverLabel.setEnabled (true);
1.1428 }
1.1429 - }
1.1430 - );
1.1431 -
1.1432 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1433 - gridBagConstraints3.gridx = 3;
1.1434 - gridBagConstraints3.gridy = 3;
1.1435 - gridBagConstraints3.gridwidth = 0;
1.1436 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1437 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1438 - propsPanel.add (moduleSelectButton, gridBagConstraints3);
1.1439 -
1.1440 - relMountLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.relMountLabel.text"));
1.1441 -
1.1442 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1443 - gridBagConstraints3.gridx = 0;
1.1444 - gridBagConstraints3.gridy = 4;
1.1445 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1446 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1447 - propsPanel.add (relMountLabel, gridBagConstraints3);
1.1448 -
1.1449 - relMountTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.relMountTextField.toolTipText"));
1.1450 - relMountTextField.setNextFocusableComponent (cvsExeTextField);
1.1451 - relMountTextField.addActionListener (new java.awt.event.ActionListener () {
1.1452 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1453 - relMountTextFieldActionPerformed (evt);
1.1454 + String osName = System.getProperty("os.name");
1.1455 + if(osName.indexOf("Win") >= 0) { // NOI18N
1.1456 + cygwinCheckBox.setEnabled (true);
1.1457 + if (cygwinCheckBox.isSelected ()) {
1.1458 + cygwinLabel.setEnabled (true);
1.1459 + cygwinTextField.setEnabled (true);
1.1460 + cygwinButton.setEnabled (true);
1.1461 + } else {
1.1462 + cygwinLabel.setEnabled (false);
1.1463 + cygwinTextField.setEnabled (false);
1.1464 + cygwinButton.setEnabled (false);
1.1465 + }
1.1466 + } else {
1.1467 + cygwinCheckBox.setVisible (false);
1.1468 + cygwinLabel.setVisible (false);
1.1469 + cygwinTextField.setVisible (false);
1.1470 + cygwinButton.setVisible (false);
1.1471 }
1.1472 - }
1.1473 - );
1.1474 - relMountTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1475 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1476 - relMountTextFieldFocusLost (evt);
1.1477 + }
1.1478 +
1.1479 + private void refreshChanged () {
1.1480 + try {
1.1481 + int time = Integer.parseInt(refreshTextField.getText());
1.1482 + if (time < 0) throw new NumberFormatException(""+time); // NOI18N
1.1483 + fileSystem.setCustomRefreshTime (time);
1.1484 + } catch (NumberFormatException e) {
1.1485 + final String msg = e.getMessage();
1.1486 + E.deb(msg);
1.1487 + refreshTextField.setText (""+fileSystem.getCustomRefreshTime ()); // NOI18N
1.1488 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1489 + public void run () {
1.1490 + TopManager.getDefault ().notify (new NotifyDescriptor.Message("'"+msg+"': "+org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.nonNegative")));
1.1491 + }
1.1492 + });
1.1493 }
1.1494 - }
1.1495 - );
1.1496 -
1.1497 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1498 - gridBagConstraints3.gridx = 1;
1.1499 - gridBagConstraints3.gridy = 4;
1.1500 - gridBagConstraints3.gridwidth = 2;
1.1501 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1502 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1503 - gridBagConstraints3.weightx = 1.0;
1.1504 - propsPanel.add (relMountTextField, gridBagConstraints3);
1.1505 -
1.1506 - cvsExeLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeLabel.text"));
1.1507 -
1.1508 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1509 - gridBagConstraints3.gridx = 0;
1.1510 - gridBagConstraints3.gridy = 5;
1.1511 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1512 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1513 - propsPanel.add (cvsExeLabel, gridBagConstraints3);
1.1514 -
1.1515 - cvsExeTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeTextField.toolTipText"));
1.1516 - cvsExeTextField.setNextFocusableComponent (cygwinCheckBox);
1.1517 - cvsExeTextField.addActionListener (new java.awt.event.ActionListener () {
1.1518 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1519 - cvsExeTextFieldActionPerformed (evt);
1.1520 - }
1.1521 - }
1.1522 - );
1.1523 - cvsExeTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1524 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1525 - cvsExeTextFieldFocusLost (evt);
1.1526 - }
1.1527 - }
1.1528 - );
1.1529 -
1.1530 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1531 - gridBagConstraints3.gridx = 1;
1.1532 - gridBagConstraints3.gridy = 5;
1.1533 - gridBagConstraints3.gridwidth = 2;
1.1534 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1535 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1536 - gridBagConstraints3.weightx = 1.0;
1.1537 - propsPanel.add (cvsExeTextField, gridBagConstraints3);
1.1538 -
1.1539 - cvsExeButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cvsExeButton.text"));
1.1540 - cvsExeButton.addActionListener (new java.awt.event.ActionListener () {
1.1541 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1542 - cvsExeButtonActionPerformed (evt);
1.1543 - }
1.1544 - }
1.1545 - );
1.1546 -
1.1547 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1548 - gridBagConstraints3.gridx = 3;
1.1549 - gridBagConstraints3.gridy = 5;
1.1550 - gridBagConstraints3.gridwidth = 0;
1.1551 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1552 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1553 - propsPanel.add (cvsExeButton, gridBagConstraints3);
1.1554 -
1.1555 - cygwinCheckBox.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinCheckBox.toolTipText"));
1.1556 - cygwinCheckBox.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinCheckBox.text"));
1.1557 - cygwinCheckBox.setNextFocusableComponent (cygwinTextField);
1.1558 - cygwinCheckBox.addActionListener (new java.awt.event.ActionListener () {
1.1559 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1560 - cygwinCheckBoxActionPerformed (evt);
1.1561 - }
1.1562 - }
1.1563 - );
1.1564 -
1.1565 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1566 - gridBagConstraints3.gridx = 0;
1.1567 - gridBagConstraints3.gridy = 6;
1.1568 - gridBagConstraints3.gridwidth = 3;
1.1569 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1570 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1571 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1572 - gridBagConstraints3.weightx = 1.0;
1.1573 - propsPanel.add (cygwinCheckBox, gridBagConstraints3);
1.1574 -
1.1575 - cygwinLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinLabel.text"));
1.1576 -
1.1577 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1578 - gridBagConstraints3.gridx = 0;
1.1579 - gridBagConstraints3.gridy = 7;
1.1580 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1581 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1582 - propsPanel.add (cygwinLabel, gridBagConstraints3);
1.1583 -
1.1584 - cygwinTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinTextField.toolTipText"));
1.1585 - cygwinTextField.setNextFocusableComponent (refreshTextField);
1.1586 - cygwinTextField.addActionListener (new java.awt.event.ActionListener () {
1.1587 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1588 - cygwinTextFieldActionPerformed (evt);
1.1589 - }
1.1590 - }
1.1591 - );
1.1592 - cygwinTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1593 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1594 - cygwinTextFieldFocusLost (evt);
1.1595 - }
1.1596 - }
1.1597 - );
1.1598 -
1.1599 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1600 - gridBagConstraints3.gridx = 1;
1.1601 - gridBagConstraints3.gridy = 7;
1.1602 - gridBagConstraints3.gridwidth = 2;
1.1603 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1604 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1605 - gridBagConstraints3.weightx = 1.0;
1.1606 - propsPanel.add (cygwinTextField, gridBagConstraints3);
1.1607 -
1.1608 - cygwinButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cygwinButton.text"));
1.1609 - cygwinButton.addActionListener (new java.awt.event.ActionListener () {
1.1610 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1611 - cygwinButtonActionPerformed (evt);
1.1612 - }
1.1613 - }
1.1614 - );
1.1615 -
1.1616 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1617 - gridBagConstraints3.gridx = 3;
1.1618 - gridBagConstraints3.gridy = 7;
1.1619 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1620 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1621 - propsPanel.add (cygwinButton, gridBagConstraints3);
1.1622 -
1.1623 - refreshLabel.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.refreshLabel.text"));
1.1624 -
1.1625 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1626 - gridBagConstraints3.gridx = 0;
1.1627 - gridBagConstraints3.gridy = 8;
1.1628 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 0, 0);
1.1629 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1630 - propsPanel.add (refreshLabel, gridBagConstraints3);
1.1631 -
1.1632 - refreshTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.refreshTextField.toolTipText"));
1.1633 - refreshTextField.setPreferredSize (new java.awt.Dimension(50, 20));
1.1634 - refreshTextField.setMinimumSize (new java.awt.Dimension(50, 20));
1.1635 - refreshTextField.setText ("0");
1.1636 - refreshTextField.setNextFocusableComponent (loginButton);
1.1637 - refreshTextField.addActionListener (new java.awt.event.ActionListener () {
1.1638 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1639 - refreshTextFieldActionPerformed (evt);
1.1640 - }
1.1641 - }
1.1642 - );
1.1643 - refreshTextField.addFocusListener (new java.awt.event.FocusAdapter () {
1.1644 - public void focusLost (java.awt.event.FocusEvent evt) {
1.1645 - refreshTextFieldFocusLost (evt);
1.1646 - }
1.1647 - }
1.1648 - );
1.1649 -
1.1650 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1651 - gridBagConstraints3.gridx = 1;
1.1652 - gridBagConstraints3.gridy = 8;
1.1653 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1654 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1655 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1656 - gridBagConstraints3.weightx = 0.4;
1.1657 - propsPanel.add (refreshTextField, gridBagConstraints3);
1.1658 -
1.1659 - jLabel10.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.jLabel10.text"));
1.1660 -
1.1661 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1662 - gridBagConstraints3.gridx = 2;
1.1663 - gridBagConstraints3.gridy = 8;
1.1664 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
1.1665 - gridBagConstraints3.insets = new java.awt.Insets (8, 0, 0, 8);
1.1666 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1667 - gridBagConstraints3.weightx = 0.6;
1.1668 - propsPanel.add (jLabel10, gridBagConstraints3);
1.1669 -
1.1670 - loginButton.setText (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.loginButton.text"));
1.1671 - loginButton.addActionListener (new java.awt.event.ActionListener () {
1.1672 - public void actionPerformed (java.awt.event.ActionEvent evt) {
1.1673 - loginButtonActionPerformed (evt);
1.1674 - }
1.1675 - }
1.1676 - );
1.1677 -
1.1678 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
1.1679 - gridBagConstraints3.gridx = 0;
1.1680 - gridBagConstraints3.gridy = 9;
1.1681 - gridBagConstraints3.insets = new java.awt.Insets (8, 8, 8, 8);
1.1682 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
1.1683 - propsPanel.add (loginButton, gridBagConstraints3);
1.1684 -
1.1685 + }
1.1686
1.1687 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
1.1688 - gridBagConstraints1.gridx = 0;
1.1689 - gridBagConstraints1.gridy = 1;
1.1690 - gridBagConstraints1.gridwidth = 2;
1.1691 - gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
1.1692 - gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
1.1693 - gridBagConstraints1.weightx = 1.0;
1.1694 - gridBagConstraints1.weighty = 0.5;
1.1695 - add (propsPanel, gridBagConstraints1);
1.1696 -
1.1697 - }//GEN-END:initComponents
1.1698 -
1.1699 - private void relMountTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_relMountTextFieldFocusLost
1.1700 -// Add your handling code here:
1.1701 - fileSystem.setCvsModule (relMountTextField.getText ());
1.1702 - rootDirChanged(false);
1.1703 - }//GEN-LAST:event_relMountTextFieldFocusLost
1.1704 -
1.1705 - private void relMountTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relMountTextFieldActionPerformed
1.1706 -// Add your handling code here:
1.1707 - fileSystem.setCvsModule (relMountTextField.getText ());
1.1708 - rootDirChanged(false);
1.1709 - }//GEN-LAST:event_relMountTextFieldActionPerformed
1.1710 -
1.1711 - private void moduleSelectButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleSelectButtonActionPerformed
1.1712 -// Add your handling code here:
1.1713 - VcsConfigVariable var = (VcsConfigVariable) fileSystem.getVariablesByName().get ("MODULE_NAME");
1.1714 - if (var == null) return;
1.1715 - String exec = var.getCustomSelector();
1.1716 - OutputContainer container = new OutputContainer(g("MSG_VariableSelector"));
1.1717 - final ExecuteSelector es = new ExecuteSelector(fileSystem, exec, "MODULE_NAME",
1.1718 - fileSystem.getVariablesAsHashtable());
1.1719 - es.setErrorNoRegexListener(container);
1.1720 - es.setOutputNoRegexListener(container);
1.1721 - es.setErrorContainer(container);
1.1722 - //javax.swing.SwingUtilities.invokeLater(new Runnable() {
1.1723 - //public void run() {
1.1724 - new Thread ("CVS-ModuleSelection") {
1.1725 - public void run() {
1.1726 - es.start();
1.1727 - try {
1.1728 - es.join();
1.1729 - } catch (InterruptedException e) {
1.1730 - return;
1.1731 - }
1.1732 - String selection = es.getSelection();
1.1733 - if (selection != null && selection.length() > 0) {
1.1734 - moduleTextField.setText(selection);
1.1735 - fileSystem.setCvsModuleName(selection);
1.1736 - //rootDirChanged(false);
1.1737 - }
1.1738 - }
1.1739 - }.start();
1.1740 - //}
1.1741 - //});
1.1742 -
1.1743 - }//GEN-LAST:event_moduleSelectButtonActionPerformed
1.1744 -
1.1745 - private void localizeComponents() {
1.1746 - javax.swing.border.TitledBorder border = (javax.swing.border.TitledBorder) connectionPanel.getBorder();
1.1747 - border.setTitle(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.connectionPanel.borderTitle"));
1.1748 - border = (javax.swing.border.TitledBorder) propsPanel.getBorder();
1.1749 - border.setTitle(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.propsPanel.borderTitle"));
1.1750 - }
1.1751 -
1.1752 -private void cvsExeTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cvsExeTextFieldActionPerformed
1.1753 -// Add your handling code here:
1.1754 - fileSystem.setCvsExePath (cvsExeTextField.getText());
1.1755 - }//GEN-LAST:event_cvsExeTextFieldActionPerformed
1.1756 -
1.1757 -private void cygwinTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinTextFieldActionPerformed
1.1758 -// Add your handling code here:
1.1759 - fileSystem.setCygwinPath (cygwinTextField.getText());
1.1760 - }//GEN-LAST:event_cygwinTextFieldActionPerformed
1.1761 -
1.1762 -private void cygwinTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cygwinTextFieldFocusLost
1.1763 -// Add your handling code here:
1.1764 - fileSystem.setCygwinPath (cygwinTextField.getText());
1.1765 - }//GEN-LAST:event_cygwinTextFieldFocusLost
1.1766 -
1.1767 -private void cvsExeTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cvsExeTextFieldFocusLost
1.1768 -// Add your handling code here:
1.1769 - fileSystem.setCvsExePath (cvsExeTextField.getText());
1.1770 - }//GEN-LAST:event_cvsExeTextFieldFocusLost
1.1771 -
1.1772 -private void cygwinCheckBoxActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinCheckBoxActionPerformed
1.1773 -// Add your handling code here:
1.1774 - fileSystem.setUseUnixShell(cygwinCheckBox.isSelected());
1.1775 - updateEnabledComponents ();
1.1776 - }//GEN-LAST:event_cygwinCheckBoxActionPerformed
1.1777 -
1.1778 -private void cygwinButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cygwinButtonActionPerformed
1.1779 -// Add your handling code here:
1.1780 - ChooseFileDialog chooseFile=new ChooseFileDialog(new JFrame(), new File(cygwinTextField.getText ()), false);
1.1781 - MiscStuff.centerWindow (chooseFile);
1.1782 - HelpCtx.setHelpIDString (chooseFile.getRootPane (), CvsCustomizer.class.getName ());
1.1783 - chooseFile.show();
1.1784 - String selected=chooseFile.getSelectedFile();
1.1785 - if( selected==null ){
1.1786 - //D.deb("no directory selected"); // NOI18N
1.1787 - return ;
1.1788 + //-------------------------------------------
1.1789 + String g(String s) {
1.1790 + D.deb("getting "+s);
1.1791 + return NbBundle.getBundle
1.1792 + ("org.netbeans.modules.vcs.cmdline.Bundle").getString (s);
1.1793 }
1.1794 - cygwinTextField.setText (selected);
1.1795 - fileSystem.setCygwinPath (selected);
1.1796 - }//GEN-LAST:event_cygwinButtonActionPerformed
1.1797 -
1.1798 -private void cvsExeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cvsExeButtonActionPerformed
1.1799 -// Add your handling code here:
1.1800 - ChooseFileDialog chooseFile=new ChooseFileDialog(new JFrame(), new File(cvsExeTextField.getText ()), false);
1.1801 - MiscStuff.centerWindow (chooseFile);
1.1802 - HelpCtx.setHelpIDString (chooseFile.getRootPane (), CvsCustomizer.class.getName ());
1.1803 - chooseFile.show();
1.1804 - String selected=chooseFile.getSelectedFile();
1.1805 - if( selected==null ){
1.1806 - //D.deb("no directory selected"); // NOI18N
1.1807 - return ;
1.1808 + String g(String s, Object obj) {
1.1809 + return MessageFormat.format (g(s), new Object[] { obj });
1.1810 }
1.1811 - cvsExeTextField.setText (selected);
1.1812 - fileSystem.setCvsExePath (selected);
1.1813 - }//GEN-LAST:event_cvsExeButtonActionPerformed
1.1814 -
1.1815 -private void moduleTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_moduleTextFieldFocusLost
1.1816 -// Add your handling code here:
1.1817 - fileSystem.setCvsModuleName (moduleTextField.getText ());
1.1818 - }//GEN-LAST:event_moduleTextFieldFocusLost
1.1819 -
1.1820 -private void moduleTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moduleTextFieldActionPerformed
1.1821 -// Add your handling code here:
1.1822 - fileSystem.setCvsModuleName (moduleTextField.getText ());
1.1823 - }//GEN-LAST:event_moduleTextFieldActionPerformed
1.1824 -
1.1825 -private void userTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userTextFieldFocusLost
1.1826 -// Add your handling code here:
1.1827 - fileSystem.setCvsUserName (userTextField.getText ());
1.1828 - }//GEN-LAST:event_userTextFieldFocusLost
1.1829 -
1.1830 -private void userTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userTextFieldActionPerformed
1.1831 -// Add your handling code here:
1.1832 - fileSystem.setCvsUserName (userTextField.getText ());
1.1833 - }//GEN-LAST:event_userTextFieldActionPerformed
1.1834 -
1.1835 -private void loginButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
1.1836 -// Add your handling code here:
1.1837 - String messageLabel = org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.loginHOWTO");
1.1838 - String messageText = "cvs -d :" + fileSystem.getCvsServerType () + ":" +fileSystem.getCvcRootForServerType ()+" login";
1.1839 - JDialog dlg = notifyMessageTF(messageLabel, messageText);
1.1840 - dlg.setVisible(true);
1.1841 - //NotifyDescriptor nd = new NotifyDescriptor.Message (message);
1.1842 - //TopManager.getDefault ().notify (nd);
1.1843 - }//GEN-LAST:event_loginButtonActionPerformed
1.1844 -
1.1845 -private void pserverRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pserverRadioButtonActionPerformed
1.1846 -// Add your handling code here:
1.1847 - if(pserverRadioButton.isSelected ()) {
1.1848 - fileSystem.setCvsServerType (fileSystem.CVS_SERVER_PSERVER);
1.1849 - }
1.1850 - updateEnabledComponents ();
1.1851 - }//GEN-LAST:event_pserverRadioButtonActionPerformed
1.1852 -
1.1853 -private void serverRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverRadioButtonActionPerformed
1.1854 -// Add your handling code here:
1.1855 - if(serverRadioButton.isSelected ()) {
1.1856 - fileSystem.setCvsServerType (fileSystem.CVS_SERVER_SERVER);
1.1857 - }
1.1858 - updateEnabledComponents ();
1.1859 - }//GEN-LAST:event_serverRadioButtonActionPerformed
1.1860 -
1.1861 -private void localRadioButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_localRadioButtonActionPerformed
1.1862 -// Add your handling code here:
1.1863 - if(localRadioButton.isSelected ()) {
1.1864 - fileSystem.setCvsServerType (fileSystem.CVS_SERVER_LOCAL);
1.1865 - }
1.1866 - updateEnabledComponents ();
1.1867 - }//GEN-LAST:event_localRadioButtonActionPerformed
1.1868 -
1.1869 -
1.1870 -
1.1871 -private void serverTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_serverTextFieldFocusLost
1.1872 -// Add your handling code here:
1.1873 - fileSystem.setCvsServer (serverTextField.getText ());
1.1874 - }//GEN-LAST:event_serverTextFieldFocusLost
1.1875 -
1.1876 -private void serverTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_serverTextFieldActionPerformed
1.1877 -// Add your handling code here:
1.1878 - fileSystem.setCvsServer (serverTextField.getText ());
1.1879 - }//GEN-LAST:event_serverTextFieldActionPerformed
1.1880 -
1.1881 -private void repositoryTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_repositoryTextFieldFocusLost
1.1882 -// Add your handling code here:
1.1883 - fileSystem.setCvsRoot (repositoryTextField.getText ());
1.1884 - }//GEN-LAST:event_repositoryTextFieldFocusLost
1.1885 -
1.1886 -private void repositoryTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repositoryTextFieldActionPerformed
1.1887 -// Add your handling code here:
1.1888 - fileSystem.setCvsRoot (repositoryTextField.getText ());
1.1889 - }//GEN-LAST:event_repositoryTextFieldActionPerformed
1.1890 -
1.1891 -private void repositoryButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repositoryButtonActionPerformed
1.1892 -// Add your handling code here:
1.1893 - ChooseDirDialog chooseDir=new ChooseDirDialog(new JFrame(), new File(repositoryTextField.getText ()));
1.1894 - MiscStuff.centerWindow (chooseDir);
1.1895 - HelpCtx.setHelpIDString (chooseDir.getRootPane (), CvsCustomizer.class.getName ());
1.1896 - chooseDir.show();
1.1897 - String selected=chooseDir.getSelectedDir();
1.1898 - if( selected==null ){
1.1899 - //D.deb("no directory selected"); // NOI18N
1.1900 - return ;
1.1901 + String g(String s, Object obj1, Object obj2) {
1.1902 + return MessageFormat.format (g(s), new Object[] { obj1, obj2 });
1.1903 }
1.1904 - File dir=new File(selected);
1.1905 - if( !dir.isDirectory() ){
1.1906 - E.err("not directory "+dir); // NOI18N
1.1907 - return ;
1.1908 + String g(String s, Object obj1, Object obj2, Object obj3) {
1.1909 + return MessageFormat.format (g(s), new Object[] { obj1, obj2, obj3 });
1.1910 }
1.1911 - repositoryTextField.setText(selected);
1.1912 - fileSystem.setCvsRoot (selected);
1.1913 - }//GEN-LAST:event_repositoryButtonActionPerformed
1.1914 -
1.1915 -private void advancedButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedButtonActionPerformed
1.1916 -// Add your handling code here:
1.1917 - }//GEN-LAST:event_advancedButtonActionPerformed
1.1918 -
1.1919 -private void refreshTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_refreshTextFieldFocusLost
1.1920 -// Add your handling code here:
1.1921 - refreshChanged ();
1.1922 - }//GEN-LAST:event_refreshTextFieldFocusLost
1.1923 -
1.1924 -private void rootDirTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_rootDirTextFieldFocusLost
1.1925 -// Add your handling code here:
1.1926 - if (isRootChanged() && !browseButton.isSelected()) rootDirChanged (true);
1.1927 - }//GEN-LAST:event_rootDirTextFieldFocusLost
1.1928 -
1.1929 -private void refreshTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTextFieldActionPerformed
1.1930 -// Add your handling code here:
1.1931 - refreshChanged ();
1.1932 - }//GEN-LAST:event_refreshTextFieldActionPerformed
1.1933 -
1.1934 - private void browseButtonAction() {
1.1935 - ChooseDirDialog chooseDir=new ChooseDirDialog(new JFrame(), new File(rootDirTextField.getText ()));
1.1936 - MiscStuff.centerWindow (chooseDir);
1.1937 - HelpCtx.setHelpIDString (chooseDir.getRootPane (), CvsCustomizer.class.getName ());
1.1938 - chooseDir.show();
1.1939 - String selected=chooseDir.getSelectedDir();
1.1940 - if( selected==null ){
1.1941 - //D.deb("no directory selected"); // NOI18N
1.1942 - return ;
1.1943 - }
1.1944 - //String module = moduleTextField.getText ();
1.1945 - //String moduleDir = module.equals ("") ? selected : selected + java.io.File.separator + module; // NOI18N
1.1946 - File dir=new File(selected);
1.1947 - /*
1.1948 - if( !dir.isDirectory() ){
1.1949 - E.err("not directory "+dir); // NOI18N
1.1950 - return ;
1.1951 - }
1.1952 - */
1.1953 - try{
1.1954 - rootDirTextField.setText(selected);
1.1955 - fileSystem.setRootDirectory(dir);
1.1956 - }
1.1957 - catch (PropertyVetoException veto){
1.1958 - fileSystem.debug(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.canNotChangeWD"));
1.1959 - //E.err(veto,"setRootDirectory() failed"); // NOI18N
1.1960 - }
1.1961 - catch (IOException e){
1.1962 - E.err(e,"setRootDirectory() failed"); // NOI18N
1.1963 - } finally {
1.1964 - if (rootNotSetDlg != null) rootNotSetDlg.setVisible(false);
1.1965 - }
1.1966 - }
1.1967 -
1.1968 -private void browseButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
1.1969 -// Add your handling code here:
1.1970 - D.deb("browseButtonActionPerformed()");
1.1971 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.1972 - public void run () {
1.1973 - browseButtonAction();
1.1974 - }
1.1975 - });
1.1976 -
1.1977 - }//GEN-LAST:event_browseButtonActionPerformed
1.1978 -
1.1979 -private void rootDirTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rootDirTextFieldActionPerformed
1.1980 -// Add your handling code here:
1.1981 - rootDirChanged (true);
1.1982 - }//GEN-LAST:event_rootDirTextFieldActionPerformed
1.1983 -
1.1984 -private void removeConfigButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeConfigButtonActionPerformed
1.1985 -// Add your handling code here:
1.1986 - }//GEN-LAST:event_removeConfigButtonActionPerformed
1.1987 -
1.1988 -private void saveAsButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsButtonActionPerformed
1.1989 -// Add your handling code here:
1.1990 - }//GEN-LAST:event_saveAsButtonActionPerformed
1.1991 -
1.1992 -private void configComboItemStateChanged (java.awt.event.ItemEvent evt) {//GEN-FIRST:event_configComboItemStateChanged
1.1993 -// Add your handling code here:
1.1994 - }//GEN-LAST:event_configComboItemStateChanged
1.1995 -
1.1996 -
1.1997 - // Variables declaration - do not modify//GEN-BEGIN:variables
1.1998 - private javax.swing.JPanel connectionPanel;
1.1999 - private javax.swing.JRadioButton localRadioButton;
1.2000 - private javax.swing.JRadioButton serverRadioButton;
1.2001 - private javax.swing.JRadioButton pserverRadioButton;
1.2002 - private javax.swing.JLabel userNameLabel;
1.2003 - private javax.swing.JTextField userTextField;
1.2004 - private javax.swing.JPanel propsPanel;
1.2005 - private javax.swing.JTextField serverTextField;
1.2006 - private javax.swing.JLabel serverLabel;
1.2007 - private javax.swing.JLabel repositoryLabel;
1.2008 - private javax.swing.JTextField repositoryTextField;
1.2009 - private javax.swing.JButton repositoryButton;
1.2010 - private javax.swing.JLabel rootDirLabel;
1.2011 - private javax.swing.JTextField rootDirTextField;
1.2012 - private javax.swing.JButton browseButton;
1.2013 - private javax.swing.JLabel moduleLabel;
1.2014 - private javax.swing.JTextField moduleTextField;
1.2015 - private javax.swing.JButton moduleSelectButton;
1.2016 - private javax.swing.JLabel relMountLabel;
1.2017 - private javax.swing.JTextField relMountTextField;
1.2018 - private javax.swing.JLabel cvsExeLabel;
1.2019 - private javax.swing.JTextField cvsExeTextField;
1.2020 - private javax.swing.JButton cvsExeButton;
1.2021 - private javax.swing.JCheckBox cygwinCheckBox;
1.2022 - private javax.swing.JLabel cygwinLabel;
1.2023 - private javax.swing.JTextField cygwinTextField;
1.2024 - private javax.swing.JButton cygwinButton;
1.2025 - private javax.swing.JLabel refreshLabel;
1.2026 - private javax.swing.JTextField refreshTextField;
1.2027 - private javax.swing.JLabel jLabel10;
1.2028 - private javax.swing.JButton loginButton;
1.2029 - // End of variables declaration//GEN-END:variables
1.2030 -
1.2031 - private CvsFileSystem fileSystem=null;
1.2032 - private PropertyChangeSupport changeSupport=null;
1.2033 - private volatile boolean isRootNotSetDlg = true;
1.2034 - private String lastRootValue = "";
1.2035 - private volatile JDialog rootNotSetDlg = null;
1.2036 -
1.2037 - //-------------------------------------------
1.2038 - public static void main(java.lang.String[] args) {
1.2039 - JDialog dialog=new JDialog(new Frame (), true );
1.2040 - CvsCustomizer customizer= new CvsCustomizer();
1.2041 - dialog.getContentPane().add(customizer);
1.2042 - dialog.pack ();
1.2043 - dialog.show();
1.2044 - }
1.2045 -
1.2046 -
1.2047 - //-------------------------------------------
1.2048 - public void addPropertyChangeListener(PropertyChangeListener l) {
1.2049 - //D.deb("addPropertyChangeListener()"); // NOI18N
1.2050 - changeSupport.addPropertyChangeListener(l);
1.2051 - }
1.2052 -
1.2053 - //-------------------------------------------
1.2054 - public void removePropertyChangeListener(PropertyChangeListener l) {
1.2055 - //D.deb("removePropertyChangeListener()"); // NOI18N
1.2056 - changeSupport.removePropertyChangeListener(l);
1.2057 - }
1.2058 -
1.2059 - //-------------------------------------------
1.2060 - public void setObject(Object bean){
1.2061 - E.deb("setObject("+bean+")"); // NOI18N
1.2062 - fileSystem=(CvsFileSystem)bean;
1.2063 - /*
1.2064 - if (fileSystem.isValid()) {
1.2065 - D.deb("Filesystem valid, bud customized. SETTING TO NOT VALID !!");
1.2066 - fileSystem.setValidFS(false);
1.2067 - }
1.2068 - */
1.2069 - String module = fileSystem.getCvsModule();
1.2070 - relMountTextField.setText(module);
1.2071 - moduleTextField.setText(fileSystem.getCvsModuleName());
1.2072 - rootDirTextField.setText(VcsFileSystem.substractRootDir(fileSystem.getRootDirectory().toString(), module));
1.2073 - refreshTextField.setText (""+fileSystem.getCustomRefreshTime ()); // NOI18N
1.2074 - serverTextField.setText (fileSystem.getCvsServer ());
1.2075 - userTextField.setText (fileSystem.getCvsUserName ());
1.2076 - repositoryTextField.setText (fileSystem.getCvsRoot());
1.2077 - String st = fileSystem.getCvsServerType ();
1.2078 - if(st.equals (fileSystem.CVS_SERVER_LOCAL)) localRadioButton.setSelected (true);
1.2079 - else if (st.equals (fileSystem.CVS_SERVER_SERVER)) serverRadioButton.setSelected (true);
1.2080 - else if (st.equals (fileSystem.CVS_SERVER_PSERVER)) pserverRadioButton.setSelected (true);
1.2081 - cvsExeTextField.setText (fileSystem.getCvsExePath ());
1.2082 - cygwinCheckBox.setSelected (fileSystem.isUseUnixShell ());
1.2083 - cygwinTextField.setText (fileSystem.getCygwinPath ());
1.2084 - updateEnabledComponents();
1.2085 - }
1.2086 -
1.2087 - /**
1.2088 - * @return true when the root directory textfield was changed, false if not.
1.2089 - */
1.2090 - boolean isRootChanged() {
1.2091 - boolean ch;
1.2092 - String selected = rootDirTextField.getText ();
1.2093 - ch = !selected.equals(lastRootValue);
1.2094 - lastRootValue = selected;
1.2095 - return ch;
1.2096 - }
1.2097 -
1.2098 - private JDialog notifyMessage(String message) {
1.2099 - JOptionPane pane = new JOptionPane(message, JOptionPane.INFORMATION_MESSAGE);
1.2100 - JDialog presenter = pane.createDialog(this,
1.2101 - NbBundle.getBundle (NotifyDescriptor.class).getString("NTF_InformationTitle"));
1.2102 - return presenter;
1.2103 - }
1.2104 -
1.2105 - private JDialog notifyMessageTF(String messageLabel, String messageText) {
1.2106 - JOptionPane pane = new JOptionPane(messageLabel, JOptionPane.INFORMATION_MESSAGE);
1.2107 - JTextField text = new JTextField(messageText);
1.2108 - text.setEditable(false);
1.2109 - pane.add(text, 1);
1.2110 - JDialog presenter = pane.createDialog(this,
1.2111 - NbBundle.getBundle (NotifyDescriptor.class).getString("NTF_InformationTitle"));
1.2112 - return presenter;
1.2113 - }
1.2114 -
1.2115 - /**
1.2116 - * Change the root directory of the filesystem. Get the directory from the text field
1.2117 - * and perform the change in the filesystem. If the root directory does not exists and
1.2118 - * <code>info</code> is <code>true</code>, nothing is changed.
1.2119 - * @param info whether to inform the user of nonexistent root directory.
1.2120 - */
1.2121 - private void rootDirChanged (boolean info) {
1.2122 - // root dir set by hand
1.2123 - String selected = rootDirTextField.getText ();
1.2124 - /*
1.2125 - String module = moduleTextField.getText ();
1.2126 - String moduleDir = module.equals ("") ? selected : selected + java.io.File.separator + module; // NOI18N
1.2127 - File dir=new File(moduleDir);
1.2128 - */
1.2129 - File root = new File(selected);
1.2130 - if( info && !root.isDirectory() ){
1.2131 - //E.err("not directory "+root); // NOI18N
1.2132 - final String badDir = root.toString();
1.2133 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.2134 - public void run () {
1.2135 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.2136 - public void run () {
1.2137 - if (browseButton.hasFocus()) {
1.2138 - try {
1.2139 - Thread.sleep(200);
1.2140 - } catch(InterruptedException e) {
1.2141 - // Ignoring interruption
1.2142 - }
1.2143 - }
1.2144 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.2145 - public void run () {
1.2146 - if (isRootNotSetDlg) {
1.2147 - isRootNotSetDlg = false;
1.2148 - rootNotSetDlg = notifyMessage(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.notDirectory"), new Object[] { badDir } ));
1.2149 - rootNotSetDlg.setVisible(true);
1.2150 - //TopManager.getDefault ().notify (new NotifyDescriptor.Message(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.notDirectory"), new Object[] { badDir } )));
1.2151 - isRootNotSetDlg = true;
1.2152 - }
1.2153 - }
1.2154 - });
1.2155 - }
1.2156 - });
1.2157 - }
1.2158 - });
1.2159 - return ;
1.2160 - }
1.2161 - try{
1.2162 - fileSystem.setRootDirectory(root);
1.2163 - rootDirTextField.setText(selected);
1.2164 - }
1.2165 - catch (PropertyVetoException veto){
1.2166 - fileSystem.debug(org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.canNotChangeWD"));
1.2167 - //E.err(veto,"setRootDirectory() failed"); // NOI18N
1.2168 - }
1.2169 - catch (IOException e){
1.2170 - E.err(e,"setRootDirectory() failed"); // NOI18N
1.2171 - final String badDir = root.toString();
1.2172 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.2173 - public void run () {
1.2174 - if (isRootNotSetDlg) {
1.2175 - isRootNotSetDlg = false;
1.2176 - TopManager.getDefault ().notify (new NotifyDescriptor.Message(MessageFormat.format (org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.cannotSetDirectory"), new Object[] { badDir } )));
1.2177 - isRootNotSetDlg = true;
1.2178 - }
1.2179 - }
1.2180 - });
1.2181 - }
1.2182 - }
1.2183 -
1.2184 - private void updateEnabledComponents () {
1.2185 - if(localRadioButton.isSelected ()) {
1.2186 - userTextField.setEnabled (false);
1.2187 - serverTextField.setEnabled (false);
1.2188 - loginButton.setEnabled (false);
1.2189 - userNameLabel.setEnabled (false);
1.2190 - repositoryButton.setEnabled (true);
1.2191 - serverLabel.setEnabled (false);
1.2192 - } else {
1.2193 - userTextField.setEnabled (true);
1.2194 - serverTextField.setEnabled (true);
1.2195 - loginButton.setEnabled (true);
1.2196 - userNameLabel.setEnabled (true);
1.2197 - repositoryButton.setEnabled (false);
1.2198 - serverLabel.setEnabled (true);
1.2199 - }
1.2200 - String osName = System.getProperty("os.name");
1.2201 - if(osName.indexOf("Win") >= 0) { // NOI18N
1.2202 - cygwinCheckBox.setEnabled (true);
1.2203 - if (cygwinCheckBox.isSelected ()) {
1.2204 - cygwinLabel.setEnabled (true);
1.2205 - cygwinTextField.setEnabled (true);
1.2206 - cygwinButton.setEnabled (true);
1.2207 - } else {
1.2208 - cygwinLabel.setEnabled (false);
1.2209 - cygwinTextField.setEnabled (false);
1.2210 - cygwinButton.setEnabled (false);
1.2211 - }
1.2212 - } else {
1.2213 - cygwinCheckBox.setVisible (false);
1.2214 - cygwinLabel.setVisible (false);
1.2215 - cygwinTextField.setVisible (false);
1.2216 - cygwinButton.setVisible (false);
1.2217 - }
1.2218 - }
1.2219 -
1.2220 - private void refreshChanged () {
1.2221 - try {
1.2222 - int time = Integer.parseInt(refreshTextField.getText());
1.2223 - if (time < 0) throw new NumberFormatException(""+time); // NOI18N
1.2224 - fileSystem.setCustomRefreshTime (time);
1.2225 - } catch (NumberFormatException e) {
1.2226 - final String msg = e.getMessage();
1.2227 - E.deb(msg);
1.2228 - refreshTextField.setText (""+fileSystem.getCustomRefreshTime ()); // NOI18N
1.2229 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
1.2230 - public void run () {
1.2231 - TopManager.getDefault ().notify (new NotifyDescriptor.Message("'"+msg+"': "+org.openide.util.NbBundle.getBundle(CvsCustomizer.class).getString("CvsCustomizer.nonNegative")));
1.2232 - }
1.2233 - });
1.2234 - }
1.2235 - }
1.2236 -
1.2237 - //-------------------------------------------
1.2238 - String g(String s) {
1.2239 - D.deb("getting "+s);
1.2240 - return NbBundle.getBundle
1.2241 - ("org.netbeans.modules.vcs.cmdline.Bundle").getString (s);
1.2242 - }
1.2243 - String g(String s, Object obj) {
1.2244 - return MessageFormat.format (g(s), new Object[] { obj });
1.2245 - }
1.2246 - String g(String s, Object obj1, Object obj2) {
1.2247 - return MessageFormat.format (g(s), new Object[] { obj1, obj2 });
1.2248 - }
1.2249 - String g(String s, Object obj1, Object obj2, Object obj3) {
1.2250 - return MessageFormat.format (g(s), new Object[] { obj1, obj2, obj3 });
1.2251 - }
1.2252 }
1.2253
1.2254 /*
2.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsFileSystem.java Tue Apr 25 12:55:38 2000 +0000
2.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsFileSystem.java Tue Apr 25 14:04:53 2000 +0000
2.3 @@ -38,713 +38,713 @@
2.4 */
2.5 //-------------------------------------------
2.6 public class CvsFileSystem extends VcsFileSystem implements java.beans.PropertyChangeListener {
2.7 - private Debug D = new Debug ("CvsFileSystem", true); // NOI18N
2.8 + private Debug D = new Debug ("CvsFileSystem", true); // NOI18N
2.9
2.10 - public VcsFactory getVcsFactory () {
2.11 - return new CvsFactory ();
2.12 - }
2.13 -
2.14 - public final static String CVS_SERVER_LOCAL = "local"; // NOI18N
2.15 - public final static String CVS_SERVER_SERVER = "server"; // NOI18N
2.16 - public final static String CVS_SERVER_PSERVER = "pserver"; // NOI18N
2.17 - // suppose that CVS server only exists for UNIX/Linux.
2.18 - // The same presumption is made in CvsAction.doCommand () method
2.19 - final static String PS_SERVER = "/"; // NOI18N
2.20 - final static String PS_LOCAL = java.io.File.separator;
2.21 -
2.22 - private static String last_cvsServerType = CVS_SERVER_LOCAL;
2.23 - private static String last_cvsRoot = System.getProperty("user.home"); // NOI18N
2.24 - private static String last_cvsServer = ""; // NOI18N
2.25 - private static String last_cvsUser = System.getProperty ("user.name");
2.26 - private static String last_cvsPassword = ""; // NOI18N
2.27 - private static String last_cvsModule = ""; // NOI18N
2.28 - private static String last_cvsModuleName = ""; // NOI18N
2.29 - private static String last_cvsExePath = null; // NOI18N
2.30 - private static String last_cygwinPath = null; // NOI18N
2.31 - private static boolean last_useUnixShell = false;
2.32 -
2.33 - private String cvsServerType = new String(last_cvsServerType);
2.34 - private String cvsRoot = new String(last_cvsRoot);
2.35 - private String cvsServer = new String(last_cvsServer);
2.36 - private String cvsUser = new String(last_cvsUser);
2.37 - private String cvsPassword = new String(last_cvsPassword);
2.38 - private String cvsModule = new String(last_cvsModule);
2.39 - private String cvsModuleName = new String(last_cvsModuleName);
2.40 - private String cvsExePath = (last_cvsExePath == null) ? null : new String(last_cvsExePath);
2.41 - private String cygwinPath = (last_cygwinPath == null) ? null : new String(last_cygwinPath);
2.42 - private boolean useUnixShell = last_useUnixShell;
2.43 -
2.44 - public String getCvsRoot () { return cvsRoot;}
2.45 - public String getCvsUserName () { return cvsUser; }
2.46 - public String getCvsServer () { return cvsServer; }
2.47 - public String getCvsServerType () { return cvsServerType; }
2.48 - public String getCvsPassword () { return cvsPassword; }
2.49 - public String getCvsModule () { return cvsModule; }
2.50 - public String getCvsModuleName () { return cvsModuleName; }
2.51 - public String getCvsExePath () { return cvsExePath; }
2.52 - public String getCygwinPath () { return cygwinPath; }
2.53 - public boolean isUseUnixShell () { return useUnixShell; }
2.54 + public VcsFactory getVcsFactory () {
2.55 + return new CvsFactory ();
2.56 + }
2.57
2.58 - String getCvcRootForServerType () {
2.59 - return cvsServerType.equals (CVS_SERVER_LOCAL) ? cvsRoot : cvsUser+"@"+cvsServer+":"+cvsRoot; // NOI18N
2.60 - }
2.61 -
2.62 - public void setCvsRoot (String root) {
2.63 - cvsRoot = root;
2.64 - last_cvsRoot = new String(root);
2.65 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CVS_REPOSITORY"); // NOI18N
2.66 - var.setValue (root);
2.67 - var = (VcsConfigVariable) variablesByName.get ("CVSROOT"); // NOI18N
2.68 - String result = getCvcRootForServerType ();
2.69 - var.setValue (result);
2.70 - D.deb (result);
2.71 - }
2.72 + public final static String CVS_SERVER_LOCAL = "local"; // NOI18N
2.73 + public final static String CVS_SERVER_SERVER = "server"; // NOI18N
2.74 + public final static String CVS_SERVER_PSERVER = "pserver"; // NOI18N
2.75 + // suppose that CVS server only exists for UNIX/Linux.
2.76 + // The same presumption is made in CvsAction.doCommand () method
2.77 + final static String PS_SERVER = "/"; // NOI18N
2.78 + final static String PS_LOCAL = java.io.File.separator;
2.79
2.80 - public void setCvsServer (String server) {
2.81 - cvsServer = server;
2.82 - last_cvsServer = new String(server);
2.83 - setCvsRoot (cvsRoot);
2.84 - }
2.85 -
2.86 - protected void setCvsServerType (String serverType) {
2.87 - D.deb ("serverType ("+serverType+")"); // NOI18N
2.88 - cvsServerType = serverType;
2.89 - last_cvsServerType = new String(serverType);
2.90 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("SERVERTYPE"); // NOI18N
2.91 - var.setValue (serverType);
2.92 - //var = (VcsConfigVariable) variablesByName.get ("PS"); // NOI18N
2.93 - //ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.94 - /*
2.95 - if(serverType==CVS_SERVER_LOCAL) {
2.96 - //var.setValue (PS_LOCAL);
2.97 - getCommand ("LIST").setDataRegex (bu.getString ("REGEX_LIST"));
2.98 + private static String last_cvsServerType = CVS_SERVER_LOCAL;
2.99 + private static String last_cvsRoot = System.getProperty("user.home"); // NOI18N
2.100 + private static String last_cvsServer = ""; // NOI18N
2.101 + private static String last_cvsUser = System.getProperty ("user.name");
2.102 + private static String last_cvsPassword = ""; // NOI18N
2.103 + private static String last_cvsModule = ""; // NOI18N
2.104 + private static String last_cvsModuleName = ""; // NOI18N
2.105 + private static String last_cvsExePath = null; // NOI18N
2.106 + private static String last_cygwinPath = null; // NOI18N
2.107 + private static boolean last_useUnixShell = false;
2.108 +
2.109 + private String cvsServerType = new String(last_cvsServerType);
2.110 + private String cvsRoot = new String(last_cvsRoot);
2.111 + private String cvsServer = new String(last_cvsServer);
2.112 + private String cvsUser = new String(last_cvsUser);
2.113 + private String cvsPassword = new String(last_cvsPassword);
2.114 + private String cvsModule = new String(last_cvsModule);
2.115 + private String cvsModuleName = new String(last_cvsModuleName);
2.116 + private String cvsExePath = (last_cvsExePath == null) ? null : new String(last_cvsExePath);
2.117 + private String cygwinPath = (last_cygwinPath == null) ? null : new String(last_cygwinPath);
2.118 + private boolean useUnixShell = last_useUnixShell;
2.119 +
2.120 + public String getCvsRoot () { return cvsRoot;}
2.121 + public String getCvsUserName () { return cvsUser; }
2.122 + public String getCvsServer () { return cvsServer; }
2.123 + public String getCvsServerType () { return cvsServerType; }
2.124 + public String getCvsPassword () { return cvsPassword; }
2.125 + public String getCvsModule () { return cvsModule; }
2.126 + public String getCvsModuleName () { return cvsModuleName; }
2.127 + public String getCvsExePath () { return cvsExePath; }
2.128 + public String getCygwinPath () { return cygwinPath; }
2.129 + public boolean isUseUnixShell () { return useUnixShell; }
2.130 +
2.131 + String getCvcRootForServerType () {
2.132 + return cvsServerType.equals (CVS_SERVER_LOCAL) ? cvsRoot : cvsUser+"@"+cvsServer+":"+cvsRoot; // NOI18N
2.133 + }
2.134 +
2.135 + public void setCvsRoot (String root) {
2.136 + cvsRoot = root;
2.137 + last_cvsRoot = new String(root);
2.138 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CVS_REPOSITORY"); // NOI18N
2.139 + var.setValue (root);
2.140 + var = (VcsConfigVariable) variablesByName.get ("CVSROOT"); // NOI18N
2.141 + String result = getCvcRootForServerType ();
2.142 + var.setValue (result);
2.143 + D.deb (result);
2.144 + }
2.145 +
2.146 + public void setCvsServer (String server) {
2.147 + cvsServer = server;
2.148 + last_cvsServer = new String(server);
2.149 + setCvsRoot (cvsRoot);
2.150 + }
2.151 +
2.152 + protected void setCvsServerType (String serverType) {
2.153 + D.deb ("serverType ("+serverType+")"); // NOI18N
2.154 + cvsServerType = serverType;
2.155 + last_cvsServerType = new String(serverType);
2.156 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("SERVERTYPE"); // NOI18N
2.157 + var.setValue (serverType);
2.158 + //var = (VcsConfigVariable) variablesByName.get ("PS"); // NOI18N
2.159 + //ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.160 + /*
2.161 + if(serverType==CVS_SERVER_LOCAL) {
2.162 + //var.setValue (PS_LOCAL);
2.163 + getCommand ("LIST").setDataRegex (bu.getString ("REGEX_LIST"));
2.164 } else {
2.165 - //var.setValue (PS_SERVER);
2.166 - getCommand ("LIST").setDataRegex (bu.getString ("REGEX_LIST_SRV"));
2.167 + //var.setValue (PS_SERVER);
2.168 + getCommand ("LIST").setDataRegex (bu.getString ("REGEX_LIST_SRV"));
2.169 }
2.170 - */
2.171 - setCvsModule (cvsModule);
2.172 - //setCvsRoot (cvsRoot);
2.173 - }
2.174 + */
2.175 + setCvsModule (cvsModule);
2.176 + //setCvsRoot (cvsRoot);
2.177 + }
2.178
2.179 - void setCvsUserName (String user) {
2.180 - cvsUser = user;
2.181 - last_cvsUser = new String(user);
2.182 - setCvsRoot (cvsRoot);
2.183 - }
2.184 + void setCvsUserName (String user) {
2.185 + cvsUser = user;
2.186 + last_cvsUser = new String(user);
2.187 + setCvsRoot (cvsRoot);
2.188 + }
2.189
2.190 - void setCvsPassword (String password) {
2.191 - cvsPassword = password;
2.192 - }
2.193 -
2.194 - public void setCvsModule (String module) {
2.195 - cvsModule = module;
2.196 - last_cvsModule = new String(module);
2.197 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODULE_S"); // NOI18N
2.198 - //if (module.length() > 0) module += "/"; // NOI18N
2.199 - var.setValue (module);
2.200 - D.deb("MODULE_S = "+var.getValue()); // NOI18N
2.201 - String osName = System.getProperty("os.name");
2.202 - module = module.replace('/', File.separatorChar);
2.203 - var = (VcsConfigVariable) variablesByName.get ("MODULE"); // NOI18N
2.204 - var.setValue (module);
2.205 - D.deb("MODULE = "+var.getValue()); // NOI18N
2.206 - }
2.207 -
2.208 - public void setCvsModuleName (String moduleName) {
2.209 - cvsModuleName = moduleName;
2.210 - last_cvsModuleName = new String(moduleName);
2.211 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODULE_NAME"); // NOI18N
2.212 - var.setValue (moduleName);
2.213 - D.deb("MODULE_NAME = "+moduleName);
2.214 - }
2.215 -
2.216 - void setCvsExePath (String exePath) {
2.217 - if (useUnixShell) cvsExePath = exePath.replace('\\', '/');
2.218 - else cvsExePath = exePath;
2.219 - D.deb("cvsExePath = "+cvsExePath);
2.220 - last_cvsExePath = new String(cvsExePath);
2.221 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CVS_EXE"); // NOI18N
2.222 - var.setValue (cvsExePath);
2.223 - }
2.224 -
2.225 - void setUseUnixShell (boolean unixShell) {
2.226 - useUnixShell = unixShell;
2.227 - last_useUnixShell = unixShell;
2.228 - setCvsExePath(((VcsConfigVariable) variablesByName.get ("CVS_EXE")).getValue());
2.229 - initCommands ();
2.230 - }
2.231 -
2.232 - void setCygwinPath (String path) {
2.233 - cygwinPath = path;
2.234 - last_cygwinPath = new String(path);
2.235 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("SHELL"); // NOI18N
2.236 - var.setValue (path);
2.237 - int index = path.lastIndexOf(File.separatorChar);
2.238 - D.deb("path = "+path); // NOI18N
2.239 - String bin = path.substring(0, index);
2.240 - D.deb("index = "+index+", bin = "+bin); // NOI18N
2.241 - bin = bin.replace(File.separatorChar, '/');
2.242 - var = (VcsConfigVariable) variablesByName.get ("CYGWINBIN"); // NOI18N
2.243 - var.setValue (bin);
2.244 - }
2.245 + void setCvsPassword (String password) {
2.246 + cvsPassword = password;
2.247 + }
2.248
2.249 - //-------------------------------------------
2.250 - static final long serialVersionUID =3105697696081480308L;
2.251 - public CvsFileSystem() {
2.252 - super ();
2.253 - D.deb ("CvsFileSystem()"); // NOI18N
2.254 - setConfiguration ();
2.255 - setCvsServerType (last_cvsServerType);
2.256 - addPropertyChangeListener(this);
2.257 - D.deb("constructor done.");
2.258 - }
2.259 -
2.260 - private void setConfiguration () {
2.261 - //System.out.println("CvsFileSystem readConfiguration ()"); // NOI18N
2.262 - ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.263 - Vector vars = new Vector ();
2.264 - String osName;
2.265 - String os = System.getProperty("os.name");
2.266 - if(os.indexOf("Win") >= 0) { // NOI18N
2.267 - osName = "_WIN"; // NOI18N
2.268 - } else osName = "_UNIX"; // NOI18N
2.269 - D.deb("OS = "+os+" => osName = "+osName); // NOI18N
2.270 + public void setCvsModule (String module) {
2.271 + cvsModule = module;
2.272 + last_cvsModule = new String(module);
2.273 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODULE_S"); // NOI18N
2.274 + //if (module.length() > 0) module += "/"; // NOI18N
2.275 + var.setValue (module);
2.276 + D.deb("MODULE_S = "+var.getValue()); // NOI18N
2.277 + String osName = System.getProperty("os.name");
2.278 + module = module.replace('/', File.separatorChar);
2.279 + var = (VcsConfigVariable) variablesByName.get ("MODULE"); // NOI18N
2.280 + var.setValue (module);
2.281 + D.deb("MODULE = "+var.getValue()); // NOI18N
2.282 + }
2.283
2.284 - vars.add (new VcsConfigVariable ("MODULE", "", "", false, false, false, "")); // NOI18N
2.285 - vars.add (new VcsConfigVariable ("MODULE_S", "", "", false, false, false, "")); // NOI18N
2.286 - vars.add (new VcsConfigVariable ("MODULE_NAME", "", "", false, false, false, bu.getString ("VAR_MODULE_SELECT"+osName))); // NOI18N
2.287 - //vars.add (new VcsConfigVariable ("CP", "", bu.getString ("VAR_CP"+osName), false, false, false));
2.288 - vars.add (new VcsConfigVariable ("PS", "", ""+java.io.File.separator, false, false, false, "")); // NOI18N
2.289 - //vars.add (new VcsConfigVariable ("CPS", "", "${classpath.separator}", false, false, false)); // NOI18N
2.290 - vars.add (new VcsConfigVariable ("CVSROOT", "", "", false, false, false, "")); // NOI18N
2.291 - vars.add (new VcsConfigVariable ("CVS_REPOSITORY", "", "", false, false, false, "")); // NOI18N
2.292 - vars.add (new VcsConfigVariable ("NUR", "", "\"", false, false, false, "")); // NOI18N
2.293 -
2.294 - D.deb("OK 1"); // NOI18N
2.295 - vars.add (new VcsConfigVariable ("MODPATH", "", bu.getString ("VAR_MODPATH"+osName), false, false, false, ""));
2.296 - D.deb("OK 2"); // NOI18N
2.297 - vars.add (new VcsConfigVariable ("RUN", "", bu.getString ("VAR_RUN"+osName), false, false, false, ""));
2.298 - D.deb("OK 3"); // NOI18N
2.299 - vars.add (new VcsConfigVariable ("RUNCDM", "", bu.getString ("VAR_RUNCDM"+osName), false, false, false, ""));
2.300 - D.deb("OK 4"); // NOI18N
2.301 - vars.add (new VcsConfigVariable ("WORKDIR", "", bu.getString ("VAR_WORKDIR"+osName), false, false, false, ""));
2.302 - vars.add (new VcsConfigVariable ("SERVERTYPE", "", "local", false, false, false, "")); // NOI18N
2.303 - vars.add (new VcsConfigVariable ("SHOWLOCALFILES", "", "true", false, false, false, "")); // NOI18N
2.304 - vars.add (new VcsConfigVariable ("WRAPPER", "", "org.netbeans.modules.vcs.cmdline.CvsList", false, false, false, "")); // NOI18N
2.305 - vars.add (new VcsConfigVariable ("CHECKOUT_CMD", "", bu.getString ("VAR_CHECKOUT_CMD"+osName), false, false, false, ""));
2.306 - vars.add (new VcsConfigVariable ("DIFF_CMD", "", bu.getString ("VAR_DIFF_CMD"+osName), false, false, false, ""));
2.307 - vars.add (new VcsConfigVariable ("LOG_INFO_CMD", "", bu.getString ("VAR_LOG_INFO_CMD"+osName), false, false, false, ""));
2.308 - vars.add (new VcsConfigVariable ("ADD_TAG_CMD", "", bu.getString ("VAR_ADD_TAG_CMD"+osName), false, false, false, ""));
2.309 - if (last_cvsExePath != null) {
2.310 - vars.add (new VcsConfigVariable ("CVS_EXE", "", last_cvsExePath, false, false, false, ""));
2.311 - cvsExePath = new String(last_cvsExePath);
2.312 - } else {
2.313 - vars.add (new VcsConfigVariable ("CVS_EXE", "", bu.getString ("VAR_CVS_EXE"), false, false, false, ""));
2.314 - cvsExePath = bu.getString ("VAR_CVS_EXE");
2.315 + public void setCvsModuleName (String moduleName) {
2.316 + cvsModuleName = moduleName;
2.317 + last_cvsModuleName = new String(moduleName);
2.318 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODULE_NAME"); // NOI18N
2.319 + var.setValue (moduleName);
2.320 + D.deb("MODULE_NAME = "+moduleName);
2.321 }
2.322 - if (last_cygwinPath != null) {
2.323 - vars.add (new VcsConfigVariable ("SHELL", "", last_cygwinPath, false, false, false, ""));
2.324 - cygwinPath = new String(last_cygwinPath);
2.325 - } else {
2.326 - vars.add (new VcsConfigVariable ("SHELL", "", bu.getString ("VAR_SHELL"), false, false, false, ""));
2.327 - cygwinPath = bu.getString ("VAR_SHELL");
2.328 +
2.329 + void setCvsExePath (String exePath) {
2.330 + if (useUnixShell) cvsExePath = exePath.replace('\\', '/');
2.331 + else cvsExePath = exePath;
2.332 + D.deb("cvsExePath = "+cvsExePath);
2.333 + last_cvsExePath = new String(cvsExePath);
2.334 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CVS_EXE"); // NOI18N
2.335 + var.setValue (cvsExePath);
2.336 }
2.337 - vars.add (new VcsConfigVariable ("CYGWINBIN", "", bu.getString ("VAR_CYGWINBIN"), false, false, false, ""));
2.338 - D.deb("OK 5"); // NOI18N
2.339 - super.setVariables (vars);
2.340 - if (last_cygwinPath != null) {
2.341 - setCygwinPath(cygwinPath);
2.342 +
2.343 + void setUseUnixShell (boolean unixShell) {
2.344 + useUnixShell = unixShell;
2.345 + last_useUnixShell = unixShell;
2.346 + setCvsExePath(((VcsConfigVariable) variablesByName.get ("CVS_EXE")).getValue());
2.347 + initCommands ();
2.348 }
2.349 - //D.deb("FileSeperator = "+java.io.File.separator); // NOI18N
2.350 - //D.deb("PS = "+ ((VcsConfigVariable) variablesByName.get("PS")).getValue()); // NOI18N
2.351 -
2.352 - D.deb("Calling initCommands()"); // NOI18N
2.353 - initCommands();
2.354 - }
2.355 -
2.356 - private void initCommands () {
2.357 - String osName;
2.358 - String os = System.getProperty("os.name");
2.359 - if(os.indexOf("Win") >= 0) { // NOI18N
2.360 - if (isUseUnixShell()) osName = "_CYGWIN"; // NOI18N
2.361 - else osName = "_WIN"; // NOI18N
2.362 - } else osName = "_UNIX"; // NOI18N
2.363 - D.deb("OS = "+os+" => osName = "+osName); // NOI18N
2.364
2.365 - ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.366 - //VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CP"); // NOI18N
2.367 - //var.setValue (bu.getString ("VAR_CP"+osName));
2.368 - VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODPATH"); // NOI18N
2.369 - D.deb("var = "+var);
2.370 - var.setValue (bu.getString ("VAR_MODPATH"+osName));
2.371 - var = (VcsConfigVariable) variablesByName.get ("RUN"); // NOI18N
2.372 - var.setValue (bu.getString ("VAR_RUN"+osName));
2.373 - var = (VcsConfigVariable) variablesByName.get ("RUNCDM"); // NOI18N
2.374 - var.setValue (bu.getString ("VAR_RUNCDM"+osName));
2.375 - var = (VcsConfigVariable) variablesByName.get ("WORKDIR"); // NOI18N
2.376 - var.setValue (bu.getString ("VAR_WORKDIR"+osName));
2.377 -
2.378 - var = (VcsConfigVariable) variablesByName.get ("CHECKOUT_CMD"); // NOI18N
2.379 - var.setValue (bu.getString ("VAR_CHECKOUT_CMD"+osName));
2.380 - var = (VcsConfigVariable) variablesByName.get ("DIFF_CMD"); // NOI18N
2.381 - var.setValue (bu.getString ("VAR_DIFF_CMD"+osName));
2.382 - var = (VcsConfigVariable) variablesByName.get ("LOG_INFO_CMD"); // NOI18N
2.383 - var.setValue (bu.getString ("VAR_LOG_INFO_CMD"+osName));
2.384 - var = (VcsConfigVariable) variablesByName.get ("ADD_TAG_CMD"); // NOI18N
2.385 - var.setValue (bu.getString ("VAR_ADD_TAG_CMD"+osName));
2.386 + void setCygwinPath (String path) {
2.387 + cygwinPath = path;
2.388 + last_cygwinPath = new String(path);
2.389 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("SHELL"); // NOI18N
2.390 + var.setValue (path);
2.391 + int index = path.lastIndexOf(File.separatorChar);
2.392 + D.deb("path = "+path); // NOI18N
2.393 + String bin = path.substring(0, index);
2.394 + D.deb("index = "+index+", bin = "+bin); // NOI18N
2.395 + bin = bin.replace(File.separatorChar, '/');
2.396 + var = (VcsConfigVariable) variablesByName.get ("CYGWINBIN"); // NOI18N
2.397 + var.setValue (bin);
2.398 + }
2.399
2.400 - var = (VcsConfigVariable) variablesByName.get ("PS"); // NOI18N
2.401 - if (isUseUnixShell())
2.402 - var.setValue ("/"); // NOI18N
2.403 - else
2.404 - var.setValue (java.io.File.separator);
2.405 - var = (VcsConfigVariable) variablesByName.get ("CD"); // NOI18N
2.406 - if (isUseUnixShell())
2.407 - var.setValue ("cd"); // NOI18N
2.408 - else {
2.409 - if (osName.equals("_WIN")) // NOI18N
2.410 - var.setValue ("cd /D"); // NOI18N
2.411 - else
2.412 - var.setValue ("cd"); // NOI18N
2.413 + //-------------------------------------------
2.414 + static final long serialVersionUID =3105697696081480308L;
2.415 + public CvsFileSystem() {
2.416 + super ();
2.417 + D.deb ("CvsFileSystem()"); // NOI18N
2.418 + setConfiguration ();
2.419 + setCvsServerType (last_cvsServerType);
2.420 + addPropertyChangeListener(this);
2.421 + D.deb("constructor done.");
2.422 }
2.423 -
2.424 - UserCommand cmd;
2.425 - Vector commands = new Vector ();
2.426 - String moduleName = " $[? MODULE_NAME] [${MODULE_NAME}] [.]"; // NOI18N
2.427
2.428 - D.deb("UserCommand.");
2.429 - cmd= new UserCommand ();
2.430 - D.deb("cmd = "+cmd);
2.431 - cmd.setName ("LIST"); // NOI18N
2.432 - D.deb("cmd = "+cmd);
2.433 - try {
2.434 - D.deb("refresh label = "+g("CMD_Refresh"));
2.435 - } catch(Exception e) {
2.436 - D.deb("Exception: "+e);
2.437 - e.printStackTrace();
2.438 + private void setConfiguration () {
2.439 + //System.out.println("CvsFileSystem readConfiguration ()"); // NOI18N
2.440 + ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.441 + Vector vars = new Vector ();
2.442 + String osName;
2.443 + String os = System.getProperty("os.name");
2.444 + if(os.indexOf("Win") >= 0) { // NOI18N
2.445 + osName = "_WIN"; // NOI18N
2.446 + } else osName = "_UNIX"; // NOI18N
2.447 + D.deb("OS = "+os+" => osName = "+osName); // NOI18N
2.448 +
2.449 + vars.add (new VcsConfigVariable ("MODULE", "", "", false, false, false, "")); // NOI18N
2.450 + vars.add (new VcsConfigVariable ("MODULE_S", "", "", false, false, false, "")); // NOI18N
2.451 + vars.add (new VcsConfigVariable ("MODULE_NAME", "", "", false, false, false, bu.getString ("VAR_MODULE_SELECT"+osName))); // NOI18N
2.452 + //vars.add (new VcsConfigVariable ("CP", "", bu.getString ("VAR_CP"+osName), false, false, false));
2.453 + vars.add (new VcsConfigVariable ("PS", "", ""+java.io.File.separator, false, false, false, "")); // NOI18N
2.454 + //vars.add (new VcsConfigVariable ("CPS", "", "${classpath.separator}", false, false, false)); // NOI18N
2.455 + vars.add (new VcsConfigVariable ("CVSROOT", "", "", false, false, false, "")); // NOI18N
2.456 + vars.add (new VcsConfigVariable ("CVS_REPOSITORY", "", "", false, false, false, "")); // NOI18N
2.457 + vars.add (new VcsConfigVariable ("NUR", "", "\"", false, false, false, "")); // NOI18N
2.458 +
2.459 + D.deb("OK 1"); // NOI18N
2.460 + vars.add (new VcsConfigVariable ("MODPATH", "", bu.getString ("VAR_MODPATH"+osName), false, false, false, ""));
2.461 + D.deb("OK 2"); // NOI18N
2.462 + vars.add (new VcsConfigVariable ("RUN", "", bu.getString ("VAR_RUN"+osName), false, false, false, ""));
2.463 + D.deb("OK 3"); // NOI18N
2.464 + vars.add (new VcsConfigVariable ("RUNCDM", "", bu.getString ("VAR_RUNCDM"+osName), false, false, false, ""));
2.465 + D.deb("OK 4"); // NOI18N
2.466 + vars.add (new VcsConfigVariable ("WORKDIR", "", bu.getString ("VAR_WORKDIR"+osName), false, false, false, ""));
2.467 + vars.add (new VcsConfigVariable ("SERVERTYPE", "", "local", false, false, false, "")); // NOI18N
2.468 + vars.add (new VcsConfigVariable ("SHOWLOCALFILES", "", "true", false, false, false, "")); // NOI18N
2.469 + vars.add (new VcsConfigVariable ("WRAPPER", "", "org.netbeans.modules.vcs.cmdline.CvsList", false, false, false, "")); // NOI18N
2.470 + vars.add (new VcsConfigVariable ("CHECKOUT_CMD", "", bu.getString ("VAR_CHECKOUT_CMD"+osName), false, false, false, ""));
2.471 + vars.add (new VcsConfigVariable ("DIFF_CMD", "", bu.getString ("VAR_DIFF_CMD"+osName), false, false, false, ""));
2.472 + vars.add (new VcsConfigVariable ("LOG_INFO_CMD", "", bu.getString ("VAR_LOG_INFO_CMD"+osName), false, false, false, ""));
2.473 + vars.add (new VcsConfigVariable ("ADD_TAG_CMD", "", bu.getString ("VAR_ADD_TAG_CMD"+osName), false, false, false, ""));
2.474 + if (last_cvsExePath != null) {
2.475 + vars.add (new VcsConfigVariable ("CVS_EXE", "", last_cvsExePath, false, false, false, ""));
2.476 + cvsExePath = new String(last_cvsExePath);
2.477 + } else {
2.478 + vars.add (new VcsConfigVariable ("CVS_EXE", "", bu.getString ("VAR_CVS_EXE"), false, false, false, ""));
2.479 + cvsExePath = bu.getString ("VAR_CVS_EXE");
2.480 + }
2.481 + if (last_cygwinPath != null) {
2.482 + vars.add (new VcsConfigVariable ("SHELL", "", last_cygwinPath, false, false, false, ""));
2.483 + cygwinPath = new String(last_cygwinPath);
2.484 + } else {
2.485 + vars.add (new VcsConfigVariable ("SHELL", "", bu.getString ("VAR_SHELL"), false, false, false, ""));
2.486 + cygwinPath = bu.getString ("VAR_SHELL");
2.487 + }
2.488 + vars.add (new VcsConfigVariable ("CYGWINBIN", "", bu.getString ("VAR_CYGWINBIN"), false, false, false, ""));
2.489 + D.deb("OK 5"); // NOI18N
2.490 + super.setVariables (vars);
2.491 + if (last_cygwinPath != null) {
2.492 + setCygwinPath(cygwinPath);
2.493 + }
2.494 + //D.deb("FileSeperator = "+java.io.File.separator); // NOI18N
2.495 + //D.deb("PS = "+ ((VcsConfigVariable) variablesByName.get("PS")).getValue()); // NOI18N
2.496 +
2.497 + D.deb("Calling initCommands()"); // NOI18N
2.498 + initCommands();
2.499 }
2.500 - cmd.setLabel (g("CMD_Refresh")); // NOI18N
2.501 - D.deb("cmd = "+cmd);
2.502 - cmd.setExec (bu.getString ("EXEC_LIST"+osName));
2.503 - D.deb("cmd = "+cmd);
2.504 - cmd.setInput (""); // NOI18N
2.505 - cmd.setTimeout (300000);
2.506 - cmd.setDataRegex (bu.getString ("REGEX_LIST"));
2.507 - cmd.setErrorRegex ("(Error.*)"); // NOI18N
2.508 - cmd.setStatus (1);
2.509 - cmd.setLocker (-1);
2.510 - cmd.setAttr (-1);
2.511 - cmd.setDate (-1);
2.512 - cmd.setTime (-1);
2.513 - cmd.setSize (-1);
2.514 - cmd.setFileName (0);
2.515 - commands.add (cmd);
2.516 -
2.517 - D.deb("cmd 1 = "+cmd);
2.518 -
2.519 - cmd= new UserCommand ();
2.520 - cmd.setName ("LIST_SUB"); // NOI18N
2.521 - cmd.setLabel (g("CMD_RefreshRecursively")); // NOI18N
2.522 - cmd.setExec (bu.getString ("EXEC_LIST_SUB"+osName));
2.523 - cmd.setInput (""); // NOI18N
2.524 - cmd.setTimeout (600000);
2.525 - cmd.setDataRegex (bu.getString ("REGEX_LIST_SUB"));
2.526 - cmd.setErrorRegex ("(Error.*)"); // NOI18N
2.527 - cmd.setStatus (1);
2.528 - cmd.setLocker (-1);
2.529 - cmd.setAttr (-1);
2.530 - cmd.setDate (-1);
2.531 - cmd.setTime (-1);
2.532 - cmd.setSize (-1);
2.533 - cmd.setFileName (0);
2.534 - commands.add (cmd);
2.535 -
2.536 - D.deb("cmd 2 = "+cmd);
2.537 -
2.538 - cmd= new UserCommand ();
2.539 - cmd.setName ("CHECKOUT"); // NOI18N
2.540 - cmd.setLabel (g("CMD_CheckOut")); // NOI18N
2.541 - cmd.setExec (bu.getString ("EXEC_CHECKOUT"+osName));
2.542 - cmd.setInput (""); // NOI18N
2.543 - cmd.setTimeout (0);
2.544 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.545 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.546 - cmd.setDisplayOutput (true);
2.547 - commands.add (cmd);
2.548 -
2.549 - cmd= new UserCommand ();
2.550 - cmd.setName ("CHECKOUT_MODULE"); // NOI18N
2.551 - cmd.setLabel (g("CMD_CheckOutModule")+moduleName); // NOI18N
2.552 - cmd.setExec (bu.getString ("EXEC_CHECKOUT_MODULE"+osName));
2.553 - cmd.setInput (""); // NOI18N
2.554 - cmd.setTimeout (0);
2.555 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.556 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.557 - cmd.setDisplayOutput (true);
2.558 - commands.add (cmd);
2.559 -
2.560 - cmd= new UserCommand ();
2.561 - cmd.setName ("LOGIN"); // NOI18N
2.562 - cmd.setLabel (g("CMD_Login")); // NOI18N
2.563 - cmd.setExec (bu.getString ("EXEC_LOGIN"));
2.564 - cmd.setInput (""); // NOI18N
2.565 - cmd.setTimeout (0);
2.566 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.567 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.568 - commands.add (cmd);
2.569 -
2.570 - cmd= new UserCommand ();
2.571 - cmd.setName ("INIT"); // NOI18N
2.572 - cmd.setLabel (g("CMD_Init")); // NOI18N
2.573 - cmd.setExec (bu.getString ("EXEC_INIT"+osName));
2.574 - cmd.setInput (""); // NOI18N
2.575 - cmd.setTimeout (60000);
2.576 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.577 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.578 - commands.add (cmd);
2.579 -
2.580 - D.deb("cmd 6 = "+cmd);
2.581
2.582 - cmd= new UserCommand ();
2.583 - cmd.setName ("UPDATE"); // NOI18N
2.584 - cmd.setLabel (g("CMD_Update")); // NOI18N
2.585 - cmd.setExec (bu.getString ("EXEC_UPDATE"+osName));
2.586 - cmd.setInput (""); // NOI18N
2.587 - cmd.setTimeout (60000);
2.588 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.589 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.590 - cmd.setDoRefresh(true);
2.591 - commands.add (cmd);
2.592 + private void initCommands () {
2.593 + String osName;
2.594 + String os = System.getProperty("os.name");
2.595 + if(os.indexOf("Win") >= 0) { // NOI18N
2.596 + if (isUseUnixShell()) osName = "_CYGWIN"; // NOI18N
2.597 + else osName = "_WIN"; // NOI18N
2.598 + } else osName = "_UNIX"; // NOI18N
2.599 + D.deb("OS = "+os+" => osName = "+osName); // NOI18N
2.600
2.601 - /*
2.602 - cmd= new UserCommand ();
2.603 - cmd.setName ("UPDATE_MODULE"); // NOI18N
2.604 - cmd.setLabel (g("CMD_UpdateModule")+moduleName); // NOI18N
2.605 - cmd.setExec (bu.getString ("EXEC_UPDATE_MODULE"+osName));
2.606 - cmd.setInput (""); // NOI18N
2.607 - cmd.setTimeout (60000);
2.608 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.609 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.610 - cmd.setDoRefresh(true);
2.611 - commands.add (cmd);
2.612 - */
2.613 -
2.614 - cmd= new UserCommand ();
2.615 - cmd.setName ("COMMIT"); // NOI18N
2.616 - cmd.setLabel (g("CMD_Commit")); // NOI18N
2.617 - cmd.setExec (bu.getString ("EXEC_COMMIT"+osName));
2.618 - cmd.setInput (""); // NOI18N
2.619 - cmd.setTimeout (90000);
2.620 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.621 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.622 - cmd.setDoRefresh(true);
2.623 - commands.add (cmd);
2.624 + ResourceBundle bu = NbBundle.getBundle ("org.netbeans.modules.vcs.cmdline.CommandLines"); // NOI18N
2.625 + //VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("CP"); // NOI18N
2.626 + //var.setValue (bu.getString ("VAR_CP"+osName));
2.627 + VcsConfigVariable var = (VcsConfigVariable) variablesByName.get ("MODPATH"); // NOI18N
2.628 + D.deb("var = "+var);
2.629 + var.setValue (bu.getString ("VAR_MODPATH"+osName));
2.630 + var = (VcsConfigVariable) variablesByName.get ("RUN"); // NOI18N
2.631 + var.setValue (bu.getString ("VAR_RUN"+osName));
2.632 + var = (VcsConfigVariable) variablesByName.get ("RUNCDM"); // NOI18N
2.633 + var.setValue (bu.getString ("VAR_RUNCDM"+osName));
2.634 + var = (VcsConfigVariable) variablesByName.get ("WORKDIR"); // NOI18N
2.635 + var.setValue (bu.getString ("VAR_WORKDIR"+osName));
2.636
2.637 - /*
2.638 - cmd= new UserCommand ();
2.639 - cmd.setName ("COMMIT_MODULE"); // NOI18N
2.640 - cmd.setLabel (g("CMD_CommitModule")+moduleName); // NOI18N
2.641 - cmd.setExec (bu.getString ("EXEC_COMMIT_MODULE"+osName));
2.642 - cmd.setInput (""); // NOI18N
2.643 - cmd.setTimeout (90000);
2.644 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.645 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.646 - cmd.setDoRefresh(true);
2.647 - commands.add (cmd);
2.648 - */
2.649 + var = (VcsConfigVariable) variablesByName.get ("CHECKOUT_CMD"); // NOI18N
2.650 + var.setValue (bu.getString ("VAR_CHECKOUT_CMD"+osName));
2.651 + var = (VcsConfigVariable) variablesByName.get ("DIFF_CMD"); // NOI18N
2.652 + var.setValue (bu.getString ("VAR_DIFF_CMD"+osName));
2.653 + var = (VcsConfigVariable) variablesByName.get ("LOG_INFO_CMD"); // NOI18N
2.654 + var.setValue (bu.getString ("VAR_LOG_INFO_CMD"+osName));
2.655 + var = (VcsConfigVariable) variablesByName.get ("ADD_TAG_CMD"); // NOI18N
2.656 + var.setValue (bu.getString ("VAR_ADD_TAG_CMD"+osName));
2.657
2.658 - cmd= new UserCommand ();
2.659 - cmd.setName ("REMOVE"); // NOI18N
2.660 - cmd.setLabel (g("CMD_Remove")); // NOI18N
2.661 - cmd.setExec (bu.getString ("EXEC_REMOVE"+osName));
2.662 - cmd.setInput (""); // NOI18N
2.663 - cmd.setTimeout (90000);
2.664 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.665 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.666 - cmd.setDoRefresh(true);
2.667 - //cmd.setConfirmationMsg(bu.getString("VAR_REMOVE_MSG"));
2.668 - commands.add (cmd);
2.669 + var = (VcsConfigVariable) variablesByName.get ("PS"); // NOI18N
2.670 + if (isUseUnixShell())
2.671 + var.setValue ("/"); // NOI18N
2.672 + else
2.673 + var.setValue (java.io.File.separator);
2.674 + var = (VcsConfigVariable) variablesByName.get ("CD"); // NOI18N
2.675 + if (isUseUnixShell())
2.676 + var.setValue ("cd"); // NOI18N
2.677 + else {
2.678 + if (osName.equals("_WIN")) // NOI18N
2.679 + var.setValue ("cd /D"); // NOI18N
2.680 + else
2.681 + var.setValue ("cd"); // NOI18N
2.682 + }
2.683
2.684 - cmd= new UserCommand ();
2.685 - cmd.setName ("LOCK"); // NOI18N
2.686 - cmd.setLabel (g("CMD_Lock")); // NOI18N
2.687 - cmd.setExec (bu.getString ("EXEC_LOCK"+osName));
2.688 - cmd.setInput (""); // NOI18N
2.689 - cmd.setTimeout (90000);
2.690 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.691 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.692 - cmd.setDisplayOutput (false);
2.693 - commands.add (cmd);
2.694 + UserCommand cmd;
2.695 + Vector commands = new Vector ();
2.696 + String moduleName = " $[? MODULE_NAME] [${MODULE_NAME}] [.]"; // NOI18N
2.697
2.698 - cmd= new UserCommand ();
2.699 - cmd.setName ("UNLOCK1"); // NOI18N
2.700 - cmd.setLabel (g("CMD_Unlock")); // NOI18N
2.701 - cmd.setExec (bu.getString ("EXEC_UNLOCK"+osName));
2.702 - cmd.setInput (""); // NOI18N
2.703 - cmd.setTimeout (90000);
2.704 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.705 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.706 - cmd.setDisplayOutput (false);
2.707 - commands.add (cmd);
2.708 + D.deb("UserCommand.");
2.709 + cmd= new UserCommand ();
2.710 + D.deb("cmd = "+cmd);
2.711 + cmd.setName ("LIST"); // NOI18N
2.712 + D.deb("cmd = "+cmd);
2.713 + try {
2.714 + D.deb("refresh label = "+g("CMD_Refresh"));
2.715 + } catch(Exception e) {
2.716 + D.deb("Exception: "+e);
2.717 + e.printStackTrace();
2.718 + }
2.719 + cmd.setLabel (g("CMD_Refresh")); // NOI18N
2.720 + D.deb("cmd = "+cmd);
2.721 + cmd.setExec (bu.getString ("EXEC_LIST"+osName));
2.722 + D.deb("cmd = "+cmd);
2.723 + cmd.setInput (""); // NOI18N
2.724 + cmd.setTimeout (300000);
2.725 + cmd.setDataRegex (bu.getString ("REGEX_LIST"));
2.726 + cmd.setErrorRegex ("(Error.*)"); // NOI18N
2.727 + cmd.setStatus (1);
2.728 + cmd.setLocker (-1);
2.729 + cmd.setAttr (-1);
2.730 + cmd.setDate (-1);
2.731 + cmd.setTime (-1);
2.732 + cmd.setSize (-1);
2.733 + cmd.setFileName (0);
2.734 + commands.add (cmd);
2.735
2.736 - cmd= new UserCommand ();
2.737 - cmd.setName ("EDIT"); // NOI18N
2.738 - cmd.setLabel (g("CMD_Edit")); // NOI18N
2.739 - cmd.setExec (bu.getString ("EXEC_EDIT"+osName));
2.740 - cmd.setInput (""); // NOI18N
2.741 - cmd.setTimeout (90000);
2.742 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.743 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.744 - cmd.setDisplayOutput (false);
2.745 - commands.add (cmd);
2.746 + D.deb("cmd 1 = "+cmd);
2.747
2.748 - cmd= new UserCommand ();
2.749 - cmd.setName ("UNEDIT"); // NOI18N
2.750 - cmd.setLabel (g("CMD_Unedit")); // NOI18N
2.751 - cmd.setExec (bu.getString ("EXEC_UNEDIT"+osName));
2.752 - cmd.setInput (""); // NOI18N
2.753 - cmd.setTimeout (90000);
2.754 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.755 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.756 - cmd.setDisplayOutput (false);
2.757 - commands.add (cmd);
2.758 + cmd= new UserCommand ();
2.759 + cmd.setName ("LIST_SUB"); // NOI18N
2.760 + cmd.setLabel (g("CMD_RefreshRecursively")); // NOI18N
2.761 + cmd.setExec (bu.getString ("EXEC_LIST_SUB"+osName));
2.762 + cmd.setInput (""); // NOI18N
2.763 + cmd.setTimeout (600000);
2.764 + cmd.setDataRegex (bu.getString ("REGEX_LIST_SUB"));
2.765 + cmd.setErrorRegex ("(Error.*)"); // NOI18N
2.766 + cmd.setStatus (1);
2.767 + cmd.setLocker (-1);
2.768 + cmd.setAttr (-1);
2.769 + cmd.setDate (-1);
2.770 + cmd.setTime (-1);
2.771 + cmd.setSize (-1);
2.772 + cmd.setFileName (0);
2.773 + commands.add (cmd);
2.774
2.775 - cmd= new UserCommand ();
2.776 - cmd.setName ("EDITORS"); // NOI18N
2.777 - cmd.setLabel (g("CMD_Editors")); // NOI18N
2.778 - cmd.setExec (bu.getString ("EXEC_EDITORS"+osName));
2.779 - cmd.setInput (""); // NOI18N
2.780 - cmd.setTimeout (90000);
2.781 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.782 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.783 - cmd.setDisplayOutput (true);
2.784 - commands.add (cmd);
2.785 + D.deb("cmd 2 = "+cmd);
2.786
2.787 - cmd= new UserCommand ();
2.788 - cmd.setName ("WATCH_ON"); // NOI18N
2.789 - cmd.setLabel (g("CMD_WatchOn")); // NOI18N
2.790 - cmd.setExec (bu.getString ("EXEC_WATCH_ON"+osName));
2.791 - cmd.setInput (""); // NOI18N
2.792 - cmd.setTimeout (90000);
2.793 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.794 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.795 - cmd.setDisplayOutput (false);
2.796 - commands.add (cmd);
2.797 + cmd= new UserCommand ();
2.798 + cmd.setName ("CHECKOUT"); // NOI18N
2.799 + cmd.setLabel (g("CMD_CheckOut")); // NOI18N
2.800 + cmd.setExec (bu.getString ("EXEC_CHECKOUT"+osName));
2.801 + cmd.setInput (""); // NOI18N
2.802 + cmd.setTimeout (0);
2.803 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.804 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.805 + cmd.setDisplayOutput (true);
2.806 + commands.add (cmd);
2.807
2.808 - cmd= new UserCommand ();
2.809 - cmd.setName ("WATCH_OFF"); // NOI18N
2.810 - cmd.setLabel (g("CMD_WatchOff")); // NOI18N
2.811 - cmd.setExec (bu.getString ("EXEC_WATCH_OFF"+osName));
2.812 - cmd.setInput (""); // NOI18N
2.813 - cmd.setTimeout (90000);
2.814 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.815 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.816 - cmd.setDisplayOutput (false);
2.817 - commands.add (cmd);
2.818 + cmd= new UserCommand ();
2.819 + cmd.setName ("CHECKOUT_MODULE"); // NOI18N
2.820 + cmd.setLabel (g("CMD_CheckOutModule")+moduleName); // NOI18N
2.821 + cmd.setExec (bu.getString ("EXEC_CHECKOUT_MODULE"+osName));
2.822 + cmd.setInput (""); // NOI18N
2.823 + cmd.setTimeout (0);
2.824 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.825 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.826 + cmd.setDisplayOutput (true);
2.827 + commands.add (cmd);
2.828
2.829 - cmd= new UserCommand ();
2.830 - cmd.setName ("WATCH_ADD"); // NOI18N
2.831 - cmd.setLabel (g("CMD_WatchSet")); // NOI18N
2.832 - cmd.setExec (bu.getString ("EXEC_WATCH_ADD"+osName));
2.833 - cmd.setInput (""); // NOI18N
2.834 - cmd.setTimeout (90000);
2.835 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.836 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.837 - cmd.setDisplayOutput (false);
2.838 - commands.add (cmd);
2.839 + cmd= new UserCommand ();
2.840 + cmd.setName ("LOGIN"); // NOI18N
2.841 + cmd.setLabel (g("CMD_Login")); // NOI18N
2.842 + cmd.setExec (bu.getString ("EXEC_LOGIN"));
2.843 + cmd.setInput (""); // NOI18N
2.844 + cmd.setTimeout (0);
2.845 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.846 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.847 + commands.add (cmd);
2.848
2.849 - cmd= new UserCommand ();
2.850 - cmd.setName ("WATCHERS"); // NOI18N
2.851 - cmd.setLabel (g("CMD_Watchers")); // NOI18N
2.852 - cmd.setExec (bu.getString ("EXEC_WATCHERS"+osName));
2.853 - cmd.setInput (""); // NOI18N
2.854 - cmd.setTimeout (90000);
2.855 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.856 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.857 - cmd.setDisplayOutput (true);
2.858 - commands.add (cmd);
2.859 + cmd= new UserCommand ();
2.860 + cmd.setName ("INIT"); // NOI18N
2.861 + cmd.setLabel (g("CMD_Init")); // NOI18N
2.862 + cmd.setExec (bu.getString ("EXEC_INIT"+osName));
2.863 + cmd.setInput (""); // NOI18N
2.864 + cmd.setTimeout (60000);
2.865 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.866 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.867 + commands.add (cmd);
2.868
2.869 - cmd= new UserCommand ();
2.870 - cmd.setName ("STATUS"); // NOI18N
2.871 - cmd.setLabel (g("CMD_Status")); // NOI18N
2.872 - cmd.setExec (bu.getString ("EXEC_STATUS"+osName));
2.873 - cmd.setInput (""); // NOI18N
2.874 - cmd.setTimeout (90000);
2.875 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.876 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.877 - cmd.setDisplayOutput (true);
2.878 - commands.add (cmd);
2.879 + D.deb("cmd 6 = "+cmd);
2.880
2.881 - cmd= new UserCommand ();
2.882 - cmd.setName ("LOG"); // NOI18N
2.883 - cmd.setLabel (g("CMD_Log")); // NOI18N
2.884 - cmd.setExec (bu.getString ("EXEC_LOG"+osName));
2.885 - cmd.setInput (""); // NOI18N
2.886 - cmd.setTimeout (90000);
2.887 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.888 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.889 - cmd.setDisplayOutput (true);
2.890 - commands.add (cmd);
2.891 + cmd= new UserCommand ();
2.892 + cmd.setName ("UPDATE"); // NOI18N
2.893 + cmd.setLabel (g("CMD_Update")); // NOI18N
2.894 + cmd.setExec (bu.getString ("EXEC_UPDATE"+osName));
2.895 + cmd.setInput (""); // NOI18N
2.896 + cmd.setTimeout (60000);
2.897 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.898 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.899 + cmd.setDoRefresh(true);
2.900 + commands.add (cmd);
2.901
2.902 - cmd= new UserCommand ();
2.903 - cmd.setName ("ADD"); // NOI18N
2.904 - cmd.setLabel (g("CMD_Add")); // NOI18N
2.905 - cmd.setExec (bu.getString ("EXEC_ADD"+osName));
2.906 - cmd.setInput (""); // NOI18N
2.907 - cmd.setTimeout (0);
2.908 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.909 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.910 - cmd.setDoRefresh(true);
2.911 - commands.add (cmd);
2.912 + /*
2.913 + cmd= new UserCommand ();
2.914 + cmd.setName ("UPDATE_MODULE"); // NOI18N
2.915 + cmd.setLabel (g("CMD_UpdateModule")+moduleName); // NOI18N
2.916 + cmd.setExec (bu.getString ("EXEC_UPDATE_MODULE"+osName));
2.917 + cmd.setInput (""); // NOI18N
2.918 + cmd.setTimeout (60000);
2.919 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.920 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.921 + cmd.setDoRefresh(true);
2.922 + commands.add (cmd);
2.923 + */
2.924
2.925 - cmd= new UserCommand ();
2.926 - cmd.setName ("IMPORT"); // NOI18N
2.927 - cmd.setLabel (g("CMD_Import")); // NOI18N
2.928 - cmd.setExec (bu.getString ("EXEC_IMPORT"+osName));
2.929 - cmd.setInput (""); // NOI18N
2.930 - cmd.setTimeout (0);
2.931 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.932 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.933 - cmd.setDisplayOutput (true);
2.934 - commands.add (cmd);
2.935 + cmd= new UserCommand ();
2.936 + cmd.setName ("COMMIT"); // NOI18N
2.937 + cmd.setLabel (g("CMD_Commit")); // NOI18N
2.938 + cmd.setExec (bu.getString ("EXEC_COMMIT"+osName));
2.939 + cmd.setInput (""); // NOI18N
2.940 + cmd.setTimeout (90000);
2.941 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.942 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.943 + cmd.setDoRefresh(true);
2.944 + commands.add (cmd);
2.945
2.946 - cmd= new UserCommand ();
2.947 - cmd.setName ("IMPORT_MODULE"); // NOI18N
2.948 - cmd.setLabel (g("CMD_ImportModule")+moduleName); // NOI18N
2.949 - cmd.setExec (bu.getString ("EXEC_IMPORT_MODULE"+osName));
2.950 - cmd.setInput (""); // NOI18N
2.951 - cmd.setTimeout (0);
2.952 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.953 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.954 - cmd.setDisplayOutput (true);
2.955 - commands.add (cmd);
2.956 + /*
2.957 + cmd= new UserCommand ();
2.958 + cmd.setName ("COMMIT_MODULE"); // NOI18N
2.959 + cmd.setLabel (g("CMD_CommitModule")+moduleName); // NOI18N
2.960 + cmd.setExec (bu.getString ("EXEC_COMMIT_MODULE"+osName));
2.961 + cmd.setInput (""); // NOI18N
2.962 + cmd.setTimeout (90000);
2.963 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.964 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.965 + cmd.setDoRefresh(true);
2.966 + commands.add (cmd);
2.967 + */
2.968
2.969 - cmd= new UserCommand ();
2.970 - cmd.setName ("CHECKOUT_REV"); // NOI18N
2.971 - cmd.setLabel (g("CMD_CheckOutRevision")); // NOI18N
2.972 - cmd.setExec (bu.getString ("EXEC_CHECKOUT_REV"+osName));
2.973 - cmd.setInput (""); // NOI18N
2.974 - cmd.setTimeout (0);
2.975 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.976 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.977 - cmd.setDisplayOutput (true);
2.978 - cmd.setDoRefresh(true);
2.979 - commands.add (cmd);
2.980 + cmd= new UserCommand ();
2.981 + cmd.setName ("REMOVE"); // NOI18N
2.982 + cmd.setLabel (g("CMD_Remove")); // NOI18N
2.983 + cmd.setExec (bu.getString ("EXEC_REMOVE"+osName));
2.984 + cmd.setInput (""); // NOI18N
2.985 + cmd.setTimeout (90000);
2.986 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.987 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.988 + cmd.setDoRefresh(true);
2.989 + //cmd.setConfirmationMsg(bu.getString("VAR_REMOVE_MSG"));
2.990 + commands.add (cmd);
2.991
2.992 - cmd= new UserCommand ();
2.993 - cmd.setName ("UPDATE_REV"); // NOI18N
2.994 - cmd.setLabel (g("CMD_UpdateRevision")); // NOI18N
2.995 - cmd.setExec (bu.getString ("EXEC_UPDATE_REV"+osName));
2.996 - cmd.setInput (""); // NOI18N
2.997 - cmd.setTimeout (0);
2.998 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.999 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1000 - cmd.setDoRefresh(true);
2.1001 - commands.add (cmd);
2.1002 + cmd= new UserCommand ();
2.1003 + cmd.setName ("LOCK"); // NOI18N
2.1004 + cmd.setLabel (g("CMD_Lock")); // NOI18N
2.1005 + cmd.setExec (bu.getString ("EXEC_LOCK"+osName));
2.1006 + cmd.setInput (""); // NOI18N
2.1007 + cmd.setTimeout (90000);
2.1008 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1009 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1010 + cmd.setDisplayOutput (false);
2.1011 + commands.add (cmd);
2.1012
2.1013 - cmd= new UserCommand ();
2.1014 - cmd.setName ("COMMIT_REV"); // NOI18N
2.1015 - cmd.setLabel (g("CMD_CommitToBranch")); // NOI18N
2.1016 - cmd.setExec (bu.getString ("EXEC_COMMIT_REV"+osName));
2.1017 - cmd.setInput (""); // NOI18N
2.1018 - cmd.setTimeout (0);
2.1019 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.1020 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1021 - cmd.setDoRefresh(true);
2.1022 - commands.add (cmd);
2.1023 + cmd= new UserCommand ();
2.1024 + cmd.setName ("UNLOCK1"); // NOI18N
2.1025 + cmd.setLabel (g("CMD_Unlock")); // NOI18N
2.1026 + cmd.setExec (bu.getString ("EXEC_UNLOCK"+osName));
2.1027 + cmd.setInput (""); // NOI18N
2.1028 + cmd.setTimeout (90000);
2.1029 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1030 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1031 + cmd.setDisplayOutput (false);
2.1032 + commands.add (cmd);
2.1033
2.1034 - cmd= new UserCommand ();
2.1035 - cmd.setName ("MERGE"); // NOI18N
2.1036 - cmd.setLabel (g("CMD_MergeWithBranch")); // NOI18N
2.1037 - cmd.setExec (bu.getString ("EXEC_MERGE"+osName));
2.1038 - cmd.setInput (""); // NOI18N
2.1039 - cmd.setTimeout (0);
2.1040 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.1041 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1042 - cmd.setDoRefresh(true);
2.1043 - commands.add (cmd);
2.1044 + cmd= new UserCommand ();
2.1045 + cmd.setName ("EDIT"); // NOI18N
2.1046 + cmd.setLabel (g("CMD_Edit")); // NOI18N
2.1047 + cmd.setExec (bu.getString ("EXEC_EDIT"+osName));
2.1048 + cmd.setInput (""); // NOI18N
2.1049 + cmd.setTimeout (90000);
2.1050 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1051 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1052 + cmd.setDisplayOutput (false);
2.1053 + commands.add (cmd);
2.1054
2.1055 - cmd= new UserCommand ();
2.1056 - cmd.setName ("REM_STICKY"); // NOI18N
2.1057 - cmd.setLabel (g("CMD_RemoveStickyTag")); // NOI18N
2.1058 - cmd.setExec (bu.getString ("EXEC_REM_STICKY"+osName));
2.1059 - cmd.setInput (""); // NOI18N
2.1060 - cmd.setTimeout (90000);
2.1061 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.1062 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1063 - commands.add (cmd);
2.1064 + cmd= new UserCommand ();
2.1065 + cmd.setName ("UNEDIT"); // NOI18N
2.1066 + cmd.setLabel (g("CMD_Unedit")); // NOI18N
2.1067 + cmd.setExec (bu.getString ("EXEC_UNEDIT"+osName));
2.1068 + cmd.setInput (""); // NOI18N
2.1069 + cmd.setTimeout (90000);
2.1070 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1071 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1072 + cmd.setDisplayOutput (false);
2.1073 + commands.add (cmd);
2.1074
2.1075 -
2.1076 - cmd= new UserCommand ();
2.1077 - cmd.setName ("DIFF"); // NOI18N
2.1078 - cmd.setLabel (g("CMD_Diff")); // NOI18N
2.1079 - cmd.setExec (bu.getString ("EXEC_DIFF"));
2.1080 - cmd.setInput (""); // NOI18N
2.1081 - cmd.setTimeout (0);
2.1082 - cmd.setDataRegex ("(^[0-9]+(,[0-9]+|)[d][0-9]+$)|(^[0-9]+(,[0-9]+|)[c][0-9]+(,[0-9]+|)$)|(^[0-9]+[a][0-9]+(,[0-9]+|)$)"); // NOI18N
2.1083 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1084 - commands.add (cmd);
2.1085 -
2.1086 - cmd= new UserCommand ();
2.1087 - cmd.setName ("BRANCHES"); // NOI18N
2.1088 - cmd.setLabel (g("CMD_ViewBranches")); // NOI18N
2.1089 - cmd.setExec (bu.getString ("EXEC_BRANCHES"));
2.1090 - cmd.setInput (""); // NOI18N
2.1091 - cmd.setTimeout (0);
2.1092 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.1093 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1094 - commands.add (cmd);
2.1095 -
2.1096 - cmd= new UserCommand ();
2.1097 - cmd.setName ("TAGS"); // NOI18N
2.1098 - cmd.setLabel (g("CMD_AddTag")); // NOI18N
2.1099 - cmd.setExec (bu.getString ("EXEC_TAGS"));
2.1100 - cmd.setInput (""); // NOI18N
2.1101 - cmd.setTimeout (0);
2.1102 - cmd.setDataRegex ("(.*$)"); // NOI18N
2.1103 - cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1104 - commands.add (cmd);
2.1105 -
2.1106 - D.deb("cmd last = "+cmd);
2.1107 + cmd= new UserCommand ();
2.1108 + cmd.setName ("EDITORS"); // NOI18N
2.1109 + cmd.setLabel (g("CMD_Editors")); // NOI18N
2.1110 + cmd.setExec (bu.getString ("EXEC_EDITORS"+osName));
2.1111 + cmd.setInput (""); // NOI18N
2.1112 + cmd.setTimeout (90000);
2.1113 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1114 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1115 + cmd.setDisplayOutput (true);
2.1116 + commands.add (cmd);
2.1117
2.1118 - setCommands (commands);
2.1119 - D.deb("initCommands done.");
2.1120 - }
2.1121 -
2.1122 - public Hashtable getVariablesByName() {
2.1123 - return variablesByName;
2.1124 - }
2.1125 + cmd= new UserCommand ();
2.1126 + cmd.setName ("WATCH_ON"); // NOI18N
2.1127 + cmd.setLabel (g("CMD_WatchOn")); // NOI18N
2.1128 + cmd.setExec (bu.getString ("EXEC_WATCH_ON"+osName));
2.1129 + cmd.setInput (""); // NOI18N
2.1130 + cmd.setTimeout (90000);
2.1131 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1132 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1133 + cmd.setDisplayOutput (false);
2.1134 + commands.add (cmd);
2.1135
2.1136 + cmd= new UserCommand ();
2.1137 + cmd.setName ("WATCH_OFF"); // NOI18N
2.1138 + cmd.setLabel (g("CMD_WatchOff")); // NOI18N
2.1139 + cmd.setExec (bu.getString ("EXEC_WATCH_OFF"+osName));
2.1140 + cmd.setInput (""); // NOI18N
2.1141 + cmd.setTimeout (90000);
2.1142 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1143 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1144 + cmd.setDisplayOutput (false);
2.1145 + commands.add (cmd);
2.1146
2.1147 - public FilenameFilter getLocalFileFilter() {
2.1148 - return new FilenameFilter() {
2.1149 - public boolean accept(File dir, String name) {
2.1150 - return !name.equalsIgnoreCase("CVS"); // NOI18N
2.1151 - }
2.1152 - };
2.1153 - }
2.1154 + cmd= new UserCommand ();
2.1155 + cmd.setName ("WATCH_ADD"); // NOI18N
2.1156 + cmd.setLabel (g("CMD_WatchSet")); // NOI18N
2.1157 + cmd.setExec (bu.getString ("EXEC_WATCH_ADD"+osName));
2.1158 + cmd.setInput (""); // NOI18N
2.1159 + cmd.setTimeout (90000);
2.1160 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1161 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1162 + cmd.setDisplayOutput (false);
2.1163 + commands.add (cmd);
2.1164
2.1165 - public void propertyChange (PropertyChangeEvent evt) {
2.1166 - if (evt.getPropertyName() != FileSystem.PROP_VALID) return;
2.1167 - if (isValid()) {
2.1168 - D.deb("Filesystem added to the repository, setting refresh time to "+refreshTimeToSet); // NOI18N
2.1169 - setRefreshTime(refreshTimeToSet);
2.1170 - D.deb("calling WARN");
2.1171 - warnDirectoriesDoNotExists();
2.1172 - D.deb("calling WARN finished.");
2.1173 - } else {
2.1174 - D.deb("Filesystem is not valid any more, setting refresh time to 0"); // NOI18N
2.1175 - setRefreshTime(0);
2.1176 + cmd= new UserCommand ();
2.1177 + cmd.setName ("WATCHERS"); // NOI18N
2.1178 + cmd.setLabel (g("CMD_Watchers")); // NOI18N
2.1179 + cmd.setExec (bu.getString ("EXEC_WATCHERS"+osName));
2.1180 + cmd.setInput (""); // NOI18N
2.1181 + cmd.setTimeout (90000);
2.1182 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1183 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1184 + cmd.setDisplayOutput (true);
2.1185 + commands.add (cmd);
2.1186 +
2.1187 + cmd= new UserCommand ();
2.1188 + cmd.setName ("STATUS"); // NOI18N
2.1189 + cmd.setLabel (g("CMD_Status")); // NOI18N
2.1190 + cmd.setExec (bu.getString ("EXEC_STATUS"+osName));
2.1191 + cmd.setInput (""); // NOI18N
2.1192 + cmd.setTimeout (90000);
2.1193 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1194 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1195 + cmd.setDisplayOutput (true);
2.1196 + commands.add (cmd);
2.1197 +
2.1198 + cmd= new UserCommand ();
2.1199 + cmd.setName ("LOG"); // NOI18N
2.1200 + cmd.setLabel (g("CMD_Log")); // NOI18N
2.1201 + cmd.setExec (bu.getString ("EXEC_LOG"+osName));
2.1202 + cmd.setInput (""); // NOI18N
2.1203 + cmd.setTimeout (90000);
2.1204 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1205 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1206 + cmd.setDisplayOutput (true);
2.1207 + commands.add (cmd);
2.1208 +
2.1209 + cmd= new UserCommand ();
2.1210 + cmd.setName ("ADD"); // NOI18N
2.1211 + cmd.setLabel (g("CMD_Add")); // NOI18N
2.1212 + cmd.setExec (bu.getString ("EXEC_ADD"+osName));
2.1213 + cmd.setInput (""); // NOI18N
2.1214 + cmd.setTimeout (0);
2.1215 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1216 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1217 + cmd.setDoRefresh(true);
2.1218 + commands.add (cmd);
2.1219 +
2.1220 + cmd= new UserCommand ();
2.1221 + cmd.setName ("IMPORT"); // NOI18N
2.1222 + cmd.setLabel (g("CMD_Import")); // NOI18N
2.1223 + cmd.setExec (bu.getString ("EXEC_IMPORT"+osName));
2.1224 + cmd.setInput (""); // NOI18N
2.1225 + cmd.setTimeout (0);
2.1226 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1227 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1228 + cmd.setDisplayOutput (true);
2.1229 + commands.add (cmd);
2.1230 +
2.1231 + cmd= new UserCommand ();
2.1232 + cmd.setName ("IMPORT_MODULE"); // NOI18N
2.1233 + cmd.setLabel (g("CMD_ImportModule")+moduleName); // NOI18N
2.1234 + cmd.setExec (bu.getString ("EXEC_IMPORT_MODULE"+osName));
2.1235 + cmd.setInput (""); // NOI18N
2.1236 + cmd.setTimeout (0);
2.1237 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1238 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1239 + cmd.setDisplayOutput (true);
2.1240 + commands.add (cmd);
2.1241 +
2.1242 + cmd= new UserCommand ();
2.1243 + cmd.setName ("CHECKOUT_REV"); // NOI18N
2.1244 + cmd.setLabel (g("CMD_CheckOutRevision")); // NOI18N
2.1245 + cmd.setExec (bu.getString ("EXEC_CHECKOUT_REV"+osName));
2.1246 + cmd.setInput (""); // NOI18N
2.1247 + cmd.setTimeout (0);
2.1248 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1249 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1250 + cmd.setDisplayOutput (true);
2.1251 + cmd.setDoRefresh(true);
2.1252 + commands.add (cmd);
2.1253 +
2.1254 + cmd= new UserCommand ();
2.1255 + cmd.setName ("UPDATE_REV"); // NOI18N
2.1256 + cmd.setLabel (g("CMD_UpdateRevision")); // NOI18N
2.1257 + cmd.setExec (bu.getString ("EXEC_UPDATE_REV"+osName));
2.1258 + cmd.setInput (""); // NOI18N
2.1259 + cmd.setTimeout (0);
2.1260 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1261 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1262 + cmd.setDoRefresh(true);
2.1263 + commands.add (cmd);
2.1264 +
2.1265 + cmd= new UserCommand ();
2.1266 + cmd.setName ("COMMIT_REV"); // NOI18N
2.1267 + cmd.setLabel (g("CMD_CommitToBranch")); // NOI18N
2.1268 + cmd.setExec (bu.getString ("EXEC_COMMIT_REV"+osName));
2.1269 + cmd.setInput (""); // NOI18N
2.1270 + cmd.setTimeout (0);
2.1271 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1272 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1273 + cmd.setDoRefresh(true);
2.1274 + commands.add (cmd);
2.1275 +
2.1276 + cmd= new UserCommand ();
2.1277 + cmd.setName ("MERGE"); // NOI18N
2.1278 + cmd.setLabel (g("CMD_MergeWithBranch")); // NOI18N
2.1279 + cmd.setExec (bu.getString ("EXEC_MERGE"+osName));
2.1280 + cmd.setInput (""); // NOI18N
2.1281 + cmd.setTimeout (0);
2.1282 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1283 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1284 + cmd.setDoRefresh(true);
2.1285 + commands.add (cmd);
2.1286 +
2.1287 + cmd= new UserCommand ();
2.1288 + cmd.setName ("REM_STICKY"); // NOI18N
2.1289 + cmd.setLabel (g("CMD_RemoveStickyTag")); // NOI18N
2.1290 + cmd.setExec (bu.getString ("EXEC_REM_STICKY"+osName));
2.1291 + cmd.setInput (""); // NOI18N
2.1292 + cmd.setTimeout (90000);
2.1293 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1294 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1295 + commands.add (cmd);
2.1296 +
2.1297 +
2.1298 + cmd= new UserCommand ();
2.1299 + cmd.setName ("DIFF"); // NOI18N
2.1300 + cmd.setLabel (g("CMD_Diff")); // NOI18N
2.1301 + cmd.setExec (bu.getString ("EXEC_DIFF"));
2.1302 + cmd.setInput (""); // NOI18N
2.1303 + cmd.setTimeout (0);
2.1304 + cmd.setDataRegex ("(^[0-9]+(,[0-9]+|)[d][0-9]+$)|(^[0-9]+(,[0-9]+|)[c][0-9]+(,[0-9]+|)$)|(^[0-9]+[a][0-9]+(,[0-9]+|)$)"); // NOI18N
2.1305 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1306 + commands.add (cmd);
2.1307 +
2.1308 + cmd= new UserCommand ();
2.1309 + cmd.setName ("BRANCHES"); // NOI18N
2.1310 + cmd.setLabel (g("CMD_ViewBranches")); // NOI18N
2.1311 + cmd.setExec (bu.getString ("EXEC_BRANCHES"));
2.1312 + cmd.setInput (""); // NOI18N
2.1313 + cmd.setTimeout (0);
2.1314 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1315 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1316 + commands.add (cmd);
2.1317 +
2.1318 + cmd= new UserCommand ();
2.1319 + cmd.setName ("TAGS"); // NOI18N
2.1320 + cmd.setLabel (g("CMD_AddTag")); // NOI18N
2.1321 + cmd.setExec (bu.getString ("EXEC_TAGS"));
2.1322 + cmd.setInput (""); // NOI18N
2.1323 + cmd.setTimeout (0);
2.1324 + cmd.setDataRegex ("(.*$)"); // NOI18N
2.1325 + cmd.setErrorRegex ("(.*$)"); // NOI18N
2.1326 + commands.add (cmd);
2.1327 +
2.1328 + D.deb("cmd last = "+cmd);
2.1329 +
2.1330 + setCommands (commands);
2.1331 + D.deb("initCommands done.");
2.1332 }
2.1333 - }
2.1334 -
2.1335 - protected String g(String s) {
2.1336 - D.deb("getting: "+s);
2.1337 - return NbBundle.getBundle
2.1338 - ("org.netbeans.modules.vcs.cmdline.BundleCVS").getString (s);
2.1339 - }
2.1340 -
2.1341 +
2.1342 + public Hashtable getVariablesByName() {
2.1343 + return variablesByName;
2.1344 + }
2.1345 +
2.1346 +
2.1347 + public FilenameFilter getLocalFileFilter() {
2.1348 + return new FilenameFilter() {
2.1349 + public boolean accept(File dir, String name) {
2.1350 + return !name.equalsIgnoreCase("CVS"); // NOI18N
2.1351 + }
2.1352 + };
2.1353 + }
2.1354 +
2.1355 + public void propertyChange (PropertyChangeEvent evt) {
2.1356 + if (evt.getPropertyName() != FileSystem.PROP_VALID) return;
2.1357 + if (isValid()) {
2.1358 + D.deb("Filesystem added to the repository, setting refresh time to "+refreshTimeToSet); // NOI18N
2.1359 + setRefreshTime(refreshTimeToSet);
2.1360 + D.deb("calling WARN");
2.1361 + warnDirectoriesDoNotExists();
2.1362 + D.deb("calling WARN finished.");
2.1363 + } else {
2.1364 + D.deb("Filesystem is not valid any more, setting refresh time to 0"); // NOI18N
2.1365 + setRefreshTime(0);
2.1366 + }
2.1367 + }
2.1368 +
2.1369 + protected String g(String s) {
2.1370 + D.deb("getting: "+s);
2.1371 + return NbBundle.getBundle
2.1372 + ("org.netbeans.modules.vcs.cmdline.BundleCVS").getString (s);
2.1373 + }
2.1374 +
2.1375
2.1376 }
2.1377
3.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsFileSystemBeanInfo.java Tue Apr 25 12:55:38 2000 +0000
3.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/CvsFileSystemBeanInfo.java Tue Apr 25 14:04:53 2000 +0000
3.3 @@ -26,78 +26,78 @@
3.4
3.5 //-------------------------------------------
3.6 public class CvsFileSystemBeanInfo extends SimpleBeanInfo {
3.7 - private static Debug E=new Debug("CvsFileSystemBeanInfo", true); // NOI18N
3.8 - private static Debug D=E;
3.9 + private static Debug E=new Debug("CvsFileSystemBeanInfo", true); // NOI18N
3.10 + private static Debug D=E;
3.11
3.12 - /** Array of property descriptors. */
3.13 - private static PropertyDescriptor[] desc;
3.14 + /** Array of property descriptors. */
3.15 + private static PropertyDescriptor[] desc;
3.16
3.17 - /** Icon for VCS filesystem. */
3.18 - private static java.awt.Image icon;
3.19 - private static java.awt.Image icon32;
3.20 + /** Icon for VCS filesystem. */
3.21 + private static java.awt.Image icon;
3.22 + private static java.awt.Image icon32;
3.23
3.24 - static {
3.25 - PropertyDescriptor rootDirectory=null;
3.26 - PropertyDescriptor debug=null;
3.27 - PropertyDescriptor lock=null;
3.28 - PropertyDescriptor lockPrompt=null;
3.29 + static {
3.30 + PropertyDescriptor rootDirectory=null;
3.31 + PropertyDescriptor debug=null;
3.32 + PropertyDescriptor lock=null;
3.33 + PropertyDescriptor lockPrompt=null;
3.34
3.35 - try {
3.36 - rootDirectory=new PropertyDescriptor
3.37 - ("rootDirectory", CvsFileSystem.class, "getRootDirectory", "setRootDirectory"); // NOI18N
3.38 - debug=new PropertyDescriptor
3.39 - ("debug",CvsFileSystem.class,"getDebug","setDebug"); // NOI18N
3.40 - lock=new PropertyDescriptor
3.41 - ("lock",CvsFileSystem.class,"isLockFilesOn","setLockFilesOn"); // NOI18N
3.42 - lockPrompt=new PropertyDescriptor
3.43 - ("lockPrompt",CvsFileSystem.class,"isPromptForLockOn","setPromptForLockOn"); // NOI18N
3.44 -
3.45 + try {
3.46 + rootDirectory=new PropertyDescriptor
3.47 + ("rootDirectory", CvsFileSystem.class, "getRootDirectory", "setRootDirectory"); // NOI18N
3.48 + debug=new PropertyDescriptor
3.49 + ("debug",CvsFileSystem.class,"getDebug","setDebug"); // NOI18N
3.50 + lock=new PropertyDescriptor
3.51 + ("lock",CvsFileSystem.class,"isLockFilesOn","setLockFilesOn"); // NOI18N
3.52 + lockPrompt=new PropertyDescriptor
3.53 + ("lockPrompt",CvsFileSystem.class,"isPromptForLockOn","setPromptForLockOn"); // NOI18N
3.54
3.55 - desc = new PropertyDescriptor[] {
3.56 - rootDirectory, debug, lock, lockPrompt
3.57 - };
3.58
3.59 - ResourceBundle bundle = NbBundle.getBundle
3.60 - ("org.netbeans.modules.vcs.cmdline.Bundle"); // NOI18N
3.61 - rootDirectory.setDisplayName (bundle.getString("PROP_rootDirectory"));
3.62 - rootDirectory.setShortDescription (bundle.getString("HINT_rootDirectory"));
3.63 - debug.setDisplayName (bundle.getString("PROP_debug"));
3.64 - debug.setShortDescription (bundle.getString("HINT_debug"));
3.65 - lock.setDisplayName (bundle.getString("PROP_lock"));
3.66 - lock.setShortDescription (bundle.getString("HINT_lock"));
3.67 - lockPrompt.setDisplayName (bundle.getString("PROP_lockPrompt"));
3.68 - lockPrompt.setShortDescription (bundle.getString("HINT_lockPrompt"));
3.69 + desc = new PropertyDescriptor[] {
3.70 + rootDirectory, debug, lock, lockPrompt
3.71 + };
3.72
3.73 - } catch (IntrospectionException ex) {
3.74 - ex.printStackTrace ();
3.75 + ResourceBundle bundle = NbBundle.getBundle
3.76 + ("org.netbeans.modules.vcs.cmdline.Bundle"); // NOI18N
3.77 + rootDirectory.setDisplayName (bundle.getString("PROP_rootDirectory"));
3.78 + rootDirectory.setShortDescription (bundle.getString("HINT_rootDirectory"));
3.79 + debug.setDisplayName (bundle.getString("PROP_debug"));
3.80 + debug.setShortDescription (bundle.getString("HINT_debug"));
3.81 + lock.setDisplayName (bundle.getString("PROP_lock"));
3.82 + lock.setShortDescription (bundle.getString("HINT_lock"));
3.83 + lockPrompt.setDisplayName (bundle.getString("PROP_lockPrompt"));
3.84 + lockPrompt.setShortDescription (bundle.getString("HINT_lockPrompt"));
3.85 +
3.86 + } catch (IntrospectionException ex) {
3.87 + ex.printStackTrace ();
3.88 + }
3.89 }
3.90 - }
3.91
3.92 - /* Provides the VCSFileSystem's icon */
3.93 - public java.awt.Image getIcon(int type) {
3.94 - if (icon == null) {
3.95 - icon = loadImage("/org/netbeans/modules/vcs/cmdline/cvs.gif"); // NOI18N
3.96 - icon32 = icon;
3.97 + /* Provides the VCSFileSystem's icon */
3.98 + public java.awt.Image getIcon(int type) {
3.99 + if (icon == null) {
3.100 + icon = loadImage("/org/netbeans/modules/vcs/cmdline/cvs.gif"); // NOI18N
3.101 + icon32 = icon;
3.102 + }
3.103 + if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16))
3.104 + return icon;
3.105 + else
3.106 + return icon32;
3.107 }
3.108 - if ((type == java.beans.BeanInfo.ICON_COLOR_16x16) || (type == java.beans.BeanInfo.ICON_MONO_16x16))
3.109 - return icon;
3.110 - else
3.111 - return icon32;
3.112 - }
3.113
3.114 - /* Descriptor of valid properties
3.115 - * @return array of properties
3.116 - */
3.117 - public PropertyDescriptor[] getPropertyDescriptors () {
3.118 - return desc;
3.119 - }
3.120 + /* Descriptor of valid properties
3.121 + * @return array of properties
3.122 + */
3.123 + public PropertyDescriptor[] getPropertyDescriptors () {
3.124 + return desc;
3.125 + }
3.126
3.127
3.128 - public BeanDescriptor getBeanDescriptor(){
3.129 - D.deb("getBeanDescriptor()"); // NOI18N
3.130 - return new BeanDescriptor(CvsFileSystem.class, org.netbeans.modules.vcs.cmdline.CvsCustomizer.class);
3.131 - }
3.132 -
3.133 + public BeanDescriptor getBeanDescriptor(){
3.134 + D.deb("getBeanDescriptor()"); // NOI18N
3.135 + return new BeanDescriptor(CvsFileSystem.class, org.netbeans.modules.vcs.cmdline.CvsCustomizer.class);
3.136 + }
3.137 +
3.138 }
3.139
3.140 /*
4.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsBranchFrame.java Tue Apr 25 12:55:38 2000 +0000
4.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsBranchFrame.java Tue Apr 25 14:04:53 2000 +0000
4.3 @@ -18,383 +18,383 @@
4.4
4.5 import org.openide.util.HelpCtx;
4.6
4.7 -/**
4.8 +/**
4.9 *
4.10 * @author Martin Entlicher
4.11 * @version
4.12 */
4.13 public class CvsBranchFrame extends javax.swing.JFrame {
4.14
4.15 - static final long serialVersionUID =7007193175692956307L;
4.16 - /** Creates new form CvsBranchFrame */
4.17 - public CvsBranchFrame(CvsLogInfo logInfo, CvsBranches branches) {
4.18 - this.logInfo = logInfo;
4.19 - this.branches = branches;
4.20 - initComponents ();
4.21 - initBranchDraw ();
4.22 - setTitle(org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.title"));
4.23 - pack ();
4.24 - HelpCtx.setHelpIDString (getRootPane (), CvsBranchFrame.class.getName ());
4.25 - }
4.26 + static final long serialVersionUID =7007193175692956307L;
4.27 + /** Creates new form CvsBranchFrame */
4.28 + public CvsBranchFrame(CvsLogInfo logInfo, CvsBranches branches) {
4.29 + this.logInfo = logInfo;
4.30 + this.branches = branches;
4.31 + initComponents ();
4.32 + initBranchDraw ();
4.33 + setTitle(org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.title"));
4.34 + pack ();
4.35 + HelpCtx.setHelpIDString (getRootPane (), CvsBranchFrame.class.getName ());
4.36 + }
4.37
4.38 - /** This method is called from within the constructor to
4.39 - * initialize the form.
4.40 - * WARNING: Do NOT modify this code. The content of this method is
4.41 - * always regenerated by the FormEditor.
4.42 - */
4.43 - private void initComponents () {//GEN-BEGIN:initComponents
4.44 - headPanel = new javax.swing.JPanel ();
4.45 - infoPanel1 = new javax.swing.JPanel ();
4.46 - revALabel = new javax.swing.JLabel ();
4.47 - revATextField = new javax.swing.JTextField ();
4.48 - infoPanel2 = new javax.swing.JPanel ();
4.49 - revBLabel = new javax.swing.JLabel ();
4.50 - revBTextField = new javax.swing.JTextField ();
4.51 - branchPanel = new javax.swing.JPanel ();
4.52 - branchScrollPane = new javax.swing.JScrollPane ();
4.53 - buttonPanel = new javax.swing.JPanel ();
4.54 - diffButton = new javax.swing.JButton ();
4.55 - closeButton = new javax.swing.JButton ();
4.56 - getContentPane ().setLayout (new java.awt.GridBagLayout ());
4.57 - java.awt.GridBagConstraints gridBagConstraints1;
4.58 - addWindowListener (new java.awt.event.WindowAdapter () {
4.59 - public void windowClosing (java.awt.event.WindowEvent evt) {
4.60 - exitForm (evt);
4.61 - }
4.62 + /** This method is called from within the constructor to
4.63 + * initialize the form.
4.64 + * WARNING: Do NOT modify this code. The content of this method is
4.65 + * always regenerated by the FormEditor.
4.66 + */
4.67 + private void initComponents () {//GEN-BEGIN:initComponents
4.68 + headPanel = new javax.swing.JPanel ();
4.69 + infoPanel1 = new javax.swing.JPanel ();
4.70 + revALabel = new javax.swing.JLabel ();
4.71 + revATextField = new javax.swing.JTextField ();
4.72 + infoPanel2 = new javax.swing.JPanel ();
4.73 + revBLabel = new javax.swing.JLabel ();
4.74 + revBTextField = new javax.swing.JTextField ();
4.75 + branchPanel = new javax.swing.JPanel ();
4.76 + branchScrollPane = new javax.swing.JScrollPane ();
4.77 + buttonPanel = new javax.swing.JPanel ();
4.78 + diffButton = new javax.swing.JButton ();
4.79 + closeButton = new javax.swing.JButton ();
4.80 + getContentPane ().setLayout (new java.awt.GridBagLayout ());
4.81 + java.awt.GridBagConstraints gridBagConstraints1;
4.82 + addWindowListener (new java.awt.event.WindowAdapter () {
4.83 + public void windowClosing (java.awt.event.WindowEvent evt) {
4.84 + exitForm (evt);
4.85 + }
4.86 + }
4.87 + );
4.88 +
4.89 + headPanel.setLayout (new java.awt.GridBagLayout ());
4.90 + java.awt.GridBagConstraints gridBagConstraints2;
4.91 +
4.92 +
4.93 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.94 + gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.95 + gridBagConstraints1.weightx = 1.0;
4.96 + getContentPane ().add (headPanel, gridBagConstraints1);
4.97 +
4.98 + infoPanel1.setLayout (new java.awt.GridBagLayout ());
4.99 + java.awt.GridBagConstraints gridBagConstraints3;
4.100 +
4.101 + revALabel.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revALabel.text"));
4.102 +
4.103 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
4.104 + gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
4.105 + infoPanel1.add (revALabel, gridBagConstraints3);
4.106 +
4.107 + revATextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revATextField.toolTipText"));
4.108 + revATextField.setEditable (false);
4.109 +
4.110 + gridBagConstraints3 = new java.awt.GridBagConstraints ();
4.111 + gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.112 + gridBagConstraints3.insets = new java.awt.Insets (0, 8, 0, 0);
4.113 + gridBagConstraints3.weightx = 1.0;
4.114 + infoPanel1.add (revATextField, gridBagConstraints3);
4.115 +
4.116 +
4.117 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.118 + gridBagConstraints1.gridy = 1;
4.119 + gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.120 + gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
4.121 + gridBagConstraints1.weightx = 1.0;
4.122 + getContentPane ().add (infoPanel1, gridBagConstraints1);
4.123 +
4.124 + infoPanel2.setLayout (new java.awt.GridBagLayout ());
4.125 + java.awt.GridBagConstraints gridBagConstraints4;
4.126 +
4.127 + revBLabel.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revBLabel.text"));
4.128 +
4.129 + gridBagConstraints4 = new java.awt.GridBagConstraints ();
4.130 + gridBagConstraints4.anchor = java.awt.GridBagConstraints.WEST;
4.131 + infoPanel2.add (revBLabel, gridBagConstraints4);
4.132 +
4.133 + revBTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revBTextField.toolTipText"));
4.134 + revBTextField.setEditable (false);
4.135 +
4.136 + gridBagConstraints4 = new java.awt.GridBagConstraints ();
4.137 + gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.138 + gridBagConstraints4.insets = new java.awt.Insets (0, 8, 0, 0);
4.139 + gridBagConstraints4.weightx = 1.0;
4.140 + infoPanel2.add (revBTextField, gridBagConstraints4);
4.141 +
4.142 +
4.143 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.144 + gridBagConstraints1.gridy = 2;
4.145 + gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.146 + gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.147 + gridBagConstraints1.weightx = 1.0;
4.148 + getContentPane ().add (infoPanel2, gridBagConstraints1);
4.149 +
4.150 + branchPanel.setLayout (new java.awt.GridBagLayout ());
4.151 + java.awt.GridBagConstraints gridBagConstraints5;
4.152 + branchPanel.setPreferredSize (new java.awt.Dimension(300, 200));
4.153 +
4.154 + branchScrollPane.setPreferredSize (new java.awt.Dimension(200, 200));
4.155 +
4.156 + gridBagConstraints5 = new java.awt.GridBagConstraints ();
4.157 + gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH;
4.158 + gridBagConstraints5.weightx = 1.0;
4.159 + gridBagConstraints5.weighty = 1.0;
4.160 + branchPanel.add (branchScrollPane, gridBagConstraints5);
4.161 +
4.162 +
4.163 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.164 + gridBagConstraints1.gridy = 3;
4.165 + gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
4.166 + gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.167 + gridBagConstraints1.weightx = 1.0;
4.168 + gridBagConstraints1.weighty = 1.0;
4.169 + getContentPane ().add (branchPanel, gridBagConstraints1);
4.170 +
4.171 + buttonPanel.setLayout (new java.awt.GridBagLayout ());
4.172 + java.awt.GridBagConstraints gridBagConstraints6;
4.173 +
4.174 + diffButton.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.diffButton.text"));
4.175 + diffButton.addActionListener (new java.awt.event.ActionListener () {
4.176 + public void actionPerformed (java.awt.event.ActionEvent evt) {
4.177 + diffButtonActionPerformed (evt);
4.178 + }
4.179 + }
4.180 + );
4.181 +
4.182 + gridBagConstraints6 = new java.awt.GridBagConstraints ();
4.183 + gridBagConstraints6.weightx = 1.0;
4.184 + buttonPanel.add (diffButton, gridBagConstraints6);
4.185 +
4.186 + closeButton.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.closeButton.text"));
4.187 + closeButton.addActionListener (new java.awt.event.ActionListener () {
4.188 + public void actionPerformed (java.awt.event.ActionEvent evt) {
4.189 + closeButtonActionPerformed (evt);
4.190 + }
4.191 + }
4.192 + );
4.193 +
4.194 + gridBagConstraints6 = new java.awt.GridBagConstraints ();
4.195 + gridBagConstraints6.weightx = 1.0;
4.196 + buttonPanel.add (closeButton, gridBagConstraints6);
4.197 +
4.198 +
4.199 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.200 + gridBagConstraints1.gridy = 4;
4.201 + gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.202 + gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.203 + gridBagConstraints1.weightx = 1.0;
4.204 + getContentPane ().add (buttonPanel, gridBagConstraints1);
4.205 +
4.206 + }//GEN-END:initComponents
4.207 +
4.208 + private void closeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
4.209 + // Add your handling code here:
4.210 + exitForm(null);
4.211 + }//GEN-LAST:event_closeButtonActionPerformed
4.212 +
4.213 + private void diffButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_diffButtonActionPerformed
4.214 + // Add your handling code here:
4.215 + String revision1 = revATextField.getText();
4.216 + String revision2 = revBTextField.getText();
4.217 + if (revision1.length() == 0) revision1 = null;
4.218 + if (revision2.length() == 0) revision2 = null;
4.219 + branches.doDiff(revision1, revision2);
4.220 + }//GEN-LAST:event_diffButtonActionPerformed
4.221 +
4.222 + /** Exit the Application */
4.223 + private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
4.224 + branches.close();
4.225 + dispose();
4.226 + }//GEN-LAST:event_exitForm
4.227 +
4.228 + private void initBranchDraw() {
4.229 + branchDraw = new BranchDraw();
4.230 + branchScrollPane.setViewportView(branchDraw);
4.231 + branchDraw.addMouseListener(new BranchMouseListener());
4.232 }
4.233 - );
4.234
4.235 - headPanel.setLayout (new java.awt.GridBagLayout ());
4.236 - java.awt.GridBagConstraints gridBagConstraints2;
4.237 + public void setPositions(int graphWidth, int graphHeight, Hashtable branchPositions) {
4.238 + this.graphWidth = graphWidth;
4.239 + this.graphHeight = graphHeight;
4.240 + this.branchPositions = branchPositions;
4.241 + }
4.242
4.243 + private String getRevision(int xPos, int yPos, CvsRevisionGraphItem item) {
4.244 + if (item == null) return null;
4.245 + if (item.getXPos() == xPos && item.getYPos() == yPos) return item.getRevision();
4.246 + else {
4.247 + String rev = getRevision(xPos, yPos, item.next);
4.248 + if (rev != null) return rev;
4.249 + Vector branches = item.getBranches();
4.250 + if (branches != null) {
4.251 + Enumeration enum = branches.elements();
4.252 + while (enum.hasMoreElements()) {
4.253 + CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
4.254 + //if (branch.getXPos() == xPos && branch.getYPos() == yPos) return branch.getRevision();
4.255 + rev = getRevision(xPos, yPos, branch.next);
4.256 + if (rev != null) return rev;
4.257 + }
4.258 + }
4.259 + return null;
4.260 + }
4.261 + }
4.262
4.263 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.264 - gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.265 - gridBagConstraints1.weightx = 1.0;
4.266 - getContentPane ().add (headPanel, gridBagConstraints1);
4.267 + private String getRevision(int xPos, int yPos) {
4.268 + CvsRevisionGraphItem root = logInfo.getRevisionGraph().getRoot();
4.269 + return getRevision(xPos, yPos, root);
4.270 + }
4.271
4.272 - infoPanel1.setLayout (new java.awt.GridBagLayout ());
4.273 - java.awt.GridBagConstraints gridBagConstraints3;
4.274 + private String getRevisionAt(int x, int y) {
4.275 + //System.out.println("Mouse Released at ("+x+", "+y+")"); // NOI18N
4.276 + x -= BranchDraw.xStart;
4.277 + y -= BranchDraw.yStart;
4.278 + int xPos = x/(branchDraw.revWidth + BranchDraw.xSpace);
4.279 + int yPos = y/(branchDraw.revHeight + BranchDraw.ySpace);
4.280 + //System.out.println("xPos = "+xPos+", yPos = "+yPos); // NOI18N
4.281 + int lx = x - xPos*(branchDraw.revWidth + BranchDraw.xSpace);
4.282 + int ly = y - yPos*(branchDraw.revHeight + BranchDraw.ySpace);
4.283 + //System.out.println("lx = "+lx+", ly = "+ly+"; revWidth = "+branchDraw.revWidth+", revHeight = "+ // NOI18N
4.284 + // branchDraw.revHeight);
4.285 + if (lx < 0 || ly < 0 || lx - branchDraw.revWidth > 0 || ly - branchDraw.revHeight > 0)
4.286 + return null;
4.287 + else return getRevision(xPos, yPos);
4.288 + }
4.289
4.290 - revALabel.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revALabel.text"));
4.291 -
4.292 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
4.293 - gridBagConstraints3.anchor = java.awt.GridBagConstraints.WEST;
4.294 - infoPanel1.add (revALabel, gridBagConstraints3);
4.295 -
4.296 - revATextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revATextField.toolTipText"));
4.297 - revATextField.setEditable (false);
4.298 -
4.299 - gridBagConstraints3 = new java.awt.GridBagConstraints ();
4.300 - gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.301 - gridBagConstraints3.insets = new java.awt.Insets (0, 8, 0, 0);
4.302 - gridBagConstraints3.weightx = 1.0;
4.303 - infoPanel1.add (revATextField, gridBagConstraints3);
4.304 -
4.305 + /**
4.306 + * @param args the command line arguments
4.307 + */
4.308 + public static void main (String args[]) {
4.309 + new CvsBranchFrame (null, null).show ();
4.310 + }
4.311
4.312 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.313 - gridBagConstraints1.gridy = 1;
4.314 - gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.315 - gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
4.316 - gridBagConstraints1.weightx = 1.0;
4.317 - getContentPane ().add (infoPanel1, gridBagConstraints1);
4.318 + class BranchDraw extends javax.swing.JPanel /*java.awt.Canvas*/ {
4.319
4.320 - infoPanel2.setLayout (new java.awt.GridBagLayout ());
4.321 - java.awt.GridBagConstraints gridBagConstraints4;
4.322 + static final int xBound = 5;
4.323 + static final int yBound = 3;
4.324 + static final int xSpace = 20;
4.325 + static final int ySpace = 5;
4.326 + static final int xStart = 10;
4.327 + static final int yStart = 2;
4.328
4.329 - revBLabel.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revBLabel.text"));
4.330 -
4.331 - gridBagConstraints4 = new java.awt.GridBagConstraints ();
4.332 - gridBagConstraints4.anchor = java.awt.GridBagConstraints.WEST;
4.333 - infoPanel2.add (revBLabel, gridBagConstraints4);
4.334 -
4.335 - revBTextField.setToolTipText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.revBTextField.toolTipText"));
4.336 - revBTextField.setEditable (false);
4.337 -
4.338 - gridBagConstraints4 = new java.awt.GridBagConstraints ();
4.339 - gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.340 - gridBagConstraints4.insets = new java.awt.Insets (0, 8, 0, 0);
4.341 - gridBagConstraints4.weightx = 1.0;
4.342 - infoPanel2.add (revBTextField, gridBagConstraints4);
4.343 -
4.344 + int revWidth = 0;
4.345 + int revHeight = 0;
4.346
4.347 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.348 - gridBagConstraints1.gridy = 2;
4.349 - gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.350 - gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.351 - gridBagConstraints1.weightx = 1.0;
4.352 - getContentPane ().add (infoPanel2, gridBagConstraints1);
4.353 + static final long serialVersionUID =-2029660479720769206L;
4.354 + public BranchDraw() {
4.355 + }
4.356
4.357 - branchPanel.setLayout (new java.awt.GridBagLayout ());
4.358 - java.awt.GridBagConstraints gridBagConstraints5;
4.359 - branchPanel.setPreferredSize (new java.awt.Dimension(300, 200));
4.360 + private int getMaxWidthRev(java.awt.Graphics g) {
4.361 + int width = 0;
4.362 + java.awt.FontMetrics fm = g.getFontMetrics();
4.363 + Vector revisions = logInfo.getRevisions();
4.364 + Enumeration enum = revisions.elements();
4.365 + while (enum.hasMoreElements()) {
4.366 + String revision = (String) enum.nextElement();
4.367 + int w = fm.stringWidth(revision);
4.368 + if (w > width) width = w;
4.369 + }
4.370 + return width;
4.371 + }
4.372
4.373 - branchScrollPane.setPreferredSize (new java.awt.Dimension(200, 200));
4.374 -
4.375 - gridBagConstraints5 = new java.awt.GridBagConstraints ();
4.376 - gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH;
4.377 - gridBagConstraints5.weightx = 1.0;
4.378 - gridBagConstraints5.weighty = 1.0;
4.379 - branchPanel.add (branchScrollPane, gridBagConstraints5);
4.380 -
4.381 + protected void paintComponent(java.awt.Graphics g) {
4.382 + super.paintComponent(g);
4.383 + //java.awt.Rectangle viewRect = branchScrollPane.getViewport().getViewRect();
4.384 + //g.setClip(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
4.385 + //System.out.println("BranchFrame.paint() setting clip("+viewRect.x+", "+ // NOI18N
4.386 + // viewRect.y+", "+viewRect.width+", "+viewRect.height+")"); // NOI18N
4.387 + if (revWidth == 0) revWidth = getMaxWidthRev(g) + 2*xBound;
4.388 + if (revHeight == 0) revHeight = g.getFontMetrics().getHeight() + 2*yBound;
4.389 + setPreferredSize(new java.awt.Dimension(graphWidth*(revWidth + xSpace) + 2*xStart,
4.390 + graphHeight*(revHeight + ySpace) + 2*yStart));
4.391 + //setSize(graphWidth*(revWidth + xSpace) + 2*xStart,
4.392 + // graphHeight*(revHeight + ySpace) + 2*yStart);
4.393 + paint(g, 0, 0, logInfo.getRevisionGraph().getRoot());
4.394 + //branchScrollPane.validate();
4.395 + revalidate();
4.396 + }
4.397
4.398 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.399 - gridBagConstraints1.gridy = 3;
4.400 - gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
4.401 - gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.402 - gridBagConstraints1.weightx = 1.0;
4.403 - gridBagConstraints1.weighty = 1.0;
4.404 - getContentPane ().add (branchPanel, gridBagConstraints1);
4.405 + private void paint(java.awt.Graphics g, int xPos, int yPos, CvsRevisionGraphItem item) {
4.406 + if (item == null) return;
4.407 + //paintRevision(g, xPos, yPos, item.getRevision());
4.408 + paintRevision(g, item.getXPos(), item.getYPos(), item.getRevision());
4.409 + Vector branches = item.getBranches();
4.410 + if (branches != null) {
4.411 + Enumeration enum = branches.elements();
4.412 + while (enum.hasMoreElements()) {
4.413 + CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
4.414 + String branchName = branch.getRevision();
4.415 + //java.awt.Point point = (java.awt.Point) branchPositions.get(branchName);
4.416 + //paintBranch(g, point.x, point.y - 1, branchName);
4.417 + //paint(g, point.x, point.y, branch.next);
4.418 + paintBranch(g, branch.getXPos(), branch.getYPos(), branchName);
4.419 + g.setColor(lineColor);
4.420 + g.drawLine(item.getXPos()*(revWidth + xSpace) + revWidth + xStart,
4.421 + item.getYPos()*(revHeight + ySpace) + revHeight/2 + yStart,
4.422 + branch.getXPos()*(revWidth + xSpace) + revWidth/2 + xStart,
4.423 + branch.getYPos()*(revHeight + ySpace) + yStart);
4.424 + paint(g, item.getXPos(), item.getYPos(), branch.next);
4.425 + }
4.426 + }
4.427 + if (item.next != null) paint(g, xPos, yPos + 1, item.next);
4.428 + }
4.429
4.430 - buttonPanel.setLayout (new java.awt.GridBagLayout ());
4.431 - java.awt.GridBagConstraints gridBagConstraints6;
4.432 + private void paintRevision(java.awt.Graphics g, int xPos, int yPos, String text) {
4.433 + int x = xPos*(revWidth + xSpace) + xStart;
4.434 + int y = yPos*(revHeight + ySpace) + yStart;
4.435 + g.setColor(revisionColor);
4.436 + g.drawRect(x, y, revWidth, revHeight);
4.437 + g.drawString(text, x + xBound, y + yBound + g.getFontMetrics().getAscent());
4.438 + }
4.439
4.440 - diffButton.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.diffButton.text"));
4.441 - diffButton.addActionListener (new java.awt.event.ActionListener () {
4.442 - public void actionPerformed (java.awt.event.ActionEvent evt) {
4.443 - diffButtonActionPerformed (evt);
4.444 + private void paintBranch(java.awt.Graphics g, int xPos, int yPos, String text) {
4.445 + int x = xPos*(revWidth + xSpace) + xStart;
4.446 + int y = yPos*(revHeight + ySpace) + yStart;
4.447 + g.setColor(branchColor);
4.448 + g.drawRect(x, y, revWidth, revHeight);
4.449 + //g.drawRoundRect(x, y, revWidth, revHeight, revWidth, revHeight);
4.450 + g.drawString(text, x + xBound, y + yBound + g.getFontMetrics().getAscent());
4.451 }
4.452 - }
4.453 - );
4.454 -
4.455 - gridBagConstraints6 = new java.awt.GridBagConstraints ();
4.456 - gridBagConstraints6.weightx = 1.0;
4.457 - buttonPanel.add (diffButton, gridBagConstraints6);
4.458 -
4.459 - closeButton.setText (org.openide.util.NbBundle.getBundle(CvsBranchFrame.class).getString("CvsBranchFrame.closeButton.text"));
4.460 - closeButton.addActionListener (new java.awt.event.ActionListener () {
4.461 - public void actionPerformed (java.awt.event.ActionEvent evt) {
4.462 - closeButtonActionPerformed (evt);
4.463 + }
4.464 +
4.465 + private class BranchMouseListener extends javax.swing.event.MouseInputAdapter {
4.466 + public void mouseReleased(java.awt.event.MouseEvent e) {
4.467 + if (SwingUtilities.isLeftMouseButton(e)) {
4.468 + String revision = getRevisionAt(e.getX(), e.getY());
4.469 + //System.out.println("Revision = "+revision); // NOI18N
4.470 + if (revision != null) {
4.471 + revATextField.setText(revision);
4.472 + revATextField.repaint();
4.473 + }
4.474 + } else if (SwingUtilities.isRightMouseButton(e)) {
4.475 + String revision = getRevisionAt(e.getX(), e.getY());
4.476 + //System.out.println("Revision = "+revision); // NOI18N
4.477 + if (revision != null) {
4.478 + revBTextField.setText(revision);
4.479 + revBTextField.repaint();
4.480 + }
4.481 + }
4.482 }
4.483 - }
4.484 - );
4.485 -
4.486 - gridBagConstraints6 = new java.awt.GridBagConstraints ();
4.487 - gridBagConstraints6.weightx = 1.0;
4.488 - buttonPanel.add (closeButton, gridBagConstraints6);
4.489 -
4.490 + }
4.491
4.492 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
4.493 - gridBagConstraints1.gridy = 4;
4.494 - gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
4.495 - gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 8);
4.496 - gridBagConstraints1.weightx = 1.0;
4.497 - getContentPane ().add (buttonPanel, gridBagConstraints1);
4.498 + private CvsLogInfo logInfo;
4.499 + private CvsBranches branches;
4.500 + private int graphWidth = 0;
4.501 + private int graphHeight = 0;
4.502 + private Hashtable branchPositions = null;
4.503 + private BranchDraw branchDraw;
4.504 + private java.awt.Color branchColor = java.awt.Color.red;
4.505 + private java.awt.Color revisionColor = java.awt.Color.black;
4.506 + private java.awt.Color lineColor = java.awt.Color.black;
4.507
4.508 - }//GEN-END:initComponents
4.509 -
4.510 -private void closeButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
4.511 -// Add your handling code here:
4.512 - exitForm(null);
4.513 - }//GEN-LAST:event_closeButtonActionPerformed
4.514 -
4.515 -private void diffButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_diffButtonActionPerformed
4.516 -// Add your handling code here:
4.517 - String revision1 = revATextField.getText();
4.518 - String revision2 = revBTextField.getText();
4.519 - if (revision1.length() == 0) revision1 = null;
4.520 - if (revision2.length() == 0) revision2 = null;
4.521 - branches.doDiff(revision1, revision2);
4.522 - }//GEN-LAST:event_diffButtonActionPerformed
4.523 -
4.524 - /** Exit the Application */
4.525 - private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
4.526 - branches.close();
4.527 - dispose();
4.528 - }//GEN-LAST:event_exitForm
4.529 -
4.530 - private void initBranchDraw() {
4.531 - branchDraw = new BranchDraw();
4.532 - branchScrollPane.setViewportView(branchDraw);
4.533 - branchDraw.addMouseListener(new BranchMouseListener());
4.534 - }
4.535 -
4.536 - public void setPositions(int graphWidth, int graphHeight, Hashtable branchPositions) {
4.537 - this.graphWidth = graphWidth;
4.538 - this.graphHeight = graphHeight;
4.539 - this.branchPositions = branchPositions;
4.540 - }
4.541 -
4.542 - private String getRevision(int xPos, int yPos, CvsRevisionGraphItem item) {
4.543 - if (item == null) return null;
4.544 - if (item.getXPos() == xPos && item.getYPos() == yPos) return item.getRevision();
4.545 - else {
4.546 - String rev = getRevision(xPos, yPos, item.next);
4.547 - if (rev != null) return rev;
4.548 - Vector branches = item.getBranches();
4.549 - if (branches != null) {
4.550 - Enumeration enum = branches.elements();
4.551 - while (enum.hasMoreElements()) {
4.552 - CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
4.553 - //if (branch.getXPos() == xPos && branch.getYPos() == yPos) return branch.getRevision();
4.554 - rev = getRevision(xPos, yPos, branch.next);
4.555 - if (rev != null) return rev;
4.556 - }
4.557 - }
4.558 - return null;
4.559 - }
4.560 - }
4.561 -
4.562 - private String getRevision(int xPos, int yPos) {
4.563 - CvsRevisionGraphItem root = logInfo.getRevisionGraph().getRoot();
4.564 - return getRevision(xPos, yPos, root);
4.565 - }
4.566 -
4.567 - private String getRevisionAt(int x, int y) {
4.568 - //System.out.println("Mouse Released at ("+x+", "+y+")"); // NOI18N
4.569 - x -= BranchDraw.xStart;
4.570 - y -= BranchDraw.yStart;
4.571 - int xPos = x/(branchDraw.revWidth + BranchDraw.xSpace);
4.572 - int yPos = y/(branchDraw.revHeight + BranchDraw.ySpace);
4.573 - //System.out.println("xPos = "+xPos+", yPos = "+yPos); // NOI18N
4.574 - int lx = x - xPos*(branchDraw.revWidth + BranchDraw.xSpace);
4.575 - int ly = y - yPos*(branchDraw.revHeight + BranchDraw.ySpace);
4.576 - //System.out.println("lx = "+lx+", ly = "+ly+"; revWidth = "+branchDraw.revWidth+", revHeight = "+ // NOI18N
4.577 - // branchDraw.revHeight);
4.578 - if (lx < 0 || ly < 0 || lx - branchDraw.revWidth > 0 || ly - branchDraw.revHeight > 0)
4.579 - return null;
4.580 - else return getRevision(xPos, yPos);
4.581 - }
4.582 -
4.583 - /**
4.584 - * @param args the command line arguments
4.585 - */
4.586 - public static void main (String args[]) {
4.587 - new CvsBranchFrame (null, null).show ();
4.588 - }
4.589 -
4.590 - class BranchDraw extends javax.swing.JPanel /*java.awt.Canvas*/ {
4.591 -
4.592 - static final int xBound = 5;
4.593 - static final int yBound = 3;
4.594 - static final int xSpace = 20;
4.595 - static final int ySpace = 5;
4.596 - static final int xStart = 10;
4.597 - static final int yStart = 2;
4.598 -
4.599 - int revWidth = 0;
4.600 - int revHeight = 0;
4.601 -
4.602 - static final long serialVersionUID =-2029660479720769206L;
4.603 - public BranchDraw() {
4.604 - }
4.605 -
4.606 - private int getMaxWidthRev(java.awt.Graphics g) {
4.607 - int width = 0;
4.608 - java.awt.FontMetrics fm = g.getFontMetrics();
4.609 - Vector revisions = logInfo.getRevisions();
4.610 - Enumeration enum = revisions.elements();
4.611 - while (enum.hasMoreElements()) {
4.612 - String revision = (String) enum.nextElement();
4.613 - int w = fm.stringWidth(revision);
4.614 - if (w > width) width = w;
4.615 - }
4.616 - return width;
4.617 - }
4.618 -
4.619 - protected void paintComponent(java.awt.Graphics g) {
4.620 - super.paintComponent(g);
4.621 - //java.awt.Rectangle viewRect = branchScrollPane.getViewport().getViewRect();
4.622 - //g.setClip(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
4.623 - //System.out.println("BranchFrame.paint() setting clip("+viewRect.x+", "+ // NOI18N
4.624 - // viewRect.y+", "+viewRect.width+", "+viewRect.height+")"); // NOI18N
4.625 - if (revWidth == 0) revWidth = getMaxWidthRev(g) + 2*xBound;
4.626 - if (revHeight == 0) revHeight = g.getFontMetrics().getHeight() + 2*yBound;
4.627 - setPreferredSize(new java.awt.Dimension(graphWidth*(revWidth + xSpace) + 2*xStart,
4.628 - graphHeight*(revHeight + ySpace) + 2*yStart));
4.629 - //setSize(graphWidth*(revWidth + xSpace) + 2*xStart,
4.630 - // graphHeight*(revHeight + ySpace) + 2*yStart);
4.631 - paint(g, 0, 0, logInfo.getRevisionGraph().getRoot());
4.632 - //branchScrollPane.validate();
4.633 - revalidate();
4.634 - }
4.635 -
4.636 - private void paint(java.awt.Graphics g, int xPos, int yPos, CvsRevisionGraphItem item) {
4.637 - if (item == null) return;
4.638 - //paintRevision(g, xPos, yPos, item.getRevision());
4.639 - paintRevision(g, item.getXPos(), item.getYPos(), item.getRevision());
4.640 - Vector branches = item.getBranches();
4.641 - if (branches != null) {
4.642 - Enumeration enum = branches.elements();
4.643 - while (enum.hasMoreElements()) {
4.644 - CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
4.645 - String branchName = branch.getRevision();
4.646 - //java.awt.Point point = (java.awt.Point) branchPositions.get(branchName);
4.647 - //paintBranch(g, point.x, point.y - 1, branchName);
4.648 - //paint(g, point.x, point.y, branch.next);
4.649 - paintBranch(g, branch.getXPos(), branch.getYPos(), branchName);
4.650 - g.setColor(lineColor);
4.651 - g.drawLine(item.getXPos()*(revWidth + xSpace) + revWidth + xStart,
4.652 - item.getYPos()*(revHeight + ySpace) + revHeight/2 + yStart,
4.653 - branch.getXPos()*(revWidth + xSpace) + revWidth/2 + xStart,
4.654 - branch.getYPos()*(revHeight + ySpace) + yStart);
4.655 - paint(g, item.getXPos(), item.getYPos(), branch.next);
4.656 - }
4.657 - }
4.658 - if (item.next != null) paint(g, xPos, yPos + 1, item.next);
4.659 - }
4.660 -
4.661 - private void paintRevision(java.awt.Graphics g, int xPos, int yPos, String text) {
4.662 - int x = xPos*(revWidth + xSpace) + xStart;
4.663 - int y = yPos*(revHeight + ySpace) + yStart;
4.664 - g.setColor(revisionColor);
4.665 - g.drawRect(x, y, revWidth, revHeight);
4.666 - g.drawString(text, x + xBound, y + yBound + g.getFontMetrics().getAscent());
4.667 - }
4.668 -
4.669 - private void paintBranch(java.awt.Graphics g, int xPos, int yPos, String text) {
4.670 - int x = xPos*(revWidth + xSpace) + xStart;
4.671 - int y = yPos*(revHeight + ySpace) + yStart;
4.672 - g.setColor(branchColor);
4.673 - g.drawRect(x, y, revWidth, revHeight);
4.674 - //g.drawRoundRect(x, y, revWidth, revHeight, revWidth, revHeight);
4.675 - g.drawString(text, x + xBound, y + yBound + g.getFontMetrics().getAscent());
4.676 - }
4.677 - }
4.678 -
4.679 - private class BranchMouseListener extends javax.swing.event.MouseInputAdapter {
4.680 - public void mouseReleased(java.awt.event.MouseEvent e) {
4.681 - if (SwingUtilities.isLeftMouseButton(e)) {
4.682 - String revision = getRevisionAt(e.getX(), e.getY());
4.683 - //System.out.println("Revision = "+revision); // NOI18N
4.684 - if (revision != null) {
4.685 - revATextField.setText(revision);
4.686 - revATextField.repaint();
4.687 - }
4.688 - } else if (SwingUtilities.isRightMouseButton(e)) {
4.689 - String revision = getRevisionAt(e.getX(), e.getY());
4.690 - //System.out.println("Revision = "+revision); // NOI18N
4.691 - if (revision != null) {
4.692 - revBTextField.setText(revision);
4.693 - revBTextField.repaint();
4.694 - }
4.695 - }
4.696 - }
4.697 - }
4.698 -
4.699 - private CvsLogInfo logInfo;
4.700 - private CvsBranches branches;
4.701 - private int graphWidth = 0;
4.702 - private int graphHeight = 0;
4.703 - private Hashtable branchPositions = null;
4.704 - private BranchDraw branchDraw;
4.705 - private java.awt.Color branchColor = java.awt.Color.red;
4.706 - private java.awt.Color revisionColor = java.awt.Color.black;
4.707 - private java.awt.Color lineColor = java.awt.Color.black;
4.708 -
4.709 - // Variables declaration - do not modify//GEN-BEGIN:variables
4.710 - private javax.swing.JPanel headPanel;
4.711 - private javax.swing.JPanel infoPanel1;
4.712 - private javax.swing.JLabel revALabel;
4.713 - private javax.swing.JTextField revATextField;
4.714 - private javax.swing.JPanel infoPanel2;
4.715 - private javax.swing.JLabel revBLabel;
4.716 - private javax.swing.JTextField revBTextField;
4.717 - private javax.swing.JPanel branchPanel;
4.718 - private javax.swing.JScrollPane branchScrollPane;
4.719 - private javax.swing.JPanel buttonPanel;
4.720 - private javax.swing.JButton diffButton;
4.721 - private javax.swing.JButton closeButton;
4.722 - // End of variables declaration//GEN-END:variables
4.723 + // Variables declaration - do not modify//GEN-BEGIN:variables
4.724 + private javax.swing.JPanel headPanel;
4.725 + private javax.swing.JPanel infoPanel1;
4.726 + private javax.swing.JLabel revALabel;
4.727 + private javax.swing.JTextField revATextField;
4.728 + private javax.swing.JPanel infoPanel2;
4.729 + private javax.swing.JLabel revBLabel;
4.730 + private javax.swing.JTextField revBTextField;
4.731 + private javax.swing.JPanel branchPanel;
4.732 + private javax.swing.JScrollPane branchScrollPane;
4.733 + private javax.swing.JPanel buttonPanel;
4.734 + private javax.swing.JButton diffButton;
4.735 + private javax.swing.JButton closeButton;
4.736 + // End of variables declaration//GEN-END:variables
4.737
4.738 }
4.739 \ No newline at end of file
5.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsBranches.java Tue Apr 25 12:55:38 2000 +0000
5.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsBranches.java Tue Apr 25 14:04:53 2000 +0000
5.3 @@ -18,165 +18,165 @@
5.4 import org.netbeans.modules.vcs.cmdline.exec.*;
5.5 import java.util.*;
5.6
5.7 -/**
5.8 +/**
5.9 *
5.10 * @author Martin Entlicher
5.11 * @version
5.12 */
5.13 public class CvsBranches extends VcsAdditionalCommand {
5.14
5.15 - private String rootDir = null;
5.16 - private String dir = null;
5.17 - private String file = null;
5.18 - Hashtable vars = null;
5.19 - CvsLogInfo logInfo = new CvsLogInfo();
5.20 - private String[] diffArgs = null;
5.21 - private NoRegexListener stdoutNRListener = null;
5.22 - private NoRegexListener stderrNRListener = null;
5.23 - private RegexListener stdoutListener = null;
5.24 - private RegexListener stderrListener = null;
5.25 - private String dataRegex = null;
5.26 - private String errorRegex = null;
5.27 -
5.28 - Hashtable branchPositions = null;
5.29 - int graphHeight = 0;
5.30 - int graphWidth = 0;
5.31 - private Hashtable itemPositionIntervals = null;
5.32 + private String rootDir = null;
5.33 + private String dir = null;
5.34 + private String file = null;
5.35 + Hashtable vars = null;
5.36 + CvsLogInfo logInfo = new CvsLogInfo();
5.37 + private String[] diffArgs = null;
5.38 + private NoRegexListener stdoutNRListener = null;
5.39 + private NoRegexListener stderrNRListener = null;
5.40 + private RegexListener stdoutListener = null;
5.41 + private RegexListener stderrListener = null;
5.42 + private String dataRegex = null;
5.43 + private String errorRegex = null;
5.44
5.45 - /** Creates new CvsBranches */
5.46 - public CvsBranches() {
5.47 - }
5.48 -
5.49 - /**
5.50 - * Calculates the positions of branches and the number of elements along x and y axis.
5.51 - */
5.52 - private void computeBranchesPositions() {
5.53 - CvsRevisionGraphItem root = logInfo.getRevisionGraph().getRoot();
5.54 - int xPos = 0;
5.55 - int yPos = 0;
5.56 - graphHeight = 1;
5.57 - graphWidth = 1;
5.58 - branchPositions = new Hashtable();
5.59 - itemPositionIntervals = new Hashtable();
5.60 - computeBranchesPositions(root, xPos, yPos);
5.61 - }
5.62 -
5.63 - private void computeBranchesPositions(CvsRevisionGraphItem item, int xPos, int yPos) {
5.64 - if (xPos >= graphWidth) graphWidth = xPos + 1;
5.65 - if (yPos >= graphHeight) graphHeight = yPos + 1;
5.66 - if (item == null) return;
5.67 - addItemPosition(xPos, yPos);
5.68 - computeBranchesPositions(item.next, xPos, yPos + 1);
5.69 - item.setXPos(xPos);
5.70 - item.setYPos(yPos);
5.71 - Vector branches = item.getBranches();
5.72 - if (branches != null) {
5.73 - Enumeration enum = branches.elements();
5.74 - while (enum.hasMoreElements()) {
5.75 - CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
5.76 - int xb = getItemFreePosition(xPos, yPos + 1);
5.77 - computeBranchesPositions(branch, xb, yPos + 1);
5.78 - }
5.79 + Hashtable branchPositions = null;
5.80 + int graphHeight = 0;
5.81 + int graphWidth = 0;
5.82 + private Hashtable itemPositionIntervals = null;
5.83 +
5.84 + /** Creates new CvsBranches */
5.85 + public CvsBranches() {
5.86 }
5.87 - }
5.88 -
5.89 - private void addItemPosition(int x, int y) {
5.90 - Vector intervals = (Vector) itemPositionIntervals.get(new Integer(x));
5.91 - if (intervals == null) {
5.92 - intervals = new Vector();
5.93 - intervals.add(new Integer(y));
5.94 - itemPositionIntervals.put(new Integer(x), intervals);
5.95 - } else {
5.96 - intervals.add(new Integer(y));
5.97 - //Enumeration enum = intervals.elements();
5.98 - //while(enum.hasMoreElements()) {
5.99 - // enum.nextElement();
5.100 +
5.101 + /**
5.102 + * Calculates the positions of branches and the number of elements along x and y axis.
5.103 + */
5.104 + private void computeBranchesPositions() {
5.105 + CvsRevisionGraphItem root = logInfo.getRevisionGraph().getRoot();
5.106 + int xPos = 0;
5.107 + int yPos = 0;
5.108 + graphHeight = 1;
5.109 + graphWidth = 1;
5.110 + branchPositions = new Hashtable();
5.111 + itemPositionIntervals = new Hashtable();
5.112 + computeBranchesPositions(root, xPos, yPos);
5.113 }
5.114 - }
5.115 -
5.116 - private int getItemFreePosition(int xPos, int yPos) {
5.117 - int x;
5.118 - for(x = xPos + 1; itemPositionIntervals.get(new Integer(x)) != null; x++);
5.119 - return x;
5.120 - }
5.121 -
5.122 - private void computeBranchesPositions_last(CvsRevisionGraphItem item, int xPos, int yPos) {
5.123 - if (xPos >= graphWidth) graphWidth = xPos + 1;
5.124 - if (yPos >= graphHeight) graphHeight = yPos + 1;
5.125 - if (item == null) return;
5.126 - Vector branches = item.getBranches();
5.127 - if (branches != null) {
5.128 - Enumeration enum = branches.elements();
5.129 - while (enum.hasMoreElements()) {
5.130 - CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
5.131 - String branchName = branch.getRevision();
5.132 - xPos++;
5.133 - branchPositions.put(branchName, new java.awt.Point(xPos, yPos + 1));
5.134 - computeBranchesPositions(branch.next, xPos, yPos + 1);
5.135 - }
5.136 +
5.137 + private void computeBranchesPositions(CvsRevisionGraphItem item, int xPos, int yPos) {
5.138 + if (xPos >= graphWidth) graphWidth = xPos + 1;
5.139 + if (yPos >= graphHeight) graphHeight = yPos + 1;
5.140 + if (item == null) return;
5.141 + addItemPosition(xPos, yPos);
5.142 + computeBranchesPositions(item.next, xPos, yPos + 1);
5.143 + item.setXPos(xPos);
5.144 + item.setYPos(yPos);
5.145 + Vector branches = item.getBranches();
5.146 + if (branches != null) {
5.147 + Enumeration enum = branches.elements();
5.148 + while (enum.hasMoreElements()) {
5.149 + CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
5.150 + int xb = getItemFreePosition(xPos, yPos + 1);
5.151 + computeBranchesPositions(branch, xb, yPos + 1);
5.152 + }
5.153 + }
5.154 }
5.155 - CvsRevisionGraphItem next = item.getNext();
5.156 - if (next != null) computeBranchesPositions(next, xPos, yPos + 1);
5.157 - }
5.158 -
5.159 - private void drawBranches() {
5.160 - //logInfo.getRevisionGraph();
5.161 - computeBranchesPositions();
5.162 - CvsBranchFrame branchFrame = new CvsBranchFrame(logInfo, this);
5.163 - MiscStuff.centerWindow(branchFrame);
5.164 - branchFrame.setPositions(graphWidth, graphHeight, branchPositions);
5.165 - branchFrame.setVisible(true);
5.166 - //logInfo.getRevisionGraph().getRoot().print();
5.167 - }
5.168 -
5.169 - public boolean doDiff(String revision1, String revision2) {
5.170 - CvsDiff diff = new CvsDiff();
5.171 - String args[] = null;
5.172 - if (revision1 != null) {
5.173 - if (revision2 != null) {
5.174 - args = new String[4];
5.175 - args[1] = revision2;
5.176 - } else {
5.177 - args = new String[3];
5.178 - }
5.179 - args[0] = revision1;
5.180 - } else args = new String[2];
5.181 - for(int i = 0; i < 2; i++) args[i + args.length - 2] = diffArgs[i];
5.182 - return diff.exec(vars, args, stdoutNRListener, stderrNRListener,
5.183 - stdoutListener, dataRegex, stderrListener, errorRegex);
5.184 - }
5.185 -
5.186 - public void close() {
5.187 - }
5.188 -
5.189 - public boolean exec(Hashtable vars, String[] args,
5.190 - NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
5.191 - RegexListener stdoutListener, String dataRegex,
5.192 - RegexListener stderrListener, String errorRegex) {
5.193 - this.vars = vars;
5.194 - this.stdoutNRListener = stdoutNRListener;
5.195 - this.stderrNRListener = stderrNRListener;
5.196 - this.stdoutListener = stdoutListener;
5.197 - this.dataRegex = dataRegex;
5.198 - this.stderrListener = stderrListener;
5.199 - this.errorRegex = errorRegex;
5.200 - boolean success;
5.201 - if (args.length < 3) {
5.202 - String message = "Too few arguments to View Branches command !"; // NOI18N
5.203 - String[] elements = { message };
5.204 - if (stderrListener != null) stderrListener.match(elements);
5.205 - if (stderrNRListener != null) stderrNRListener.match(message);
5.206 - return false;
5.207 - }
5.208 - String[] logInfoArgs = new String[1];
5.209 - logInfoArgs[0] = args[0];
5.210 - diffArgs = new String[2];
5.211 - diffArgs[0] = args[1];
5.212 - diffArgs[1] = args[2];
5.213 - success = this.logInfo.updateLogInfo(vars, logInfoArgs, stdoutNRListener, stderrNRListener);
5.214 - if (success) {
5.215 - drawBranches();
5.216 +
5.217 + private void addItemPosition(int x, int y) {
5.218 + Vector intervals = (Vector) itemPositionIntervals.get(new Integer(x));
5.219 + if (intervals == null) {
5.220 + intervals = new Vector();
5.221 + intervals.add(new Integer(y));
5.222 + itemPositionIntervals.put(new Integer(x), intervals);
5.223 + } else {
5.224 + intervals.add(new Integer(y));
5.225 + //Enumeration enum = intervals.elements();
5.226 + //while(enum.hasMoreElements()) {
5.227 + // enum.nextElement();
5.228 + }
5.229 }
5.230 - return success;
5.231 - }
5.232 +
5.233 + private int getItemFreePosition(int xPos, int yPos) {
5.234 + int x;
5.235 + for(x = xPos + 1; itemPositionIntervals.get(new Integer(x)) != null; x++);
5.236 + return x;
5.237 + }
5.238 +
5.239 + private void computeBranchesPositions_last(CvsRevisionGraphItem item, int xPos, int yPos) {
5.240 + if (xPos >= graphWidth) graphWidth = xPos + 1;
5.241 + if (yPos >= graphHeight) graphHeight = yPos + 1;
5.242 + if (item == null) return;
5.243 + Vector branches = item.getBranches();
5.244 + if (branches != null) {
5.245 + Enumeration enum = branches.elements();
5.246 + while (enum.hasMoreElements()) {
5.247 + CvsRevisionGraphItem branch = (CvsRevisionGraphItem) enum.nextElement();
5.248 + String branchName = branch.getRevision();
5.249 + xPos++;
5.250 + branchPositions.put(branchName, new java.awt.Point(xPos, yPos + 1));
5.251 + computeBranchesPositions(branch.next, xPos, yPos + 1);
5.252 + }
5.253 + }
5.254 + CvsRevisionGraphItem next = item.getNext();
5.255 + if (next != null) computeBranchesPositions(next, xPos, yPos + 1);
5.256 + }
5.257 +
5.258 + private void drawBranches() {
5.259 + //logInfo.getRevisionGraph();
5.260 + computeBranchesPositions();
5.261 + CvsBranchFrame branchFrame = new CvsBranchFrame(logInfo, this);
5.262 + MiscStuff.centerWindow(branchFrame);
5.263 + branchFrame.setPositions(graphWidth, graphHeight, branchPositions);
5.264 + branchFrame.setVisible(true);
5.265 + //logInfo.getRevisionGraph().getRoot().print();
5.266 + }
5.267 +
5.268 + public boolean doDiff(String revision1, String revision2) {
5.269 + CvsDiff diff = new CvsDiff();
5.270 + String args[] = null;
5.271 + if (revision1 != null) {
5.272 + if (revision2 != null) {
5.273 + args = new String[4];
5.274 + args[1] = revision2;
5.275 + } else {
5.276 + args = new String[3];
5.277 + }
5.278 + args[0] = revision1;
5.279 + } else args = new String[2];
5.280 + for(int i = 0; i < 2; i++) args[i + args.length - 2] = diffArgs[i];
5.281 + return diff.exec(vars, args, stdoutNRListener, stderrNRListener,
5.282 + stdoutListener, dataRegex, stderrListener, errorRegex);
5.283 + }
5.284 +
5.285 + public void close() {
5.286 + }
5.287 +
5.288 + public boolean exec(Hashtable vars, String[] args,
5.289 + NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
5.290 + RegexListener stdoutListener, String dataRegex,
5.291 + RegexListener stderrListener, String errorRegex) {
5.292 + this.vars = vars;
5.293 + this.stdoutNRListener = stdoutNRListener;
5.294 + this.stderrNRListener = stderrNRListener;
5.295 + this.stdoutListener = stdoutListener;
5.296 + this.dataRegex = dataRegex;
5.297 + this.stderrListener = stderrListener;
5.298 + this.errorRegex = errorRegex;
5.299 + boolean success;
5.300 + if (args.length < 3) {
5.301 + String message = "Too few arguments to View Branches command !"; // NOI18N
5.302 + String[] elements = { message };
5.303 + if (stderrListener != null) stderrListener.match(elements);
5.304 + if (stderrNRListener != null) stderrNRListener.match(message);
5.305 + return false;
5.306 + }
5.307 + String[] logInfoArgs = new String[1];
5.308 + logInfoArgs[0] = args[0];
5.309 + diffArgs = new String[2];
5.310 + diffArgs[0] = args[1];
5.311 + diffArgs[1] = args[2];
5.312 + success = this.logInfo.updateLogInfo(vars, logInfoArgs, stdoutNRListener, stderrNRListener);
5.313 + if (success) {
5.314 + drawBranches();
5.315 + }
5.316 + return success;
5.317 + }
5.318 }
5.319 \ No newline at end of file
6.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsDiff.java Tue Apr 25 12:55:38 2000 +0000
6.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsDiff.java Tue Apr 25 14:04:53 2000 +0000
6.3 @@ -28,610 +28,610 @@
6.4 import javax.swing.*;
6.5 import javax.swing.text.*;
6.6
6.7 -/**
6.8 +/**
6.9 *
6.10 * @author Martin Entlicher
6.11 * @version
6.12 */
6.13 public class CvsDiff extends VcsAdditionalCommand implements RegexListener {
6.14
6.15 - private Debug E=new Debug("CvsDiff",true); // NOI18N
6.16 - private Debug D=E;
6.17 + private Debug E=new Debug("CvsDiff",true); // NOI18N
6.18 + private Debug D=E;
6.19
6.20 - //private static transient String TMP_ROOT="vcs/tmp"; // NOI18N
6.21 - private transient String TMP_ROOT;
6.22 - private File tmpDir = null;
6.23 - private File tmpDir2 = null;
6.24 - private String tmpDirName = ""; // NOI18N
6.25 - private String tmpDir2Name = ""; // NOI18N
6.26 - Hashtable vars = null;
6.27 + //private static transient String TMP_ROOT="vcs/tmp"; // NOI18N
6.28 + private transient String TMP_ROOT;
6.29 + private File tmpDir = null;
6.30 + private File tmpDir2 = null;
6.31 + private String tmpDirName = ""; // NOI18N
6.32 + private String tmpDir2Name = ""; // NOI18N
6.33 + Hashtable vars = null;
6.34
6.35 - private String rootDir = null;
6.36 - private String rootDirWroot = null;
6.37 - private String dir = null;
6.38 - //private String mdir = null;
6.39 - private String file = null;
6.40 -
6.41 - private String diffDataRegex = null;
6.42 - private NoRegexListener stdoutNRListener = null;
6.43 - private NoRegexListener stderrNRListener = null;
6.44 - private RegexListener stdoutListener = null;
6.45 - private RegexListener stderrListener = null;
6.46 - private String dataRegex = null;
6.47 - private String errorRegex = null;
6.48 - private String checkoutCmd = null;
6.49 - private String diffCmd = null;
6.50 -
6.51 - private StringBuffer diffBuffer = new StringBuffer(4096);
6.52 - private Vector diffActions = new Vector();
6.53 - private CvsDiffFrame diffFrame = null;
6.54 - private static int currentDiffLine = 0;
6.55 - private static final java.awt.Color colorMissing = new java.awt.Color(255, 160, 180);
6.56 - private static final java.awt.Color colorAdded = new java.awt.Color(180, 255, 180);
6.57 - private static final java.awt.Color colorChanged = new java.awt.Color(160, 200, 255);
6.58 - //private JEditorPane e1;
6.59 - //private JEditorPane e2;
6.60 -
6.61 - /** Creates new CvsDiff */
6.62 - public CvsDiff() {
6.63 - }
6.64 -
6.65 - private File createTMP() {
6.66 - TMP_ROOT=System.getProperty("netbeans.user")+File.separator+
6.67 - "system"+File.separator+"vcs"+File.separator+"tmp";
6.68 - File tmpDir = new File(TMP_ROOT);
6.69 - if (!tmpDir.exists()) {
6.70 - tmpDir.mkdirs();
6.71 - }
6.72 - long tmpId;
6.73 - do {
6.74 - tmpId = 10000 * (1 + Math.round (Math.random () * 8)) + Math.round (Math.random () * 1000);
6.75 - } while (new File(TMP_ROOT+File.separator+"tmp"+tmpId).exists()); // NOI18N
6.76 - TMP_ROOT = TMP_ROOT+File.separator+"tmp"+tmpId; // NOI18N
6.77 - tmpDir = new File(TMP_ROOT);
6.78 - if (!tmpDir.exists()) {
6.79 - tmpDir.mkdirs();
6.80 - }
6.81 - return tmpDir;
6.82 - }
6.83 -
6.84 - private boolean checkOut(Hashtable vars, String file, String revision, String tmpDir) {
6.85 - String cmd = checkoutCmd;
6.86 - String varRevision = ""; // NOI18N
6.87 - //if (revision != null) varRevision = " -r "+revision+" "; // NOI18N
6.88 - if (revision != null) varRevision = ""+revision; // NOI18N
6.89 - vars.put("REVISION", varRevision); // NOI18N
6.90 - D.deb("varRevision = "+varRevision); // NOI18N
6.91 - vars.put("TEMPDIR", tmpDir); // NOI18N
6.92 - D.deb("checkOut Command: "+cmd); // NOI18N
6.93 - Variables v=new Variables();
6.94 - String prepared=v.expand(vars,cmd, true);
6.95 - D.deb("checkOut prepared: "+prepared); // NOI18N
6.96 - if (stderrListener != null) {
6.97 - String[] command = { "CHECKOUT: "+prepared }; // NOI18N
6.98 - stderrListener.match(command);
6.99 - }
6.100 - if (stderrNRListener != null) stderrNRListener.match("CHECKOUT: "+prepared); // NOI18N
6.101 - ExternalCommand ec=new ExternalCommand(prepared);
6.102 - ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
6.103 - if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(this.stdoutNRListener);
6.104 - if (this.stderrNRListener != null) ec.addStderrNoRegexListener(this.stderrNRListener);
6.105 - if (this.stdoutListener != null) {
6.106 - try {
6.107 - ec.addStdoutRegexListener(this.stdoutListener, this.dataRegex);
6.108 - } catch (BadRegexException e) {
6.109 - if (stderrListener != null) {
6.110 - String[] elements = { "CHECKOUT: Bad data regex "+dataRegex+"\n" }; // NOI18N
6.111 - stderrListener.match(elements);
6.112 - }
6.113 - }
6.114 - }
6.115 - if (this.stderrListener != null) {
6.116 - try {
6.117 - ec.addStderrRegexListener(this.stderrListener, this.errorRegex);
6.118 - } catch (BadRegexException e) {
6.119 - String[] elements = { "CHECKOUT: Bad error regex "+errorRegex+"\n" }; // NOI18N
6.120 - stderrListener.match(elements);
6.121 - }
6.122 - }
6.123 - if ( ec.exec() != ExternalCommand.SUCCESS ){
6.124 - E.err("exec failed "+ec.getExitStatus()); // NOI18N
6.125 - return false;
6.126 - } else return true;
6.127 - }
6.128 -
6.129 - private boolean performDiff(String revision1, String revision2) {
6.130 - String cmd = diffCmd;
6.131 - String varRevision = ""; // NOI18N
6.132 - if (revision1 != null) varRevision += " -r "+revision1+" "; // NOI18N
6.133 - if (revision2 != null) varRevision += " -r "+revision2+" "; // NOI18N
6.134 - vars.put("REVISION", varRevision); // NOI18N
6.135 - D.deb("diff command: "+cmd); // NOI18N
6.136 - Variables v=new Variables();
6.137 - String prepared=v.expand(vars,cmd, true);
6.138 - D.deb("diff prepared: "+prepared); // NOI18N
6.139 - if (stderrListener != null) {
6.140 - String[] command = { "DIFF: "+prepared }; // NOI18N
6.141 - stderrListener.match(command);
6.142 - }
6.143 - if (stderrNRListener != null) stderrNRListener.match("DIFF: "+prepared); // NOI18N
6.144 - ExternalCommand ec=new ExternalCommand(prepared);
6.145 - ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
6.146 - try{
6.147 - D.deb("stdout diff dataRegex = "+diffDataRegex); // NOI18N
6.148 - ec.addStdoutRegexListener(this,diffDataRegex);
6.149 - } catch (BadRegexException e) {
6.150 - if (stderrListener != null) {
6.151 - String[] elements = { "cvs diff: Bad data regex "+diffDataRegex }; // NOI18N
6.152 - stderrListener.match(elements);
6.153 - }
6.154 - return false;
6.155 - }
6.156 - if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
6.157 - if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
6.158 - if (this.stdoutListener != null) {
6.159 - try {
6.160 - ec.addStdoutRegexListener(this.stdoutListener, this.dataRegex);
6.161 - } catch (BadRegexException e) {
6.162 - if (stderrListener != null) {
6.163 - String[] elements = { "DIFF: Bad data regex "+dataRegex+"\n" }; // NOI18N
6.164 - stderrListener.match(elements);
6.165 - }
6.166 - }
6.167 - }
6.168 - if (this.stderrListener != null) {
6.169 - try {
6.170 - ec.addStderrRegexListener(this.stderrListener, this.errorRegex);
6.171 - } catch (BadRegexException e) {
6.172 - String[] elements = { "DIFF: Bad error regex "+errorRegex+"\n" }; // NOI18N
6.173 - stderrListener.match(elements);
6.174 - }
6.175 - }
6.176 - if ( ec.exec() != ExternalCommand.SUCCESS ){
6.177 - D.deb("exec failed "+ec.getExitStatus()); // NOI18N
6.178 - return false;
6.179 - }
6.180 - return true;
6.181 - }
6.182 -
6.183 - private boolean openEditors(String file1, String file2, String title1, String title2) {
6.184 - String mime = (String) vars.get("MIMETYPE"); // NOI18N
6.185 - D.deb("I have MIME = "+mime); // NOI18N
6.186 - URL url1 = null;
6.187 - URL url2 = null;
6.188 - try {
6.189 - url1 = new File(file1).toURL();
6.190 - url2 = new File(file2).toURL();
6.191 - } catch (java.net.MalformedURLException e) {
6.192 - D.deb("MalformedURLException "+e.getMessage()); // NOI18N
6.193 - return false;
6.194 - }
6.195 - diffFrame = new CvsDiffFrame(this);
6.196 - MiscStuff.centerWindow(diffFrame);
6.197 - if (mime != null) {
6.198 - diffFrame.setMimeType1(mime);
6.199 - diffFrame.setMimeType2(mime);
6.200 - }
6.201 - try {
6.202 - diffFrame.setFile1(url1);
6.203 - diffFrame.setFile2(url2);
6.204 - } catch (IOException e) {
6.205 - D.err("IO Exception "+e.getMessage()); // NOI18N
6.206 - return false;
6.207 - }
6.208 - diffFrame.setFile1Title(title1);
6.209 - diffFrame.setFile2Title(title2);
6.210 - diffFrame.pack();
6.211 - diffFrame.show();
6.212 - return true;
6.213 - }
6.214 -
6.215 - private void insertEmptyLines() {
6.216 - int n = diffActions.size();
6.217 - int ins1 = 0;
6.218 - int ins2 = 0;
6.219 - D.deb("insertEmptyLines():"); // NOI18N
6.220 - for(int i = 0; i < n; i++) {
6.221 - DiffAction action = (DiffAction) diffActions.get(i);
6.222 - int n1 = action.getF1Line1() + ins1;
6.223 - int n2 = action.getF1Line2() + ins1;
6.224 - int n3 = action.getF2Line1() + ins2;
6.225 - int n4 = action.getF2Line2() + ins2;
6.226 - D.deb("Action: "+action.getAction()+": ("+n1+","+n2+","+n3+","+n4+")"); // NOI18N
6.227 - D.deb("ins1 = "+ins1+", ins2 = "+ins2); // NOI18N
6.228 - switch (action.getAction()) {
6.229 - case DiffAction.DELETE:
6.230 - diffFrame.addEmptyLines2(n3, n2 - n1 + 1);
6.231 - ins2 += n2 - n1 + 1;
6.232 - break;
6.233 - case DiffAction.ADD:
6.234 - diffFrame.addEmptyLines1(n1, n4 - n3 + 1);
6.235 - ins1 += n4 - n3 + 1;
6.236 - break;
6.237 - case DiffAction.CHANGE:
6.238 - int r1 = n2 - n1;
6.239 - int r2 = n4 - n3;
6.240 - if (r1 < r2) {
6.241 - diffFrame.addEmptyLines1(n2, r2 - r1);
6.242 - ins1 += r2 - r1;
6.243 - } else if (r1 > r2) {
6.244 - diffFrame.addEmptyLines2(n4, r1 - r2);
6.245 - ins2 += r1 - r2;
6.246 - }
6.247 - break;
6.248 - }
6.249 - action.setF1Line1(n1);
6.250 - action.setF1Line2(n2);
6.251 - action.setF2Line1(n3);
6.252 - action.setF2Line2(n4);
6.253 - }
6.254 - }
6.255 -
6.256 - private void setDiffHighlight(boolean set) {
6.257 - int n = diffActions.size();
6.258 - D.deb("Num Actions = "+n); // NOI18N
6.259 - for(int i = 0; i < n; i++) {
6.260 - DiffAction action = (DiffAction) diffActions.get(i);
6.261 - int n1 = action.getF1Line1();
6.262 - int n2 = action.getF1Line2();
6.263 - int n3 = action.getF2Line1();
6.264 - int n4 = action.getF2Line2();
6.265 - D.deb("Action: "+action.getAction()+": ("+n1+","+n2+","+n3+","+n4+")"); // NOI18N
6.266 - switch (action.getAction()) {
6.267 - case DiffAction.DELETE:
6.268 - if (set) diffFrame.highlightRegion1(n1, n2, colorMissing);
6.269 - else diffFrame.highlightRegion1(n1, n2, java.awt.Color.white);
6.270 - break;
6.271 - case DiffAction.ADD:
6.272 - if (set) diffFrame.highlightRegion2(n3, n4, colorAdded);
6.273 - else diffFrame.highlightRegion2(n3, n4, java.awt.Color.white);
6.274 - break;
6.275 - case DiffAction.CHANGE:
6.276 - if (set) {
6.277 - diffFrame.highlightRegion1(n1, n2, colorChanged);
6.278 - diffFrame.highlightRegion2(n3, n4, colorChanged);
6.279 - } else {
6.280 - diffFrame.highlightRegion1(n1, n2, java.awt.Color.white);
6.281 - diffFrame.highlightRegion2(n3, n4, java.awt.Color.white);
6.282 - }
6.283 - break;
6.284 - }
6.285 - }
6.286 - }
6.287 -
6.288 - /**
6.289 - * Executes the checkout and diff commands and display differences.
6.290 - * @param vars variables needed to run cvs commands
6.291 - * @param args the arguments, first two are supposed to be the revision tags to be compared.
6.292 - * @param stdoutNRListener listener of the standard output of the command
6.293 - * @param stderrNRListener listener of the error output of the command
6.294 - * @param stdoutListener listener of the standard output of the command which
6.295 - * satisfies regex <CODE>dataRegex</CODE>
6.296 - * @param dataRegex the regular expression for parsing the standard output
6.297 - * @param stderrListener listener of the error output of the command which
6.298 - * satisfies regex <CODE>errorRegex</CODE>
6.299 - * @param errorRegex the regular expression for parsing the error output
6.300 - * @return true if the command was succesfull,
6.301 - * false if some error has occured.
6.302 - */
6.303 - public boolean exec(Hashtable vars, String[] args,
6.304 - NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
6.305 - RegexListener stdoutListener, String dataRegex,
6.306 - RegexListener stderrListener, String errorRegex) {
6.307 - boolean status = true;
6.308 - this.stdoutNRListener = stdoutNRListener;
6.309 - this.stderrNRListener = stderrNRListener;
6.310 - this.stdoutListener = stdoutListener;
6.311 - this.dataRegex = dataRegex;
6.312 - this.stderrListener = stderrListener;
6.313 - this.errorRegex = errorRegex;
6.314 - this.vars = vars;
6.315 - int arglen = args.length;
6.316 - if (arglen < 2) {
6.317 - String message = "Too few arguments to Diff command !"; // NOI18N
6.318 - String[] elements = { message };
6.319 - if (stderrListener != null) stderrListener.match(elements);
6.320 - if (stderrNRListener != null) stderrNRListener.match(message);
6.321 - return false;
6.322 - }
6.323 - this.checkoutCmd = args[arglen - 2];
6.324 - this.diffCmd = args[arglen - 1];
6.325 - String mime = (String) vars.get("MIMETYPE"); // NOI18N
6.326 - if (mime == null || mime.indexOf("unknown") >= 0) { // NOI18N
6.327 - String message = org.openide.util.NbBundle.getBundle(CvsDiff.class).getString("CvsDiff.unknownMIMETYPE");
6.328 - String[] elements = { message };
6.329 - if (stderrListener != null) stderrListener.match(elements);
6.330 - if (stderrNRListener != null) stderrNRListener.match(message);
6.331 - return false;
6.332 - }
6.333 - this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
6.334 - String module = (String) vars.get("MODULE"); // NOI18N
6.335 - if (module == null) module = ""; // NOI18N
6.336 - if (module.length() > 0) module += File.separator;
6.337 - this.rootDirWroot = VcsFileSystem.substractRootDir(rootDir, module);
6.338 - D.deb("rootDir = "+rootDir+", module = "+module+" => rootDirWroot = "+rootDirWroot); // NOI18N
6.339 - //this.dir = (String) vars.get("DIR"); // NOI18N
6.340 - this.dir = module + (String) vars.get("DIR"); // NOI18N
6.341 - this.file = (String) vars.get("FILE"); // NOI18N
6.342 - tmpDir = createTMP();
6.343 - //tmpDirName = tmpDir.getName();
6.344 - tmpDirName = tmpDir.getAbsolutePath();
6.345 - String path = rootDir+File.separator+dir+File.separator+file;
6.346 - this.diffDataRegex = (String) vars.get("DATAREGEX"); // NOI18N
6.347 - if (this.diffDataRegex == null) this.diffDataRegex = "(^.*)$"; // NOI18N
6.348 - this.diffDataRegex = "(^[0-9]+(,[0-9]+|)[d][0-9]+$)|(^[0-9]+(,[0-9]+|)[c][0-9]+(,[0-9]+|)$)|(^[0-9]+[a][0-9]+(,[0-9]+|)$)"; // NOI18N
6.349 - String revision1 = null;
6.350 - String revision2 = null;
6.351 - if (args != null && args.length > 2) {
6.352 - revision1 = args[0];
6.353 - if (args.length > 3) {
6.354 - revision2 = args[1];
6.355 - tmpDir2 = createTMP();
6.356 - tmpDir2Name = tmpDir2.getAbsolutePath();
6.357 - }
6.358 - }
6.359 - status = checkOut(vars, dir+File.separator+file, revision1, tmpDirName);
6.360 - if (!status) {
6.361 - close();
6.362 - return status;
6.363 - }
6.364 - if (revision2 != null) {
6.365 - status = checkOut(vars, dir+File.separator+file, revision2, tmpDir2Name);
6.366 - if (!status) {
6.367 - close();
6.368 - return status;
6.369 - }
6.370 - }
6.371 - performDiff(revision1, revision2);
6.372 - final String file1Title = (revision1 == null) ? g("CvsDiff.titleCVSHeadRevision") : g("CvsDiff.titleCVSRevision", revision1); // NOI18N
6.373 - final String file2Title = (revision2 == null) ? g("CvsDiff.titleWorkingFile") : g("CvsDiff.titleCVSRevision", revision2); // NOI18N
6.374 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
6.375 - public void run () {
6.376 - if (tmpDir2 == null)
6.377 - openEditors(tmpDir+File.separator+dir+File.separator+file,
6.378 - rootDirWroot+File.separator+dir+File.separator+file,
6.379 - file1Title, file2Title);
6.380 - else
6.381 - openEditors(tmpDir+File.separator+dir+File.separator+file,
6.382 - tmpDir2+File.separator+dir+File.separator+file,
6.383 - file1Title, file2Title);
6.384 - diffFrame.setTitle("cvs diff: "+file); // NOI18N
6.385 - diffFrame.repaint();
6.386 - insertEmptyLines();
6.387 - setDiffHighlight(true);
6.388 - }
6.389 - });
6.390 - D.deb("exec return = "+status); // NOI18N
6.391 - return status;
6.392 - }
6.393 -
6.394 - public int getNextDiffLine() {
6.395 - currentDiffLine++;
6.396 - if (currentDiffLine >= diffActions.size()) currentDiffLine = 0;
6.397 - return ((DiffAction) diffActions.get(currentDiffLine)).getF1Line1();
6.398 - }
6.399 -
6.400 - public int getPrevDiffLine() {
6.401 - currentDiffLine--;
6.402 - if (currentDiffLine < 0) currentDiffLine = diffActions.size() - 1;
6.403 - return ((DiffAction) diffActions.get(currentDiffLine)).getF1Line1();
6.404 - }
6.405 - /*
6.406 - public void diffAgain() {
6.407 - //setDiffHighlight(false);
6.408 - diffFrame.unhighlightAll();
6.409 - diffActions.removeAllElements();
6.410 - performDiff();
6.411 - setDiffHighlight(true);
6.412 - }
6.413 - */
6.414 - public void close() {
6.415 - //new File(tmpDir, file).delete();
6.416 - D.deb("deleting "+tmpDir); // NOI18N
6.417 - MiscStuff.deleteRecursive(tmpDir);
6.418 - if (tmpDir2 != null) {
6.419 - D.deb("deleting "+tmpDir2); // NOI18N
6.420 - MiscStuff.deleteRecursive(tmpDir2);
6.421 - }
6.422 - }
6.423 + private String rootDir = null;
6.424 + private String rootDirWroot = null;
6.425 + private String dir = null;
6.426 + //private String mdir = null;
6.427 + private String file = null;
6.428
6.429 - private boolean checkEmpty(String str, String element) {
6.430 - if (str == null || str.length() == 0) {
6.431 - if (this.stderrListener != null) {
6.432 - String[] elements = { "Bad format of diff result: "+element }; // NOI18N
6.433 - stderrListener.match(elements);
6.434 - }
6.435 - E.deb("Bad format of diff result: "+element); // NOI18N
6.436 - return true;
6.437 - }
6.438 - return false;
6.439 - }
6.440 -
6.441 - public void match(String[] elements) {
6.442 - diffBuffer.append(elements[0]+"\n"); // NOI18N
6.443 - D.deb("diff match: "+elements[0]); // NOI18N
6.444 -
6.445 - int index = 0, commaIndex = 0;
6.446 - int n1 = 0, n2 = 0, n3 = 0, n4 = 0;
6.447 - String nStr;
6.448 - if ((index = elements[0].indexOf('a')) >= 0) {
6.449 - DiffAction action = new DiffAction();
6.450 - try {
6.451 - n1 = Integer.parseInt(elements[0].substring(0, index));
6.452 - index++;
6.453 - commaIndex = elements[0].indexOf(',', index);
6.454 - if (commaIndex < 0) {
6.455 - nStr = elements[0].substring(index, elements[0].length());
6.456 - if (checkEmpty(nStr, elements[0])) return;
6.457 - n3 = Integer.parseInt(nStr);
6.458 - n4 = n3;
6.459 - } else {
6.460 - nStr = elements[0].substring(index, commaIndex);
6.461 - if (checkEmpty(nStr, elements[0])) return;
6.462 - n3 = Integer.parseInt(nStr);
6.463 - nStr = elements[0].substring(commaIndex+1, elements[0].length());
6.464 - if (nStr == null || nStr.length() == 0) n4 = n3;
6.465 - else n4 = Integer.parseInt(nStr);
6.466 - }
6.467 - } catch (NumberFormatException e) {
6.468 - if (this.stderrListener != null) {
6.469 - String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.470 - stderrListener.match(debugOut);
6.471 - }
6.472 - E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.473 - }
6.474 - action.setAddAction(n1, n3, n4);
6.475 - diffActions.add(action);
6.476 - } else if ((index = elements[0].indexOf('d')) >= 0) {
6.477 - DiffAction action = new DiffAction();
6.478 - commaIndex = elements[0].lastIndexOf(',', index);
6.479 - try {
6.480 - if (commaIndex < 0) {
6.481 - n1 = Integer.parseInt(elements[0].substring(0, index));
6.482 - n2 = n1;
6.483 - } else {
6.484 - nStr = elements[0].substring(0, commaIndex);
6.485 - if (checkEmpty(nStr, elements[0])) return;
6.486 - n1 = Integer.parseInt(nStr);
6.487 - nStr = elements[0].substring(commaIndex+1, index);
6.488 - if (checkEmpty(nStr, elements[0])) return;
6.489 - n2 = Integer.parseInt(nStr);
6.490 - }
6.491 - nStr = elements[0].substring(index+1, elements[0].length());
6.492 - if (checkEmpty(nStr, elements[0])) return;
6.493 - n3 = Integer.parseInt(nStr);
6.494 - } catch (NumberFormatException e) {
6.495 - if (this.stderrListener != null) {
6.496 - String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.497 - stderrListener.match(debugOut);
6.498 - }
6.499 - E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.500 - }
6.501 - action.setDeleteAction(n1, n2, n3);
6.502 - diffActions.add(action);
6.503 - } else if ((index = elements[0].indexOf('c')) >= 0) {
6.504 - DiffAction action = new DiffAction();
6.505 - commaIndex = elements[0].lastIndexOf(',', index);
6.506 - try {
6.507 - if (commaIndex < 0) {
6.508 - n1 = Integer.parseInt(elements[0].substring(0, index));
6.509 - n2 = n1;
6.510 - } else {
6.511 - nStr = elements[0].substring(0, commaIndex);
6.512 - if (checkEmpty(nStr, elements[0])) return;
6.513 - n1 = Integer.parseInt(nStr);
6.514 - nStr = elements[0].substring(commaIndex+1, index);
6.515 - if (checkEmpty(nStr, elements[0])) return;
6.516 - n2 = Integer.parseInt(nStr);
6.517 - }
6.518 - index++;
6.519 - commaIndex = elements[0].indexOf(',', index);
6.520 - if (commaIndex < 0) {
6.521 - nStr = elements[0].substring(index, elements[0].length());
6.522 - if (checkEmpty(nStr, elements[0])) return;
6.523 - n3 = Integer.parseInt(nStr);
6.524 - n4 = n3;
6.525 - } else {
6.526 - nStr = elements[0].substring(index, commaIndex);
6.527 - if (checkEmpty(nStr, elements[0])) return;
6.528 - n3 = Integer.parseInt(nStr);
6.529 - nStr = elements[0].substring(commaIndex+1, elements[0].length());
6.530 - if (nStr == null || nStr.length() == 0) n4 = n3;
6.531 - else n4 = Integer.parseInt(nStr);
6.532 - }
6.533 - } catch (NumberFormatException e) {
6.534 - if (this.stderrListener != null) {
6.535 - String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.536 - stderrListener.match(debugOut);
6.537 - }
6.538 - E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.539 - }
6.540 - action.setChangeAction(n1, n2, n3, n4);
6.541 - diffActions.add(action);
6.542 - }
6.543 - }
6.544 -
6.545 - private String g(String s) {
6.546 - D.deb("getting "+s);
6.547 - return org.openide.util.NbBundle.getBundle(CvsDiff.class).getString(s);
6.548 - }
6.549 -
6.550 - private String g(String s, Object obj) {
6.551 - return java.text.MessageFormat.format (g(s), new Object[] { obj });
6.552 - }
6.553 -
6.554 - private class DiffAction {
6.555 - public static final int DELETE = 0;
6.556 - public static final int CHANGE = 1;
6.557 - public static final int ADD = 2;
6.558 -
6.559 - private int action = 0;
6.560 - private int f1Line1 = 0;
6.561 - private int f1Line2 = 0;
6.562 - private int f2Line1 = 0;
6.563 - private int f2Line2 = 0;
6.564 -
6.565 - public DiffAction() {
6.566 - }
6.567 -
6.568 - public void setDeleteAction(int f1Line1, int f1Line2, int f2Line1) {
6.569 - this.action = DELETE;
6.570 - this.f1Line1 = f1Line1;
6.571 - this.f1Line2 = f1Line2;
6.572 - this.f2Line1 = f2Line1;
6.573 + private String diffDataRegex = null;
6.574 + private NoRegexListener stdoutNRListener = null;
6.575 + private NoRegexListener stderrNRListener = null;
6.576 + private RegexListener stdoutListener = null;
6.577 + private RegexListener stderrListener = null;
6.578 + private String dataRegex = null;
6.579 + private String errorRegex = null;
6.580 + private String checkoutCmd = null;
6.581 + private String diffCmd = null;
6.582 +
6.583 + private StringBuffer diffBuffer = new StringBuffer(4096);
6.584 + private Vector diffActions = new Vector();
6.585 + private CvsDiffFrame diffFrame = null;
6.586 + private static int currentDiffLine = 0;
6.587 + private static final java.awt.Color colorMissing = new java.awt.Color(255, 160, 180);
6.588 + private static final java.awt.Color colorAdded = new java.awt.Color(180, 255, 180);
6.589 + private static final java.awt.Color colorChanged = new java.awt.Color(160, 200, 255);
6.590 + //private JEditorPane e1;
6.591 + //private JEditorPane e2;
6.592 +
6.593 + /** Creates new CvsDiff */
6.594 + public CvsDiff() {
6.595 }
6.596
6.597 - public void setAddAction(int f1Line1, int f2Line1, int f2Line2) {
6.598 - this.action = ADD;
6.599 - this.f1Line1 = f1Line1;
6.600 - this.f2Line1 = f2Line1;
6.601 - this.f2Line2 = f2Line2;
6.602 + private File createTMP() {
6.603 + TMP_ROOT=System.getProperty("netbeans.user")+File.separator+
6.604 + "system"+File.separator+"vcs"+File.separator+"tmp";
6.605 + File tmpDir = new File(TMP_ROOT);
6.606 + if (!tmpDir.exists()) {
6.607 + tmpDir.mkdirs();
6.608 + }
6.609 + long tmpId;
6.610 + do {
6.611 + tmpId = 10000 * (1 + Math.round (Math.random () * 8)) + Math.round (Math.random () * 1000);
6.612 + } while (new File(TMP_ROOT+File.separator+"tmp"+tmpId).exists()); // NOI18N
6.613 + TMP_ROOT = TMP_ROOT+File.separator+"tmp"+tmpId; // NOI18N
6.614 + tmpDir = new File(TMP_ROOT);
6.615 + if (!tmpDir.exists()) {
6.616 + tmpDir.mkdirs();
6.617 + }
6.618 + return tmpDir;
6.619 }
6.620
6.621 - public void setChangeAction(int f1Line1, int f1Line2, int f2Line1, int f2Line2) {
6.622 - this.action = CHANGE;
6.623 - this.f1Line1 = f1Line1;
6.624 - this.f1Line2 = f1Line2;
6.625 - this.f2Line1 = f2Line1;
6.626 - this.f2Line2 = f2Line2;
6.627 + private boolean checkOut(Hashtable vars, String file, String revision, String tmpDir) {
6.628 + String cmd = checkoutCmd;
6.629 + String varRevision = ""; // NOI18N
6.630 + //if (revision != null) varRevision = " -r "+revision+" "; // NOI18N
6.631 + if (revision != null) varRevision = ""+revision; // NOI18N
6.632 + vars.put("REVISION", varRevision); // NOI18N
6.633 + D.deb("varRevision = "+varRevision); // NOI18N
6.634 + vars.put("TEMPDIR", tmpDir); // NOI18N
6.635 + D.deb("checkOut Command: "+cmd); // NOI18N
6.636 + Variables v=new Variables();
6.637 + String prepared=v.expand(vars,cmd, true);
6.638 + D.deb("checkOut prepared: "+prepared); // NOI18N
6.639 + if (stderrListener != null) {
6.640 + String[] command = { "CHECKOUT: "+prepared }; // NOI18N
6.641 + stderrListener.match(command);
6.642 + }
6.643 + if (stderrNRListener != null) stderrNRListener.match("CHECKOUT: "+prepared); // NOI18N
6.644 + ExternalCommand ec=new ExternalCommand(prepared);
6.645 + ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
6.646 + if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(this.stdoutNRListener);
6.647 + if (this.stderrNRListener != null) ec.addStderrNoRegexListener(this.stderrNRListener);
6.648 + if (this.stdoutListener != null) {
6.649 + try {
6.650 + ec.addStdoutRegexListener(this.stdoutListener, this.dataRegex);
6.651 + } catch (BadRegexException e) {
6.652 + if (stderrListener != null) {
6.653 + String[] elements = { "CHECKOUT: Bad data regex "+dataRegex+"\n" }; // NOI18N
6.654 + stderrListener.match(elements);
6.655 + }
6.656 + }
6.657 + }
6.658 + if (this.stderrListener != null) {
6.659 + try {
6.660 + ec.addStderrRegexListener(this.stderrListener, this.errorRegex);
6.661 + } catch (BadRegexException e) {
6.662 + String[] elements = { "CHECKOUT: Bad error regex "+errorRegex+"\n" }; // NOI18N
6.663 + stderrListener.match(elements);
6.664 + }
6.665 + }
6.666 + if ( ec.exec() != ExternalCommand.SUCCESS ){
6.667 + E.err("exec failed "+ec.getExitStatus()); // NOI18N
6.668 + return false;
6.669 + } else return true;
6.670 }
6.671
6.672 - public int getAction() {
6.673 - return this.action;
6.674 - }
6.675 -
6.676 - public int getF1Line1() {
6.677 - return this.f1Line1;
6.678 - }
6.679 -
6.680 - public void setF1Line1(int value) {
6.681 - this.f1Line1 = value;
6.682 + private boolean performDiff(String revision1, String revision2) {
6.683 + String cmd = diffCmd;
6.684 + String varRevision = ""; // NOI18N
6.685 + if (revision1 != null) varRevision += " -r "+revision1+" "; // NOI18N
6.686 + if (revision2 != null) varRevision += " -r "+revision2+" "; // NOI18N
6.687 + vars.put("REVISION", varRevision); // NOI18N
6.688 + D.deb("diff command: "+cmd); // NOI18N
6.689 + Variables v=new Variables();
6.690 + String prepared=v.expand(vars,cmd, true);
6.691 + D.deb("diff prepared: "+prepared); // NOI18N
6.692 + if (stderrListener != null) {
6.693 + String[] command = { "DIFF: "+prepared }; // NOI18N
6.694 + stderrListener.match(command);
6.695 + }
6.696 + if (stderrNRListener != null) stderrNRListener.match("DIFF: "+prepared); // NOI18N
6.697 + ExternalCommand ec=new ExternalCommand(prepared);
6.698 + ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
6.699 + try{
6.700 + D.deb("stdout diff dataRegex = "+diffDataRegex); // NOI18N
6.701 + ec.addStdoutRegexListener(this,diffDataRegex);
6.702 + } catch (BadRegexException e) {
6.703 + if (stderrListener != null) {
6.704 + String[] elements = { "cvs diff: Bad data regex "+diffDataRegex }; // NOI18N
6.705 + stderrListener.match(elements);
6.706 + }
6.707 + return false;
6.708 + }
6.709 + if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
6.710 + if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
6.711 + if (this.stdoutListener != null) {
6.712 + try {
6.713 + ec.addStdoutRegexListener(this.stdoutListener, this.dataRegex);
6.714 + } catch (BadRegexException e) {
6.715 + if (stderrListener != null) {
6.716 + String[] elements = { "DIFF: Bad data regex "+dataRegex+"\n" }; // NOI18N
6.717 + stderrListener.match(elements);
6.718 + }
6.719 + }
6.720 + }
6.721 + if (this.stderrListener != null) {
6.722 + try {
6.723 + ec.addStderrRegexListener(this.stderrListener, this.errorRegex);
6.724 + } catch (BadRegexException e) {
6.725 + String[] elements = { "DIFF: Bad error regex "+errorRegex+"\n" }; // NOI18N
6.726 + stderrListener.match(elements);
6.727 + }
6.728 + }
6.729 + if ( ec.exec() != ExternalCommand.SUCCESS ){
6.730 + D.deb("exec failed "+ec.getExitStatus()); // NOI18N
6.731 + return false;
6.732 + }
6.733 + return true;
6.734 }
6.735
6.736 - public int getF1Line2() {
6.737 - return this.f1Line2;
6.738 - }
6.739 -
6.740 - public void setF1Line2(int value) {
6.741 - this.f1Line2 = value;
6.742 + private boolean openEditors(String file1, String file2, String title1, String title2) {
6.743 + String mime = (String) vars.get("MIMETYPE"); // NOI18N
6.744 + D.deb("I have MIME = "+mime); // NOI18N
6.745 + URL url1 = null;
6.746 + URL url2 = null;
6.747 + try {
6.748 + url1 = new File(file1).toURL();
6.749 + url2 = new File(file2).toURL();
6.750 + } catch (java.net.MalformedURLException e) {
6.751 + D.deb("MalformedURLException "+e.getMessage()); // NOI18N
6.752 + return false;
6.753 + }
6.754 + diffFrame = new CvsDiffFrame(this);
6.755 + MiscStuff.centerWindow(diffFrame);
6.756 + if (mime != null) {
6.757 + diffFrame.setMimeType1(mime);
6.758 + diffFrame.setMimeType2(mime);
6.759 + }
6.760 + try {
6.761 + diffFrame.setFile1(url1);
6.762 + diffFrame.setFile2(url2);
6.763 + } catch (IOException e) {
6.764 + D.err("IO Exception "+e.getMessage()); // NOI18N
6.765 + return false;
6.766 + }
6.767 + diffFrame.setFile1Title(title1);
6.768 + diffFrame.setFile2Title(title2);
6.769 + diffFrame.pack();
6.770 + diffFrame.show();
6.771 + return true;
6.772 }
6.773
6.774 - public int getF2Line1() {
6.775 - return this.f2Line1;
6.776 + private void insertEmptyLines() {
6.777 + int n = diffActions.size();
6.778 + int ins1 = 0;
6.779 + int ins2 = 0;
6.780 + D.deb("insertEmptyLines():"); // NOI18N
6.781 + for(int i = 0; i < n; i++) {
6.782 + DiffAction action = (DiffAction) diffActions.get(i);
6.783 + int n1 = action.getF1Line1() + ins1;
6.784 + int n2 = action.getF1Line2() + ins1;
6.785 + int n3 = action.getF2Line1() + ins2;
6.786 + int n4 = action.getF2Line2() + ins2;
6.787 + D.deb("Action: "+action.getAction()+": ("+n1+","+n2+","+n3+","+n4+")"); // NOI18N
6.788 + D.deb("ins1 = "+ins1+", ins2 = "+ins2); // NOI18N
6.789 + switch (action.getAction()) {
6.790 + case DiffAction.DELETE:
6.791 + diffFrame.addEmptyLines2(n3, n2 - n1 + 1);
6.792 + ins2 += n2 - n1 + 1;
6.793 + break;
6.794 + case DiffAction.ADD:
6.795 + diffFrame.addEmptyLines1(n1, n4 - n3 + 1);
6.796 + ins1 += n4 - n3 + 1;
6.797 + break;
6.798 + case DiffAction.CHANGE:
6.799 + int r1 = n2 - n1;
6.800 + int r2 = n4 - n3;
6.801 + if (r1 < r2) {
6.802 + diffFrame.addEmptyLines1(n2, r2 - r1);
6.803 + ins1 += r2 - r1;
6.804 + } else if (r1 > r2) {
6.805 + diffFrame.addEmptyLines2(n4, r1 - r2);
6.806 + ins2 += r1 - r2;
6.807 + }
6.808 + break;
6.809 + }
6.810 + action.setF1Line1(n1);
6.811 + action.setF1Line2(n2);
6.812 + action.setF2Line1(n3);
6.813 + action.setF2Line2(n4);
6.814 + }
6.815 }
6.816
6.817 - public void setF2Line1(int value) {
6.818 - this.f2Line1 = value;
6.819 + private void setDiffHighlight(boolean set) {
6.820 + int n = diffActions.size();
6.821 + D.deb("Num Actions = "+n); // NOI18N
6.822 + for(int i = 0; i < n; i++) {
6.823 + DiffAction action = (DiffAction) diffActions.get(i);
6.824 + int n1 = action.getF1Line1();
6.825 + int n2 = action.getF1Line2();
6.826 + int n3 = action.getF2Line1();
6.827 + int n4 = action.getF2Line2();
6.828 + D.deb("Action: "+action.getAction()+": ("+n1+","+n2+","+n3+","+n4+")"); // NOI18N
6.829 + switch (action.getAction()) {
6.830 + case DiffAction.DELETE:
6.831 + if (set) diffFrame.highlightRegion1(n1, n2, colorMissing);
6.832 + else diffFrame.highlightRegion1(n1, n2, java.awt.Color.white);
6.833 + break;
6.834 + case DiffAction.ADD:
6.835 + if (set) diffFrame.highlightRegion2(n3, n4, colorAdded);
6.836 + else diffFrame.highlightRegion2(n3, n4, java.awt.Color.white);
6.837 + break;
6.838 + case DiffAction.CHANGE:
6.839 + if (set) {
6.840 + diffFrame.highlightRegion1(n1, n2, colorChanged);
6.841 + diffFrame.highlightRegion2(n3, n4, colorChanged);
6.842 + } else {
6.843 + diffFrame.highlightRegion1(n1, n2, java.awt.Color.white);
6.844 + diffFrame.highlightRegion2(n3, n4, java.awt.Color.white);
6.845 + }
6.846 + break;
6.847 + }
6.848 + }
6.849 }
6.850
6.851 - public int getF2Line2() {
6.852 - return this.f2Line2;
6.853 + /**
6.854 + * Executes the checkout and diff commands and display differences.
6.855 + * @param vars variables needed to run cvs commands
6.856 + * @param args the arguments, first two are supposed to be the revision tags to be compared.
6.857 + * @param stdoutNRListener listener of the standard output of the command
6.858 + * @param stderrNRListener listener of the error output of the command
6.859 + * @param stdoutListener listener of the standard output of the command which
6.860 + * satisfies regex <CODE>dataRegex</CODE>
6.861 + * @param dataRegex the regular expression for parsing the standard output
6.862 + * @param stderrListener listener of the error output of the command which
6.863 + * satisfies regex <CODE>errorRegex</CODE>
6.864 + * @param errorRegex the regular expression for parsing the error output
6.865 + * @return true if the command was succesfull,
6.866 + * false if some error has occured.
6.867 + */
6.868 + public boolean exec(Hashtable vars, String[] args,
6.869 + NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
6.870 + RegexListener stdoutListener, String dataRegex,
6.871 + RegexListener stderrListener, String errorRegex) {
6.872 + boolean status = true;
6.873 + this.stdoutNRListener = stdoutNRListener;
6.874 + this.stderrNRListener = stderrNRListener;
6.875 + this.stdoutListener = stdoutListener;
6.876 + this.dataRegex = dataRegex;
6.877 + this.stderrListener = stderrListener;
6.878 + this.errorRegex = errorRegex;
6.879 + this.vars = vars;
6.880 + int arglen = args.length;
6.881 + if (arglen < 2) {
6.882 + String message = "Too few arguments to Diff command !"; // NOI18N
6.883 + String[] elements = { message };
6.884 + if (stderrListener != null) stderrListener.match(elements);
6.885 + if (stderrNRListener != null) stderrNRListener.match(message);
6.886 + return false;
6.887 + }
6.888 + this.checkoutCmd = args[arglen - 2];
6.889 + this.diffCmd = args[arglen - 1];
6.890 + String mime = (String) vars.get("MIMETYPE"); // NOI18N
6.891 + if (mime == null || mime.indexOf("unknown") >= 0) { // NOI18N
6.892 + String message = org.openide.util.NbBundle.getBundle(CvsDiff.class).getString("CvsDiff.unknownMIMETYPE");
6.893 + String[] elements = { message };
6.894 + if (stderrListener != null) stderrListener.match(elements);
6.895 + if (stderrNRListener != null) stderrNRListener.match(message);
6.896 + return false;
6.897 + }
6.898 + this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
6.899 + String module = (String) vars.get("MODULE"); // NOI18N
6.900 + if (module == null) module = ""; // NOI18N
6.901 + if (module.length() > 0) module += File.separator;
6.902 + this.rootDirWroot = VcsFileSystem.substractRootDir(rootDir, module);
6.903 + D.deb("rootDir = "+rootDir+", module = "+module+" => rootDirWroot = "+rootDirWroot); // NOI18N
6.904 + //this.dir = (String) vars.get("DIR"); // NOI18N
6.905 + this.dir = module + (String) vars.get("DIR"); // NOI18N
6.906 + this.file = (String) vars.get("FILE"); // NOI18N
6.907 + tmpDir = createTMP();
6.908 + //tmpDirName = tmpDir.getName();
6.909 + tmpDirName = tmpDir.getAbsolutePath();
6.910 + String path = rootDir+File.separator+dir+File.separator+file;
6.911 + this.diffDataRegex = (String) vars.get("DATAREGEX"); // NOI18N
6.912 + if (this.diffDataRegex == null) this.diffDataRegex = "(^.*)$"; // NOI18N
6.913 + this.diffDataRegex = "(^[0-9]+(,[0-9]+|)[d][0-9]+$)|(^[0-9]+(,[0-9]+|)[c][0-9]+(,[0-9]+|)$)|(^[0-9]+[a][0-9]+(,[0-9]+|)$)"; // NOI18N
6.914 + String revision1 = null;
6.915 + String revision2 = null;
6.916 + if (args != null && args.length > 2) {
6.917 + revision1 = args[0];
6.918 + if (args.length > 3) {
6.919 + revision2 = args[1];
6.920 + tmpDir2 = createTMP();
6.921 + tmpDir2Name = tmpDir2.getAbsolutePath();
6.922 + }
6.923 + }
6.924 + status = checkOut(vars, dir+File.separator+file, revision1, tmpDirName);
6.925 + if (!status) {
6.926 + close();
6.927 + return status;
6.928 + }
6.929 + if (revision2 != null) {
6.930 + status = checkOut(vars, dir+File.separator+file, revision2, tmpDir2Name);
6.931 + if (!status) {
6.932 + close();
6.933 + return status;
6.934 + }
6.935 + }
6.936 + performDiff(revision1, revision2);
6.937 + final String file1Title = (revision1 == null) ? g("CvsDiff.titleCVSHeadRevision") : g("CvsDiff.titleCVSRevision", revision1); // NOI18N
6.938 + final String file2Title = (revision2 == null) ? g("CvsDiff.titleWorkingFile") : g("CvsDiff.titleCVSRevision", revision2); // NOI18N
6.939 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
6.940 + public void run () {
6.941 + if (tmpDir2 == null)
6.942 + openEditors(tmpDir+File.separator+dir+File.separator+file,
6.943 + rootDirWroot+File.separator+dir+File.separator+file,
6.944 + file1Title, file2Title);
6.945 + else
6.946 + openEditors(tmpDir+File.separator+dir+File.separator+file,
6.947 + tmpDir2+File.separator+dir+File.separator+file,
6.948 + file1Title, file2Title);
6.949 + diffFrame.setTitle("cvs diff: "+file); // NOI18N
6.950 + diffFrame.repaint();
6.951 + insertEmptyLines();
6.952 + setDiffHighlight(true);
6.953 + }
6.954 + });
6.955 + D.deb("exec return = "+status); // NOI18N
6.956 + return status;
6.957 }
6.958 -
6.959 - public void setF2Line2(int value) {
6.960 - this.f2Line2 = value;
6.961 +
6.962 + public int getNextDiffLine() {
6.963 + currentDiffLine++;
6.964 + if (currentDiffLine >= diffActions.size()) currentDiffLine = 0;
6.965 + return ((DiffAction) diffActions.get(currentDiffLine)).getF1Line1();
6.966 }
6.967 - }
6.968 +
6.969 + public int getPrevDiffLine() {
6.970 + currentDiffLine--;
6.971 + if (currentDiffLine < 0) currentDiffLine = diffActions.size() - 1;
6.972 + return ((DiffAction) diffActions.get(currentDiffLine)).getF1Line1();
6.973 + }
6.974 + /*
6.975 + public void diffAgain() {
6.976 + //setDiffHighlight(false);
6.977 + diffFrame.unhighlightAll();
6.978 + diffActions.removeAllElements();
6.979 + performDiff();
6.980 + setDiffHighlight(true);
6.981 +}
6.982 + */
6.983 + public void close() {
6.984 + //new File(tmpDir, file).delete();
6.985 + D.deb("deleting "+tmpDir); // NOI18N
6.986 + MiscStuff.deleteRecursive(tmpDir);
6.987 + if (tmpDir2 != null) {
6.988 + D.deb("deleting "+tmpDir2); // NOI18N
6.989 + MiscStuff.deleteRecursive(tmpDir2);
6.990 + }
6.991 + }
6.992 +
6.993 + private boolean checkEmpty(String str, String element) {
6.994 + if (str == null || str.length() == 0) {
6.995 + if (this.stderrListener != null) {
6.996 + String[] elements = { "Bad format of diff result: "+element }; // NOI18N
6.997 + stderrListener.match(elements);
6.998 + }
6.999 + E.deb("Bad format of diff result: "+element); // NOI18N
6.1000 + return true;
6.1001 + }
6.1002 + return false;
6.1003 + }
6.1004 +
6.1005 + public void match(String[] elements) {
6.1006 + diffBuffer.append(elements[0]+"\n"); // NOI18N
6.1007 + D.deb("diff match: "+elements[0]); // NOI18N
6.1008 +
6.1009 + int index = 0, commaIndex = 0;
6.1010 + int n1 = 0, n2 = 0, n3 = 0, n4 = 0;
6.1011 + String nStr;
6.1012 + if ((index = elements[0].indexOf('a')) >= 0) {
6.1013 + DiffAction action = new DiffAction();
6.1014 + try {
6.1015 + n1 = Integer.parseInt(elements[0].substring(0, index));
6.1016 + index++;
6.1017 + commaIndex = elements[0].indexOf(',', index);
6.1018 + if (commaIndex < 0) {
6.1019 + nStr = elements[0].substring(index, elements[0].length());
6.1020 + if (checkEmpty(nStr, elements[0])) return;
6.1021 + n3 = Integer.parseInt(nStr);
6.1022 + n4 = n3;
6.1023 + } else {
6.1024 + nStr = elements[0].substring(index, commaIndex);
6.1025 + if (checkEmpty(nStr, elements[0])) return;
6.1026 + n3 = Integer.parseInt(nStr);
6.1027 + nStr = elements[0].substring(commaIndex+1, elements[0].length());
6.1028 + if (nStr == null || nStr.length() == 0) n4 = n3;
6.1029 + else n4 = Integer.parseInt(nStr);
6.1030 + }
6.1031 + } catch (NumberFormatException e) {
6.1032 + if (this.stderrListener != null) {
6.1033 + String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.1034 + stderrListener.match(debugOut);
6.1035 + }
6.1036 + E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.1037 + }
6.1038 + action.setAddAction(n1, n3, n4);
6.1039 + diffActions.add(action);
6.1040 + } else if ((index = elements[0].indexOf('d')) >= 0) {
6.1041 + DiffAction action = new DiffAction();
6.1042 + commaIndex = elements[0].lastIndexOf(',', index);
6.1043 + try {
6.1044 + if (commaIndex < 0) {
6.1045 + n1 = Integer.parseInt(elements[0].substring(0, index));
6.1046 + n2 = n1;
6.1047 + } else {
6.1048 + nStr = elements[0].substring(0, commaIndex);
6.1049 + if (checkEmpty(nStr, elements[0])) return;
6.1050 + n1 = Integer.parseInt(nStr);
6.1051 + nStr = elements[0].substring(commaIndex+1, index);
6.1052 + if (checkEmpty(nStr, elements[0])) return;
6.1053 + n2 = Integer.parseInt(nStr);
6.1054 + }
6.1055 + nStr = elements[0].substring(index+1, elements[0].length());
6.1056 + if (checkEmpty(nStr, elements[0])) return;
6.1057 + n3 = Integer.parseInt(nStr);
6.1058 + } catch (NumberFormatException e) {
6.1059 + if (this.stderrListener != null) {
6.1060 + String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.1061 + stderrListener.match(debugOut);
6.1062 + }
6.1063 + E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.1064 + }
6.1065 + action.setDeleteAction(n1, n2, n3);
6.1066 + diffActions.add(action);
6.1067 + } else if ((index = elements[0].indexOf('c')) >= 0) {
6.1068 + DiffAction action = new DiffAction();
6.1069 + commaIndex = elements[0].lastIndexOf(',', index);
6.1070 + try {
6.1071 + if (commaIndex < 0) {
6.1072 + n1 = Integer.parseInt(elements[0].substring(0, index));
6.1073 + n2 = n1;
6.1074 + } else {
6.1075 + nStr = elements[0].substring(0, commaIndex);
6.1076 + if (checkEmpty(nStr, elements[0])) return;
6.1077 + n1 = Integer.parseInt(nStr);
6.1078 + nStr = elements[0].substring(commaIndex+1, index);
6.1079 + if (checkEmpty(nStr, elements[0])) return;
6.1080 + n2 = Integer.parseInt(nStr);
6.1081 + }
6.1082 + index++;
6.1083 + commaIndex = elements[0].indexOf(',', index);
6.1084 + if (commaIndex < 0) {
6.1085 + nStr = elements[0].substring(index, elements[0].length());
6.1086 + if (checkEmpty(nStr, elements[0])) return;
6.1087 + n3 = Integer.parseInt(nStr);
6.1088 + n4 = n3;
6.1089 + } else {
6.1090 + nStr = elements[0].substring(index, commaIndex);
6.1091 + if (checkEmpty(nStr, elements[0])) return;
6.1092 + n3 = Integer.parseInt(nStr);
6.1093 + nStr = elements[0].substring(commaIndex+1, elements[0].length());
6.1094 + if (nStr == null || nStr.length() == 0) n4 = n3;
6.1095 + else n4 = Integer.parseInt(nStr);
6.1096 + }
6.1097 + } catch (NumberFormatException e) {
6.1098 + if (this.stderrListener != null) {
6.1099 + String[] debugOut = { "NumberFormatException "+e.getMessage() }; // NOI18N
6.1100 + stderrListener.match(debugOut);
6.1101 + }
6.1102 + E.deb("NumberFormatException "+e.getMessage()); // NOI18N
6.1103 + }
6.1104 + action.setChangeAction(n1, n2, n3, n4);
6.1105 + diffActions.add(action);
6.1106 + }
6.1107 + }
6.1108 +
6.1109 + private String g(String s) {
6.1110 + D.deb("getting "+s);
6.1111 + return org.openide.util.NbBundle.getBundle(CvsDiff.class).getString(s);
6.1112 + }
6.1113 +
6.1114 + private String g(String s, Object obj) {
6.1115 + return java.text.MessageFormat.format (g(s), new Object[] { obj });
6.1116 + }
6.1117 +
6.1118 + private class DiffAction {
6.1119 + public static final int DELETE = 0;
6.1120 + public static final int CHANGE = 1;
6.1121 + public static final int ADD = 2;
6.1122 +
6.1123 + private int action = 0;
6.1124 + private int f1Line1 = 0;
6.1125 + private int f1Line2 = 0;
6.1126 + private int f2Line1 = 0;
6.1127 + private int f2Line2 = 0;
6.1128 +
6.1129 + public DiffAction() {
6.1130 + }
6.1131 +
6.1132 + public void setDeleteAction(int f1Line1, int f1Line2, int f2Line1) {
6.1133 + this.action = DELETE;
6.1134 + this.f1Line1 = f1Line1;
6.1135 + this.f1Line2 = f1Line2;
6.1136 + this.f2Line1 = f2Line1;
6.1137 + }
6.1138 +
6.1139 + public void setAddAction(int f1Line1, int f2Line1, int f2Line2) {
6.1140 + this.action = ADD;
6.1141 + this.f1Line1 = f1Line1;
6.1142 + this.f2Line1 = f2Line1;
6.1143 + this.f2Line2 = f2Line2;
6.1144 + }
6.1145 +
6.1146 + public void setChangeAction(int f1Line1, int f1Line2, int f2Line1, int f2Line2) {
6.1147 + this.action = CHANGE;
6.1148 + this.f1Line1 = f1Line1;
6.1149 + this.f1Line2 = f1Line2;
6.1150 + this.f2Line1 = f2Line1;
6.1151 + this.f2Line2 = f2Line2;
6.1152 + }
6.1153 +
6.1154 + public int getAction() {
6.1155 + return this.action;
6.1156 + }
6.1157 +
6.1158 + public int getF1Line1() {
6.1159 + return this.f1Line1;
6.1160 + }
6.1161 +
6.1162 + public void setF1Line1(int value) {
6.1163 + this.f1Line1 = value;
6.1164 + }
6.1165 +
6.1166 + public int getF1Line2() {
6.1167 + return this.f1Line2;
6.1168 + }
6.1169 +
6.1170 + public void setF1Line2(int value) {
6.1171 + this.f1Line2 = value;
6.1172 + }
6.1173 +
6.1174 + public int getF2Line1() {
6.1175 + return this.f2Line1;
6.1176 + }
6.1177 +
6.1178 + public void setF2Line1(int value) {
6.1179 + this.f2Line1 = value;
6.1180 + }
6.1181 +
6.1182 + public int getF2Line2() {
6.1183 + return this.f2Line2;
6.1184 + }
6.1185 +
6.1186 + public void setF2Line2(int value) {
6.1187 + this.f2Line2 = value;
6.1188 + }
6.1189 + }
6.1190 }
6.1191 /*
6.1192 * Log
7.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsLogInfo.java Tue Apr 25 12:55:38 2000 +0000
7.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsLogInfo.java Tue Apr 25 14:04:53 2000 +0000
7.3 @@ -20,312 +20,312 @@
7.4 import java.util.*;
7.5 import java.io.*;
7.6
7.7 -/**
7.8 +/**
7.9 *
7.10 * @author Martin Entlicher
7.11 * @version
7.12 */
7.13 public class CvsLogInfo extends Object implements RegexListener {
7.14
7.15 - private Debug E=new Debug("CvsLogInfo",true); // NOI18N
7.16 - private Debug D=E;
7.17 + private Debug E=new Debug("CvsLogInfo",true); // NOI18N
7.18 + private Debug D=E;
7.19
7.20 - private StringBuffer logBuffer = new StringBuffer(4096);
7.21 - private Vector revisions = new Vector();
7.22 - private Vector revisionsFile = new Vector();
7.23 - private Vector branches = new Vector();
7.24 - private Vector branchesFile = new Vector();
7.25 - private Vector orderRevBranch = new Vector();
7.26 - private Vector orderRevBranchFile = new Vector();
7.27 - private static final int ORDER_REVISION = 0;
7.28 - private static final int ORDER_BRANCH = 1;
7.29 -
7.30 - /**
7.31 - * Contains revision number as the key and the tag name as the value.
7.32 - */
7.33 - private Hashtable symbolicNames = new Hashtable();
7.34 - private Hashtable symbolicNamesFile = new Hashtable();
7.35 - private boolean matchingSymbolicNames = false;
7.36 - private boolean mergeIsEmpty = true;
7.37 - private CvsRevisionGraph revisionGraph = null;
7.38 -
7.39 - private String revisionStr = new String("revision"); // NOI18N
7.40 - private String branchesStr = new String("branches"); // NOI18N
7.41 - private String symbNamesStr = new String("symbolic names"); // NOI18N
7.42 - private String nextFileStr = new String("=================="); // NOI18N
7.43 + private StringBuffer logBuffer = new StringBuffer(4096);
7.44 + private Vector revisions = new Vector();
7.45 + private Vector revisionsFile = new Vector();
7.46 + private Vector branches = new Vector();
7.47 + private Vector branchesFile = new Vector();
7.48 + private Vector orderRevBranch = new Vector();
7.49 + private Vector orderRevBranchFile = new Vector();
7.50 + private static final int ORDER_REVISION = 0;
7.51 + private static final int ORDER_BRANCH = 1;
7.52
7.53 - /** Creates new CvsLogInfo */
7.54 - public CvsLogInfo() {
7.55 - }
7.56 -
7.57 - public Vector getRevisions() {
7.58 - return revisions;
7.59 - }
7.60 -
7.61 - public Vector getBranches() {
7.62 - return branches;
7.63 - }
7.64 -
7.65 - public Hashtable getSymbolicNames() {
7.66 - return symbolicNames;
7.67 - }
7.68 + /**
7.69 + * Contains revision number as the key and the tag name as the value.
7.70 + */
7.71 + private Hashtable symbolicNames = new Hashtable();
7.72 + private Hashtable symbolicNamesFile = new Hashtable();
7.73 + private boolean matchingSymbolicNames = false;
7.74 + private boolean mergeIsEmpty = true;
7.75 + private CvsRevisionGraph revisionGraph = null;
7.76
7.77 - public Vector getRevisionsWithSymbolicNames() {
7.78 - String revision;
7.79 - Vector revisions = getRevisions();
7.80 - Vector revSN = new Vector(revisions);
7.81 - Hashtable sn = getSymbolicNames();
7.82 - Enumeration enum = sn.keys();
7.83 - while(enum.hasMoreElements()) {
7.84 - revision = (String) enum.nextElement();
7.85 - String symbName = (String) sn.get(revision);
7.86 - D.deb("I have symbolic name: "+symbName+" for revision: "+revision); // NOI18N
7.87 - int revIndex = revSN.indexOf(revision);
7.88 - if (symbName != null) revision += " "+symbName; // NOI18N
7.89 - if (revIndex >= 0) {
7.90 - revSN.setElementAt(revision, revIndex);
7.91 - } else {
7.92 - revSN.addElement(revision);
7.93 - }
7.94 + private String revisionStr = new String("revision"); // NOI18N
7.95 + private String branchesStr = new String("branches"); // NOI18N
7.96 + private String symbNamesStr = new String("symbolic names"); // NOI18N
7.97 + private String nextFileStr = new String("=================="); // NOI18N
7.98 +
7.99 + /** Creates new CvsLogInfo */
7.100 + public CvsLogInfo() {
7.101 }
7.102 - return revSN;
7.103 - }
7.104 -
7.105 - public Vector getBranchesWithSymbolicNames() {
7.106 - String revision;
7.107 - Vector branches = getBranches();
7.108 - Vector brSN = new Vector(branches);
7.109 - Hashtable sn = getSymbolicNames();
7.110 - Enumeration enum = sn.keys();
7.111 - while(enum.hasMoreElements()) {
7.112 - revision = (String) enum.nextElement();
7.113 - String symbName = (String) sn.get(revision);
7.114 - D.deb("I have symbolic name: "+symbName+" for revision: "+revision); // NOI18N
7.115 - int brIndex = brSN.indexOf(revision);
7.116 - if (brIndex >= 0) {
7.117 - if (symbName != null) revision += " "+symbName; // NOI18N
7.118 - brSN.setElementAt(revision, brIndex);
7.119 - } else {
7.120 - int lastDot = revision.lastIndexOf('.');
7.121 - if (lastDot > 1 && revision.charAt(lastDot - 1) == '0' &&
7.122 - revision.charAt(lastDot - 2) == '.') {
7.123 - String branch = revision.substring(0, lastDot-1) + revision.substring(lastDot+1);
7.124 - D.deb("I have created the branch number "+branch); // NOI18N
7.125 - brIndex = brSN.indexOf(branch);
7.126 - if (symbName != null) branch += " "+symbName; // NOI18N
7.127 - if (brIndex >= 0) {
7.128 - brSN.setElementAt(branch, brIndex);
7.129 - } else {
7.130 - brSN.addElement(branch);
7.131 - }
7.132 +
7.133 + public Vector getRevisions() {
7.134 + return revisions;
7.135 + }
7.136 +
7.137 + public Vector getBranches() {
7.138 + return branches;
7.139 + }
7.140 +
7.141 + public Hashtable getSymbolicNames() {
7.142 + return symbolicNames;
7.143 + }
7.144 +
7.145 + public Vector getRevisionsWithSymbolicNames() {
7.146 + String revision;
7.147 + Vector revisions = getRevisions();
7.148 + Vector revSN = new Vector(revisions);
7.149 + Hashtable sn = getSymbolicNames();
7.150 + Enumeration enum = sn.keys();
7.151 + while(enum.hasMoreElements()) {
7.152 + revision = (String) enum.nextElement();
7.153 + String symbName = (String) sn.get(revision);
7.154 + D.deb("I have symbolic name: "+symbName+" for revision: "+revision); // NOI18N
7.155 + int revIndex = revSN.indexOf(revision);
7.156 + if (symbName != null) revision += " "+symbName; // NOI18N
7.157 + if (revIndex >= 0) {
7.158 + revSN.setElementAt(revision, revIndex);
7.159 + } else {
7.160 + revSN.addElement(revision);
7.161 + }
7.162 + }
7.163 + return revSN;
7.164 + }
7.165 +
7.166 + public Vector getBranchesWithSymbolicNames() {
7.167 + String revision;
7.168 + Vector branches = getBranches();
7.169 + Vector brSN = new Vector(branches);
7.170 + Hashtable sn = getSymbolicNames();
7.171 + Enumeration enum = sn.keys();
7.172 + while(enum.hasMoreElements()) {
7.173 + revision = (String) enum.nextElement();
7.174 + String symbName = (String) sn.get(revision);
7.175 + D.deb("I have symbolic name: "+symbName+" for revision: "+revision); // NOI18N
7.176 + int brIndex = brSN.indexOf(revision);
7.177 + if (brIndex >= 0) {
7.178 + if (symbName != null) revision += " "+symbName; // NOI18N
7.179 + brSN.setElementAt(revision, brIndex);
7.180 + } else {
7.181 + int lastDot = revision.lastIndexOf('.');
7.182 + if (lastDot > 1 && revision.charAt(lastDot - 1) == '0' &&
7.183 + revision.charAt(lastDot - 2) == '.') {
7.184 + String branch = revision.substring(0, lastDot-1) + revision.substring(lastDot+1);
7.185 + D.deb("I have created the branch number "+branch); // NOI18N
7.186 + brIndex = brSN.indexOf(branch);
7.187 + if (symbName != null) branch += " "+symbName; // NOI18N
7.188 + if (brIndex >= 0) {
7.189 + brSN.setElementAt(branch, brIndex);
7.190 + } else {
7.191 + brSN.addElement(branch);
7.192 + }
7.193 + }
7.194 + }
7.195 + }
7.196 + return brSN;
7.197 + }
7.198 +
7.199 + public CvsRevisionGraph getRevisionGraph() {
7.200 + return revisionGraph;
7.201 + }
7.202 +
7.203 + public boolean updateLogInfo(Hashtable vars, String[] args,
7.204 + NoRegexListener stdoutListener,
7.205 + NoRegexListener stderrListener) {
7.206 + revisionGraph = new CvsRevisionGraph();
7.207 + mergeIsEmpty = true;
7.208 + String cmd = MiscStuff.array2string(args);
7.209 + Variables v=new Variables();
7.210 + String prepared=v.expand(vars,cmd, true);
7.211 + D.deb("Log prepared: "+prepared); // NOI18N
7.212 + if (stderrListener != null) stderrListener.match("LOG INFO: "+prepared); // NOI18N
7.213 + ExternalCommand ec=new ExternalCommand(prepared);
7.214 + ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
7.215 + String logDataRegex = (String) vars.get("DATAREGEX"); // NOI18N
7.216 + try{
7.217 + D.deb("stdout log dataRegex = "+logDataRegex); // NOI18N
7.218 + ec.addStdoutRegexListener(this, logDataRegex);
7.219 + } catch (BadRegexException e) {
7.220 + if (stderrListener != null) stderrListener.match("cvs log: Bad data regex "+logDataRegex+"\n"); // NOI18N
7.221 + return false;
7.222 + }
7.223 + if (stdoutListener != null) ec.addStdoutNoRegexListener(stdoutListener);
7.224 + if (stderrListener != null) ec.addStderrNoRegexListener(stderrListener);
7.225 + if ( ec.exec() != ExternalCommand.SUCCESS ){
7.226 + E.err("exec failed "+ec.getExitStatus()); // NOI18N
7.227 + return false;
7.228 + }
7.229 + D.deb("branches = "+branches); // NOI18N
7.230 + for(int i = 0; i < orderRevBranch.size(); i++) {
7.231 + Integer what = (Integer) orderRevBranch.get(i);
7.232 + i++;
7.233 + if (what.intValue() == ORDER_REVISION) {
7.234 + Integer revision = (Integer) orderRevBranch.get(i);
7.235 + revisionGraph.insertRevision((String) revisions.get(revision.intValue()));
7.236 + } else {
7.237 + Integer branch = (Integer) orderRevBranch.get(i);
7.238 + revisionGraph.insertBranch((String) branches.get(branch.intValue()));
7.239 + }
7.240 + }
7.241 + //for(int i = 0; i < branches.size(); i++) revisionGraph.insertBranch((String) branches.get(i));
7.242 + //for(int i = 0; i < revisions.size(); i++) revisionGraph.insertRevision((String) revisions.get(i));
7.243 + return true;
7.244 + }
7.245 +
7.246 + /*
7.247 + * Merge the common content of Vectors <CODE>v1</CODE> and <CODE>v2</CODE> into <CODE>v1</CODE>.
7.248 + * In other words it deletes every element of <CODE>v1</CODE> which is not contained in <CODE>v2</CODE>.
7.249 + * @param v1
7.250 + * @param v2
7.251 + *
7.252 + private void mergeCommonVector(Vector v1, Vector v2) {
7.253 + int n1 = v1.size();
7.254 + int n2 = v2.size();
7.255 + for(int i = 0; i < n1; i++) {
7.256 + Object o1 = v1.get(i);
7.257 + int j = 0;
7.258 + for(j = 0; j < n2; j++) {
7.259 + Object o2 = v2.get(j);
7.260 + if (o1.equals(o2)) break;
7.261 + }
7.262 + if (j >= n2) {
7.263 + v1.remove(i);
7.264 + n1--;
7.265 }
7.266 }
7.267 +}
7.268 + */
7.269 +
7.270 + /**
7.271 + * Merge the common content of Hashtables <CODE>h1</CODE> and <CODE>h2</CODE> into <CODE>h1</CODE>.
7.272 + * In other words it deletes every entry of <CODE>h1</CODE> which is not contained in <CODE>h2</CODE>.
7.273 + * @param h1
7.274 + * @param h2
7.275 + */
7.276 + private void mergeCommonHashtable(Hashtable h1, Hashtable h2) {
7.277 + Enumeration enum1 = h1.keys();
7.278 + while (enum1.hasMoreElements()) {
7.279 + Object o1 = enum1.nextElement();
7.280 + boolean contains = false;
7.281 + Enumeration enum2 = h2.keys();
7.282 + while (enum2.hasMoreElements()) {
7.283 + Object o2 = enum2.nextElement();
7.284 + if (o1.equals(o2)) { contains = true; break; }
7.285 + }
7.286 + if (!contains) h1.remove(o1);
7.287 + }
7.288 }
7.289 - return brSN;
7.290 - }
7.291
7.292 - public CvsRevisionGraph getRevisionGraph() {
7.293 - return revisionGraph;
7.294 - }
7.295 -
7.296 - public boolean updateLogInfo(Hashtable vars, String[] args,
7.297 - NoRegexListener stdoutListener,
7.298 - NoRegexListener stderrListener) {
7.299 - revisionGraph = new CvsRevisionGraph();
7.300 - mergeIsEmpty = true;
7.301 - String cmd = MiscStuff.array2string(args);
7.302 - Variables v=new Variables();
7.303 - String prepared=v.expand(vars,cmd, true);
7.304 - D.deb("Log prepared: "+prepared); // NOI18N
7.305 - if (stderrListener != null) stderrListener.match("LOG INFO: "+prepared); // NOI18N
7.306 - ExternalCommand ec=new ExternalCommand(prepared);
7.307 - ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
7.308 - String logDataRegex = (String) vars.get("DATAREGEX"); // NOI18N
7.309 - try{
7.310 - D.deb("stdout log dataRegex = "+logDataRegex); // NOI18N
7.311 - ec.addStdoutRegexListener(this, logDataRegex);
7.312 - } catch (BadRegexException e) {
7.313 - if (stderrListener != null) stderrListener.match("cvs log: Bad data regex "+logDataRegex+"\n"); // NOI18N
7.314 - return false;
7.315 + /**
7.316 + * Merge the content of order vectors.
7.317 + */
7.318 + private void mergeRevBr() {
7.319 + for(int i = 0; i < orderRevBranch.size(); i++) {
7.320 + Integer what = (Integer) orderRevBranch.get(i);
7.321 + i++;
7.322 + if (what.intValue() == ORDER_REVISION) {
7.323 + Integer revision = (Integer) orderRevBranch.get(i);
7.324 + String rev = (String) revisions.get(revision.intValue());
7.325 + int j;
7.326 + for(j = 0; j < orderRevBranchFile.size(); j++) {
7.327 + Integer whatFile = (Integer) orderRevBranchFile.get(j);
7.328 + j++;
7.329 + if (whatFile.intValue() == ORDER_REVISION) {
7.330 + Integer revisionFile = (Integer) orderRevBranchFile.get(j);
7.331 + String revFile = (String) revisionsFile.get(revisionFile.intValue());
7.332 + if (revFile.equals(rev)) break;
7.333 + }
7.334 + }
7.335 + if (j >= orderRevBranchFile.size()) {
7.336 + orderRevBranch.remove(i-1);
7.337 + orderRevBranch.remove(i);
7.338 + revisions.remove(revision.intValue());
7.339 + i -= 2;
7.340 + }
7.341 + } else {
7.342 + Integer branch = (Integer) orderRevBranch.get(i);
7.343 + String br = (String) branches.get(branch.intValue());
7.344 + int j;
7.345 + for(j = 0; j < orderRevBranchFile.size(); j++) {
7.346 + Integer whatFile = (Integer) orderRevBranchFile.get(j);
7.347 + j++;
7.348 + if (whatFile.intValue() == ORDER_REVISION) {
7.349 + Integer branchFile = (Integer) orderRevBranchFile.get(j);
7.350 + String brFile = (String) branchesFile.get(branchFile.intValue());
7.351 + if (brFile.equals(br)) break;
7.352 + }
7.353 + }
7.354 + if (j >= orderRevBranchFile.size()) {
7.355 + orderRevBranch.remove(i-1);
7.356 + orderRevBranch.remove(i);
7.357 + branches.remove(branch.intValue());
7.358 + i -= 2;
7.359 + }
7.360 + }
7.361 + }
7.362 }
7.363 - if (stdoutListener != null) ec.addStdoutNoRegexListener(stdoutListener);
7.364 - if (stderrListener != null) ec.addStderrNoRegexListener(stderrListener);
7.365 - if ( ec.exec() != ExternalCommand.SUCCESS ){
7.366 - E.err("exec failed "+ec.getExitStatus()); // NOI18N
7.367 - return false;
7.368 +
7.369 + private void mergeCommonRevisions() {
7.370 + if (mergeIsEmpty) {
7.371 + revisions = new Vector(revisionsFile);
7.372 + branches = new Vector(branchesFile);
7.373 + symbolicNames = new Hashtable(symbolicNamesFile);
7.374 + orderRevBranch = new Vector(orderRevBranchFile);
7.375 + } else {
7.376 + //mergeCommonVector(revisions, revisionsFile);
7.377 + //mergeCommonVector(branches, branchesFile);
7.378 + mergeCommonHashtable(symbolicNames, symbolicNamesFile);
7.379 + mergeRevBr();
7.380 + //orderRevBranch = new Vector(orderRevBranchFile);
7.381 + }
7.382 + mergeIsEmpty = false;
7.383 }
7.384 - D.deb("branches = "+branches); // NOI18N
7.385 - for(int i = 0; i < orderRevBranch.size(); i++) {
7.386 - Integer what = (Integer) orderRevBranch.get(i);
7.387 - i++;
7.388 - if (what.intValue() == ORDER_REVISION) {
7.389 - Integer revision = (Integer) orderRevBranch.get(i);
7.390 - revisionGraph.insertRevision((String) revisions.get(revision.intValue()));
7.391 - } else {
7.392 - Integer branch = (Integer) orderRevBranch.get(i);
7.393 - revisionGraph.insertBranch((String) branches.get(branch.intValue()));
7.394 - }
7.395 - }
7.396 - //for(int i = 0; i < branches.size(); i++) revisionGraph.insertBranch((String) branches.get(i));
7.397 - //for(int i = 0; i < revisions.size(); i++) revisionGraph.insertRevision((String) revisions.get(i));
7.398 - return true;
7.399 - }
7.400 -
7.401 - /*
7.402 - * Merge the common content of Vectors <CODE>v1</CODE> and <CODE>v2</CODE> into <CODE>v1</CODE>.
7.403 - * In other words it deletes every element of <CODE>v1</CODE> which is not contained in <CODE>v2</CODE>.
7.404 - * @param v1
7.405 - * @param v2
7.406 - *
7.407 - private void mergeCommonVector(Vector v1, Vector v2) {
7.408 - int n1 = v1.size();
7.409 - int n2 = v2.size();
7.410 - for(int i = 0; i < n1; i++) {
7.411 - Object o1 = v1.get(i);
7.412 - int j = 0;
7.413 - for(j = 0; j < n2; j++) {
7.414 - Object o2 = v2.get(j);
7.415 - if (o1.equals(o2)) break;
7.416 - }
7.417 - if (j >= n2) {
7.418 - v1.remove(i);
7.419 - n1--;
7.420 - }
7.421 +
7.422 + public void match(String[] elements) {
7.423 + if (elements[0] == null) return;
7.424 + D.deb("log match: "+elements[0]); // NOI18N
7.425 + logBuffer.append(elements[0]+"\n"); // NOI18N
7.426 + if (elements[0].indexOf(nextFileStr) >= 0) {
7.427 + mergeCommonRevisions();
7.428 + }
7.429 + if (elements[0].indexOf(revisionStr) == 0) {
7.430 + String revision = elements[0].substring(revisionStr.length(), elements[0].length()).trim();
7.431 + revisionsFile.add(revision);
7.432 + orderRevBranchFile.add(new Integer(ORDER_REVISION));
7.433 + orderRevBranchFile.add(new Integer(revisionsFile.size() - 1));
7.434 + //revisionGraph.insertRevision(revision);
7.435 + }
7.436 + if (elements[0].indexOf(branchesStr) >= 0) {
7.437 + int bBegin = branchesStr.length()+1;
7.438 + int bEnd = elements[0].indexOf(';', bBegin);
7.439 + if (bEnd < 0) bEnd = elements[0].length();
7.440 + while (bBegin < bEnd) {
7.441 + String branch = elements[0].substring(bBegin, bEnd).trim();
7.442 + branchesFile.add(branch);
7.443 + orderRevBranchFile.add(new Integer(ORDER_BRANCH));
7.444 + orderRevBranchFile.add(new Integer(branchesFile.size() - 1));
7.445 + //revisionGraph.insertBranch(branch);
7.446 + bBegin = bEnd+1;
7.447 + bEnd = elements[0].indexOf(';', bBegin);
7.448 + if (bEnd < 0) bEnd = elements[0].length();
7.449 + }
7.450 + }
7.451 + if (matchingSymbolicNames) {
7.452 + int keyIndex = 0;
7.453 + while (elements[0].charAt(keyIndex) == ' ' || elements[0].charAt(keyIndex) == '\t') keyIndex++;
7.454 + if (keyIndex == 0) matchingSymbolicNames = false;
7.455 + else {
7.456 + int valueIndex = keyIndex;
7.457 + while (elements[0].charAt(valueIndex) != ':') valueIndex++;
7.458 + /*
7.459 + symbolicNames.put(elements[0].substring(keyIndex, valueIndex).trim(),
7.460 + elements[0].substring(valueIndex + 1, elements[0].length()).trim());
7.461 + */
7.462 + symbolicNamesFile.put(elements[0].substring(valueIndex + 1, elements[0].length()).trim(),
7.463 + elements[0].substring(keyIndex, valueIndex).trim());
7.464 + //D.deb("Putting to symbolic names: ("+elements[0].substring(valueIndex + 1, elements[0].length()).trim()+ // NOI18N
7.465 + // ", "+elements[0].substring(keyIndex, valueIndex).trim()+")"); // NOI18N
7.466 + }
7.467 + }
7.468 + if (elements[0].indexOf(symbNamesStr) >= 0) matchingSymbolicNames = true;
7.469 }
7.470 - }
7.471 - */
7.472 -
7.473 - /**
7.474 - * Merge the common content of Hashtables <CODE>h1</CODE> and <CODE>h2</CODE> into <CODE>h1</CODE>.
7.475 - * In other words it deletes every entry of <CODE>h1</CODE> which is not contained in <CODE>h2</CODE>.
7.476 - * @param h1
7.477 - * @param h2
7.478 - */
7.479 - private void mergeCommonHashtable(Hashtable h1, Hashtable h2) {
7.480 - Enumeration enum1 = h1.keys();
7.481 - while (enum1.hasMoreElements()) {
7.482 - Object o1 = enum1.nextElement();
7.483 - boolean contains = false;
7.484 - Enumeration enum2 = h2.keys();
7.485 - while (enum2.hasMoreElements()) {
7.486 - Object o2 = enum2.nextElement();
7.487 - if (o1.equals(o2)) { contains = true; break; }
7.488 - }
7.489 - if (!contains) h1.remove(o1);
7.490 - }
7.491 - }
7.492 -
7.493 - /**
7.494 - * Merge the content of order vectors.
7.495 - */
7.496 - private void mergeRevBr() {
7.497 - for(int i = 0; i < orderRevBranch.size(); i++) {
7.498 - Integer what = (Integer) orderRevBranch.get(i);
7.499 - i++;
7.500 - if (what.intValue() == ORDER_REVISION) {
7.501 - Integer revision = (Integer) orderRevBranch.get(i);
7.502 - String rev = (String) revisions.get(revision.intValue());
7.503 - int j;
7.504 - for(j = 0; j < orderRevBranchFile.size(); j++) {
7.505 - Integer whatFile = (Integer) orderRevBranchFile.get(j);
7.506 - j++;
7.507 - if (whatFile.intValue() == ORDER_REVISION) {
7.508 - Integer revisionFile = (Integer) orderRevBranchFile.get(j);
7.509 - String revFile = (String) revisionsFile.get(revisionFile.intValue());
7.510 - if (revFile.equals(rev)) break;
7.511 - }
7.512 - }
7.513 - if (j >= orderRevBranchFile.size()) {
7.514 - orderRevBranch.remove(i-1);
7.515 - orderRevBranch.remove(i);
7.516 - revisions.remove(revision.intValue());
7.517 - i -= 2;
7.518 - }
7.519 - } else {
7.520 - Integer branch = (Integer) orderRevBranch.get(i);
7.521 - String br = (String) branches.get(branch.intValue());
7.522 - int j;
7.523 - for(j = 0; j < orderRevBranchFile.size(); j++) {
7.524 - Integer whatFile = (Integer) orderRevBranchFile.get(j);
7.525 - j++;
7.526 - if (whatFile.intValue() == ORDER_REVISION) {
7.527 - Integer branchFile = (Integer) orderRevBranchFile.get(j);
7.528 - String brFile = (String) branchesFile.get(branchFile.intValue());
7.529 - if (brFile.equals(br)) break;
7.530 - }
7.531 - }
7.532 - if (j >= orderRevBranchFile.size()) {
7.533 - orderRevBranch.remove(i-1);
7.534 - orderRevBranch.remove(i);
7.535 - branches.remove(branch.intValue());
7.536 - i -= 2;
7.537 - }
7.538 - }
7.539 - }
7.540 - }
7.541 -
7.542 - private void mergeCommonRevisions() {
7.543 - if (mergeIsEmpty) {
7.544 - revisions = new Vector(revisionsFile);
7.545 - branches = new Vector(branchesFile);
7.546 - symbolicNames = new Hashtable(symbolicNamesFile);
7.547 - orderRevBranch = new Vector(orderRevBranchFile);
7.548 - } else {
7.549 - //mergeCommonVector(revisions, revisionsFile);
7.550 - //mergeCommonVector(branches, branchesFile);
7.551 - mergeCommonHashtable(symbolicNames, symbolicNamesFile);
7.552 - mergeRevBr();
7.553 - //orderRevBranch = new Vector(orderRevBranchFile);
7.554 - }
7.555 - mergeIsEmpty = false;
7.556 - }
7.557 -
7.558 - public void match(String[] elements) {
7.559 - if (elements[0] == null) return;
7.560 - D.deb("log match: "+elements[0]); // NOI18N
7.561 - logBuffer.append(elements[0]+"\n"); // NOI18N
7.562 - if (elements[0].indexOf(nextFileStr) >= 0) {
7.563 - mergeCommonRevisions();
7.564 - }
7.565 - if (elements[0].indexOf(revisionStr) == 0) {
7.566 - String revision = elements[0].substring(revisionStr.length(), elements[0].length()).trim();
7.567 - revisionsFile.add(revision);
7.568 - orderRevBranchFile.add(new Integer(ORDER_REVISION));
7.569 - orderRevBranchFile.add(new Integer(revisionsFile.size() - 1));
7.570 - //revisionGraph.insertRevision(revision);
7.571 - }
7.572 - if (elements[0].indexOf(branchesStr) >= 0) {
7.573 - int bBegin = branchesStr.length()+1;
7.574 - int bEnd = elements[0].indexOf(';', bBegin);
7.575 - if (bEnd < 0) bEnd = elements[0].length();
7.576 - while (bBegin < bEnd) {
7.577 - String branch = elements[0].substring(bBegin, bEnd).trim();
7.578 - branchesFile.add(branch);
7.579 - orderRevBranchFile.add(new Integer(ORDER_BRANCH));
7.580 - orderRevBranchFile.add(new Integer(branchesFile.size() - 1));
7.581 - //revisionGraph.insertBranch(branch);
7.582 - bBegin = bEnd+1;
7.583 - bEnd = elements[0].indexOf(';', bBegin);
7.584 - if (bEnd < 0) bEnd = elements[0].length();
7.585 - }
7.586 - }
7.587 - if (matchingSymbolicNames) {
7.588 - int keyIndex = 0;
7.589 - while (elements[0].charAt(keyIndex) == ' ' || elements[0].charAt(keyIndex) == '\t') keyIndex++;
7.590 - if (keyIndex == 0) matchingSymbolicNames = false;
7.591 - else {
7.592 - int valueIndex = keyIndex;
7.593 - while (elements[0].charAt(valueIndex) != ':') valueIndex++;
7.594 - /*
7.595 - symbolicNames.put(elements[0].substring(keyIndex, valueIndex).trim(),
7.596 - elements[0].substring(valueIndex + 1, elements[0].length()).trim());
7.597 - */
7.598 - symbolicNamesFile.put(elements[0].substring(valueIndex + 1, elements[0].length()).trim(),
7.599 - elements[0].substring(keyIndex, valueIndex).trim());
7.600 - //D.deb("Putting to symbolic names: ("+elements[0].substring(valueIndex + 1, elements[0].length()).trim()+ // NOI18N
7.601 - // ", "+elements[0].substring(keyIndex, valueIndex).trim()+")"); // NOI18N
7.602 - }
7.603 - }
7.604 - if (elements[0].indexOf(symbNamesStr) >= 0) matchingSymbolicNames = true;
7.605 - }
7.606 }
7.607 \ No newline at end of file
8.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsModuleSelector.java Tue Apr 25 12:55:38 2000 +0000
8.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsModuleSelector.java Tue Apr 25 14:04:53 2000 +0000
8.3 @@ -23,185 +23,185 @@
8.4 import org.netbeans.modules.vcs.util.*;
8.5 import org.netbeans.modules.vcs.cmdline.VcsVariableSelector;
8.6
8.7 -/**
8.8 +/**
8.9 *
8.10 * @author Martin Entlicher
8.11 * @version
8.12 */
8.13 public class CvsModuleSelector extends VcsVariableSelector implements RegexListener {
8.14 - private Debug E = new Debug("CvsModuleSelector", true); // NOI18N
8.15 - private Debug D = E;
8.16 + private Debug E = new Debug("CvsModuleSelector", true); // NOI18N
8.17 + private Debug D = E;
8.18
8.19 - private Hashtable vars;
8.20 - private NoRegexListener stdoutNRListener;
8.21 - private NoRegexListener stderrNRListener;
8.22 - private String dataRegex = "^(.*)$";
8.23 - private StringBuffer outputBuffer = new StringBuffer();
8.24 - private volatile boolean cmdSuccess = false;
8.25 - private volatile boolean dlgSuccess = false;
8.26 - private volatile boolean dlgFinished = false;
8.27 -
8.28 - private static transient String lastPrepared = null;
8.29 - private static transient String[] lastModules = null;
8.30 + private Hashtable vars;
8.31 + private NoRegexListener stdoutNRListener;
8.32 + private NoRegexListener stderrNRListener;
8.33 + private String dataRegex = "^(.*)$";
8.34 + private StringBuffer outputBuffer = new StringBuffer();
8.35 + private volatile boolean cmdSuccess = false;
8.36 + private volatile boolean dlgSuccess = false;
8.37 + private volatile boolean dlgFinished = false;
8.38
8.39 - /** Creates new CvsModuleSelector */
8.40 - public CvsModuleSelector() {
8.41 - }
8.42 -
8.43 - /**
8.44 - * Find out whether we need to run the command which get module info.
8.45 - * If we have this information from previous call, we don't have to call it again.
8.46 - * @param args the command we want to run.
8.47 - * @return true or false
8.48 - */
8.49 - private boolean needToRunCommand(String[] args) {
8.50 - if (lastPrepared == null || lastModules == null) return true;
8.51 - Variables v = new Variables();
8.52 - String cmd = MiscStuff.array2string(args);
8.53 - String prepared = v.expand(vars, cmd, true);
8.54 - return !prepared.equals(lastPrepared);
8.55 - }
8.56 -
8.57 - /**
8.58 - * This method is used to start the selector.
8.59 - * @param vars the VCS variables
8.60 - * @param variable the name of the selected variable
8.61 - * @param args the command line parametres
8.62 - * @param stdoutNRListener listener of the standard output of the command
8.63 - * @param stderrNRListener listener of the error output of the command
8.64 - * @return the selected value, empty string when the selection was canceled
8.65 - * or null when an error occures.
8.66 - */
8.67 - public String exec(Hashtable vars, String variable, String[] args,
8.68 + private static transient String lastPrepared = null;
8.69 + private static transient String[] lastModules = null;
8.70 +
8.71 + /** Creates new CvsModuleSelector */
8.72 + public CvsModuleSelector() {
8.73 + }
8.74 +
8.75 + /**
8.76 + * Find out whether we need to run the command which get module info.
8.77 + * If we have this information from previous call, we don't have to call it again.
8.78 + * @param args the command we want to run.
8.79 + * @return true or false
8.80 + */
8.81 + private boolean needToRunCommand(String[] args) {
8.82 + if (lastPrepared == null || lastModules == null) return true;
8.83 + Variables v = new Variables();
8.84 + String cmd = MiscStuff.array2string(args);
8.85 + String prepared = v.expand(vars, cmd, true);
8.86 + return !prepared.equals(lastPrepared);
8.87 + }
8.88 +
8.89 + /**
8.90 + * This method is used to start the selector.
8.91 + * @param vars the VCS variables
8.92 + * @param variable the name of the selected variable
8.93 + * @param args the command line parametres
8.94 + * @param stdoutNRListener listener of the standard output of the command
8.95 + * @param stderrNRListener listener of the error output of the command
8.96 + * @return the selected value, empty string when the selection was canceled
8.97 + * or null when an error occures.
8.98 + */
8.99 + public String exec(Hashtable vars, String variable, String[] args,
8.100 NoRegexListener stdoutNRListener,
8.101 NoRegexListener stderrNRListener) {
8.102 - D.deb("exec for "+variable);
8.103 - this.vars = vars;
8.104 - this.stdoutNRListener = stdoutNRListener;
8.105 - this.stderrNRListener = stderrNRListener;
8.106 - /*
8.107 - if (!runCommand(args)) return null;
8.108 - String[] modules = getModules();
8.109 - if (modules == null || modules.length <= 0) {
8.110 - javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.111 - public void run() {
8.112 - NotifyDescriptor nd = new NotifyDescriptor.Message (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.NoModules"));
8.113 - TopManager.getDefault ().notify (nd);
8.114 + D.deb("exec for "+variable);
8.115 + this.vars = vars;
8.116 + this.stdoutNRListener = stdoutNRListener;
8.117 + this.stderrNRListener = stderrNRListener;
8.118 + /*
8.119 + if (!runCommand(args)) return null;
8.120 + String[] modules = getModules();
8.121 + if (modules == null || modules.length <= 0) {
8.122 + javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.123 + public void run() {
8.124 + NotifyDescriptor nd = new NotifyDescriptor.Message (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.NoModules"));
8.125 + TopManager.getDefault ().notify (nd);
8.126 + }
8.127 + });
8.128 + return null;
8.129 + }
8.130 + */
8.131 + javax.swing.JFrame dlgFrame = new javax.swing.JFrame ();
8.132 + MiscStuff.centerWindow(dlgFrame);
8.133 + CvsModuleSelectorDialog dlg = new CvsModuleSelectorDialog(dlgFrame, true);
8.134 + MiscStuff.centerWindow(dlg);
8.135 + final String[] fargs = args;
8.136 + final CvsModuleSelectorDialog fdlg = dlg;
8.137 + javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.138 + public void run() {
8.139 + javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.140 + public void run() {
8.141 + new Thread("ModuleSelector-Command") {
8.142 + public void run() {
8.143 + String[] modules = null;
8.144 + if (needToRunCommand(fargs)) {
8.145 + fdlg.waitingForModules();
8.146 + cmdSuccess = runCommand(fargs);
8.147 + if (cmdSuccess) modules = getModules();
8.148 + } else {
8.149 + cmdSuccess = true;
8.150 + modules = lastModules;
8.151 + }
8.152 + fdlg.setModules(modules);
8.153 + }
8.154 + }.start();
8.155 + }
8.156 + });
8.157 + }
8.158 + });
8.159 + //dlg.setModules(modules);
8.160 + Thread showThread = new Thread() {
8.161 + public void run() {
8.162 + dlgSuccess = fdlg.showDialog();
8.163 + dlgFinished = true;
8.164 + }
8.165 + };
8.166 + javax.swing.SwingUtilities.invokeLater(showThread);
8.167 + try {
8.168 + while(!dlgFinished) {
8.169 + Thread.sleep(200);
8.170 + }
8.171 + D.deb("showThread is alive = "+showThread.isAlive()+", joining him");
8.172 + showThread.join();
8.173 + } catch (InterruptedException e) {
8.174 + // Interrupted
8.175 + dlgSuccess = false;
8.176 }
8.177 - });
8.178 - return null;
8.179 + D.deb("dlgSuccess = "+dlgSuccess+", cmdSuccess = "+cmdSuccess);
8.180 + if (dlgSuccess && cmdSuccess) {
8.181 + return dlg.getSelection();
8.182 + } else {
8.183 + return (dlgSuccess) ? null : "";
8.184 + }
8.185 }
8.186 - */
8.187 - javax.swing.JFrame dlgFrame = new javax.swing.JFrame ();
8.188 - MiscStuff.centerWindow(dlgFrame);
8.189 - CvsModuleSelectorDialog dlg = new CvsModuleSelectorDialog(dlgFrame, true);
8.190 - MiscStuff.centerWindow(dlg);
8.191 - final String[] fargs = args;
8.192 - final CvsModuleSelectorDialog fdlg = dlg;
8.193 - javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.194 - public void run() {
8.195 - javax.swing.SwingUtilities.invokeLater(new Runnable() {
8.196 - public void run() {
8.197 - new Thread("ModuleSelector-Command") {
8.198 - public void run() {
8.199 - String[] modules = null;
8.200 - if (needToRunCommand(fargs)) {
8.201 - fdlg.waitingForModules();
8.202 - cmdSuccess = runCommand(fargs);
8.203 - if (cmdSuccess) modules = getModules();
8.204 - } else {
8.205 - cmdSuccess = true;
8.206 - modules = lastModules;
8.207 - }
8.208 - fdlg.setModules(modules);
8.209 - }
8.210 - }.start();
8.211 - }
8.212 - });
8.213 - }
8.214 - });
8.215 - //dlg.setModules(modules);
8.216 - Thread showThread = new Thread() {
8.217 - public void run() {
8.218 - dlgSuccess = fdlg.showDialog();
8.219 - dlgFinished = true;
8.220 - }
8.221 - };
8.222 - javax.swing.SwingUtilities.invokeLater(showThread);
8.223 - try {
8.224 - while(!dlgFinished) {
8.225 - Thread.sleep(200);
8.226 - }
8.227 - D.deb("showThread is alive = "+showThread.isAlive()+", joining him");
8.228 - showThread.join();
8.229 - } catch (InterruptedException e) {
8.230 - // Interrupted
8.231 - dlgSuccess = false;
8.232 +
8.233 + private boolean runCommand(String[] args) {
8.234 + Variables v = new Variables();
8.235 + String cmd = MiscStuff.array2string(args);
8.236 + String prepared = v.expand(vars, cmd, true);
8.237 + D.deb("prepared: "+prepared); // NOI18N
8.238 + ExternalCommand ec=new ExternalCommand(prepared);
8.239 + //ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
8.240 + if (stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
8.241 + if (stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
8.242 + if (stderrNRListener != null) stderrNRListener.match(NbBundle.getBundle
8.243 + ("org.netbeans.modules.vcs.cmdline.Bundle").getString ("MSG_VariableSelector")+
8.244 + ": "+prepared); // NOI18N
8.245 + try{
8.246 + ec.addStdoutRegexListener(this, dataRegex);
8.247 + } catch (BadRegexException e) {
8.248 + if (stderrNRListener != null) {
8.249 + stderrNRListener.match("Bad data regex "+dataRegex); // NOI18N
8.250 + }
8.251 + return false;
8.252 + }
8.253 + if ( ec.exec() != ExternalCommand.SUCCESS ){
8.254 + E.err("exec failed "+ec.getExitStatus()); // NOI18N
8.255 + return false;
8.256 + } else {
8.257 + lastPrepared = prepared;
8.258 + return true;
8.259 + }
8.260 }
8.261 - D.deb("dlgSuccess = "+dlgSuccess+", cmdSuccess = "+cmdSuccess);
8.262 - if (dlgSuccess && cmdSuccess) {
8.263 - return dlg.getSelection();
8.264 - } else {
8.265 - return (dlgSuccess) ? null : "";
8.266 +
8.267 + private String[] getModules() {
8.268 + Vector modules = new Vector();
8.269 + String output = outputBuffer.toString();
8.270 + int pos = 0;
8.271 + int index = 0;
8.272 + for(; pos >= 0 && pos < output.length(); pos = output.indexOf('\n', index)) {
8.273 + while(pos < output.length() && output.charAt(pos) == '\n') pos++;
8.274 + index = output.indexOf(' ', pos);
8.275 + if (index == pos) continue;
8.276 + int index2 = output.indexOf('\t', pos);
8.277 + if (index < 0 && index2 < 0) break;
8.278 + if (index < 0) index = output.length();
8.279 + if (index2 < 0) index2 = output.length();
8.280 + index = Math.min(index, index2);
8.281 + String module = output.substring(pos, index);
8.282 + D.deb("module = '"+module+"'");
8.283 + modules.add(module);
8.284 + }
8.285 + if (modules.size() == 0) return null;
8.286 + String[] modulesStrs = (String[]) modules.toArray(new String[0]);
8.287 + lastModules = modulesStrs;
8.288 + return modulesStrs;
8.289 }
8.290 - }
8.291 -
8.292 - private boolean runCommand(String[] args) {
8.293 - Variables v = new Variables();
8.294 - String cmd = MiscStuff.array2string(args);
8.295 - String prepared = v.expand(vars, cmd, true);
8.296 - D.deb("prepared: "+prepared); // NOI18N
8.297 - ExternalCommand ec=new ExternalCommand(prepared);
8.298 - //ec.setTimeout(((Long) vars.get("TIMEOUT")).longValue()); // NOI18N
8.299 - if (stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
8.300 - if (stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
8.301 - if (stderrNRListener != null) stderrNRListener.match(NbBundle.getBundle
8.302 - ("org.netbeans.modules.vcs.cmdline.Bundle").getString ("MSG_VariableSelector")+
8.303 - ": "+prepared); // NOI18N
8.304 - try{
8.305 - ec.addStdoutRegexListener(this, dataRegex);
8.306 - } catch (BadRegexException e) {
8.307 - if (stderrNRListener != null) {
8.308 - stderrNRListener.match("Bad data regex "+dataRegex); // NOI18N
8.309 - }
8.310 - return false;
8.311 +
8.312 + public void match(String[] elements) {
8.313 + D.deb("match: "+elements[0]);
8.314 + if (elements[0].length() > 0 && elements[0].charAt(0) != '#')
8.315 + outputBuffer.append(elements[0]+"\n");
8.316 }
8.317 - if ( ec.exec() != ExternalCommand.SUCCESS ){
8.318 - E.err("exec failed "+ec.getExitStatus()); // NOI18N
8.319 - return false;
8.320 - } else {
8.321 - lastPrepared = prepared;
8.322 - return true;
8.323 - }
8.324 - }
8.325 -
8.326 - private String[] getModules() {
8.327 - Vector modules = new Vector();
8.328 - String output = outputBuffer.toString();
8.329 - int pos = 0;
8.330 - int index = 0;
8.331 - for(; pos >= 0 && pos < output.length(); pos = output.indexOf('\n', index)) {
8.332 - while(pos < output.length() && output.charAt(pos) == '\n') pos++;
8.333 - index = output.indexOf(' ', pos);
8.334 - if (index == pos) continue;
8.335 - int index2 = output.indexOf('\t', pos);
8.336 - if (index < 0 && index2 < 0) break;
8.337 - if (index < 0) index = output.length();
8.338 - if (index2 < 0) index2 = output.length();
8.339 - index = Math.min(index, index2);
8.340 - String module = output.substring(pos, index);
8.341 - D.deb("module = '"+module+"'");
8.342 - modules.add(module);
8.343 - }
8.344 - if (modules.size() == 0) return null;
8.345 - String[] modulesStrs = (String[]) modules.toArray(new String[0]);
8.346 - lastModules = modulesStrs;
8.347 - return modulesStrs;
8.348 - }
8.349 -
8.350 - public void match(String[] elements) {
8.351 - D.deb("match: "+elements[0]);
8.352 - if (elements[0].length() > 0 && elements[0].charAt(0) != '#')
8.353 - outputBuffer.append(elements[0]+"\n");
8.354 - }
8.355 }
8.356 \ No newline at end of file
9.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsModuleSelectorDialog.java Tue Apr 25 12:55:38 2000 +0000
9.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsModuleSelectorDialog.java Tue Apr 25 14:04:53 2000 +0000
9.3 @@ -17,169 +17,169 @@
9.4
9.5 import org.netbeans.modules.vcs.util.*;
9.6
9.7 -/**
9.8 +/**
9.9 *
9.10 * @author Martin Entlicher
9.11 * @version
9.12 */
9.13 public class CvsModuleSelectorDialog extends javax.swing.JDialog {
9.14
9.15 - private String[] modules = null;
9.16 - private boolean validSelection = false;
9.17 - //private volatile InformationDialog waitDlg = null;
9.18 -
9.19 - static final long serialVersionUID = 1987612235843595460L;
9.20 - /** Creates new form CvsModuleSelectorDialog */
9.21 - public CvsModuleSelectorDialog(java.awt.Frame parent,boolean modal) {
9.22 - super (parent, modal);
9.23 - initComponents ();
9.24 - setTitle(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.title"));
9.25 - pack ();
9.26 - }
9.27 + private String[] modules = null;
9.28 + private boolean validSelection = false;
9.29 + //private volatile InformationDialog waitDlg = null;
9.30
9.31 - /** This method is called from within the constructor to
9.32 - * initialize the form.
9.33 - * WARNING: Do NOT modify this code. The content of this method is
9.34 - * always regenerated by the FormEditor.
9.35 - */
9.36 - private void initComponents () {//GEN-BEGIN:initComponents
9.37 - statusLabel = new javax.swing.JLabel ();
9.38 - listScrollPane = new javax.swing.JScrollPane ();
9.39 - moduleList = new javax.swing.JList ();
9.40 - okButton = new javax.swing.JButton ();
9.41 - cancelButton = new javax.swing.JButton ();
9.42 - getContentPane ().setLayout (new java.awt.GridBagLayout ());
9.43 - java.awt.GridBagConstraints gridBagConstraints1;
9.44 - addWindowListener (new java.awt.event.WindowAdapter () {
9.45 - public void windowClosing (java.awt.event.WindowEvent evt) {
9.46 - closeDialog (evt);
9.47 - }
9.48 + static final long serialVersionUID = 1987612235843595460L;
9.49 + /** Creates new form CvsModuleSelectorDialog */
9.50 + public CvsModuleSelectorDialog(java.awt.Frame parent,boolean modal) {
9.51 + super (parent, modal);
9.52 + initComponents ();
9.53 + setTitle(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.title"));
9.54 + pack ();
9.55 }
9.56 - );
9.57
9.58 + /** This method is called from within the constructor to
9.59 + * initialize the form.
9.60 + * WARNING: Do NOT modify this code. The content of this method is
9.61 + * always regenerated by the FormEditor.
9.62 + */
9.63 + private void initComponents () {//GEN-BEGIN:initComponents
9.64 + statusLabel = new javax.swing.JLabel ();
9.65 + listScrollPane = new javax.swing.JScrollPane ();
9.66 + moduleList = new javax.swing.JList ();
9.67 + okButton = new javax.swing.JButton ();
9.68 + cancelButton = new javax.swing.JButton ();
9.69 + getContentPane ().setLayout (new java.awt.GridBagLayout ());
9.70 + java.awt.GridBagConstraints gridBagConstraints1;
9.71 + addWindowListener (new java.awt.event.WindowAdapter () {
9.72 + public void windowClosing (java.awt.event.WindowEvent evt) {
9.73 + closeDialog (evt);
9.74 + }
9.75 + }
9.76 + );
9.77
9.78
9.79 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.80 - gridBagConstraints1.gridwidth = 2;
9.81 - gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
9.82 - gridBagConstraints1.insets = new java.awt.Insets (8, 8, 0, 8);
9.83 - gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
9.84 - gridBagConstraints1.weightx = 1.0;
9.85 - getContentPane ().add (statusLabel, gridBagConstraints1);
9.86
9.87 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.88 + gridBagConstraints1.gridwidth = 2;
9.89 + gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
9.90 + gridBagConstraints1.insets = new java.awt.Insets (8, 8, 0, 8);
9.91 + gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;
9.92 + gridBagConstraints1.weightx = 1.0;
9.93 + getContentPane ().add (statusLabel, gridBagConstraints1);
9.94
9.95 -
9.96 - listScrollPane.setViewportView (moduleList);
9.97 -
9.98
9.99 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.100 - gridBagConstraints1.gridy = 1;
9.101 - gridBagConstraints1.gridwidth = 2;
9.102 - gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
9.103 - gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
9.104 - gridBagConstraints1.weightx = 1.0;
9.105 - gridBagConstraints1.weighty = 1.0;
9.106 - getContentPane ().add (listScrollPane, gridBagConstraints1);
9.107
9.108 - okButton.setText (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.okButton.text"));
9.109 - okButton.addActionListener (new java.awt.event.ActionListener () {
9.110 - public void actionPerformed (java.awt.event.ActionEvent evt) {
9.111 - okButtonActionPerformed (evt);
9.112 - }
9.113 + listScrollPane.setViewportView (moduleList);
9.114 +
9.115 +
9.116 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.117 + gridBagConstraints1.gridy = 1;
9.118 + gridBagConstraints1.gridwidth = 2;
9.119 + gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
9.120 + gridBagConstraints1.insets = new java.awt.Insets (8, 8, 8, 8);
9.121 + gridBagConstraints1.weightx = 1.0;
9.122 + gridBagConstraints1.weighty = 1.0;
9.123 + getContentPane ().add (listScrollPane, gridBagConstraints1);
9.124 +
9.125 + okButton.setText (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.okButton.text"));
9.126 + okButton.addActionListener (new java.awt.event.ActionListener () {
9.127 + public void actionPerformed (java.awt.event.ActionEvent evt) {
9.128 + okButtonActionPerformed (evt);
9.129 + }
9.130 + }
9.131 + );
9.132 +
9.133 +
9.134 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.135 + gridBagConstraints1.gridy = 2;
9.136 + gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 0);
9.137 + gridBagConstraints1.weightx = 1.0;
9.138 + getContentPane ().add (okButton, gridBagConstraints1);
9.139 +
9.140 + cancelButton.setText (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.cancelButton.text"));
9.141 + cancelButton.addActionListener (new java.awt.event.ActionListener () {
9.142 + public void actionPerformed (java.awt.event.ActionEvent evt) {
9.143 + cancelButtonActionPerformed (evt);
9.144 + }
9.145 + }
9.146 + );
9.147 +
9.148 +
9.149 + gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.150 + gridBagConstraints1.gridy = 2;
9.151 + gridBagConstraints1.insets = new java.awt.Insets (0, 0, 8, 8);
9.152 + gridBagConstraints1.weightx = 1.0;
9.153 + getContentPane ().add (cancelButton, gridBagConstraints1);
9.154 +
9.155 + }//GEN-END:initComponents
9.156 +
9.157 + private void cancelButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
9.158 + // Add your handling code here:
9.159 + validSelection = false;
9.160 + closeDialog(null);
9.161 + }//GEN-LAST:event_cancelButtonActionPerformed
9.162 +
9.163 + private void okButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
9.164 + // Add your handling code here:
9.165 + validSelection = true;
9.166 + closeDialog(null);
9.167 + }//GEN-LAST:event_okButtonActionPerformed
9.168 +
9.169 + /** Closes the dialog */
9.170 + private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
9.171 + setVisible (false);
9.172 + dispose ();
9.173 + }//GEN-LAST:event_closeDialog
9.174 +
9.175 + public boolean showDialog() {
9.176 + show();
9.177 + return validSelection;
9.178 }
9.179 - );
9.180
9.181 + public void waitingForModules() {
9.182 + statusLabel.setText(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.waitingForModules"));
9.183 + /*
9.184 + if (waitDlg == null) {
9.185 + javax.swing.SwingUtilities.invokeLater(new Runnable () {
9.186 + public void run () {
9.187 + waitDlg = new InformationDialog(new java.awt.Frame(), true, "Please wait, modules are loading ...");
9.188 + MiscStuff.centerWindow(waitDlg);
9.189 + waitDlg.show();
9.190 + }
9.191 + });
9.192 + }
9.193 + */
9.194 + }
9.195
9.196 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.197 - gridBagConstraints1.gridy = 2;
9.198 - gridBagConstraints1.insets = new java.awt.Insets (0, 8, 8, 0);
9.199 - gridBagConstraints1.weightx = 1.0;
9.200 - getContentPane ().add (okButton, gridBagConstraints1);
9.201 + public void setModules(String[] modules) {
9.202 + this.modules = modules;
9.203 + //if (waitDlg != null) waitDlg.setVisible(false);
9.204 + if (modules == null || modules.length == 0) {
9.205 + javax.swing.SwingUtilities.invokeLater(new Runnable() {
9.206 + public void run() {
9.207 + NotifyDescriptor nd = new NotifyDescriptor.Message (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.noModules"));
9.208 + TopManager.getDefault ().notify (nd);
9.209 + }
9.210 + });
9.211 + closeDialog(null);
9.212 + } else {
9.213 + statusLabel.setText(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.modulesLoaded"));
9.214 + moduleList.setListData(modules);
9.215 + }
9.216 + }
9.217
9.218 - cancelButton.setText (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.cancelButton.text"));
9.219 - cancelButton.addActionListener (new java.awt.event.ActionListener () {
9.220 - public void actionPerformed (java.awt.event.ActionEvent evt) {
9.221 - cancelButtonActionPerformed (evt);
9.222 - }
9.223 + public String getSelection() {
9.224 + if (modules == null) return null;
9.225 + if (validSelection) return (String) moduleList.getSelectedValue();
9.226 + else return null;
9.227 }
9.228 - );
9.229
9.230 -
9.231 - gridBagConstraints1 = new java.awt.GridBagConstraints ();
9.232 - gridBagConstraints1.gridy = 2;
9.233 - gridBagConstraints1.insets = new java.awt.Insets (0, 0, 8, 8);
9.234 - gridBagConstraints1.weightx = 1.0;
9.235 - getContentPane ().add (cancelButton, gridBagConstraints1);
9.236 -
9.237 - }//GEN-END:initComponents
9.238 -
9.239 - private void cancelButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
9.240 -// Add your handling code here:
9.241 - validSelection = false;
9.242 - closeDialog(null);
9.243 - }//GEN-LAST:event_cancelButtonActionPerformed
9.244 -
9.245 - private void okButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
9.246 -// Add your handling code here:
9.247 - validSelection = true;
9.248 - closeDialog(null);
9.249 - }//GEN-LAST:event_okButtonActionPerformed
9.250 -
9.251 - /** Closes the dialog */
9.252 - private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
9.253 - setVisible (false);
9.254 - dispose ();
9.255 - }//GEN-LAST:event_closeDialog
9.256 -
9.257 - public boolean showDialog() {
9.258 - show();
9.259 - return validSelection;
9.260 - }
9.261 -
9.262 - public void waitingForModules() {
9.263 - statusLabel.setText(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.waitingForModules"));
9.264 - /*
9.265 - if (waitDlg == null) {
9.266 - javax.swing.SwingUtilities.invokeLater(new Runnable () {
9.267 - public void run () {
9.268 - waitDlg = new InformationDialog(new java.awt.Frame(), true, "Please wait, modules are loading ...");
9.269 - MiscStuff.centerWindow(waitDlg);
9.270 - waitDlg.show();
9.271 - }
9.272 - });
9.273 - }
9.274 - */
9.275 - }
9.276 -
9.277 - public void setModules(String[] modules) {
9.278 - this.modules = modules;
9.279 - //if (waitDlg != null) waitDlg.setVisible(false);
9.280 - if (modules == null || modules.length == 0) {
9.281 - javax.swing.SwingUtilities.invokeLater(new Runnable() {
9.282 - public void run() {
9.283 - NotifyDescriptor nd = new NotifyDescriptor.Message (org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.noModules"));
9.284 - TopManager.getDefault ().notify (nd);
9.285 - }
9.286 - });
9.287 - closeDialog(null);
9.288 - } else {
9.289 - statusLabel.setText(org.openide.util.NbBundle.getBundle(CvsModuleSelectorDialog.class).getString("CvsModuleSelectorDialog.modulesLoaded"));
9.290 - moduleList.setListData(modules);
9.291 - }
9.292 - }
9.293 -
9.294 - public String getSelection() {
9.295 - if (modules == null) return null;
9.296 - if (validSelection) return (String) moduleList.getSelectedValue();
9.297 - else return null;
9.298 - }
9.299 -
9.300 - // Variables declaration - do not modify//GEN-BEGIN:variables
9.301 - private javax.swing.JLabel statusLabel;
9.302 - private javax.swing.JScrollPane listScrollPane;
9.303 - private javax.swing.JList moduleList;
9.304 - private javax.swing.JButton okButton;
9.305 - private javax.swing.JButton cancelButton;
9.306 - // End of variables declaration//GEN-END:variables
9.307 + // Variables declaration - do not modify//GEN-BEGIN:variables
9.308 + private javax.swing.JLabel statusLabel;
9.309 + private javax.swing.JScrollPane listScrollPane;
9.310 + private javax.swing.JList moduleList;
9.311 + private javax.swing.JButton okButton;
9.312 + private javax.swing.JButton cancelButton;
9.313 + // End of variables declaration//GEN-END:variables
9.314
9.315 }
9.316 \ No newline at end of file
10.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsRevisionGraph.java Tue Apr 25 12:55:38 2000 +0000
10.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsRevisionGraph.java Tue Apr 25 14:04:53 2000 +0000
10.3 @@ -15,33 +15,33 @@
10.4
10.5 import java.util.*;
10.6
10.7 -/**
10.8 +/**
10.9 *
10.10 * @author Martin Entlicher
10.11 * @version
10.12 */
10.13 public class CvsRevisionGraph extends Object {
10.14
10.15 - CvsRevisionGraphItem root;
10.16 -
10.17 - /** Creates new CvsRevisionGraph */
10.18 - public CvsRevisionGraph() {
10.19 - root = new CvsRevisionGraphItem("1.1"); // NOI18N
10.20 - root.setXPos(0);
10.21 - root.setYPos(0);
10.22 - }
10.23 -
10.24 - public CvsRevisionGraphItem getRoot() {
10.25 - return root;
10.26 - }
10.27 -
10.28 - public void insertRevision(String revision) {
10.29 - if (!revision.equals("1.1")) this.root.addRevision(revision); // NOI18N
10.30 - }
10.31 -
10.32 - public void insertBranch(String branch) {
10.33 - this.root.addBranch(branch);
10.34 - }
10.35 -
10.36 -
10.37 + CvsRevisionGraphItem root;
10.38 +
10.39 + /** Creates new CvsRevisionGraph */
10.40 + public CvsRevisionGraph() {
10.41 + root = new CvsRevisionGraphItem("1.1"); // NOI18N
10.42 + root.setXPos(0);
10.43 + root.setYPos(0);
10.44 + }
10.45 +
10.46 + public CvsRevisionGraphItem getRoot() {
10.47 + return root;
10.48 + }
10.49 +
10.50 + public void insertRevision(String revision) {
10.51 + if (!revision.equals("1.1")) this.root.addRevision(revision); // NOI18N
10.52 + }
10.53 +
10.54 + public void insertBranch(String branch) {
10.55 + this.root.addBranch(branch);
10.56 + }
10.57 +
10.58 +
10.59 }
10.60 \ No newline at end of file
11.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsRevisionGraphItem.java Tue Apr 25 12:55:38 2000 +0000
11.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/commands/CvsRevisionGraphItem.java Tue Apr 25 14:04:53 2000 +0000
11.3 @@ -15,146 +15,146 @@
11.4
11.5 import java.util.*;
11.6
11.7 -/**
11.8 +/**
11.9 *
11.10 * @author Martin Entlicher
11.11 * @version
11.12 */
11.13 public class CvsRevisionGraphItem extends Object {
11.14
11.15 - String revision;
11.16 - Vector branches;
11.17 - Vector merges;
11.18 - CvsRevisionGraphItem next;
11.19 - int xPos;
11.20 - int yPos;
11.21 -
11.22 - /** Creates new CvsRevisionGraphItem */
11.23 - public CvsRevisionGraphItem(String revision) {
11.24 - this.revision = revision;
11.25 - branches = null;
11.26 - merges = null;
11.27 - next = null;
11.28 - xPos = 0;
11.29 - yPos = 0;
11.30 - }
11.31 -
11.32 - private int numDots(String str) {
11.33 - int num = 0;
11.34 - for(int i = 0; i < str.length(); i++) {
11.35 - if (str.charAt(i) == '.') num++;
11.36 + String revision;
11.37 + Vector branches;
11.38 + Vector merges;
11.39 + CvsRevisionGraphItem next;
11.40 + int xPos;
11.41 + int yPos;
11.42 +
11.43 + /** Creates new CvsRevisionGraphItem */
11.44 + public CvsRevisionGraphItem(String revision) {
11.45 + this.revision = revision;
11.46 + branches = null;
11.47 + merges = null;
11.48 + next = null;
11.49 + xPos = 0;
11.50 + yPos = 0;
11.51 }
11.52 - return num;
11.53 - }
11.54 -
11.55 - private boolean evenDots() {
11.56 - return (numDots(this.revision) % 2) == 0;
11.57 - }
11.58 -
11.59 - private int cmpRev(String revision) {
11.60 - int lastDot1 = this.revision.lastIndexOf('.');
11.61 - int lastDot2 = revision.lastIndexOf('.');
11.62 - int rev1 = 0;
11.63 - int rev2 = 0;
11.64 - try {
11.65 - rev1 = Integer.parseInt(this.revision.substring(lastDot1+1));
11.66 - rev2 = Integer.parseInt(revision.substring(lastDot2+1));
11.67 - } catch (NumberFormatException e) {
11.68 - return -1000;
11.69 +
11.70 + private int numDots(String str) {
11.71 + int num = 0;
11.72 + for(int i = 0; i < str.length(); i++) {
11.73 + if (str.charAt(i) == '.') num++;
11.74 + }
11.75 + return num;
11.76 }
11.77 - return rev1 - rev2;
11.78 - }
11.79 -
11.80 - public void addRevision(String revision) {
11.81 - boolean inserted = false;
11.82 - if (next == null) {
11.83 - if (numDots(revision) == numDots(this.revision)) {
11.84 - next = new CvsRevisionGraphItem(revision);
11.85 - inserted = true;
11.86 - } else if (evenDots() && revision.indexOf(this.revision) == 0) {// this <- the beginning of a branch
11.87 - next = new CvsRevisionGraphItem(revision);
11.88 - inserted = true;
11.89 - }
11.90 - } else {
11.91 - if (numDots(revision) == numDots(next.revision) && next.cmpRev(revision) > 0) {
11.92 - CvsRevisionGraphItem nextOne = next;
11.93 - next = new CvsRevisionGraphItem(revision);
11.94 - next.next = nextOne;
11.95 - inserted = true;
11.96 - } else {
11.97 - //System.out.println("Leaving revision "+revision+" to the next."); // NOI18N
11.98 - next.addRevision(revision);
11.99 - }
11.100 +
11.101 + private boolean evenDots() {
11.102 + return (numDots(this.revision) % 2) == 0;
11.103 }
11.104 - if (!inserted && this.branches != null) {
11.105 - Enumeration enum = branches.elements();
11.106 - while(enum.hasMoreElements()) {
11.107 - CvsRevisionGraphItem branch = ((CvsRevisionGraphItem) enum.nextElement());
11.108 - if (revision.indexOf(branch.revision) == 0) branch.addRevision(revision);
11.109 - }
11.110 +
11.111 + private int cmpRev(String revision) {
11.112 + int lastDot1 = this.revision.lastIndexOf('.');
11.113 + int lastDot2 = revision.lastIndexOf('.');
11.114 + int rev1 = 0;
11.115 + int rev2 = 0;
11.116 + try {
11.117 + rev1 = Integer.parseInt(this.revision.substring(lastDot1+1));
11.118 + rev2 = Integer.parseInt(revision.substring(lastDot2+1));
11.119 + } catch (NumberFormatException e) {
11.120 + return -1000;
11.121 + }
11.122 + return rev1 - rev2;
11.123 }
11.124 - }
11.125 -
11.126 - public void addBranch(String branch) {
11.127 - if (branch.indexOf(this.revision) == 0 && (numDots(this.revision) + 1) == numDots(branch)) {
11.128 - if (branches == null) branches = new Vector();
11.129 - branches.add(new CvsRevisionGraphItem(branch));
11.130 - } else {
11.131 - if (next != null) next.addBranch(branch);
11.132 - if (branches != null) {
11.133 - Enumeration enum = branches.elements();
11.134 - while(enum.hasMoreElements())
11.135 - ((CvsRevisionGraphItem) enum.nextElement()).addBranch(branch);
11.136 - }
11.137 +
11.138 + public void addRevision(String revision) {
11.139 + boolean inserted = false;
11.140 + if (next == null) {
11.141 + if (numDots(revision) == numDots(this.revision)) {
11.142 + next = new CvsRevisionGraphItem(revision);
11.143 + inserted = true;
11.144 + } else if (evenDots() && revision.indexOf(this.revision) == 0) {// this <- the beginning of a branch
11.145 + next = new CvsRevisionGraphItem(revision);
11.146 + inserted = true;
11.147 + }
11.148 + } else {
11.149 + if (numDots(revision) == numDots(next.revision) && next.cmpRev(revision) > 0) {
11.150 + CvsRevisionGraphItem nextOne = next;
11.151 + next = new CvsRevisionGraphItem(revision);
11.152 + next.next = nextOne;
11.153 + inserted = true;
11.154 + } else {
11.155 + //System.out.println("Leaving revision "+revision+" to the next."); // NOI18N
11.156 + next.addRevision(revision);
11.157 + }
11.158 + }
11.159 + if (!inserted && this.branches != null) {
11.160 + Enumeration enum = branches.elements();
11.161 + while(enum.hasMoreElements()) {
11.162 + CvsRevisionGraphItem branch = ((CvsRevisionGraphItem) enum.nextElement());
11.163 + if (revision.indexOf(branch.revision) == 0) branch.addRevision(revision);
11.164 + }
11.165 + }
11.166 }
11.167 - }
11.168 -
11.169 - public int getXPos() {
11.170 - return this.xPos;
11.171 - }
11.172 -
11.173 - public void setXPos(int xPos) {
11.174 - this.xPos = xPos;
11.175 - }
11.176 -
11.177 - public int getYPos() {
11.178 - return this.yPos;
11.179 - }
11.180 -
11.181 - public void setYPos(int yPos) {
11.182 - this.yPos = yPos;
11.183 - }
11.184 -
11.185 - public String getRevision() {
11.186 - return this.revision;
11.187 - }
11.188 -
11.189 - public CvsRevisionGraphItem getNext() {
11.190 - return this.next;
11.191 - }
11.192 -
11.193 - public Vector getBranches() {
11.194 - return this.branches;
11.195 - }
11.196 -
11.197 - public Vector getMerges() {
11.198 - return this.merges;
11.199 - }
11.200 -
11.201 - public void print() {
11.202 - print(""); // NOI18N
11.203 - }
11.204 -
11.205 - private void print(String preString) {
11.206 - System.out.println(preString+"Revision: "+this.revision); // NOI18N
11.207 - if (branches != null) {
11.208 - Enumeration enum = branches.elements();
11.209 - while(enum.hasMoreElements()) {
11.210 - CvsRevisionGraphItem branch = ((CvsRevisionGraphItem) enum.nextElement());
11.211 - System.out.println(preString+"Starting branch:"+branch.revision); // NOI18N
11.212 - if (branch.next != null) branch.next.print(preString+" "); // NOI18N
11.213 - }
11.214 +
11.215 + public void addBranch(String branch) {
11.216 + if (branch.indexOf(this.revision) == 0 && (numDots(this.revision) + 1) == numDots(branch)) {
11.217 + if (branches == null) branches = new Vector();
11.218 + branches.add(new CvsRevisionGraphItem(branch));
11.219 + } else {
11.220 + if (next != null) next.addBranch(branch);
11.221 + if (branches != null) {
11.222 + Enumeration enum = branches.elements();
11.223 + while(enum.hasMoreElements())
11.224 + ((CvsRevisionGraphItem) enum.nextElement()).addBranch(branch);
11.225 + }
11.226 + }
11.227 }
11.228 - if (next != null) next.print(preString);
11.229 - }
11.230 +
11.231 + public int getXPos() {
11.232 + return this.xPos;
11.233 + }
11.234 +
11.235 + public void setXPos(int xPos) {
11.236 + this.xPos = xPos;
11.237 + }
11.238 +
11.239 + public int getYPos() {
11.240 + return this.yPos;
11.241 + }
11.242 +
11.243 + public void setYPos(int yPos) {
11.244 + this.yPos = yPos;
11.245 + }
11.246 +
11.247 + public String getRevision() {
11.248 + return this.revision;
11.249 + }
11.250 +
11.251 + public CvsRevisionGraphItem getNext() {
11.252 + return this.next;
11.253 + }
11.254 +
11.255 + public Vector getBranches() {
11.256 + return this.branches;
11.257 + }
11.258 +
11.259 + public Vector getMerges() {
11.260 + return this.merges;
11.261 + }
11.262 +
11.263 + public void print() {
11.264 + print(""); // NOI18N
11.265 + }
11.266 +
11.267 + private void print(String preString) {
11.268 + System.out.println(preString+"Revision: "+this.revision); // NOI18N
11.269 + if (branches != null) {
11.270 + Enumeration enum = branches.elements();
11.271 + while(enum.hasMoreElements()) {
11.272 + CvsRevisionGraphItem branch = ((CvsRevisionGraphItem) enum.nextElement());
11.273 + System.out.println(preString+"Starting branch:"+branch.revision); // NOI18N
11.274 + if (branch.next != null) branch.next.print(preString+" "); // NOI18N
11.275 + }
11.276 + }
11.277 + if (next != null) next.print(preString);
11.278 + }
11.279 }
12.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/list/CvsListCommand.java Tue Apr 25 12:55:38 2000 +0000
12.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/list/CvsListCommand.java Tue Apr 25 14:04:53 2000 +0000
12.3 @@ -22,327 +22,327 @@
12.4 import java.util.*;
12.5 import java.beans.*;
12.6 import java.text.*;
12.7 -/**
12.8 +/**
12.9 * List command for CVS.
12.10 * @author Martin Entlicher
12.11 * @version
12.12 */
12.13 public class CvsListCommand extends VcsListCommand implements RegexListener {
12.14
12.15 - private Debug E=new Debug("CvsListCommand",true); // NOI18N
12.16 - private Debug D=E;
12.17 + private Debug E=new Debug("CvsListCommand",true); // NOI18N
12.18 + private Debug D=E;
12.19
12.20 - private String rootDir=null;
12.21 - private String dir=null;
12.22 - private String cmd=null;
12.23 - private String cvsRoot=null;
12.24 -
12.25 - private boolean shouldFail=false;
12.26 + private String rootDir=null;
12.27 + private String dir=null;
12.28 + private String cmd=null;
12.29 + private String cvsRoot=null;
12.30
12.31 - private Vector files=new Vector(30);
12.32 + private boolean shouldFail=false;
12.33
12.34 - private StringBuffer dataBuffer=new StringBuffer(4096);
12.35 - //private StringBuffer errorBuffer = new StringBuffer(256);
12.36 - private NoRegexListener stdoutNRListener = null;
12.37 - private NoRegexListener stderrNRListener = null;
12.38 - private RegexListener stderrListener = null;
12.39 -
12.40 - private String dataRegex = null;
12.41 - private String errorRegex = null;
12.42 - private String input = null;
12.43 - private long timeout = 0;
12.44 -
12.45 - private static final String CVS_DIRNAME = "CVS";
12.46 - private static final String[] CVS_DIRCONTENT = {"Entries", "Repository", "Root"};
12.47 + private Vector files=new Vector(30);
12.48
12.49 - /** Creates new CvsListCommand */
12.50 - public CvsListCommand() {
12.51 - }
12.52 -
12.53 - private void initVars(Hashtable vars, String[] args) {
12.54 - this.cmd = MiscStuff.array2string(args);
12.55 -
12.56 - this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
12.57 - if (this.rootDir == null) {
12.58 - this.rootDir = "."; // NOI18N
12.59 - //vars.put("ROOTDIR","."); // NOI18N
12.60 + private StringBuffer dataBuffer=new StringBuffer(4096);
12.61 + //private StringBuffer errorBuffer = new StringBuffer(256);
12.62 + private NoRegexListener stdoutNRListener = null;
12.63 + private NoRegexListener stderrNRListener = null;
12.64 + private RegexListener stderrListener = null;
12.65 +
12.66 + private String dataRegex = null;
12.67 + private String errorRegex = null;
12.68 + private String input = null;
12.69 + private long timeout = 0;
12.70 +
12.71 + private static final String CVS_DIRNAME = "CVS";
12.72 + private static final String[] CVS_DIRCONTENT = {"Entries", "Repository", "Root"};
12.73 +
12.74 + /** Creates new CvsListCommand */
12.75 + public CvsListCommand() {
12.76 }
12.77 - this.dir = (String) vars.get("DIR"); // NOI18N
12.78 - if (this.dir == null) {
12.79 - this.dir = ""; // NOI18N
12.80 - //vars.put("DIR","."); // NOI18N
12.81 +
12.82 + private void initVars(Hashtable vars, String[] args) {
12.83 + this.cmd = MiscStuff.array2string(args);
12.84 +
12.85 + this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
12.86 + if (this.rootDir == null) {
12.87 + this.rootDir = "."; // NOI18N
12.88 + //vars.put("ROOTDIR","."); // NOI18N
12.89 + }
12.90 + this.dir = (String) vars.get("DIR"); // NOI18N
12.91 + if (this.dir == null) {
12.92 + this.dir = ""; // NOI18N
12.93 + //vars.put("DIR","."); // NOI18N
12.94 + }
12.95 + String module = (String) vars.get("MODULE"); // NOI18N
12.96 + D.deb("rootDir = "+rootDir+", module = "+module+", dir = "+dir); // NOI18N
12.97 + if (dir.equals("")) { // NOI18N
12.98 + dir=rootDir;
12.99 + if (module != null && module.length() > 0) dir += File.separator + module;
12.100 + } else {
12.101 + if (module == null)
12.102 + dir=rootDir+File.separator+dir;
12.103 + else
12.104 + dir=rootDir+File.separator+module+File.separator+dir;
12.105 + }
12.106 + if (dir.charAt(dir.length() - 1) == File.separatorChar)
12.107 + dir = dir.substring(0, dir.length() - 1);
12.108 + D.deb("dir="+dir); // NOI18N
12.109 +
12.110 + String dataRegex = (String) vars.get("DATAREGEX"); // NOI18N
12.111 + if (dataRegex != null) this.dataRegex = dataRegex;
12.112 + String errorRegex = (String) vars.get("ERRORREGEX"); // NOI18N
12.113 + if (errorRegex != null) this.errorRegex = errorRegex;
12.114 + D.deb("dataRegex = "+dataRegex+", errorRegex = "+errorRegex); // NOI18N
12.115 + this.input = (String) vars.get("INPUT"); // NOI18N
12.116 + if (this.input == null) this.input = "Cancel/n"; // NOI18N
12.117 + this.timeout = ((Long) vars.get("TIMEOUT")).longValue(); // NOI18N
12.118 }
12.119 - String module = (String) vars.get("MODULE"); // NOI18N
12.120 - D.deb("rootDir = "+rootDir+", module = "+module+", dir = "+dir); // NOI18N
12.121 - if (dir.equals("")) { // NOI18N
12.122 - dir=rootDir;
12.123 - if (module != null && module.length() > 0) dir += File.separator + module;
12.124 - } else {
12.125 - if (module == null)
12.126 - dir=rootDir+File.separator+dir;
12.127 - else
12.128 - dir=rootDir+File.separator+module+File.separator+dir;
12.129 +
12.130 + private boolean isCVSDir() {
12.131 + File d=new File(dir);
12.132 + String[] files=d.list();
12.133 + if (files != null) {
12.134 + for(int i = 0; i < files.length; i++)
12.135 + if (files[i].equals("CVS")) return true; // NOI18N
12.136 + }
12.137 + shouldFail=true ;
12.138 + return false;
12.139 }
12.140 - if (dir.charAt(dir.length() - 1) == File.separatorChar)
12.141 - dir = dir.substring(0, dir.length() - 1);
12.142 - D.deb("dir="+dir); // NOI18N
12.143 -
12.144 - String dataRegex = (String) vars.get("DATAREGEX"); // NOI18N
12.145 - if (dataRegex != null) this.dataRegex = dataRegex;
12.146 - String errorRegex = (String) vars.get("ERRORREGEX"); // NOI18N
12.147 - if (errorRegex != null) this.errorRegex = errorRegex;
12.148 - D.deb("dataRegex = "+dataRegex+", errorRegex = "+errorRegex); // NOI18N
12.149 - this.input = (String) vars.get("INPUT"); // NOI18N
12.150 - if (this.input == null) this.input = "Cancel/n"; // NOI18N
12.151 - this.timeout = ((Long) vars.get("TIMEOUT")).longValue(); // NOI18N
12.152 - }
12.153 -
12.154 - private boolean isCVSDir() {
12.155 - File d=new File(dir);
12.156 - String[] files=d.list();
12.157 - if (files != null) {
12.158 - for(int i = 0; i < files.length; i++)
12.159 - if (files[i].equals("CVS")) return true; // NOI18N
12.160 +
12.161 + //-----------------------------------
12.162 + private void runStatusCommand(Hashtable vars){
12.163 +
12.164 + /*
12.165 + vars.put("DIR",dir);
12.166 + vars.put("CVSROOT",cvsRoot);
12.167 + */
12.168 + Variables v=new Variables();
12.169 + String prepared=v.expand(vars,cmd, true);
12.170 +
12.171 + D.deb("prepared = "+prepared); // NOI18N
12.172 + D.deb("DIR = '"+(String) vars.get("DIR")+"'"+", dir = '"+this.dir+"'"); // NOI18N
12.173 + ExternalCommand ec=new ExternalCommand(prepared);
12.174 + if (stderrListener != null) {
12.175 + String[] command = { "LIST: "+prepared }; // NOI18N
12.176 + stderrListener.match(command);
12.177 + }
12.178 + if (stderrNRListener != null) stderrNRListener.match("LIST: "+prepared); // NOI18N
12.179 + ec.setTimeout(timeout);
12.180 + ec.setInput(input);
12.181 +
12.182 + try{
12.183 + D.deb("stdout dataRegex = "+dataRegex); // NOI18N
12.184 + ec.addStdoutRegexListener(this,dataRegex);
12.185 + }
12.186 + catch (BadRegexException e){
12.187 + //E.err(e,"bad regex"); // NOI18N
12.188 + //errorBuffer.append("CvsList: Bad data regex "+dataRegex+"\n"); // NOI18N
12.189 + if (stderrListener != null) {
12.190 + String[] elements = { "CvsList: Bad data regex "+dataRegex+"\n" }; // NOI18N
12.191 + stderrListener.match(elements);
12.192 + }
12.193 + //System.err.println("CvsList: Bad regex "+dataRegex);
12.194 + shouldFail=true ;
12.195 + }
12.196 +
12.197 + try{
12.198 + ec.addStderrRegexListener(new RegexListener () {
12.199 + public void match(String[] elements){
12.200 + //D.deb("stderr match:"+MiscStuff.arrayToString(elements)); // NOI18N
12.201 + //errorBuffer.append(elements[0]+"\n"); // NOI18N
12.202 + //System.err.println("CvsList: stderr: "+elements[0]);
12.203 + shouldFail=true ;
12.204 + }
12.205 + },errorRegex);
12.206 + if (this.stderrListener != null) ec.addStderrRegexListener(stderrListener, errorRegex);
12.207 + ec.addStderrRegexListener(this,dataRegex); // Because of "Examining" status // NOI18N
12.208 + }
12.209 + catch (BadRegexException e){
12.210 + //E.err(e,"bad regex"); // NOI18N
12.211 + //errorBuffer.append("CvsList: Bad error regex "+errorRegex+"\n"); // NOI18N
12.212 + if (stderrListener != null) {
12.213 + String[] elements = { "CvsList: Bad error regex "+errorRegex+"\n" }; // NOI18N
12.214 + stderrListener.match(elements);
12.215 + }
12.216 + //System.err.println("CvsList: Bad regex "+errorRegex);
12.217 + shouldFail=true ;
12.218 + }
12.219 +
12.220 + if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
12.221 + if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
12.222 +
12.223 + //D.deb("ec="+ec); // NOI18N
12.224 + if( ec.exec() != ExternalCommand.SUCCESS ){
12.225 + //E.err("exec failed "+ec.getExitStatus()); // NOI18N
12.226 + shouldFail=true;
12.227 + }
12.228 }
12.229 - shouldFail=true ;
12.230 - return false;
12.231 - }
12.232 -
12.233 - //-----------------------------------
12.234 - private void runStatusCommand(Hashtable vars){
12.235
12.236 - /*
12.237 - vars.put("DIR",dir);
12.238 - vars.put("CVSROOT",cvsRoot);
12.239 + //------------------------------------------
12.240 + private boolean furtherExamining(String data, int index) {
12.241 + while(Character.isWhitespace(data.charAt(index))) index++;
12.242 + return (data.charAt(index) == '.');
12.243 + }
12.244 +
12.245 + //-------------------------------------------
12.246 + private void fillHashtable(Hashtable filesByName) {
12.247 + String data=new String(dataBuffer);
12.248 + String examiningStr = "status: Examining"; // NOI18N
12.249 +
12.250 + int pos=0;
12.251 + int index=0;
12.252 + /* I expect file listing in the form: File: <filename> Status: <status>
12.253 + * There has to be info line about examining directories.
12.254 + * (Regex ^(File:.*Status:.*$)|(cvs status.*))
12.255 + */
12.256 + int fileIndex;
12.257 + int examIndex = data.indexOf(examiningStr, pos);
12.258 + if (examIndex < 0) {
12.259 + examiningStr = "server: Examining"; // NOI18N
12.260 + examIndex = data.indexOf(examiningStr, pos);
12.261 + }
12.262 + boolean examining = true;
12.263 + if (examIndex < 0) {
12.264 + E.err("Warning: No examining info from cvs status command !"); // NOI18N
12.265 + examining = false;
12.266 + } else {
12.267 + examining = furtherExamining(data, examIndex += examiningStr.length());
12.268 + examIndex = data.indexOf(examiningStr, examIndex);
12.269 + }
12.270 + fileIndex=data.indexOf("File:",pos); // NOI18N
12.271 + while( examining && fileIndex >=0 ){
12.272 + //int fileIndex=data.indexOf("File:",pos); // NOI18N
12.273 + int statusIndex=data.indexOf("Status:",pos); // NOI18N
12.274 +
12.275 + int nextIndex=data.indexOf("\n",statusIndex); // NOI18N
12.276 + if( nextIndex<0 ){
12.277 + nextIndex=data.length()-1;
12.278 + }
12.279 +
12.280 + D.deb("fillHashtable: fileIndex = "+fileIndex+", statusIndex = "+statusIndex); // NOI18N
12.281 + if( fileIndex>=0 && statusIndex>=0 ){
12.282 + fileIndex+="File:".length(); // NOI18N
12.283 + String fileName=data.substring(fileIndex,statusIndex).trim();
12.284 + int i=-1;
12.285 + if( (i=fileName.indexOf("no file")) >=0 ){ // NOI18N
12.286 + fileName=fileName.substring(i+7).trim();
12.287 + }
12.288 + //D.deb("fileName="+fileName); // NOI18N
12.289 +
12.290 + String fileDetails=data.substring(index,nextIndex);
12.291 + //D.deb("fileDetails="+fileDetails); // NOI18N
12.292 +
12.293 + int eolIndex=data.indexOf("\n",statusIndex); // NOI18N
12.294 + String fileStatus="Unknown"; // NOI18N
12.295 +
12.296 + if( statusIndex>=0 && eolIndex>=0 ){
12.297 + statusIndex+="Status:".length(); // NOI18N
12.298 + fileStatus=data.substring(statusIndex,eolIndex).trim();
12.299 + }
12.300 + //D.deb("fileStatus="+fileStatus); // NOI18N
12.301 +
12.302 + D.deb("fillHashTable: "+"fileName="+fileName+", fileStatus="+fileStatus); // NOI18N
12.303 +
12.304 + String[] fileStatuses = new String[2];
12.305 + fileStatuses[0] = fileName;
12.306 + fileStatuses[1] = fileStatus;
12.307 + filesByName.put(fileName,fileStatuses);
12.308 + }
12.309 + pos=nextIndex;
12.310 + fileIndex=data.indexOf("File:",pos); // NOI18N
12.311 + if (examIndex > 0 && examIndex < fileIndex) {
12.312 + examining = furtherExamining(data, examIndex += examiningStr.length());
12.313 + examIndex = data.indexOf(examiningStr, examIndex);
12.314 + }
12.315 + }
12.316 + }
12.317 +
12.318 + /**
12.319 + * Test if the directory was checked out by CVS or not.
12.320 + * @param dir the directory name to test
12.321 + * @return <code>true</code> if the directory was created by CVS, <code>false</code> if not.
12.322 */
12.323 - Variables v=new Variables();
12.324 - String prepared=v.expand(vars,cmd, true);
12.325 + private boolean isCVSDirectory(File dir) {
12.326 + File subdir = new File(dir, CVS_DIRNAME);
12.327 + if (!subdir.isDirectory()) return false;
12.328 + for(int i = 0; i < CVS_DIRCONTENT.length; i++) {
12.329 + File cvsFile = new File(subdir, CVS_DIRCONTENT[i]);
12.330 + if (!cvsFile.isFile()) return false;
12.331 + }
12.332 + return true;
12.333 + }
12.334
12.335 - D.deb("prepared = "+prepared); // NOI18N
12.336 - D.deb("DIR = '"+(String) vars.get("DIR")+"'"+", dir = '"+this.dir+"'"); // NOI18N
12.337 - ExternalCommand ec=new ExternalCommand(prepared);
12.338 - if (stderrListener != null) {
12.339 - String[] command = { "LIST: "+prepared }; // NOI18N
12.340 - stderrListener.match(command);
12.341 + /**
12.342 + * Add local directories with no status information.
12.343 + * @param filesByName the files container
12.344 + */
12.345 + private void addLocalFiles(Hashtable filesByName){
12.346 + File d=new File(dir);
12.347 + String[] files=d.list();
12.348 + if (files != null) {
12.349 + String[] fileStatuses = new String[2];
12.350 + fileStatuses[1] = ""; // NOI18N
12.351 + for(int i=0;i<files.length;i++){
12.352 + String fileName=files[i];
12.353 + //D.deb("fileName="+fileName); // NOI18N
12.354 +
12.355 + File dirfile = new File(d+File.separator+fileName);
12.356 + if( dirfile.isDirectory() ){
12.357 + fileName+="/"; // NOI18N
12.358 + } else continue;
12.359 + if( fileName.equals(CVS_DIRNAME+"/") ){ // NOI18N
12.360 + continue;
12.361 + }
12.362 +
12.363 + if (!isCVSDirectory(dirfile)) continue;
12.364 + if( filesByName.get(fileName)==null ){
12.365 + D.deb("adding "+fileName); // NOI18N
12.366 + fileStatuses[0] = fileName;
12.367 + filesByName.put(fileName, fileStatuses.clone());
12.368 + }
12.369 + }
12.370 + }
12.371 }
12.372 - if (stderrNRListener != null) stderrNRListener.match("LIST: "+prepared); // NOI18N
12.373 - ec.setTimeout(timeout);
12.374 - ec.setInput(input);
12.375
12.376 - try{
12.377 - D.deb("stdout dataRegex = "+dataRegex); // NOI18N
12.378 - ec.addStdoutRegexListener(this,dataRegex);
12.379 + //--------------------------------------------
12.380 + /**
12.381 + * List files of CVS Repository.
12.382 + * @param vars Variables used by the command
12.383 + * @param args Command-line arguments
12.384 + * filesByName listing of files with statuses
12.385 + * @param stdoutNRListener listener of the standard output of the command
12.386 + * @param stderrNRListener listener of the error output of the command
12.387 + * @param stdoutListener listener of the standard output of the command which
12.388 + * satisfies regex <CODE>dataRegex</CODE>
12.389 + * @param dataRegex the regular expression for parsing the standard output
12.390 + * @param stderrListener listener of the error output of the command which
12.391 + * satisfies regex <CODE>errorRegex</CODE>
12.392 + * @param errorRegex the regular expression for parsing the error output
12.393 + */
12.394 + public boolean list(Hashtable vars, String[] args, Hashtable filesByName,
12.395 + NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
12.396 + RegexListener stdoutListener, String dataRegex,
12.397 + RegexListener stderrListener, String errorRegex) {
12.398 +
12.399 + this.stdoutNRListener = stdoutNRListener;
12.400 + this.stderrNRListener = stderrNRListener;
12.401 + this.stderrListener = stderrListener;
12.402 + this.dataRegex = dataRegex;
12.403 + this.errorRegex = errorRegex;
12.404 + initVars(vars, args);
12.405 + /*if (isCVSDir())*/ runStatusCommand(vars);
12.406 + if (!shouldFail) fillHashtable(filesByName);
12.407 + addLocalFiles(filesByName);
12.408 + if (shouldFail) {
12.409 + //errorBuffer.append(allOutputBuffer.toString());
12.410 + //filesByName.put("ERROR", errorBuffer.toString()); // NOI18N
12.411 + }
12.412 + return !shouldFail;
12.413 }
12.414 - catch (BadRegexException e){
12.415 - //E.err(e,"bad regex"); // NOI18N
12.416 - //errorBuffer.append("CvsList: Bad data regex "+dataRegex+"\n"); // NOI18N
12.417 - if (stderrListener != null) {
12.418 - String[] elements = { "CvsList: Bad data regex "+dataRegex+"\n" }; // NOI18N
12.419 - stderrListener.match(elements);
12.420 - }
12.421 - //System.err.println("CvsList: Bad regex "+dataRegex);
12.422 - shouldFail=true ;
12.423 +
12.424 + public void match(String[] elements) {
12.425 + dataBuffer.append(elements[0]+"\n"); // NOI18N
12.426 + D.deb("match: append line '"+elements[0]+"'"); // NOI18N
12.427 }
12.428 -
12.429 - try{
12.430 - ec.addStderrRegexListener(new RegexListener () {
12.431 - public void match(String[] elements){
12.432 - //D.deb("stderr match:"+MiscStuff.arrayToString(elements)); // NOI18N
12.433 - //errorBuffer.append(elements[0]+"\n"); // NOI18N
12.434 - //System.err.println("CvsList: stderr: "+elements[0]);
12.435 - shouldFail=true ;
12.436 - }
12.437 - },errorRegex);
12.438 - if (this.stderrListener != null) ec.addStderrRegexListener(stderrListener, errorRegex);
12.439 - ec.addStderrRegexListener(this,dataRegex); // Because of "Examining" status // NOI18N
12.440 - }
12.441 - catch (BadRegexException e){
12.442 - //E.err(e,"bad regex"); // NOI18N
12.443 - //errorBuffer.append("CvsList: Bad error regex "+errorRegex+"\n"); // NOI18N
12.444 - if (stderrListener != null) {
12.445 - String[] elements = { "CvsList: Bad error regex "+errorRegex+"\n" }; // NOI18N
12.446 - stderrListener.match(elements);
12.447 - }
12.448 - //System.err.println("CvsList: Bad regex "+errorRegex);
12.449 - shouldFail=true ;
12.450 - }
12.451 -
12.452 - if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
12.453 - if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
12.454 -
12.455 - //D.deb("ec="+ec); // NOI18N
12.456 - if( ec.exec() != ExternalCommand.SUCCESS ){
12.457 - //E.err("exec failed "+ec.getExitStatus()); // NOI18N
12.458 - shouldFail=true;
12.459 - }
12.460 - }
12.461 -
12.462 - //------------------------------------------
12.463 - private boolean furtherExamining(String data, int index) {
12.464 - while(Character.isWhitespace(data.charAt(index))) index++;
12.465 - return (data.charAt(index) == '.');
12.466 - }
12.467 -
12.468 - //-------------------------------------------
12.469 - private void fillHashtable(Hashtable filesByName) {
12.470 - String data=new String(dataBuffer);
12.471 - String examiningStr = "status: Examining"; // NOI18N
12.472 -
12.473 - int pos=0;
12.474 - int index=0;
12.475 - /* I expect file listing in the form: File: <filename> Status: <status>
12.476 - * There has to be info line about examining directories.
12.477 - * (Regex ^(File:.*Status:.*$)|(cvs status.*))
12.478 - */
12.479 - int fileIndex;
12.480 - int examIndex = data.indexOf(examiningStr, pos);
12.481 - if (examIndex < 0) {
12.482 - examiningStr = "server: Examining"; // NOI18N
12.483 - examIndex = data.indexOf(examiningStr, pos);
12.484 - }
12.485 - boolean examining = true;
12.486 - if (examIndex < 0) {
12.487 - E.err("Warning: No examining info from cvs status command !"); // NOI18N
12.488 - examining = false;
12.489 - } else {
12.490 - examining = furtherExamining(data, examIndex += examiningStr.length());
12.491 - examIndex = data.indexOf(examiningStr, examIndex);
12.492 - }
12.493 - fileIndex=data.indexOf("File:",pos); // NOI18N
12.494 - while( examining && fileIndex >=0 ){
12.495 - //int fileIndex=data.indexOf("File:",pos); // NOI18N
12.496 - int statusIndex=data.indexOf("Status:",pos); // NOI18N
12.497 -
12.498 - int nextIndex=data.indexOf("\n",statusIndex); // NOI18N
12.499 - if( nextIndex<0 ){
12.500 - nextIndex=data.length()-1;
12.501 - }
12.502 -
12.503 - D.deb("fillHashtable: fileIndex = "+fileIndex+", statusIndex = "+statusIndex); // NOI18N
12.504 - if( fileIndex>=0 && statusIndex>=0 ){
12.505 - fileIndex+="File:".length(); // NOI18N
12.506 - String fileName=data.substring(fileIndex,statusIndex).trim();
12.507 - int i=-1;
12.508 - if( (i=fileName.indexOf("no file")) >=0 ){ // NOI18N
12.509 - fileName=fileName.substring(i+7).trim();
12.510 - }
12.511 - //D.deb("fileName="+fileName); // NOI18N
12.512 -
12.513 - String fileDetails=data.substring(index,nextIndex);
12.514 - //D.deb("fileDetails="+fileDetails); // NOI18N
12.515 -
12.516 - int eolIndex=data.indexOf("\n",statusIndex); // NOI18N
12.517 - String fileStatus="Unknown"; // NOI18N
12.518 -
12.519 - if( statusIndex>=0 && eolIndex>=0 ){
12.520 - statusIndex+="Status:".length(); // NOI18N
12.521 - fileStatus=data.substring(statusIndex,eolIndex).trim();
12.522 - }
12.523 - //D.deb("fileStatus="+fileStatus); // NOI18N
12.524 -
12.525 - D.deb("fillHashTable: "+"fileName="+fileName+", fileStatus="+fileStatus); // NOI18N
12.526 -
12.527 - String[] fileStatuses = new String[2];
12.528 - fileStatuses[0] = fileName;
12.529 - fileStatuses[1] = fileStatus;
12.530 - filesByName.put(fileName,fileStatuses);
12.531 - }
12.532 - pos=nextIndex;
12.533 - fileIndex=data.indexOf("File:",pos); // NOI18N
12.534 - if (examIndex > 0 && examIndex < fileIndex) {
12.535 - examining = furtherExamining(data, examIndex += examiningStr.length());
12.536 - examIndex = data.indexOf(examiningStr, examIndex);
12.537 - }
12.538 - }
12.539 - }
12.540 -
12.541 - /**
12.542 - * Test if the directory was checked out by CVS or not.
12.543 - * @param dir the directory name to test
12.544 - * @return <code>true</code> if the directory was created by CVS, <code>false</code> if not.
12.545 - */
12.546 - private boolean isCVSDirectory(File dir) {
12.547 - File subdir = new File(dir, CVS_DIRNAME);
12.548 - if (!subdir.isDirectory()) return false;
12.549 - for(int i = 0; i < CVS_DIRCONTENT.length; i++) {
12.550 - File cvsFile = new File(subdir, CVS_DIRCONTENT[i]);
12.551 - if (!cvsFile.isFile()) return false;
12.552 - }
12.553 - return true;
12.554 - }
12.555 -
12.556 - /**
12.557 - * Add local directories with no status information.
12.558 - * @param filesByName the files container
12.559 - */
12.560 - private void addLocalFiles(Hashtable filesByName){
12.561 - File d=new File(dir);
12.562 - String[] files=d.list();
12.563 - if (files != null) {
12.564 - String[] fileStatuses = new String[2];
12.565 - fileStatuses[1] = ""; // NOI18N
12.566 - for(int i=0;i<files.length;i++){
12.567 - String fileName=files[i];
12.568 - //D.deb("fileName="+fileName); // NOI18N
12.569 -
12.570 - File dirfile = new File(d+File.separator+fileName);
12.571 - if( dirfile.isDirectory() ){
12.572 - fileName+="/"; // NOI18N
12.573 - } else continue;
12.574 - if( fileName.equals(CVS_DIRNAME+"/") ){ // NOI18N
12.575 - continue;
12.576 - }
12.577 -
12.578 - if (!isCVSDirectory(dirfile)) continue;
12.579 - if( filesByName.get(fileName)==null ){
12.580 - D.deb("adding "+fileName); // NOI18N
12.581 - fileStatuses[0] = fileName;
12.582 - filesByName.put(fileName, fileStatuses.clone());
12.583 - }
12.584 - }
12.585 - }
12.586 - }
12.587 -
12.588 - //--------------------------------------------
12.589 - /**
12.590 - * List files of CVS Repository.
12.591 - * @param vars Variables used by the command
12.592 - * @param args Command-line arguments
12.593 - * filesByName listing of files with statuses
12.594 - * @param stdoutNRListener listener of the standard output of the command
12.595 - * @param stderrNRListener listener of the error output of the command
12.596 - * @param stdoutListener listener of the standard output of the command which
12.597 - * satisfies regex <CODE>dataRegex</CODE>
12.598 - * @param dataRegex the regular expression for parsing the standard output
12.599 - * @param stderrListener listener of the error output of the command which
12.600 - * satisfies regex <CODE>errorRegex</CODE>
12.601 - * @param errorRegex the regular expression for parsing the error output
12.602 - */
12.603 - public boolean list(Hashtable vars, String[] args, Hashtable filesByName,
12.604 - NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
12.605 - RegexListener stdoutListener, String dataRegex,
12.606 - RegexListener stderrListener, String errorRegex) {
12.607 -
12.608 - this.stdoutNRListener = stdoutNRListener;
12.609 - this.stderrNRListener = stderrNRListener;
12.610 - this.stderrListener = stderrListener;
12.611 - this.dataRegex = dataRegex;
12.612 - this.errorRegex = errorRegex;
12.613 - initVars(vars, args);
12.614 - /*if (isCVSDir())*/ runStatusCommand(vars);
12.615 - if (!shouldFail) fillHashtable(filesByName);
12.616 - addLocalFiles(filesByName);
12.617 - if (shouldFail) {
12.618 - //errorBuffer.append(allOutputBuffer.toString());
12.619 - //filesByName.put("ERROR", errorBuffer.toString()); // NOI18N
12.620 - }
12.621 - return !shouldFail;
12.622 - }
12.623 -
12.624 - public void match(String[] elements) {
12.625 - dataBuffer.append(elements[0]+"\n"); // NOI18N
12.626 - D.deb("match: append line '"+elements[0]+"'"); // NOI18N
12.627 - }
12.628 }
12.629
12.630 /*
13.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/list/CvsListRecursiveCommand.java Tue Apr 25 12:55:38 2000 +0000
13.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/list/CvsListRecursiveCommand.java Tue Apr 25 14:04:53 2000 +0000
13.3 @@ -22,342 +22,342 @@
13.4 import java.io.*;
13.5 import java.util.*;
13.6
13.7 -/**
13.8 +/**
13.9 *
13.10 * @author Martin Entlicher
13.11 * @version
13.12 */
13.13 public class CvsListRecursiveCommand extends VcsListRecursiveCommand implements RegexListener {
13.14
13.15 - private Debug E=new Debug("CvsListRecursiveCommand",true); // NOI18N
13.16 - private Debug D=E;
13.17 -
13.18 - private static final String[] examiningStrs = {"status: Examining", "server: Examining"}; // NOI18N
13.19 + private Debug E=new Debug("CvsListRecursiveCommand",true); // NOI18N
13.20 + private Debug D=E;
13.21
13.22 - private String rootDir = null;
13.23 - private String dir = null;
13.24 - private String dirPath = null;
13.25 - private String cmd = null;
13.26 - private String cvsRoot = null;
13.27 - private String cvsRepository = null;
13.28 -
13.29 - private boolean shouldFail = false;
13.30 + private static final String[] examiningStrs = {"status: Examining", "server: Examining"}; // NOI18N
13.31
13.32 - private StringBuffer dataBuffer=new StringBuffer(4096);
13.33 - //private StringBuffer errorBuffer = new StringBuffer(256);
13.34 - private NoRegexListener stdoutNRListener = null;
13.35 - private NoRegexListener stderrNRListener = null;
13.36 - private RegexListener stderrListener = null;
13.37 -
13.38 - private String dataRegex = null;
13.39 - private String errorRegex = null;
13.40 - private String input = null;
13.41 - private long timeout = 0;
13.42 - /*
13.43 - private VcsDirContainer filesByNameCont = null;
13.44 - private VcsDirContainer filesByNameContPath = null;
13.45 - private Hashtable filesByName = null;
13.46 - */
13.47 -
13.48 - /** Creates new CvsListRecursiveCommand */
13.49 - public CvsListRecursiveCommand() {
13.50 - }
13.51 + private String rootDir = null;
13.52 + private String dir = null;
13.53 + private String dirPath = null;
13.54 + private String cmd = null;
13.55 + private String cvsRoot = null;
13.56 + private String cvsRepository = null;
13.57
13.58 - private void initVars(Hashtable vars, String[] args) {
13.59 - this.cmd = MiscStuff.array2string(args);
13.60 -
13.61 - this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
13.62 - if (this.rootDir == null) {
13.63 - this.rootDir = "."; // NOI18N
13.64 - //vars.put("ROOTDIR","."); // NOI18N
13.65 + private boolean shouldFail = false;
13.66 +
13.67 + private StringBuffer dataBuffer=new StringBuffer(4096);
13.68 + //private StringBuffer errorBuffer = new StringBuffer(256);
13.69 + private NoRegexListener stdoutNRListener = null;
13.70 + private NoRegexListener stderrNRListener = null;
13.71 + private RegexListener stderrListener = null;
13.72 +
13.73 + private String dataRegex = null;
13.74 + private String errorRegex = null;
13.75 + private String input = null;
13.76 + private long timeout = 0;
13.77 + /*
13.78 + private VcsDirContainer filesByNameCont = null;
13.79 + private VcsDirContainer filesByNameContPath = null;
13.80 + private Hashtable filesByName = null;
13.81 + */
13.82 +
13.83 + /** Creates new CvsListRecursiveCommand */
13.84 + public CvsListRecursiveCommand() {
13.85 }
13.86 - this.cvsRepository = (String) vars.get("CVS_REPOSITORY");
13.87 - if (this.cvsRepository == null) {
13.88 - this.cvsRepository = "";
13.89 +
13.90 + private void initVars(Hashtable vars, String[] args) {
13.91 + this.cmd = MiscStuff.array2string(args);
13.92 +
13.93 + this.rootDir = (String) vars.get("ROOTDIR"); // NOI18N
13.94 + if (this.rootDir == null) {
13.95 + this.rootDir = "."; // NOI18N
13.96 + //vars.put("ROOTDIR","."); // NOI18N
13.97 + }
13.98 + this.cvsRepository = (String) vars.get("CVS_REPOSITORY");
13.99 + if (this.cvsRepository == null) {
13.100 + this.cvsRepository = "";
13.101 + }
13.102 + this.dir = (String) vars.get("DIR"); // NOI18N
13.103 + if (this.dir == null) {
13.104 + this.dir = ""; // NOI18N
13.105 + //vars.put("DIR","."); // NOI18N
13.106 + }
13.107 + this.dirPath = dir.replace(java.io.File.separatorChar, '/');
13.108 + String module = (String) vars.get("MODULE"); // NOI18N
13.109 + D.deb("rootDir = "+rootDir+", module = "+module+", dir = "+dir); // NOI18N
13.110 + if (dir.equals("")) { // NOI18N
13.111 + dir=rootDir;
13.112 + if (module != null && module.length() > 0) dir += File.separator + module;
13.113 + } else {
13.114 + if (module == null)
13.115 + dir=rootDir+File.separator+dir;
13.116 + else
13.117 + dir=rootDir+File.separator+module+File.separator+dir;
13.118 + }
13.119 + if (module.length() > 0) this.cvsRepository += "/"+module.replace('\\', '/');
13.120 + if (dir.charAt(dir.length() - 1) == File.separatorChar)
13.121 + dir = dir.substring(0, dir.length() - 1);
13.122 + D.deb("dir="+dir); // NOI18N
13.123 +
13.124 + String dataRegex = (String) vars.get("DATAREGEX"); // NOI18N
13.125 + if (dataRegex != null) this.dataRegex = dataRegex;
13.126 + String errorRegex = (String) vars.get("ERRORREGEX"); // NOI18N
13.127 + if (errorRegex != null) this.errorRegex = errorRegex;
13.128 + D.deb("dataRegex = "+dataRegex+", errorRegex = "+errorRegex); // NOI18N
13.129 + this.input = (String) vars.get("INPUT"); // NOI18N
13.130 + if (this.input == null) this.input = "Cancel/n"; // NOI18N
13.131 + this.timeout = ((Long) vars.get("TIMEOUT")).longValue(); // NOI18N
13.132 }
13.133 - this.dir = (String) vars.get("DIR"); // NOI18N
13.134 - if (this.dir == null) {
13.135 - this.dir = ""; // NOI18N
13.136 - //vars.put("DIR","."); // NOI18N
13.137 +
13.138 + //-----------------------------------
13.139 + private void runStatusCommand(Hashtable vars){
13.140 + Variables v=new Variables();
13.141 + String prepared=v.expand(vars,cmd, true);
13.142 +
13.143 + D.deb("prepared = "+prepared); // NOI18N
13.144 + D.deb("DIR = '"+(String) vars.get("DIR")+"'"+", dir = '"+this.dir+"'"); // NOI18N
13.145 + ExternalCommand ec=new ExternalCommand(prepared);
13.146 + if (stderrListener != null) {
13.147 + String[] command = { "LIST_SUB: "+prepared }; // NOI18N
13.148 + stderrListener.match(command);
13.149 + }
13.150 + if (stderrNRListener != null) stderrNRListener.match("LIST_SUB: "+prepared); // NOI18N
13.151 + ec.setTimeout(timeout);
13.152 + ec.setInput(input);
13.153 +
13.154 + try{
13.155 + D.deb("stdout dataRegex = "+dataRegex); // NOI18N
13.156 + ec.addStdoutRegexListener(this,dataRegex);
13.157 + }
13.158 + catch (BadRegexException e){
13.159 + if (stderrListener != null) {
13.160 + String[] elements = { "CvsList: Bad data regex "+dataRegex+"\n" }; // NOI18N
13.161 + stderrListener.match(elements);
13.162 + }
13.163 + shouldFail=true ;
13.164 + }
13.165 +
13.166 + try{
13.167 + ec.addStderrRegexListener(new RegexListener () {
13.168 + public void match(String[] elements){
13.169 + shouldFail=true ;
13.170 + }
13.171 + },errorRegex);
13.172 + if (this.stderrListener != null) ec.addStderrRegexListener(stderrListener, errorRegex);
13.173 + ec.addStderrRegexListener(this,dataRegex); // Because of "Examining" status // NOI18N
13.174 + }
13.175 + catch (BadRegexException e){
13.176 + if (stderrListener != null) {
13.177 + String[] elements = { "CvsList: Bad error regex "+errorRegex+"\n" }; // NOI18N
13.178 + stderrListener.match(elements);
13.179 + }
13.180 + shouldFail=true ;
13.181 + }
13.182 +
13.183 + if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
13.184 + if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
13.185 +
13.186 + if( ec.exec() != ExternalCommand.SUCCESS ){
13.187 + shouldFail=true;
13.188 + }
13.189 }
13.190 - this.dirPath = dir.replace(java.io.File.separatorChar, '/');
13.191 - String module = (String) vars.get("MODULE"); // NOI18N
13.192 - D.deb("rootDir = "+rootDir+", module = "+module+", dir = "+dir); // NOI18N
13.193 - if (dir.equals("")) { // NOI18N
13.194 - dir=rootDir;
13.195 - if (module != null && module.length() > 0) dir += File.separator + module;
13.196 - } else {
13.197 - if (module == null)
13.198 - dir=rootDir+File.separator+dir;
13.199 - else
13.200 - dir=rootDir+File.separator+module+File.separator+dir;
13.201 +
13.202 +
13.203 + /**
13.204 + * Get the path of file from the output information at given index.
13.205 + * @param data the output data
13.206 + * @param index the index to the file information
13.207 + */
13.208 + private String getFilePath(String data, int index) {
13.209 + int begin = index;
13.210 + while(Character.isWhitespace(data.charAt(begin))) begin++; // skip the space
13.211 + while(!Character.isWhitespace(data.charAt(begin))) begin++; // skip the revision number
13.212 + while(Character.isWhitespace(data.charAt(begin))) begin++; // skip the space
13.213 + int end = data.indexOf('\n', begin);
13.214 + if (end < 0) return null;
13.215 + String path = data.substring(begin, end);
13.216 + D.deb("getFilePath(): path = "+path);
13.217 + int nameIndex = path.lastIndexOf('/');
13.218 + D.deb("nameIndex = "+nameIndex);
13.219 + if (nameIndex < 0) return null;
13.220 + if (nameIndex == 0) return (cvsRepository.length() > 0) ? null : "";
13.221 + path = path.substring(0, nameIndex);
13.222 + index = path.indexOf(cvsRepository);
13.223 + if (index < 0) return null;
13.224 + D.deb("getFilePath(): path = "+path+", index = "+index+", cvsRepository = "+cvsRepository);
13.225 + if (path.length() <= cvsRepository.length())
13.226 + return "";
13.227 + else
13.228 + return path.substring(index + cvsRepository.length() + 1);
13.229 }
13.230 - if (module.length() > 0) this.cvsRepository += "/"+module.replace('\\', '/');
13.231 - if (dir.charAt(dir.length() - 1) == File.separatorChar)
13.232 - dir = dir.substring(0, dir.length() - 1);
13.233 - D.deb("dir="+dir); // NOI18N
13.234 -
13.235 - String dataRegex = (String) vars.get("DATAREGEX"); // NOI18N
13.236 - if (dataRegex != null) this.dataRegex = dataRegex;
13.237 - String errorRegex = (String) vars.get("ERRORREGEX"); // NOI18N
13.238 - if (errorRegex != null) this.errorRegex = errorRegex;
13.239 - D.deb("dataRegex = "+dataRegex+", errorRegex = "+errorRegex); // NOI18N
13.240 - this.input = (String) vars.get("INPUT"); // NOI18N
13.241 - if (this.input == null) this.input = "Cancel/n"; // NOI18N
13.242 - this.timeout = ((Long) vars.get("TIMEOUT")).longValue(); // NOI18N
13.243 - }
13.244 -
13.245 - //-----------------------------------
13.246 - private void runStatusCommand(Hashtable vars){
13.247 - Variables v=new Variables();
13.248 - String prepared=v.expand(vars,cmd, true);
13.249
13.250 - D.deb("prepared = "+prepared); // NOI18N
13.251 - D.deb("DIR = '"+(String) vars.get("DIR")+"'"+", dir = '"+this.dir+"'"); // NOI18N
13.252 - ExternalCommand ec=new ExternalCommand(prepared);
13.253 - if (stderrListener != null) {
13.254 - String[] command = { "LIST_SUB: "+prepared }; // NOI18N
13.255 - stderrListener.match(command);
13.256 +
13.257 + /**
13.258 + * Get files and their statuses from the command output.
13.259 + * @param filesByNameCont the container of files.
13.260 + */
13.261 + private void fillHashtable(VcsDirContainer filesByNameCont) {
13.262 + String data=new String(dataBuffer);
13.263 + Hashtable filesByName = new Hashtable();
13.264 + VcsDirContainer filesByNameContPath = filesByNameCont;
13.265 + String last_filePath = "";
13.266 + int pos=0;
13.267 + int index=0;
13.268 + /* I expect file listing in the form: File: <filename> Status: <status>
13.269 + * Followed by Repository Revision: <revision path>
13.270 + * I suppose that revision path is the same as the working path.
13.271 + * (Regex ^(File:.*Status:.*$)|(Repository Revision.*))
13.272 + */
13.273 + filesByNameCont.setPath(dirPath);
13.274 + filesByName = new Hashtable();
13.275 + filesByNameCont.setElement(filesByName);
13.276 + while(pos < data.length()) {
13.277 + //int examIndex = getExaminingInfo(data, pos);
13.278 + int fileIndex=data.indexOf("File:",pos); // NOI18N
13.279 + int statusIndex=data.indexOf("Status:",pos); // NOI18N
13.280 + if (fileIndex < 0 || statusIndex < 0) {
13.281 + pos = data.length();
13.282 + continue;
13.283 + }
13.284 + int nextIndex=data.indexOf("\n",statusIndex); // NOI18N
13.285 + if (nextIndex < 0) {
13.286 + nextIndex = data.length()-1;
13.287 + }
13.288 + //D.deb("fillHashtable: fileIndex = "+fileIndex+", statusIndex = "+statusIndex); // NOI18N
13.289 + fileIndex+="File:".length(); // NOI18N
13.290 + String fileName=data.substring(fileIndex,statusIndex).trim();
13.291 + int i=-1;
13.292 + if( (i=fileName.indexOf("no file")) >=0 ){ // NOI18N
13.293 + fileName=fileName.substring(i+7).trim();
13.294 + }
13.295 + //D.deb("fileName="+fileName); // NOI18N
13.296 +
13.297 + String fileDetails=data.substring(index,nextIndex);
13.298 + //D.deb("fileDetails="+fileDetails); // NOI18N
13.299 +
13.300 + int eolIndex=data.indexOf("\n",statusIndex); // NOI18N
13.301 + String fileStatus="Unknown"; // NOI18N
13.302 +
13.303 + if( statusIndex>=0 && eolIndex>=0 ){
13.304 + statusIndex+="Status:".length(); // NOI18N
13.305 + fileStatus=data.substring(statusIndex,eolIndex).trim();
13.306 + }
13.307 + //D.deb("fileStatus="+fileStatus); // NOI18N
13.308 + int repositoryIndex = data.indexOf("Repository revision:", statusIndex);
13.309 + if (repositoryIndex < 0) {
13.310 + pos = data.length();
13.311 + continue;
13.312 + }
13.313 + repositoryIndex += "Repository revision:".length();
13.314 + String filePath = getFilePath(data, repositoryIndex);
13.315 + if (filePath != null && !filePath.equals(last_filePath)) {
13.316 + VcsDirContainer parent = VcsDirContainer.getParent(filePath, filesByNameCont);
13.317 + if (parent != null) filesByNameContPath = parent.addSubdir(filePath);
13.318 + else filesByNameContPath = filesByNameCont.addSubdirRecursive(filePath);
13.319 + D.deb("parent = "+parent+((parent == null) ? "" : " path = "+parent.getPath()));
13.320 + filesByName = new Hashtable();
13.321 + filesByNameContPath.setElement(filesByName);
13.322 + D.deb("created new Container with path: "+filePath);
13.323 + last_filePath = filePath;
13.324 + }
13.325 +
13.326 + //D.deb("fillHashTable: "+"fileName="+fileName+", fileStatus="+fileStatus); // NOI18N
13.327 +
13.328 + String[] fileStatuses = new String[2];
13.329 + fileStatuses[0] = fileName;
13.330 + fileStatuses[1] = fileStatus;
13.331 + filesByName.put(fileName,fileStatuses);
13.332 + pos = repositoryIndex;
13.333 + //fileIndex=data.indexOf("File:",pos); // NOI18N
13.334 + //if (examIndex > 0 && examIndex < fileIndex) {
13.335 + //examining = furtherExamining(data, examIndex += examiningStr.length());
13.336 + //examIndex = data.indexOf(examiningStr, examIndex);
13.337 + //}
13.338 + }
13.339 }
13.340 - if (stderrNRListener != null) stderrNRListener.match("LIST_SUB: "+prepared); // NOI18N
13.341 - ec.setTimeout(timeout);
13.342 - ec.setInput(input);
13.343
13.344 - try{
13.345 - D.deb("stdout dataRegex = "+dataRegex); // NOI18N
13.346 - ec.addStdoutRegexListener(this,dataRegex);
13.347 +
13.348 + //-------------------------------------------
13.349 + /**
13.350 + * Add local directories with no status information.
13.351 + * @param filesByName the files container
13.352 + */
13.353 + private void addLocalFiles(String dir, VcsDirContainer filesByNameCont) {
13.354 + File d = new File(dir);
13.355 + String[] files = d.list();
13.356 + Hashtable filesByName = (Hashtable) filesByNameCont.getElement();
13.357 + if (filesByName == null) {
13.358 + filesByName = new Hashtable();
13.359 + filesByNameCont.setElement(filesByName);
13.360 + }
13.361 + if (files != null) {
13.362 + String[] fileStatuses = new String[2];
13.363 + fileStatuses[1] = ""; // NOI18N
13.364 + for(int i=0;i<files.length;i++){
13.365 + String fileName=files[i];
13.366 + //D.deb("fileName="+fileName); // NOI18N
13.367 +
13.368 + if( new File(d+File.separator+fileName).isDirectory() ){
13.369 + fileName+="/"; // NOI18N
13.370 + } else continue;
13.371 + if( fileName.equals("CVS/") ){ // NOI18N
13.372 + continue;
13.373 + }
13.374 +
13.375 + if( filesByName.get(fileName)==null ){
13.376 + //D.deb("addLocalFiles: adding "+fileName+", to Container with path = "+filesByNameCont.getPath()); // NOI18N
13.377 + fileStatuses[0] = fileName;
13.378 + filesByName.put(fileName, fileStatuses.clone());
13.379 + }
13.380 + VcsDirContainer subdir = filesByNameCont.getDirContainer(files[i]);
13.381 + if (subdir == null) subdir = filesByNameCont.addSubdir(filesByNameCont.getPath()+"/"+files[i]);
13.382 + //D.deb("addLocalFiles: call add of "+dir+File.separator+files[i]+" to container "+subdir.getPath());
13.383 + addLocalFiles(dir+File.separator+files[i], subdir);
13.384 + }
13.385 + }
13.386 }
13.387 - catch (BadRegexException e){
13.388 - if (stderrListener != null) {
13.389 - String[] elements = { "CvsList: Bad data regex "+dataRegex+"\n" }; // NOI18N
13.390 - stderrListener.match(elements);
13.391 - }
13.392 - shouldFail=true ;
13.393 +
13.394 + /**
13.395 + * List files of CVS Repository recursively.
13.396 + * @param vars Variables used by the command
13.397 + * @param args Command-line arguments
13.398 + * @param filesByNameCont listing of files with statuses. For each directory there is a <code>Hashtable</code>
13.399 + * with files.
13.400 + * @param stdoutNRListener listener of the standard output of the command
13.401 + * @param stderrNRListener listener of the error output of the command
13.402 + * @param stdoutListener listener of the standard output of the command which
13.403 + * satisfies regex <CODE>dataRegex</CODE>
13.404 + * @param dataRegex the regular expression for parsing the standard output
13.405 + * @param stderrListener listener of the error output of the command which
13.406 + * satisfies regex <CODE>errorRegex</CODE>
13.407 + * @param errorRegex the regular expression for parsing the error output
13.408 + */
13.409 + public boolean listRecursively(Hashtable vars, String[] args, VcsDirContainer filesByNameCont,
13.410 + NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
13.411 + RegexListener stdoutListener, String dataRegex,
13.412 + RegexListener stderrListener, String errorRegex) {
13.413 +
13.414 + this.stdoutNRListener = stdoutNRListener;
13.415 + this.stderrNRListener = stderrNRListener;
13.416 + this.stderrListener = stderrListener;
13.417 + this.dataRegex = dataRegex;
13.418 + this.errorRegex = errorRegex;
13.419 + initVars(vars, args);
13.420 + /*
13.421 + this.filesByNameCont = filesByNameCont;
13.422 + this.filesByNameContPath = filesByNameCont;
13.423 + this.filesByName = new Hashtable();
13.424 + */
13.425 + runStatusCommand(vars);
13.426 + if (!shouldFail) fillHashtable(filesByNameCont);
13.427 + //addLocalFiles(dir, filesByNameCont);
13.428 + return !shouldFail;
13.429 }
13.430 -
13.431 - try{
13.432 - ec.addStderrRegexListener(new RegexListener () {
13.433 - public void match(String[] elements){
13.434 - shouldFail=true ;
13.435 - }
13.436 - },errorRegex);
13.437 - if (this.stderrListener != null) ec.addStderrRegexListener(stderrListener, errorRegex);
13.438 - ec.addStderrRegexListener(this,dataRegex); // Because of "Examining" status // NOI18N
13.439 +
13.440 + /**
13.441 + * Matches the standard output of the command.
13.442 + * @param elements a line of output
13.443 + */
13.444 + public void match(String[] elements) {
13.445 + dataBuffer.append(elements[0]+"\n"); // NOI18N
13.446 + D.deb("match: append line '"+elements[0]+"'"); // NOI18N
13.447 }
13.448 - catch (BadRegexException e){
13.449 - if (stderrListener != null) {
13.450 - String[] elements = { "CvsList: Bad error regex "+errorRegex+"\n" }; // NOI18N
13.451 - stderrListener.match(elements);
13.452 - }
13.453 - shouldFail=true ;
13.454 - }
13.455 -
13.456 - if (this.stdoutNRListener != null) ec.addStdoutNoRegexListener(stdoutNRListener);
13.457 - if (this.stderrNRListener != null) ec.addStderrNoRegexListener(stderrNRListener);
13.458 -
13.459 - if( ec.exec() != ExternalCommand.SUCCESS ){
13.460 - shouldFail=true;
13.461 - }
13.462 - }
13.463 -
13.464 -
13.465 - /**
13.466 - * Get the path of file from the output information at given index.
13.467 - * @param data the output data
13.468 - * @param index the index to the file information
13.469 - */
13.470 - private String getFilePath(String data, int index) {
13.471 - int begin = index;
13.472 - while(Character.isWhitespace(data.charAt(begin))) begin++; // skip the space
13.473 - while(!Character.isWhitespace(data.charAt(begin))) begin++; // skip the revision number
13.474 - while(Character.isWhitespace(data.charAt(begin))) begin++; // skip the space
13.475 - int end = data.indexOf('\n', begin);
13.476 - if (end < 0) return null;
13.477 - String path = data.substring(begin, end);
13.478 - D.deb("getFilePath(): path = "+path);
13.479 - int nameIndex = path.lastIndexOf('/');
13.480 - D.deb("nameIndex = "+nameIndex);
13.481 - if (nameIndex < 0) return null;
13.482 - if (nameIndex == 0) return (cvsRepository.length() > 0) ? null : "";
13.483 - path = path.substring(0, nameIndex);
13.484 - index = path.indexOf(cvsRepository);
13.485 - if (index < 0) return null;
13.486 - D.deb("getFilePath(): path = "+path+", index = "+index+", cvsRepository = "+cvsRepository);
13.487 - if (path.length() <= cvsRepository.length())
13.488 - return "";
13.489 - else
13.490 - return path.substring(index + cvsRepository.length() + 1);
13.491 - }
13.492 -
13.493 -
13.494 - /**
13.495 - * Get files and their statuses from the command output.
13.496 - * @param filesByNameCont the container of files.
13.497 - */
13.498 - private void fillHashtable(VcsDirContainer filesByNameCont) {
13.499 - String data=new String(dataBuffer);
13.500 - Hashtable filesByName = new Hashtable();
13.501 - VcsDirContainer filesByNameContPath = filesByNameCont;
13.502 - String last_filePath = "";
13.503 - int pos=0;
13.504 - int index=0;
13.505 - /* I expect file listing in the form: File: <filename> Status: <status>
13.506 - * Followed by Repository Revision: <revision path>
13.507 - * I suppose that revision path is the same as the working path.
13.508 - * (Regex ^(File:.*Status:.*$)|(Repository Revision.*))
13.509 - */
13.510 - filesByNameCont.setPath(dirPath);
13.511 - filesByName = new Hashtable();
13.512 - filesByNameCont.setElement(filesByName);
13.513 - while(pos < data.length()) {
13.514 - //int examIndex = getExaminingInfo(data, pos);
13.515 - int fileIndex=data.indexOf("File:",pos); // NOI18N
13.516 - int statusIndex=data.indexOf("Status:",pos); // NOI18N
13.517 - if (fileIndex < 0 || statusIndex < 0) {
13.518 - pos = data.length();
13.519 - continue;
13.520 - }
13.521 - int nextIndex=data.indexOf("\n",statusIndex); // NOI18N
13.522 - if (nextIndex < 0) {
13.523 - nextIndex = data.length()-1;
13.524 - }
13.525 - //D.deb("fillHashtable: fileIndex = "+fileIndex+", statusIndex = "+statusIndex); // NOI18N
13.526 - fileIndex+="File:".length(); // NOI18N
13.527 - String fileName=data.substring(fileIndex,statusIndex).trim();
13.528 - int i=-1;
13.529 - if( (i=fileName.indexOf("no file")) >=0 ){ // NOI18N
13.530 - fileName=fileName.substring(i+7).trim();
13.531 - }
13.532 - //D.deb("fileName="+fileName); // NOI18N
13.533 -
13.534 - String fileDetails=data.substring(index,nextIndex);
13.535 - //D.deb("fileDetails="+fileDetails); // NOI18N
13.536 -
13.537 - int eolIndex=data.indexOf("\n",statusIndex); // NOI18N
13.538 - String fileStatus="Unknown"; // NOI18N
13.539 -
13.540 - if( statusIndex>=0 && eolIndex>=0 ){
13.541 - statusIndex+="Status:".length(); // NOI18N
13.542 - fileStatus=data.substring(statusIndex,eolIndex).trim();
13.543 - }
13.544 - //D.deb("fileStatus="+fileStatus); // NOI18N
13.545 - int repositoryIndex = data.indexOf("Repository revision:", statusIndex);
13.546 - if (repositoryIndex < 0) {
13.547 - pos = data.length();
13.548 - continue;
13.549 - }
13.550 - repositoryIndex += "Repository revision:".length();
13.551 - String filePath = getFilePath(data, repositoryIndex);
13.552 - if (filePath != null && !filePath.equals(last_filePath)) {
13.553 - VcsDirContainer parent = VcsDirContainer.getParent(filePath, filesByNameCont);
13.554 - if (parent != null) filesByNameContPath = parent.addSubdir(filePath);
13.555 - else filesByNameContPath = filesByNameCont.addSubdirRecursive(filePath);
13.556 - D.deb("parent = "+parent+((parent == null) ? "" : " path = "+parent.getPath()));
13.557 - filesByName = new Hashtable();
13.558 - filesByNameContPath.setElement(filesByName);
13.559 - D.deb("created new Container with path: "+filePath);
13.560 - last_filePath = filePath;
13.561 - }
13.562 -
13.563 - //D.deb("fillHashTable: "+"fileName="+fileName+", fileStatus="+fileStatus); // NOI18N
13.564 -
13.565 - String[] fileStatuses = new String[2];
13.566 - fileStatuses[0] = fileName;
13.567 - fileStatuses[1] = fileStatus;
13.568 - filesByName.put(fileName,fileStatuses);
13.569 - pos = repositoryIndex;
13.570 - //fileIndex=data.indexOf("File:",pos); // NOI18N
13.571 - //if (examIndex > 0 && examIndex < fileIndex) {
13.572 - //examining = furtherExamining(data, examIndex += examiningStr.length());
13.573 - //examIndex = data.indexOf(examiningStr, examIndex);
13.574 - //}
13.575 - }
13.576 - }
13.577 -
13.578 -
13.579 - //-------------------------------------------
13.580 - /**
13.581 - * Add local directories with no status information.
13.582 - * @param filesByName the files container
13.583 - */
13.584 - private void addLocalFiles(String dir, VcsDirContainer filesByNameCont) {
13.585 - File d = new File(dir);
13.586 - String[] files = d.list();
13.587 - Hashtable filesByName = (Hashtable) filesByNameCont.getElement();
13.588 - if (filesByName == null) {
13.589 - filesByName = new Hashtable();
13.590 - filesByNameCont.setElement(filesByName);
13.591 - }
13.592 - if (files != null) {
13.593 - String[] fileStatuses = new String[2];
13.594 - fileStatuses[1] = ""; // NOI18N
13.595 - for(int i=0;i<files.length;i++){
13.596 - String fileName=files[i];
13.597 - //D.deb("fileName="+fileName); // NOI18N
13.598 -
13.599 - if( new File(d+File.separator+fileName).isDirectory() ){
13.600 - fileName+="/"; // NOI18N
13.601 - } else continue;
13.602 - if( fileName.equals("CVS/") ){ // NOI18N
13.603 - continue;
13.604 - }
13.605 -
13.606 - if( filesByName.get(fileName)==null ){
13.607 - //D.deb("addLocalFiles: adding "+fileName+", to Container with path = "+filesByNameCont.getPath()); // NOI18N
13.608 - fileStatuses[0] = fileName;
13.609 - filesByName.put(fileName, fileStatuses.clone());
13.610 - }
13.611 - VcsDirContainer subdir = filesByNameCont.getDirContainer(files[i]);
13.612 - if (subdir == null) subdir = filesByNameCont.addSubdir(filesByNameCont.getPath()+"/"+files[i]);
13.613 - //D.deb("addLocalFiles: call add of "+dir+File.separator+files[i]+" to container "+subdir.getPath());
13.614 - addLocalFiles(dir+File.separator+files[i], subdir);
13.615 - }
13.616 - }
13.617 - }
13.618 -
13.619 - /**
13.620 - * List files of CVS Repository recursively.
13.621 - * @param vars Variables used by the command
13.622 - * @param args Command-line arguments
13.623 - * @param filesByNameCont listing of files with statuses. For each directory there is a <code>Hashtable</code>
13.624 - * with files.
13.625 - * @param stdoutNRListener listener of the standard output of the command
13.626 - * @param stderrNRListener listener of the error output of the command
13.627 - * @param stdoutListener listener of the standard output of the command which
13.628 - * satisfies regex <CODE>dataRegex</CODE>
13.629 - * @param dataRegex the regular expression for parsing the standard output
13.630 - * @param stderrListener listener of the error output of the command which
13.631 - * satisfies regex <CODE>errorRegex</CODE>
13.632 - * @param errorRegex the regular expression for parsing the error output
13.633 - */
13.634 - public boolean listRecursively(Hashtable vars, String[] args, VcsDirContainer filesByNameCont,
13.635 - NoRegexListener stdoutNRListener, NoRegexListener stderrNRListener,
13.636 - RegexListener stdoutListener, String dataRegex,
13.637 - RegexListener stderrListener, String errorRegex) {
13.638 -
13.639 - this.stdoutNRListener = stdoutNRListener;
13.640 - this.stderrNRListener = stderrNRListener;
13.641 - this.stderrListener = stderrListener;
13.642 - this.dataRegex = dataRegex;
13.643 - this.errorRegex = errorRegex;
13.644 - initVars(vars, args);
13.645 - /*
13.646 - this.filesByNameCont = filesByNameCont;
13.647 - this.filesByNameContPath = filesByNameCont;
13.648 - this.filesByName = new Hashtable();
13.649 - */
13.650 - runStatusCommand(vars);
13.651 - if (!shouldFail) fillHashtable(filesByNameCont);
13.652 - //addLocalFiles(dir, filesByNameCont);
13.653 - return !shouldFail;
13.654 - }
13.655 -
13.656 - /**
13.657 - * Matches the standard output of the command.
13.658 - * @param elements a line of output
13.659 - */
13.660 - public void match(String[] elements) {
13.661 - dataBuffer.append(elements[0]+"\n"); // NOI18N
13.662 - D.deb("match: append line '"+elements[0]+"'"); // NOI18N
13.663 - }
13.664 }
13.665 \ No newline at end of file