~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to javacvs/cvsmodule/src/org/netbeans/modules/versioning/system/cvss/options/CvsOptionsPanel.java

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
3
 *
 
4
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
5
 *
 
6
 * The contents of this file are subject to the terms of either the GNU
 
7
 * General Public License Version 2 only ("GPL") or the Common
 
8
 * Development and Distribution License("CDDL") (collectively, the
 
9
 * "License"). You may not use this file except in compliance with the
 
10
 * License. You can obtain a copy of the License at
 
11
 * http://www.netbeans.org/cddl-gplv2.html
 
12
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
13
 * specific language governing permissions and limitations under the
 
14
 * License.  When distributing the software, include this License Header
 
15
 * Notice in each file and include the License file at
 
16
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
17
 * particular file as subject to the "Classpath" exception as provided
 
18
 * by Sun in the GPL Version 2 section of the License file that
 
19
 * accompanied this code. If applicable, add the following below the
 
20
 * License Header, with the fields enclosed by brackets [] replaced by
 
21
 * your own identifying information:
 
22
 * "Portions Copyrighted [year] [name of copyright owner]"
 
23
 *
 
24
 * Contributor(s):
 
25
 *
 
26
 * The Original Software is NetBeans. The Initial Developer of the Original
 
27
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
 
28
 * Microsystems, Inc. All Rights Reserved.
 
29
 *
 
30
 * If you wish your version of this file to be governed by only the CDDL
 
31
 * or only the GPL Version 2, indicate your decision by adding
 
32
 * "[Contributor] elects to include this software in this distribution
 
33
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
 
34
 * single choice of license, a recipient has the option to distribute
 
35
 * your version of this file under either the CDDL, the GPL Version 2 or
 
36
 * to extend the choice of license to its licensees as provided above.
 
37
 * However, if you add GPL Version 2 code and therefore, elected the GPL
 
38
 * Version 2 license, then the option applies only if the new code is
 
39
 * made subject to such option by the copyright holder.
 
40
 */
 
41
package org.netbeans.modules.versioning.system.cvss.options;
 
42
 
 
43
import org.netbeans.modules.versioning.util.StringSelector;
 
44
import org.openide.util.NbBundle;
 
45
 
 
46
import javax.swing.*;
 
47
import java.util.*;
 
48
 
 
49
/**
 
50
 * UI panel for CVS settings.
 
51
 * 
 
52
 * @author Maros Sandor
 
53
 */
 
54
class CvsOptionsPanel extends javax.swing.JPanel {
 
55
    
 
56
    /** Creates new form CvsOptionsPanel */
 
57
    public CvsOptionsPanel() {
 
58
        initComponents();
 
59
        refreshComponents();
 
60
    }
 
61
    
 
62
    private void refreshComponents() {
 
63
        wrapCharCount.setEnabled(wrapCommitMessages.isSelected());
 
64
    }
 
65
    
 
66
    public JCheckBox getExcludeNewFiles() {
 
67
        return excludeNewFiles;
 
68
    }
 
69
 
 
70
    public JTextField getStatusLabelFormat() {
 
71
        return statusLabelFormat;
 
72
    }
 
73
 
 
74
    public JButton getStatusVarsBrowse() {
 
75
        return statusVarsBrowse;
 
76
    }
 
77
 
 
78
    public JTextField getWrapCharCount() {
 
79
        return wrapCharCount;
 
80
    }
 
81
 
 
82
    public JCheckBox getWrapCommitMessages() {
 
83
        return wrapCommitMessages;
 
84
    }
 
85
 
 
86
    /** This method is called from within the constructor to
 
87
     * initialize the form.
 
88
     * WARNING: Do NOT modify this code. The content of this method is
 
89
     * always regenerated by the Form Editor.
 
90
     */
 
91
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
 
92
    private void initComponents() {
 
93
 
 
94
        jLabel1 = new javax.swing.JLabel();
 
95
        statusLabelFormat = new javax.swing.JTextField();
 
96
        statusVarsBrowse = new javax.swing.JButton();
 
97
        excludeNewFiles = new javax.swing.JCheckBox();
 
98
        wrapCommitMessages = new javax.swing.JCheckBox();
 
99
        wrapCharCount = new javax.swing.JTextField();
 
100
 
 
101
        setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 5));
 
102
 
 
103
        jLabel1.setLabelFor(statusLabelFormat);
 
104
        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.jLabel1.text")); // NOI18N
 
105
        jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.jLabel1.toolTipText")); // NOI18N
 
106
 
 
107
        statusLabelFormat.setText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusLabelFormat.text")); // NOI18N
 
108
        statusLabelFormat.setToolTipText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusLabelFormat.toolTipText")); // NOI18N
 
109
 
 
110
        org.openide.awt.Mnemonics.setLocalizedText(statusVarsBrowse, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusVarsBrowse.text")); // NOI18N
 
111
        statusVarsBrowse.setToolTipText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.statusVarsBrowse.toolTipText")); // NOI18N
 
112
        statusVarsBrowse.addActionListener(new java.awt.event.ActionListener() {
 
113
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
114
                statusVarsBrowseActionPerformed(evt);
 
115
            }
 
116
        });
 
117
 
 
118
        org.openide.awt.Mnemonics.setLocalizedText(excludeNewFiles, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.excludeNewFiles.text")); // NOI18N
 
119
        excludeNewFiles.setToolTipText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.excludeNewFiles.toolTipText")); // NOI18N
 
120
        excludeNewFiles.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
 
121
        excludeNewFiles.setMargin(new java.awt.Insets(0, 0, 0, 0));
 
122
        excludeNewFiles.addActionListener(new java.awt.event.ActionListener() {
 
123
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
124
                excludeNewFilesActionPerformed(evt);
 
125
            }
 
126
        });
 
127
 
 
128
        org.openide.awt.Mnemonics.setLocalizedText(wrapCommitMessages, org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.wrapCommitMessages.text")); // NOI18N
 
129
        wrapCommitMessages.setToolTipText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.wrapCommitMessages.toolTipText")); // NOI18N
 
130
        wrapCommitMessages.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
 
131
        wrapCommitMessages.setMargin(new java.awt.Insets(0, 0, 0, 0));
 
132
        wrapCommitMessages.addActionListener(new java.awt.event.ActionListener() {
 
133
            public void actionPerformed(java.awt.event.ActionEvent evt) {
 
134
                wrapCommitMessagesActionPerformed(evt);
 
135
            }
 
136
        });
 
137
 
 
138
        wrapCharCount.setColumns(4);
 
139
        wrapCharCount.setText(org.openide.util.NbBundle.getMessage(CvsOptionsPanel.class, "CvsOptionsPanel.wrapCharCount.text")); // NOI18N
 
140
 
 
141
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
 
142
        this.setLayout(layout);
 
143
        layout.setHorizontalGroup(
 
144
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
145
            .add(layout.createSequentialGroup()
 
146
                .add(jLabel1)
 
147
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
 
148
                .add(statusLabelFormat, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
 
149
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
 
150
                .add(statusVarsBrowse))
 
151
            .add(layout.createSequentialGroup()
 
152
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
153
                    .add(excludeNewFiles)
 
154
                    .add(layout.createSequentialGroup()
 
155
                        .add(wrapCommitMessages)
 
156
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
 
157
                        .add(wrapCharCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 55, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
 
158
                .addContainerGap(165, Short.MAX_VALUE))
 
159
        );
 
160
        layout.setVerticalGroup(
 
161
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
 
162
            .add(layout.createSequentialGroup()
 
163
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
 
164
                    .add(jLabel1)
 
165
                    .add(statusVarsBrowse)
 
166
                    .add(statusLabelFormat, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
 
167
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
168
                .add(excludeNewFiles)
 
169
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
 
170
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
 
171
                    .add(wrapCommitMessages)
 
172
                    .add(wrapCharCount, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
 
173
                .addContainerGap(16, Short.MAX_VALUE))
 
174
        );
 
175
    }// </editor-fold>//GEN-END:initComponents
 
176
 
 
177
private void statusVarsBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_statusVarsBrowseActionPerformed
 
178
    List<String> formatVars = new ArrayList<String>();
 
179
    formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_1"));
 
180
    formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_2"));
 
181
    formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_3"));
 
182
    formatVars.add(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_4"));
 
183
    String newVariable = StringSelector.select(NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_Title"),
 
184
            NbBundle.getMessage(CvsOptionsPanel.class, "LBL_FormatVariable_Prompt"),
 
185
            formatVars);
 
186
    if (newVariable != null) {
 
187
        statusLabelFormat.replaceSelection(newVariable.substring(0, newVariable.lastIndexOf('}') + 1));
 
188
    }
 
189
}//GEN-LAST:event_statusVarsBrowseActionPerformed
 
190
 
 
191
private void excludeNewFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_excludeNewFilesActionPerformed
 
192
    // TODO add your handling code here:
 
193
}//GEN-LAST:event_excludeNewFilesActionPerformed
 
194
 
 
195
private void wrapCommitMessagesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_wrapCommitMessagesActionPerformed
 
196
    refreshComponents();
 
197
}//GEN-LAST:event_wrapCommitMessagesActionPerformed
 
198
    
 
199
    
 
200
    // Variables declaration - do not modify//GEN-BEGIN:variables
 
201
    private javax.swing.JCheckBox excludeNewFiles;
 
202
    private javax.swing.JLabel jLabel1;
 
203
    private javax.swing.JTextField statusLabelFormat;
 
204
    private javax.swing.JButton statusVarsBrowse;
 
205
    private javax.swing.JTextField wrapCharCount;
 
206
    private javax.swing.JCheckBox wrapCommitMessages;
 
207
    // End of variables declaration//GEN-END:variables
 
208
 
 
209
}