KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > subversion > options > SvnLabelsModel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.subversion.options;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.Collections JavaDoc;
24 import java.util.Comparator JavaDoc;
25 import java.util.HashMap JavaDoc;
26 import java.util.HashSet JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.List JavaDoc;
29 import java.util.Map JavaDoc;
30 import java.util.MissingResourceException JavaDoc;
31 import java.util.Set JavaDoc;
32 import java.util.Vector JavaDoc;
33 import javax.swing.KeyStroke JavaDoc;
34 import javax.swing.event.TableModelEvent JavaDoc;
35 import javax.swing.event.TableModelListener JavaDoc;
36 import javax.swing.table.DefaultTableModel JavaDoc;
37 import org.netbeans.editor.BaseKit;
38
39 import org.openide.util.NbBundle;
40
41
42 class SvnLabelsModel implements TableModelListener JavaDoc {
43     
44 // private List languages = new ArrayList ();
45
// /** Map (String (localized language name) > String (localised language name)). */
46
// private Map languagesMap = new HashMap ();
47
// /** Set (String (localized language name)). */
48
// private Set modifiedLanguages = new HashSet ();
49
// private Map languageToModel = new HashMap ();
50
// private Map languageToMimeType = new HashMap ();
51
// private Map modelToLanguage = new HashMap ();
52
//
53
//
54
// SvnLabelsModel () {
55
//
56
// Iterator it = AllOptionsFolder.getDefault ().getInstalledOptions ().
57
// iterator ();
58
// Vector columns = new Vector ();
59
// columns.add (loc ("Abbreviation_Title"));
60
// columns.add (loc ("Expanded_Text_Title"));
61
// while (it.hasNext ()) {
62
// Class optionsClass = (Class) it.next ();
63
// BaseOptions baseOptions = (BaseOptions) BaseOptions.findObject
64
// (optionsClass, true);
65
// String language = baseOptions.getTypeName ();
66
//
67
// // localize language name
68
// try {
69
// String localizedLanguage = NbBundle.getMessage
70
// (SvnLabelsModel.class, language);
71
// languagesMap.put (language, localizedLanguage);
72
// language = localizedLanguage;
73
// } catch (MissingResourceException ex) {
74
// languagesMap.put (language, language);
75
// }
76
// languages.add (language);
77
//
78
// Map abbreviationsMap = baseOptions.getAbbrevMap ();
79
//
80
// Iterator it2 = abbreviationsMap.keySet ().iterator ();
81
// List table = new ArrayList ();
82
// while (it2.hasNext ()) {
83
// String abbreviation = (String) it2.next ();
84
// Vector line = new Vector (2);
85
// line.add (abbreviation);
86
// line.add (abbreviationsMap.get (abbreviation));
87
// table.add (line);
88
// }
89
// Collections.sort (table, new MComparator ());
90
// DefaultTableModel tableModel = new DefaultTableModel
91
// (new Vector (table), columns) {
92
// public boolean isCellEditable (int row, int column) {
93
// return false;
94
// }
95
// };
96
// tableModel.addTableModelListener (this);
97
// modelToLanguage.put (tableModel, language);
98
// languageToModel.put (language, tableModel);
99
// BaseKit kit = BaseKit.getKit (baseOptions.getKitClass ());
100
// languageToMimeType.put (language, kit.getContentType ());
101
// }
102
// expander = BaseOptions.getCodeTemplateExpandKey ();
103
// }
104
//
105
// List getLanguages () {
106
// return languages;
107
// }
108
//
109
// String getMimeType (String language) {
110
// return (String) languageToMimeType.get (language);
111
// }
112
//
113
// DefaultTableModel getTableModel (String language) {
114
// return (DefaultTableModel) languageToModel.get (language);
115
// }
116
//
117
// void addRow (String language, String abbreviation, String text) {
118
// DefaultTableModel tableModel = getTableModel (language);
119
// Vector newLine = new Vector ();
120
// newLine.add (abbreviation);
121
// newLine.add (text);
122
// tableModel.insertRow (0, newLine);
123
// modifiedLanguages.add (language);
124
// }
125
//
126
// void removeRow (String language, int index) {
127
// DefaultTableModel tableModel = getTableModel (language);
128
// tableModel.removeRow (index);
129
// modifiedLanguages.add (language);
130
// }
131
//
132
// void saveChanges () {
133
// Iterator it = AllOptionsFolder.getDefault ().getInstalledOptions ().
134
// iterator ();
135
// while (it.hasNext ()) {
136
// Class optionsClass = (Class) it.next ();
137
// BaseOptions baseOptions = (BaseOptions) BaseOptions.findObject
138
// (optionsClass, true);
139
// String language = baseOptions.getTypeName ();
140
// language = (String) languagesMap.get (language);
141
// if (!modifiedLanguages.contains (language))
142
// continue;
143
//
144
// DefaultTableModel tableModel = getTableModel (language);
145
// Map abbreviationsMap = new HashMap ();
146
// int i, k = tableModel.getRowCount ();
147
// for (i = 0; i < k; i++) {
148
// abbreviationsMap.put (
149
// tableModel.getValueAt (i, 0),
150
// tableModel.getValueAt (i, 1)
151
// );
152
// }
153
// baseOptions.setAbbrevMap (abbreviationsMap);
154
// }
155
// if (expander != null &&
156
// !BaseOptions.getCodeTemplateExpandKey ().equals (expander)
157
// )
158
// BaseOptions.setCodeTemplateExpandKey (expander);
159
// }
160
//
161
// boolean isChanged () {
162
// return !modifiedLanguages.isEmpty () ||
163
// !BaseOptions.getCodeTemplateExpandKey ().equals (expander);
164
// }
165
//
166
// public void tableChanged (TableModelEvent e) {
167
// DefaultTableModel tableModel = (DefaultTableModel) e.getSource ();
168
// String language = (String) modelToLanguage.get (tableModel);
169
// modifiedLanguages.add (language);
170
// }
171
//
172
// private static String loc (String key) {
173
// return NbBundle.getMessage (SvnLabelsModel.class, key);
174
// }
175
//
176
// KeyStroke getExpander () {
177
// return expander;
178
// }
179
//
180
// private KeyStroke expander;
181
// void setExpander (KeyStroke expander) {
182
// this.expander = expander;
183
// }
184
//
185
// private static class MComparator implements Comparator {
186
// public int compare (Object o1, Object o2) {
187
// String s1 = (String) ((Vector) o1).get (0);
188
// String s2 = (String) ((Vector) o2).get (0);
189
// return s1.compareTo (s2);
190
// }
191
// }
192

193     public void tableChanged(TableModelEvent JavaDoc arg0) {
194         throw new UnsupportedOperationException JavaDoc("Not supported yet.");
195     }
196     
197 }
198
199
200
Popular Tags