|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.cvsclient.commands.checkout;
import java.beans.Customizer;
import java.beans.PropertyChangeListener;
import javax.swing.JPanel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JCheckBox;
import org.netbeans.modules.cvsclient.IndependantClient;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import org.netbeans.modules.cvsclient.commands.*;
import org.netbeans.lib.cvsclient.command.KeywordSubstitutionOptions;
import org.netbeans.lib.cvsclient.command.GlobalOptions;
import org.openide.util.NbBundle;
import org.netbeans.modules.javacvs.commands.*;
import org.netbeans.modules.javacvs.events.*;
import org.netbeans.modules.javacvs.customizers.CustomizerPropChangeSupport;
import javax.accessibility.*;
/**
*
* @author mkleint
* @version
*/
public class NbCheckoutParamInput extends JPanel implements Customizer {
private IndependantClient provider;
private ModuleChooser moduleChooser = null;
private CvsCheckout checkoutCommand;
private static final String K_NONE = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.NoSubstitution"); //NOI18N
private static final String K_BINARY = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.BinarySubst"); //NOI18N
private static final String K_KEYWORD_VALUE = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.KeywordValueSubst"); //NOI18N
private static final String K_KEYWORD_VALUE_LOCKER = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.KeywordValueLockerSubst"); //NOI18N
private static final String K_KEYWORD = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.Keyword"); //NOI18N
private static final String K_VALUE = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.Value"); //NOI18N
private static final String K_OLD = NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.Old"); //NOI18N
private Object[] comboValues = new Object[] { K_NONE, K_BINARY, K_KEYWORD_VALUE,
K_KEYWORD_VALUE_LOCKER, K_KEYWORD, K_VALUE, K_OLD} ;
private KeywordSubstitutionOptions[] cvsValues = new KeywordSubstitutionOptions[] { null, KeywordSubstitutionOptions.BINARY, KeywordSubstitutionOptions.DEFAULT,
KeywordSubstitutionOptions.DEFAULT_LOCKER, KeywordSubstitutionOptions.ONLY_KEYWORDS,
KeywordSubstitutionOptions.ONLY_VALUES, KeywordSubstitutionOptions.OLD_VALUES };
private CustomizerPropChangeSupport support;
private String oldCVSRoot;
/** Creates new form CheckoutParamInput */
public NbCheckoutParamInput() {
initComponents ();
initAccessibility();
if (support == null) {
support = new CustomizerPropChangeSupport(this);
}
cbClearSticky.setMnemonic(bundle.getString("CheckoutParamInput.cbClearSticky.mnemonic").charAt(0)); //NOI18N
cbDates.setMnemonic(bundle.getString("CheckoutParamInput.cbDates.mnemonic").charAt(0)); //NOI18N
cbForceUpdate.setMnemonic(bundle.getString("CheckoutParamInput.cbForceCheckout.mnemonic").charAt(0)); //NOI18N
cbLocal.setMnemonic(bundle.getString("CheckoutParamInput.cbLocal.mnemonic").charAt(0)); //NOI18N
cbModNamesAndStatus.setMnemonic(bundle.getString("CheckoutParamInput.cbModNamesAndStatus.mnemonic").charAt(0)); //NOI18N
cbModuleNames.setMnemonic(bundle.getString("CheckoutParamInput.cbModuleNames.mnemonic").charAt(0)); //NOI18N
cbPipeToOutput.setMnemonic(bundle.getString("CheckoutParamInput.cbPipeToOutput.mnemonic").charAt(0)); //NOI18N
cbPruneEmpty.setMnemonic(bundle.getString("CheckoutParamInput.cbPruneEmpty.mnemonic").charAt(0)); //NOI18N
cbRevision.setMnemonic(bundle.getString("CheckoutParamInput.cbRevision.mnemonic").charAt(0)); //NOI18N
lblKeyword.setDisplayedMnemonic(bundle.getString("CheckoutParamInput.lblKeyword.mnemonic").charAt(0)); //NOI18N
lblKeyword.setLabelFor(cbKeyword);
lblModule.setDisplayedMnemonic(bundle.getString("CheckoutParamInput.lblModule.mnemonic").charAt(0)); //NOI18N
lblModule.setLabelFor(txModule);
btnModule.setMnemonic(bundle.getString("CheckoutParamInput.btnModule.mnemonic").charAt(0)); //NOI18N
txRevision.setEnabled(false);
txDates.setEnabled(false);
cbKeyword.setModel(new DefaultComboBoxModel(comboValues));
cbKeyword.setSelectedIndex(0);
cbForceUpdate.setEnabled(false);
java.awt.event.ActionListener actionList = new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
setData(checkoutCommand);
}
};
cbClearSticky.addActionListener(actionList);
cbDates.addActionListener(actionList);
cbForceUpdate.addActionListener(actionList);
cbLocal.addActionListener(actionList);
cbModNamesAndStatus.addActionListener(actionList);
cbModuleNames.addActionListener(actionList);
cbPipeToOutput.addActionListener(actionList);
cbPruneEmpty.addActionListener(actionList);
cbRevision.addActionListener(actionList);
cbKeyword.addActionListener(actionList);
txDates.addActionListener(actionList);
txModule.addActionListener(actionList);
txRevision.addActionListener(actionList);
java.awt.event.FocusAdapter focusList = new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
setData(checkoutCommand);
}
};
txDates.addFocusListener(focusList);
txModule.addFocusListener(focusList);
txRevision.addFocusListener(focusList);
javax.swing.event.DocumentListener docList = new javax.swing.event.DocumentListener() {
public void insertUpdate(javax.swing.event.DocumentEvent e) {
setData(checkoutCommand);
}
public void removeUpdate(javax.swing.event.DocumentEvent e) {
setData(checkoutCommand);
}
public void changedUpdate(javax.swing.event.DocumentEvent e) {
setData(checkoutCommand);
}
};
txRevision.getDocument().addDocumentListener(docList);
txModule.getDocument().addDocumentListener(docList);
txDates.getDocument().addDocumentListener(docList);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
lblModule = new javax.swing.JLabel();
txModule = new javax.swing.JTextField();
btnModule = new javax.swing.JButton();
cbLocal = new javax.swing.JCheckBox();
cbPruneEmpty = new javax.swing.JCheckBox();
cbClearSticky = new javax.swing.JCheckBox();
cbPipeToOutput = new javax.swing.JCheckBox();
cbModuleNames = new javax.swing.JCheckBox();
cbModNamesAndStatus = new javax.swing.JCheckBox();
lblKeyword = new javax.swing.JLabel();
cbKeyword = new javax.swing.JComboBox();
cbDates = new javax.swing.JCheckBox();
txDates = new javax.swing.JTextField();
cbRevision = new javax.swing.JCheckBox();
txRevision = new javax.swing.JTextField();
cbForceUpdate = new javax.swing.JCheckBox();
setLayout(new java.awt.GridBagLayout());
jPanel1.setLayout(new java.awt.GridBagLayout());
lblModule.setLabelFor(txModule);
lblModule.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.lblModule.text"));
jPanel1.add(lblModule, new java.awt.GridBagConstraints());
txModule.setMaximumSize(new java.awt.Dimension(100, 17));
txModule.setPreferredSize(new java.awt.Dimension(75, 17));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
jPanel1.add(txModule, gridBagConstraints);
btnModule.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.btnModule.text"));
btnModule.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnModuleActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
jPanel1.add(btnModule, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 11);
add(jPanel1, gridBagConstraints);
cbLocal.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbLocal.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
add(cbLocal, gridBagConstraints);
cbPruneEmpty.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbPruneEmpty.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 11);
add(cbPruneEmpty, gridBagConstraints);
cbClearSticky.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbClearStciky.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
add(cbClearSticky, gridBagConstraints);
cbPipeToOutput.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbPipeToOutput.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 11);
add(cbPipeToOutput, gridBagConstraints);
cbModuleNames.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbModuleNames.text"));
cbModuleNames.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbModuleNamesActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 0);
add(cbModuleNames, gridBagConstraints);
cbModNamesAndStatus.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbModNamesAndStatus.text"));
cbModNamesAndStatus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbModNamesAndStatusActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 11);
add(cbModNamesAndStatus, gridBagConstraints);
lblKeyword.setLabelFor(cbKeyword);
lblKeyword.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.lblKeyword.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
add(lblKeyword, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 11);
add(cbKeyword, gridBagConstraints);
cbDates.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbDates.text"));
cbDates.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbDatesActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
add(cbDates, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.ipadx = 80;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
add(txDates, gridBagConstraints);
cbRevision.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbRevision.text"));
cbRevision.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbRevisionActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 6;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 0);
add(cbRevision, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 6;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.ipadx = 80;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 12, 11, 0);
add(txRevision, gridBagConstraints);
cbForceUpdate.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/cvsclient/commands/checkout/Bundle").getString("CheckoutParamInput.cbForceCheckout.text"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 6;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 11);
add(cbForceUpdate, gridBagConstraints);
}//GEN-END:initComponents
private void btnModuleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModuleActionPerformed
// if (!checkoutCommand.getClientProvider() instanceof IndependantClient) return;
IndependantClient provider = (IndependantClient)checkoutCommand.getClientProvider();
try {
provider = (IndependantClient)provider.clone();
} catch (CloneNotSupportedException exc) {
// just leave the old provider in place..
// System.out.println("not clonable..");
}
if (provider == null || provider.isOffLine()) return;
GlobalOptions opts = checkoutCommand.getGlobalOptions();
if (oldCVSRoot != null &&
(!oldCVSRoot.equals(opts.getCVSRoot())))
{
moduleChooser = null;
//reset cached chooser if the repository root changed..
// System.out.println("resetting");
}
if (opts.getCVSRoot() != null && !opts.getCVSRoot().equals("")) {
provider.setCvsRootString(opts.getCVSRoot());
}
oldCVSRoot = opts.getCVSRoot();
// System.out.println("provider's root = " + provider.getCvsRootString());
if (moduleChooser == null) {
CvsCompleteModList myCom = new CvsCompleteModList(provider);
moduleChooser = new ModuleChooser(myCom);
moduleChooser.addChooserFinishListener(new ChooserFinishListener() {
public void chooserFinished(ChooserFinishEvent event) {
pasteChosenItems(event);
}
});
myCom.addDisplayerListener(moduleChooser);
org.netbeans.modules.cvsclient.FsCommandFactory.getFsInstance().addIndependantRuntime(myCom);
myCom.addCommandErrorListener(moduleChooser);
// moduleChooser.displayFrameWork();
// Do show the dialog before starting the command??
myCom.startCommand();
} else {
if (moduleChooser.wasFinished()) {
// System.out.println("finished...");
moduleChooser.displayFrameWork();
moduleChooser.displayOutputData();
} else if (moduleChooser.isShowingDial()) {
// System.out.println("showing..");
moduleChooser.displayFrameWork();
} else {
//kinda hack to force the rereun of the command
// System.out.println("hack??");
moduleChooser = null;
btnModuleActionPerformed(evt);
}
}
}//GEN-LAST:event_btnModuleActionPerformed
private void cbModNamesAndStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbModNamesAndStatusActionPerformed
// Add your handling code here:
disableAllExceptTop(cbModNamesAndStatus, !cbModNamesAndStatus.isSelected());
}//GEN-LAST:event_cbModNamesAndStatusActionPerformed
private void cbModuleNamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbModuleNamesActionPerformed
// Add your handling code here:
disableAllExceptTop(cbModuleNames, !cbModuleNames.isSelected());
}//GEN-LAST:event_cbModuleNamesActionPerformed
private void cbRevisionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbRevisionActionPerformed
// Add your handling code here:
enableRevision();
}//GEN-LAST:event_cbRevisionActionPerformed
private void cbDatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbDatesActionPerformed
// Add your handling code here:
enableDate();
}//GEN-LAST:event_cbDatesActionPerformed
public void setData(CvsCheckout command) {
if (command == null) return;
if (cbModNamesAndStatus.isSelected() || cbModuleNames.isSelected()) {
command.setCheckoutByDate(null);
command.setCheckoutByRevision(null);
command.setKeywordSubst(null);
command.setModules(new String[] {""}); //NOI18N
command.setPipeToOutput(false);
command.setPruneDirectories(false);
command.setRecursive(true);
command.setResetStickyOnes(false);
command.setUseHeadIfNotFound(false);
}
if (cbModuleNames.isSelected()) {
command.setShowModules(true);
support.firePropertyChange(command.getImpl());
return;
}
if (cbModNamesAndStatus.isSelected()) {
command.setShowModulesWithStatus(true);
support.firePropertyChange(command.getImpl());
return;
}
command.setShowModules(false);
command.setShowModulesWithStatus(false);
command.setModules(getModArray());
command.setRecursive(!cbLocal.isSelected());
if (cbDates.isSelected()) {
command.setCheckoutByDate(txDates.getText().trim());
} else {
command.setCheckoutByDate(null);
}
if (cbRevision.isSelected()) {
command.setCheckoutByRevision(txRevision.getText().trim());
} else {
command.setCheckoutByRevision(null);
}
command.setKeywordSubst(cvsValues[cbKeyword.getSelectedIndex()]);
command.setResetStickyOnes(cbClearSticky.isSelected());
command.setUseHeadIfNotFound(cbForceUpdate.isSelected());
command.setPipeToOutput(cbPipeToOutput.isSelected());
command.setPruneDirectories(cbPruneEmpty.isSelected());
support.firePropertyChange(command.getImpl());
}
public void getData(CvsCheckout command) {
if (command == null) return;
cbModuleNames.setSelected(command.isShowModules());
cbModNamesAndStatus.setSelected(command.isShowModulesWithStatus());
cbLocal.setSelected(!command.isRecursive());
cbPipeToOutput.setSelected(command.isPipeToOutput());
cbClearSticky.setSelected(command.isResetStickyOnes());
cbForceUpdate.setSelected(command.isUseHeadIfNotFound());
cbPruneEmpty.setSelected(command.getPruneDirectories());
String updByDate = command.getCheckoutByDate();
if (updByDate != null && (!updByDate.equals(""))) { //NOI18N
cbDates.setSelected(true);
txDates.setText(updByDate);
} else {
cbDates.setSelected(false);
txDates.setText(""); //NOI18N
}
String updByRev = command.getCheckoutByRevision();
if (updByRev != null && (!updByRev.equals(""))) { //NOI18N
cbRevision.setSelected(true);
txRevision.setText(updByRev);
} else {
cbRevision.setSelected(false);
txRevision.setText(""); //NOI18N
}
enableDate();
enableRevision();
String[] mods = command.getModules();
StringBuffer modString = new StringBuffer(""); //NOI18N
for (int i = 0; i < mods.length; i ++) {
modString.append(mods[i]);
modString.append(" "); //NOI18N
}
txModule.setText(modString.toString().trim());
disableAllExceptTop(null, true);
if (cbModNamesAndStatus.isSelected()) {
disableAllExceptTop(cbModNamesAndStatus, !cbModNamesAndStatus.isSelected());
}
if (cbModuleNames.isSelected()) {
disableAllExceptTop(cbModuleNames, !cbModuleNames.isSelected());
}
for (int index = 0; index < cvsValues.length; index++) {
if (cvsValues[index] == null) {
if (command.getKeywordSubst() == null) {
cbKeyword.setSelectedIndex(index);
break;
}
}
else {
if (cvsValues[index].equals(command.getKeywordSubst())) {
cbKeyword.setSelectedIndex(index);
break;
}
}
}
support.firePropertyChange(command.getImpl());
}
private String[] getModArray() {
String modules = txModule.getText().trim();
StringTokenizer tok = new StringTokenizer(modules, " ", false); //NOI18N
String[] modArray = new String[tok.countTokens()];
if (tok.countTokens() == 0) {
modArray = new String[] { "." }; //NOI18N
return modArray;
}
int index = 0;
while (tok.hasMoreTokens()) {
modArray[index] = tok.nextToken();
index = index + 1;
}
return modArray;
}
public String getDialogTitle() {
return NbBundle.getBundle(NbCheckoutParamInput.class).getString("CheckoutParamInput.dialogTitle"); //NOI18N
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox cbModuleNames;
private javax.swing.JCheckBox cbClearSticky;
private javax.swing.JCheckBox cbPruneEmpty;
private javax.swing.JCheckBox cbLocal;
private javax.swing.JTextField txDates;
private javax.swing.JCheckBox cbModNamesAndStatus;
private javax.swing.JTextField txModule;
private javax.swing.JLabel lblModule;
private javax.swing.JComboBox cbKeyword;
private javax.swing.JCheckBox cbRevision;
private javax.swing.JLabel lblKeyword;
private javax.swing.JButton btnModule;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField txRevision;
private javax.swing.JCheckBox cbDates;
private javax.swing.JCheckBox cbForceUpdate;
private javax.swing.JCheckBox cbPipeToOutput;
// End of variables declaration//GEN-END:variables
private static final ResourceBundle bundle = NbBundle.getBundle(NbCheckoutParamInput.class); //NOI18N
private void initAccessibility() {
AccessibleContext context = this.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput"));
context = btnModule.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.btnModule"));
context = cbLocal.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbLocal"));
context = cbPruneEmpty.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbPruneEmpty"));
context = cbClearSticky.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbClearSticky"));
context = cbPipeToOutput.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbPipeToOutput"));
context = cbModuleNames.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbModuleNames"));
context = cbModNamesAndStatus.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbModNamesAndStatus"));
context = cbDates.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbDates"));
context = txDates.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.txDates"));
context = cbRevision.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbRevision"));
context = txRevision.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.txRevision"));
context = cbForceUpdate.getAccessibleContext();
context.setAccessibleDescription(bundle.getString("ACSD_NbCheckoutParamInput.cbForceUpdate"));
}
private void disableAllExceptTop(JCheckBox onlyOne, boolean disable) {
cbLocal.setEnabled(disable);
cbDates.setEnabled(disable);
txDates.setEnabled(disable);
cbRevision.setEnabled(disable);
txRevision.setEnabled(disable);
cbForceUpdate.setEnabled(disable);
cbClearSticky.setEnabled(disable);
cbPruneEmpty.setEnabled(disable);
cbKeyword.setEnabled(disable);
cbKeyword.setEnabled(disable);
cbPipeToOutput.setEnabled(disable);
if (onlyOne != null) {
if (!cbModuleNames.equals(onlyOne)) {
cbModuleNames.setEnabled(disable);
}
if (!cbModNamesAndStatus.equals(onlyOne)) {
cbModNamesAndStatus.setEnabled(disable);
}
} else {
cbModNamesAndStatus.setEnabled(true);
cbModuleNames.setEnabled(true);
}
txModule.setEnabled(disable);
btnModule.setEnabled(disable);
if (disable) {
enableRevision();
enableDate();
}
}
private void enableDate() {
txDates.setEnabled(cbDates.isSelected());
if (cbDates.isSelected()) {
cbForceUpdate.setEnabled(true);
} else {
if (!cbRevision.isSelected()) {
cbForceUpdate.setSelected(false);
cbForceUpdate.setEnabled(false);
}
}
}
private void enableRevision() {
txRevision.setEnabled(cbRevision.isSelected());
if (cbRevision.isSelected()) {
cbForceUpdate.setEnabled(true);
} else {
if (!cbDates.isSelected()) {
cbForceUpdate.setSelected(false);
cbForceUpdate.setEnabled(false);
}
}
}
private void enableKeyWords() {
}
private void pasteChosenItems(ChooserFinishEvent evt) {
String selected = (String) evt.getChooser().getValue();
if (evt.getChooser().getReturnValue() == CommandChooser.FINISH_ERROR) {
// System.out.println("error..");
moduleChooser = null;
return;
}
if (selected != null) {
txModule.setText(selected);
setData(this.checkoutCommand);
}
}
public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
if (support == null) {
support = new CustomizerPropChangeSupport(this);
}
support.removePropertyChangeListener(propertyChangeListener);
}
public void setObject(java.lang.Object obj) {
if (obj instanceof FileSystemCommandImpl) {
FileSystemCommandImpl impl = (FileSystemCommandImpl)obj;
FileSystemCommand command = impl.getOuterClassInstance();
if (command instanceof CvsCheckout) {
checkoutCommand = (CvsCheckout)command;
getData(checkoutCommand);
}
}
if (obj instanceof java.util.List) {
java.util.List list = (java.util.List)obj;
Object item = list.get(0);
if (item instanceof FileSystemCommandImpl) {
FileSystemCommandImpl impl = (FileSystemCommandImpl)item;
if (impl != null) {
checkoutCommand = (CvsCheckout)impl.getOuterClassInstance();
getData(checkoutCommand);
// System.out.println("got dtat..");
}
} else {
if (item instanceof FileSystemCommand) {
// System.out.println("fs command...");
}
}
}
}
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
if (support == null) {
support = new CustomizerPropChangeSupport(this);
}
support.addPropertyChangeListener(propertyChangeListener);
}
protected void firePropertyChange(java.lang.String str, java.lang.Object obj, java.lang.Object obj2) {
if (support == null) {
support = new CustomizerPropChangeSupport(this);
}
support.firePropertyChange(str, obj, obj2);
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.