|
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-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.vcs.advanced;
import java.awt.BorderLayout;
import java.io.*;
import java.util.*;
import java.beans.*;
import java.text.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.text.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.JTextComponent;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import org.openide.ErrorManager;
import org.openide.NotifyDescriptor;
import org.openide.awt.HtmlBrowser;
import org.openide.filesystems.*;
import org.openide.loaders.DataObject;
import org.openide.loaders.XMLDataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.nodes.Node;
import org.openide.util.*;
import org.netbeans.api.vcs.VcsManager;
import org.netbeans.api.vcs.commands.Command;
import org.netbeans.api.vcs.commands.CommandTask;
import org.netbeans.spi.vcs.commands.CommandSupport;
import org.netbeans.modules.vcscore.*;
import org.netbeans.modules.vcscore.cmdline.*;
import org.netbeans.modules.vcscore.commands.*;
import org.netbeans.modules.vcscore.util.*;
import org.openide.explorer.propertysheet.PropertySheetView;
import org.netbeans.modules.vcs.advanced.commands.ConditionedCommands;
import org.netbeans.modules.vcs.advanced.commands.ConditionedCommandsBuilder;
import org.netbeans.modules.vcs.advanced.commands.UserCommandIO;
import org.netbeans.modules.vcs.advanced.variables.Condition;
import org.netbeans.modules.vcs.advanced.variables.ConditionedVariables;
import org.netbeans.modules.vcs.advanced.variables.ConditionedVariablesUpdater;
import org.netbeans.modules.vcs.advanced.variables.VariableIO;
import org.netbeans.modules.vcs.advanced.variables.VariableIOCompat;
import org.openide.explorer.ExplorerManager;
import org.openide.nodes.BeanNode;
/** Customizer
*
* @author Michal Fadljevic, Martin Entlicher
*/
public class VcsCustomizer extends javax.swing.JPanel implements Customizer,ExplorerManager.Provider {
/**
* The name of the variable, that contains pairs of variables and commands.
* When the variables listed here change their value, the corresponding command
* is executed to fill values of remaining variables. This can be used to automatically
* fill in VCS configuartion, when it can be obtained from local configuration files.
*/
public static final String VAR_AUTO_FILL = "AUTO_FILL_VARS";
/**
* The name of a variable, that contains the string representation of variable
* input descriptor, that is used to construct the panel with configuration
* input components. If this variable is defined, the "basic" property of
* variables has no effect.
*/
public static final String VAR_CONFIG_INPUT_DESCRIPTOR = "CONFIG_INPUT_DESCRIPTOR";
/**
* The name of a variable, that contains the string representation of variable
* input descriptor, that is used to construct the panel with configuration
* input components for the mount wizard.
* If this variable is not defined, {@link VAR_CONFIG_INPUT_DESCRIPTOR} is taken instead.
*/
public static final String VAR_WIZARD_INPUT_DESCRIPTOR = "WIZARD_INPUT_DESCRIPTOR";
public static final String PROP_PROFILE_SELECTION_CHANGED = "profileSelectionChanged";
public static final String PROP_IS_FINISH_ENABLED_CHANGED = "isFinishEnablesChanged";
private HashMap autoFillVars = new HashMap();
private Map fsVarsByName = null;
/** Whether we will reset FS values to the same values that are already set.
* If true, then e.g. auto-fill commands are executed even when nothing has actually changed. */
private boolean resetEqualFSVars = false;
//private HashMap cache = new HashMap ();
private String browseRoot = null;
private Hashtable envVariables = new Hashtable();
private Hashtable envVariablesRemoved = new Hashtable();
private int numCreations = 0;
private Map profileNamesForLabels;
private String noProfileSelectedLabel;
private boolean useWizardDescriptors;
private boolean rapidVariablesAssignment;
private transient ConditionedVariablesUpdater cVarsUpdater;
private transient JTextComponent fieldBeingRapidlyAssigned;
private transient Object fieldBeingRapidlyAssignedLock = new Object();
private transient VariableInputDescriptor[] configInputDescriptors;
private transient VariableInputComponent rootDirInputComponent;
/** A lock for the synchronized access to properties of the filesystem */
private transient Object fsChangeLock = new Object();
//private static transient FileLock configSaveLock = FileLock.NONE;
static final long serialVersionUID = -8801742771957370172L;
private ExplorerManager manager = null;
/** Creates new form VcsCustomizer */
public VcsCustomizer () {
initComponents ();
postInitComponents();
PropertySheetView propertiesView = new PropertySheetView();
propertiesPanel.setLayout(new BorderLayout());
propertiesPanel.add(propertiesView,BorderLayout.CENTER);
initAccessibility();
}
private void initAccessibility()
{
getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizerDialogA11yName")); // NOI18N
getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizerDialogA11yDesc")); // NOI18N
configCombo.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.configComboBoxA11yName")); // NOI18N
configCombo.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.configComboBoxA11yDesc")); // NOI18N
jLabel2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.jLabel2.textA11yDesc")); // NOI18N
rootDirTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.workingDirectoryTextField.textA11yName")); // NOI18N
browseButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.browseButton.textA11yDesc")); // NOI18N
jLabel1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_AdditionalProfilesTextA11yDesc")); // NOI18N
jLabel5.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.modesLabel.textA11yDesc")); // NOI18N
jLabel6.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.actionsLabel.textA11yDesc")); // NOI18N
promptEditLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptEditLabel.textA11yDesc")); // NOI18N
promptEditTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptTextField.textA11yName")); // NOI18N
promptLockLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptLockLabel.textA11yDesc")); // NOI18N
promptLockTextField.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.lockTextField.textA11yName")); // NOI18N
jLabel7.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.otherLabel.textA11yDesc")); // NOI18N
userEnvLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.userEnvLabel.textA11yDesc")); // NOI18N
systemEnvLabel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.varButton.textA11yDesc")); // NOI18N
jTabbedPane1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizerTabbedPaneA11yName")); // NOI18N
jTabbedPane1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizerTabbedPaneA11yDesc")); // NOI18N
}
/**
* Set, whether we will reset FS values to the same values that are already set.
* If true, then e.g. auto-fill commands are executed even when nothing has actually changed.
*/
public void setResetEqualFSVars(boolean resetEqualFSVars) {
this.resetEqualFSVars = resetEqualFSVars;
}
public void setUseWizardDescriptors(boolean useWizardDescriptors) {
this.useWizardDescriptors = useWizardDescriptors;
}
/**
* If true, assign the variable values as soon as possible,
* even before the user has finished explicitely the input (by focus lost, etc.).
* Currently this makes any difference only for textfields, which listen on key typed
* events and update the variables immediately.
*/
public void setRapidVariablesAssignment(boolean rapidVariablesAssignment) {
this.rapidVariablesAssignment = rapidVariablesAssignment;
if (rapidVariablesAssignment) {
rootDirTextField.getDocument().addDocumentListener(new RapidDocumentChangeListener(rootDirTextField));
}
}
/** 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;
jTabbedPane1 = new javax.swing.JTabbedPane();
configPanel = new javax.swing.JPanel();
vcsPanel = new javax.swing.JPanel();
configCombo = new javax.swing.JComboBox();
saveAsButton = new javax.swing.JButton();
propsPanel = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
rootDirTextField = new javax.swing.JTextField();
browseButton = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jSeparator1 = new javax.swing.JSeparator();
jLabel1 = new javax.swing.JLabel();
linkLabel = new javax.swing.JLabel();
advancedPanel = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
advancedModeCheckBox = new javax.swing.JCheckBox();
offLineCheckBox = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
editCheckBox = new javax.swing.JCheckBox();
promptEditCheckBox = new javax.swing.JCheckBox();
promptEditLabel = new javax.swing.JLabel();
promptEditTextField = new javax.swing.JTextField();
lockCheckBox = new javax.swing.JCheckBox();
promptLockCheckBox = new javax.swing.JCheckBox();
promptLockLabel = new javax.swing.JLabel();
promptLockTextField = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
debugCheckBox = new javax.swing.JCheckBox();
jPanel2 = new javax.swing.JPanel();
cmdButton = new javax.swing.JButton();
varButton = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
environmentPanel = new javax.swing.JPanel();
userEnvLabel = new javax.swing.JLabel();
envScrollPane = new javax.swing.JScrollPane();
envTable = new javax.swing.JTable();
actionPanel = new javax.swing.JPanel();
insertEnvButton = new javax.swing.JButton();
deleteEnvButton = new javax.swing.JButton();
systemEnvLabel = new javax.swing.JLabel();
systemEnvScrollPane = new javax.swing.JScrollPane();
systemEnvTable = new javax.swing.JTable();
propertiesPanel = new javax.swing.JPanel();
FormListener formListener = new FormListener();
setLayout(new java.awt.GridBagLayout());
configPanel.setLayout(new java.awt.GridBagLayout());
configPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 11, 11)));
vcsPanel.setLayout(new java.awt.GridBagLayout());
vcsPanel.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " " + java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.congifurationTitle.text") + " "));
configCombo.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.configComboBoxA11yDesc"));
configCombo.setNextFocusableComponent(saveAsButton);
configCombo.addItemListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 12, 11, 6);
vcsPanel.add(configCombo, gridBagConstraints);
saveAsButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.saveAsButton.text"));
saveAsButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.saveAsButton.textA11yDesc"));
saveAsButton.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.insets = new java.awt.Insets(4, 5, 11, 11);
vcsPanel.add(saveAsButton, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.weightx = 1.0;
configPanel.add(vcsPanel, gridBagConstraints);
propsPanel.setLayout(new java.awt.GridBagLayout());
jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.jLabel2.text"));
jLabel2.setLabelFor(rootDirTextField);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 12);
propsPanel.add(jLabel2, gridBagConstraints);
rootDirTextField.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.workingDirectoryTextField.textA11yDesc"));
rootDirTextField.setColumns(15);
rootDirTextField.setText(".");
rootDirTextField.setNextFocusableComponent(browseButton);
rootDirTextField.addActionListener(formListener);
rootDirTextField.addFocusListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 5);
propsPanel.add(rootDirTextField, gridBagConstraints);
browseButton.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.browseButton.text"));
browseButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.browseButton.textA11yDesc"));
browseButton.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
propsPanel.add(browseButton, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
configPanel.add(propsPanel, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 0);
jPanel1.add(jSeparator1, gridBagConstraints);
jLabel1.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("AdditionalProfilesText"));
jLabel1.setLabelFor(linkLabel);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
jPanel1.add(jLabel1, gridBagConstraints);
linkLabel.setText("http://vcsgeneric.netbeans.org/profiles/index.html");
linkLabel.setForeground(new java.awt.Color(102, 102, 153));
linkLabel.addMouseListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
jPanel1.add(linkLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
gridBagConstraints.weightx = 1.0;
configPanel.add(jPanel1, gridBagConstraints);
jTabbedPane1.addTab("Configuration", null, configPanel, "");
advancedPanel.setLayout(new java.awt.GridBagLayout());
advancedPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 11, 11)));
jLabel5.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.modesLabel.text"));
jLabel5.setLabelFor(advancedModeCheckBox);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
advancedPanel.add(jLabel5, gridBagConstraints);
advancedModeCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.advancedModeCheckBox.textA11yDesc"));
advancedModeCheckBox.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.advancedModeCheckBox.text"));
advancedModeCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
advancedPanel.add(advancedModeCheckBox, gridBagConstraints);
offLineCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.offLineCheckBox.textA11yDesc"));
offLineCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.offLineCheckBox.text"));
offLineCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
advancedPanel.add(offLineCheckBox, gridBagConstraints);
jLabel6.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.actionsLabel.text"));
jLabel6.setLabelFor(editCheckBox);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 11);
advancedPanel.add(jLabel6, gridBagConstraints);
editCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.editCheckBox.textA11yDesc"));
editCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.editCheckBox.text"));
editCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
advancedPanel.add(editCheckBox, gridBagConstraints);
promptEditCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptEditCheckBox.textA11yDesc"));
promptEditCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.promptEditCheckBox.text"));
promptEditCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 24, 0, 0);
advancedPanel.add(promptEditCheckBox, gridBagConstraints);
promptEditLabel.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.promptEditLabel.text"));
promptEditLabel.setLabelFor(promptEditTextField);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 48, 5, 5);
advancedPanel.add(promptEditLabel, gridBagConstraints);
promptEditTextField.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptTextField.textA11yDesc"));
promptEditTextField.addFocusListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
advancedPanel.add(promptEditTextField, gridBagConstraints);
lockCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.lockCheckBox.textA11yDesc"));
lockCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.lockCheckBox.text"));
lockCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0);
advancedPanel.add(lockCheckBox, gridBagConstraints);
promptLockCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.promptEditCheckBox.textA11yDesc"));
promptLockCheckBox.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.promptLockCheckBox.text"));
promptLockCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 6;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 0);
advancedPanel.add(promptLockCheckBox, gridBagConstraints);
promptLockLabel.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.promptLockLabel.text"));
promptLockLabel.setLabelFor(promptLockTextField);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 7;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 48, 12, 5);
advancedPanel.add(promptLockLabel, gridBagConstraints);
promptLockTextField.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.lockTextField.textA11yDesc"));
promptLockTextField.addFocusListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 7;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 7, 0);
advancedPanel.add(promptLockTextField, gridBagConstraints);
jLabel7.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("VcsCustomizer.otherLabel.text"));
jLabel7.setLabelFor(debugCheckBox);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 8;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 11);
advancedPanel.add(jLabel7, gridBagConstraints);
debugCheckBox.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.debugCheckBox.textA11yDesc"));
debugCheckBox.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.debugCheckBox.text"));
debugCheckBox.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 8;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
advancedPanel.add(debugCheckBox, gridBagConstraints);
jPanel2.setLayout(new java.awt.GridLayout(1, 0, 5, 0));
cmdButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.cmdButton.textA11yDesc"));
cmdButton.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.cmdButton.text"));
cmdButton.addActionListener(formListener);
jPanel2.add(cmdButton);
varButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_VcsCustomizer.varButton.textA11yDesc"));
varButton.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("VcsCustomizer.varButton.text"));
varButton.addActionListener(formListener);
jPanel2.add(varButton);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 12;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
advancedPanel.add(jPanel2, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 7;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
advancedPanel.add(jLabel8, gridBagConstraints);
jTabbedPane1.addTab("Advanced", null, advancedPanel, "");
environmentPanel.setLayout(new java.awt.GridBagLayout());
environmentPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 11, 11)));
userEnvLabel.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("userEnvLabel.text"));
userEnvLabel.setLabelFor(envTable);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
environmentPanel.add(userEnvLabel, gridBagConstraints);
envScrollPane.setPreferredSize(new java.awt.Dimension(10, 10));
envTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null},
{null, null},
{null, null}
},
new String [] {
"Variable Name", "Variable Value"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, true
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
envTable.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_userEnvTable.textA11yDesc"));
envTable.setPreferredScrollableViewportSize(new java.awt.Dimension(0, 0));
envScrollPane.setViewportView(envTable);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 12);
environmentPanel.add(envScrollPane, gridBagConstraints);
actionPanel.setLayout(new java.awt.GridBagLayout());
insertEnvButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_InsertEnvA11yDesc"));
insertEnvButton.setText(org.openide.util.NbBundle.getMessage(VcsCustomizer.class, "LBL_InsertEnv"));
insertEnvButton.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
actionPanel.add(insertEnvButton, gridBagConstraints);
deleteEnvButton.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_DeleteEnvA11yDesc"));
deleteEnvButton.setText(org.openide.util.NbBundle.getMessage(VcsCustomizer.class, "LBL_DeleteEnv"));
deleteEnvButton.addActionListener(formListener);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
actionPanel.add(deleteEnvButton, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 12, 0);
environmentPanel.add(actionPanel, gridBagConstraints);
systemEnvLabel.setText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("systemEnvLabel.text"));
systemEnvLabel.setLabelFor(systemEnvTable);
systemEnvLabel.setAlignmentX(0.5F);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 0);
environmentPanel.add(systemEnvLabel, gridBagConstraints);
systemEnvScrollPane.setPreferredSize(new java.awt.Dimension(32, 32));
systemEnvTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Variable Name", "Variable Value", "Use In VCS"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.Boolean.class
};
boolean[] canEdit = new boolean [] {
false, false, true
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
systemEnvTable.setToolTipText(org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("ACS_systemEnvTable.textA11yDesc"));
systemEnvTable.setPreferredScrollableViewportSize(new java.awt.Dimension(0, 0));
systemEnvScrollPane.setViewportView(systemEnvTable);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
environmentPanel.add(systemEnvScrollPane, gridBagConstraints);
jTabbedPane1.addTab("Environment", null, environmentPanel, "");
jTabbedPane1.addTab(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("DLG_TAB_Properties"), propertiesPanel);
propertiesPanel.getAccessibleContext().setAccessibleName(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("DLG_TAB_Properties"));
propertiesPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle("org/netbeans/modules/vcs/advanced/Bundle").getString("ACSD_DLG_TAB_Properties"));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
add(jTabbedPane1, gridBagConstraints);
}
// Code for dispatching events from components to event handlers.
private class FormListener implements java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.event.MouseListener {
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == saveAsButton) {
VcsCustomizer.this.saveAsButtonActionPerformed(evt);
}
else if (evt.getSource() == rootDirTextField) {
VcsCustomizer.this.rootDirTextFieldActionPerformed(evt);
}
else if (evt.getSource() == browseButton) {
VcsCustomizer.this.browseButtonActionPerformed(evt);
}
else if (evt.getSource() == advancedModeCheckBox) {
VcsCustomizer.this.advancedModeCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == offLineCheckBox) {
VcsCustomizer.this.offLineCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == editCheckBox) {
VcsCustomizer.this.editCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == promptEditCheckBox) {
VcsCustomizer.this.promptEditCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == lockCheckBox) {
VcsCustomizer.this.lockCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == promptLockCheckBox) {
VcsCustomizer.this.promptLockCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == debugCheckBox) {
VcsCustomizer.this.debugCheckBoxActionPerformed(evt);
}
else if (evt.getSource() == cmdButton) {
VcsCustomizer.this.cmdButtonActionPerformed(evt);
}
else if (evt.getSource() == varButton) {
VcsCustomizer.this.varButtonActionPerformed(evt);
}
else if (evt.getSource() == insertEnvButton) {
VcsCustomizer.this.insertEnvButtonActionPerformed(evt);
}
else if (evt.getSource() == deleteEnvButton) {
VcsCustomizer.this.deleteEnvButtonActionPerformed(evt);
}
}
public void focusGained(java.awt.event.FocusEvent evt) {
}
public void focusLost(java.awt.event.FocusEvent evt) {
if (evt.getSource() == rootDirTextField) {
VcsCustomizer.this.rootDirTextFieldFocusLost(evt);
}
else if (evt.getSource() == promptEditTextField) {
VcsCustomizer.this.promptEditTextFieldFocusLost(evt);
}
else if (evt.getSource() == promptLockTextField) {
VcsCustomizer.this.promptLockTextFieldFocusLost(evt);
}
}
public void itemStateChanged(java.awt.event.ItemEvent evt) {
if (evt.getSource() == configCombo) {
VcsCustomizer.this.configComboItemStateChanged(evt);
}
}
public void mouseClicked(java.awt.event.MouseEvent evt) {
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
}
public void mouseExited(java.awt.event.MouseEvent evt) {
}
public void mousePressed(java.awt.event.MouseEvent evt) {
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
if (evt.getSource() == linkLabel) {
VcsCustomizer.this.linkLabelMouseReleased(evt);
}
}
}//GEN-END:initComponents
private void promptEditTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_promptEditTextFieldFocusLost
// Add your handling code here:
VcsConfigVariable var = getFSVariable(Variables.MSG_PROMPT_FOR_AUTO_EDIT);
var.setValue(promptEditTextField.getText());
}//GEN-LAST:event_promptEditTextFieldFocusLost
private void promptLockTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_promptLockTextFieldFocusLost
// Add your handling code here:
VcsConfigVariable var = getFSVariable(Variables.MSG_PROMPT_FOR_AUTO_LOCK);
var.setValue(promptLockTextField.getText());
}//GEN-LAST:event_promptLockTextFieldFocusLost
private HashMap fsVars = new HashMap();
private VcsConfigVariable getFSVariable(String varName) {
VcsConfigVariable var = (VcsConfigVariable) fsVars.get(varName);
if (var == null) {
Vector vars = fileSystem.getVariables();
for (int i = vars.size() - 1; i >= 0; i--) {
VcsConfigVariable testVar = (VcsConfigVariable) vars.get(i);
if (varName.equals(testVar.getName())) {
var = testVar;
break;
}
}
if (var == null) {
var = new VcsConfigVariable(varName, "", "", false, false, false, null);
}
fsVars.put(varName, var);
vars.add(var);
fileSystem.setVariables(vars);
}
return var;
}
private void deleteEnvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteEnvButtonActionPerformed
// Add your handling code here:
int row = envTable.getSelectedRow();
if (row < 0 || row >= envTable.getRowCount()) return ; // Sometimes the row can be == row count !!! (see issue #33176)
String name = (String) envTableModel.getValueAt(row, 0);
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(NbBundle.getMessage(VcsCustomizer.class, "DLG_EnvVarDeleteConfirm", name));
if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(nd))) {
row = envTableModel.getModelRow(row);
((javax.swing.table.DefaultTableModel) envTableModel.getModel()).removeRow(row);
Vector vars = fileSystem.getVariables();
VcsConfigVariable var = (VcsConfigVariable) envVariables.remove(name);
vars.remove(var);
fileSystem.setVariables(vars);
}
}//GEN-LAST:event_deleteEnvButtonActionPerformed
private void insertEnvButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertEnvButtonActionPerformed
// Add your handling code here:
NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(NbBundle.getMessage(VcsCustomizer.class, "DLG_EnvVarName"), g ("DLG_EnvVarTitle"));
if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(nd))) {
String name = (String) nd.getInputText();
if (envVariables.containsKey(name)) {
selectEnvVar(name);
return ;
}
((javax.swing.table.DefaultTableModel) envTableModel.getModel()).addRow(new String[] { name, "" });
Vector vars = fileSystem.getVariables();
VcsConfigVariable var = new VcsConfigVariable(VcsFileSystem.VAR_ENVIRONMENT_PREFIX + name,
null, "", false, false, false, null);
vars.add(var);
fileSystem.setVariables(vars);
envVariables.put(name, var);
int row = envTableModel.getRowCount() - 1;
int srow = envTableModel.getSorterRow(row);
javax.swing.table.TableCellEditor editor = envTable.getCellEditor(row, 1);
editor.addCellEditorListener(new EnvCellEditorListener(name, row, 1));
envTable.clearSelection();
envTable.addRowSelectionInterval(srow, srow);
//envTable.getSelectionModel().setSelectionInterval(row, envTableModel.getRowCount());
}
}//GEN-LAST:event_insertEnvButtonActionPerformed
private void selectEnvVar(String name) {
for (int row = envTableModel.getRowCount() - 1; row >= 0; row--) {
if (name.equals(envTable.getValueAt(row, 0))) {
envTable.setRowSelectionInterval(row, row);
break;
}
}
}
private void linkLabelMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_linkLabelMouseReleased
// Add your handling code here:
try {
HtmlBrowser.URLDisplayer.getDefault().showURL(new java.net.URL(linkLabel.getText()));
} catch (java.net.MalformedURLException exc) {
ErrorManager.getDefault().notify(exc);
}
}//GEN-LAST:event_linkLabelMouseReleased
private void cmdButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdButtonActionPerformed
// Add your handling code here:
UserCommandsEditor commandsEditor = new UserCommandsEditor();
commandsEditor.setValue(fileSystem.getCommands());
UserCommandsPanel advancedPanel = new UserCommandsPanel(commandsEditor);
javax.swing.JButton closeButton = new javax.swing.JButton(NbBundle.getMessage(VcsCustomizer.class, "DLG_Close"));
closeButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VcsCustomizer.class, "ACSD_DLG_Close"));
DialogDescriptor dd = new DialogDescriptor(advancedPanel, org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("TIT_CommandsView"),
true, new Object[] { closeButton }, closeButton,
DialogDescriptor.DEFAULT_ALIGN, null, null);
DialogDisplayer.getDefault ().createDialog (dd).setVisible(true);
}//GEN-LAST:event_cmdButtonActionPerformed
private void varButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_varButtonActionPerformed
// Add your handling code here:
UserVariablesEditor variableEditor= new UserVariablesEditor();
variableEditor.setValue(fileSystem.getVariables());
UserVariablesPanel variablePanel = new UserVariablesPanel (variableEditor);
DialogDescriptor dd = new DialogDescriptor(variablePanel, org.openide.util.NbBundle.getBundle(VcsCustomizer.class).getString("TIT_VariablesView"));
DialogDisplayer.getDefault ().createDialog (dd).setVisible(true);
if(dd.getValue ().equals (DialogDescriptor.OK_OPTION)) {
fileSystem.setVariables ((Vector) variablePanel.getPropertyValue());
}
initAdditionalComponents (true);
}//GEN-LAST:event_varButtonActionPerformed
private void offLineCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_offLineCheckBoxActionPerformed
// Add your handling code here:
fileSystem.setOffLine(offLineCheckBox.isSelected());
}//GEN-LAST:event_offLineCheckBoxActionPerformed
private void promptLockCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_promptLockCheckBoxActionPerformed
// Add your handling code here:
fileSystem.setPromptForLockOn(promptLockCheckBox.isSelected());
promptLockLabel.setEnabled(promptLockCheckBox.isSelected());
promptLockTextField.setEnabled(promptLockCheckBox.isSelected());
}//GEN-LAST:event_promptLockCheckBoxActionPerformed
private void lockCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lockCheckBoxActionPerformed
// Add your handling code here:
promptLockCheckBox.setEnabled(lockCheckBox.isSelected());
fileSystem.setLockFilesOn(lockCheckBox.isSelected());
promptLockLabel.setEnabled(promptLockCheckBox.isEnabled() && promptLockCheckBox.isSelected());
promptLockTextField.setEnabled(promptLockCheckBox.isEnabled() && promptLockCheckBox.isSelected());
}//GEN-LAST:event_lockCheckBoxActionPerformed
private void promptEditCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_promptEditCheckBoxActionPerformed
// Add your handling code here:
fileSystem.setPromptForEditOn(promptEditCheckBox.isSelected());
promptEditLabel.setEnabled(promptEditCheckBox.isSelected());
promptEditTextField.setEnabled(promptEditCheckBox.isSelected());
}//GEN-LAST:event_promptEditCheckBoxActionPerformed
private void editCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editCheckBoxActionPerformed
// Add your handling code here:
promptEditCheckBox.setEnabled(editCheckBox.isSelected());
fileSystem.setCallEditFilesOn(editCheckBox.isSelected());
promptEditLabel.setEnabled(promptEditCheckBox.isEnabled() && promptEditCheckBox.isSelected());
promptEditTextField.setEnabled(promptEditCheckBox.isEnabled() && promptEditCheckBox.isSelected());
}//GEN-LAST:event_editCheckBoxActionPerformed
private void debugCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_debugCheckBoxActionPerformed
// Add your handling code here:
fileSystem.setDebug(debugCheckBox.isSelected());
}//GEN-LAST:event_debugCheckBoxActionPerformed
private void advancedModeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedModeCheckBoxActionPerformed
// Add your handling code here:
fileSystem.setExpertMode(advancedModeCheckBox.isSelected());
}//GEN-LAST:event_advancedModeCheckBoxActionPerformed
private void rootDirTextFieldFocusLost (java.awt.event.FocusEvent evt) {//GEN-FIRST:event_rootDirTextFieldFocusLost
// Add your handling code here:
if (rapidVariablesAssignment) {
synchronized (fieldBeingRapidlyAssignedLock) {
if (fieldBeingRapidlyAssigned == evt.getSource()) {
fieldBeingRapidlyAssigned = null;
}
}
}
rootDirChanged ();
}//GEN-LAST:event_rootDirTextFieldFocusLost
private void browseButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
// Add your handling code here:
String rootDir = browseRoot;
if (rootDir == null) rootDir = rootDirTextField.getText ();
browseRoot = null;
File rootDirFile = null;
if (rootDir == null || rootDir.trim().equals(""))
{
try
{
File defDir = new File(System.getProperty("user.home")); // NOI18N
if (Utilities.isUnix() || (Utilities.getOperatingSystem() == Utilities.OS_VMS))
rootDirFile = defDir;
else if (Utilities.isWindows())
{
do
{
defDir = defDir.getParentFile();
}
while (defDir != null && defDir.getParentFile() != null);
if (defDir != null)
rootDirFile = defDir;
}
}
catch (Exception ex)
{
rootDirFile = null;
}
}
else
rootDirFile = new File(rootDir);
if (rootDirFile == null)
rootDirFile = new File("");
java.awt.Dialog[] dialog_ptr = new java.awt.Dialog[1];
java.awt.Frame frame = VcsUtilities.getAncestor(getConfigPanel(), dialog_ptr);
ChooseDirDialog chooseDir;
if (frame != null) {
chooseDir = new ChooseDirDialog(frame, rootDirFile);
} else {
chooseDir = new ChooseDirDialog(dialog_ptr[0], rootDirFile);
}
VcsUtilities.centerWindow (chooseDir);
chooseDir.show();
String selected=chooseDir.getSelectedDir();
if( selected==null ){
return ;
}
rootDirTextField.setText(selected);
rootDirChanged();
/*
String module = getModuleValue();
String moduleDir = module.equals ("") ? selected : selected + java.io.File.separator + module; // NOI18N
File dir=new File(moduleDir);
if( !dir.isDirectory() ){
E.err("not directory "+dir);
return ;
}
try{
rootDirTextField.setText(selected);
fileSystem.setRootDirectory(dir);
}
catch (PropertyVetoException veto){
fileSystem.debug("I can not change the working directory");
//E.err(veto,"setRootDirectory() failed");
}
catch (IOException e){
E.err(e,"setRootDirectory() failed");
}
*/
}//GEN-LAST:event_browseButtonActionPerformed
private void rootDirTextFieldActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rootDirTextFieldActionPerformed
// Add your handling code here:
if (rapidVariablesAssignment) {
synchronized (fieldBeingRapidlyAssignedLock) {
if (fieldBeingRapidlyAssigned == evt.getSource()) {
fieldBeingRapidlyAssigned = null;
}
}
}
rootDirChanged ();
}//GEN-LAST:event_rootDirTextFieldActionPerformed
private void saveAsButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsButtonActionPerformed
// Add your handling code here:
final FileObject dir = fileSystem.getConfigRootFO();
ConfigSaveAsDialog chooseFile = new ConfigSaveAsDialog(new JFrame(), true, dir);
VcsUtilities.centerWindow (chooseFile);
chooseFile.show();
final String selected=chooseFile.getSelectedFile ();
if (selected == null) return;
String selectedLabel = chooseFile.getSelectedConfigLabel();
if (selectedLabel == null || selectedLabel.length() == 0) selectedLabel = selected;
final String configLabel = selectedLabel;
RequestProcessor.getDefault().post(new Runnable() {
public void run() {
FileObject file = dir.getFileObject(selected, VariableIO.CONFIG_FILE_EXT);
boolean configExists = false;
//String profileName = selected + "." + VariableIO.CONFIG_FILE_EXT;
if (file != null) {
if (NotifyDescriptor.Confirmation.NO_OPTION.equals (
DialogDisplayer.getDefault ().notify (new NotifyDescriptor.Confirmation (g("DLG_OverwriteSettings", file.getName()),
NotifyDescriptor.Confirmation.YES_NO_OPTION)))
) {
return;
}
configExists = true;
}
Vector variables = fileSystem.getVariables ();
CommandsTree commands = fileSystem.getCommands();
ProfilesFactory profilesFactory = ProfilesFactory.getDefault();
Profile profile;
try {
profile = profilesFactory.addProfile(selected, configLabel,
fileSystem.getCompatibleOSs(), fileSystem.getUncompatibleOSs(),
new ConditionedVariables(variables, Collections.EMPTY_MAP, Collections.EMPTY_MAP),
new ConditionedCommandsBuilder(commands).getConditionedCommands());
} catch (IOException ioex) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(g("MSG_CanNotCreateFile", selected+"."+VariableIO.CONFIG_FILE_EXT)));
return ;
}
//cache.addProfile(selected, configLabel, variables, commands,
// fileSystem.getCompatibleOSs(), fileSystem.getUncompatibleOSs(), true);
fileSystem.setConfig (configLabel);
fileSystem.setConfigFileName(profile.getName());
if (!configExists) {
promptForConfigComboChange = false;
updateConfigurations ();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
promptForConfigComboChange = true;
}
});
}
}
});
}//GEN-LAST:event_saveAsButtonActionPerformed
private void configComboItemStateChanged (java.awt.event.ItemEvent evt) {//GEN-FIRST:event_configComboItemStateChanged
// Add your handling code here:
switch( evt.getStateChange() ){
case ItemEvent.SELECTED:
String selectedLabel=(String)evt.getItem();
//updateVariables (selectedLabel);
/*
if(selectedLabel.equalsIgnoreCase("empty")) { // NOI18N
removeConfigButton.setEnabled (false);
saveAsButton.setNextFocusableComponent (propsPanel);
} else {
removeConfigButton.setEnabled (true);
saveAsButton.setNextFocusableComponent (removeConfigButton);
}
*/
int selectedIndex=configCombo.getSelectedIndex();
if (selectedIndex > 0 && noProfileSelectedLabel != null
&& noProfileSelectedLabel.equals(configCombo.getItemAt(0))) {
configCombo.removeItemAt(0);
selectedIndex--;
promptForConfigComboChange = false;
if (changeSupport != null) {
changeSupport.firePropertyChange(new PropertyChangeEvent(this,PROP_PROFILE_SELECTION_CHANGED, null, null));
}
}
if (oldSelectedLabel == null) {
oldSelectedLabel = selectedLabel;
return ;
}
if (oldSelectedLabel.equals(selectedLabel)) {
return ;
}
if (!doConfigComboChange) break;
boolean change;
if (promptForConfigComboChange) {
String msg=g("MSG_Do_you_really_want_to_discard_current_commands",selectedLabel); // NOI18N
NotifyDescriptor nd = new NotifyDescriptor.Confirmation (msg, NotifyDescriptor.YES_NO_OPTION );
if (DialogDisplayer.getDefault().notify( nd ).equals( NotifyDescriptor.YES_OPTION ) ) {
change = true;
} else {
change = false;
}
} else {
change = true;
}
if (change) {
// just do not display prompt for the first change if config was not edited
promptForConfigComboChange = true;
String profileName = (String) profileNamesForLabels.get(selectedLabel);
loadConfig(profileName, selectedLabel);
oldSelectedLabel = selectedLabel;
if (changeSupport != null) {
changeSupport.firePropertyChange(new PropertyChangeEvent(this,PROP_PROFILE_SELECTION_CHANGED, null, selectedLabel));
}
} else {
if (oldSelectedLabel == null) {
configCombo.setSelectedIndex(0);
} else {
configCombo.setSelectedItem(oldSelectedLabel);
}
}
break ;
case ItemEvent.DESELECTED:
break ;
}
}//GEN-LAST:event_configComboItemStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel actionPanel;
private javax.swing.JCheckBox advancedModeCheckBox;
private javax.swing.JPanel advancedPanel;
private javax.swing.JButton browseButton;
private javax.swing.JButton cmdButton;
private javax.swing.JComboBox configCombo;
private javax.swing.JPanel configPanel;
private javax.swing.JCheckBox debugCheckBox;
private javax.swing.JButton deleteEnvButton;
private javax.swing.JCheckBox editCheckBox;
private javax.swing.JScrollPane envScrollPane;
private javax.swing.JTable envTable;
private javax.swing.JPanel environmentPanel;
private javax.swing.JButton insertEnvButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JLabel linkLabel;
private javax.swing.JCheckBox lockCheckBox;
private javax.swing.JCheckBox offLineCheckBox;
private javax.swing.JCheckBox promptEditCheckBox;
private javax.swing.JLabel promptEditLabel;
private javax.swing.JTextField promptEditTextField;
private javax.swing.JCheckBox promptLockCheckBox;
private javax.swing.JLabel promptLockLabel;
private javax.swing.JTextField promptLockTextField;
private javax.swing.JPanel propertiesPanel;
private javax.swing.JPanel propsPanel;
private javax.swing.JTextField rootDirTextField;
private javax.swing.JButton saveAsButton;
private javax.swing.JLabel systemEnvLabel;
private javax.swing.JScrollPane systemEnvScrollPane;
private javax.swing.JTable systemEnvTable;
private javax.swing.JLabel userEnvLabel;
private javax.swing.JButton varButton;
private javax.swing.JPanel vcsPanel;
// End of variables declaration//GEN-END:variables
private static final double ADVANCED_DLG_WIDTH_RELATIVE = 0.9;
private static final double ADVANCED_DLG_HEIGHT_RELATIVE = 0.6;
private Vector varLabels = new Vector ();
private Vector varTextFields = new Vector ();
private Vector varButtons = new Vector();
private Vector varVariables = new Vector ();
private VariableInputDialog[] configInputPanels = null;
private Object configInputPanelsLock = new Object();
private JPanel[] additionalConfigPanels = null;
private CommandLineVcsFileSystem fileSystem = null;
private volatile PropertyChangeSupport changeSupport = null;
private Vector configLabels;
private String oldSelectedLabel = null;
private boolean promptForConfigComboChange = true;
private boolean doConfigComboChange = true;
// Entries in hashtables are maintained as a cache of properties read from disk
// and are read only. Changes are applied only to fileSystem.variables (fileSystem.commands).
//private Hashtable configVariablesByLabel;
//private Hashtable configAdvancedByLabel;
//private Hashtable configNamesByLabel;
private boolean isRootNotSetDlg = true;
private TableSorter envTableModel;
private TableSorter systemEnvTableModel;
/**
* @return true if no profile is selected
*/
public boolean isNoneProfileSelected() {
return (noProfileSelectedLabel != null &&
noProfileSelectedLabel.equals(configCombo.getItemAt(0)));
}
/**
* @deprecated It's only for a temporary use by the wizard.
*/
public JPanel getConfigPanel() {
return configPanel;
}
/**
* @deprecated It's only for a temporary use by the wizard.
*/
public JPanel[] getAdditionalConfigPanels() {
return additionalConfigPanels;
}
/**
* @deprecated It's only for a temporary use by the wizard.
*/
public int getNumConfigPanels() {
synchronized (configInputPanelsLock) {
return (configInputPanels == null) ? 1 : configInputPanels.length;
}
}
/**
* @deprecated It's only for a temporary use by the wizard.
*/
public String getConfigPanelName(int index) {
if (index == 0) {
return NbBundle.getMessage(VcsCustomizer.class, "DLG_Tab_Configuration");
} else {
synchronized (configInputPanelsLock) {
return configInputPanels[index].getInputDescriptor().getLabel();
}
}
}
/**
* Validate the configuration panel, if possible, and return the result of the validation.
* @return the validator, or
|
| ... 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.