KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > j2seproject > ui > customizer > J2SEClassPathUi


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.java.j2seproject.ui.customizer;
21
22 import java.awt.Component JavaDoc;
23 import java.awt.Dialog JavaDoc;
24 import java.awt.event.ActionEvent JavaDoc;
25 import java.awt.event.ActionListener JavaDoc;
26 import java.beans.BeanInfo JavaDoc;
27 import java.io.File JavaDoc;
28 import java.text.MessageFormat JavaDoc;
29 import java.util.Arrays JavaDoc;
30 import java.util.Collection JavaDoc;
31 import java.util.Collections JavaDoc;
32 import java.util.HashMap JavaDoc;
33 import java.util.HashSet JavaDoc;
34 import java.util.Iterator JavaDoc;
35 import java.util.Map JavaDoc;
36 import java.util.Set JavaDoc;
37 import java.util.regex.Matcher JavaDoc;
38 import java.util.regex.Pattern JavaDoc;
39 import javax.swing.ButtonModel JavaDoc;
40 import javax.swing.DefaultListCellRenderer JavaDoc;
41 import javax.swing.DefaultListModel JavaDoc;
42 import javax.swing.Icon JavaDoc;
43 import javax.swing.ImageIcon JavaDoc;
44 import javax.swing.JButton JavaDoc;
45 import javax.swing.JFileChooser JavaDoc;
46 import javax.swing.JList JavaDoc;
47 import javax.swing.ListCellRenderer JavaDoc;
48 import javax.swing.ListSelectionModel JavaDoc;
49 import javax.swing.SwingUtilities JavaDoc;
50 import javax.swing.event.ListSelectionEvent JavaDoc;
51 import javax.swing.event.ListSelectionListener JavaDoc;
52 import javax.swing.filechooser.FileFilter JavaDoc;
53 import org.netbeans.api.java.project.JavaProjectConstants;
54 import org.netbeans.api.project.Project;
55 import org.netbeans.api.project.ProjectInformation;
56 import org.netbeans.api.project.ProjectUtils;
57 import org.netbeans.api.project.libraries.Library;
58 import org.netbeans.modules.java.j2seproject.classpath.ClassPathSupport;
59 import org.netbeans.modules.java.j2seproject.ui.FoldersListSettings;
60 import org.netbeans.spi.project.support.ant.AntProjectHelper;
61 import org.netbeans.spi.project.support.ant.PropertyEvaluator;
62 import org.netbeans.spi.project.support.ant.ReferenceHelper;
63 import org.openide.DialogDescriptor;
64 import org.openide.DialogDisplayer;
65 import org.openide.filesystems.FileObject;
66 import org.openide.filesystems.FileUtil;
67 import org.openide.filesystems.Repository;
68 import org.openide.loaders.DataFolder;
69 import org.openide.util.NbBundle;
70 import org.openide.util.Utilities;
71
72 /** Classes containing code speciic for handling UI of J2SE project classpath
73  *
74  * @author Petr Hrebejk
75  */

76 public class J2SEClassPathUi {
77     
78     private J2SEClassPathUi() {}
79            
80     // Innerclasses ------------------------------------------------------------
81

82     /** Renderer which can be used to render the classpath in lists
83      */

84     public static class ClassPathListCellRenderer extends DefaultListCellRenderer JavaDoc {
85         
86         private static final Pattern JavaDoc FOREIGN_PLAIN_FILE_REFERENCE = Pattern.compile("\\$\\{file\\.reference\\.([^${}]+)\\}"); // NOI18N
87
private static final Pattern JavaDoc UNKNOWN_FILE_REFERENCE = Pattern.compile("\\$\\{([^${}]+)\\}"); // NOI18N
88

89         private static String JavaDoc RESOURCE_ICON_JAR = "org/netbeans/modules/java/j2seproject/ui/resources/jar.gif"; //NOI18N
90
private static String JavaDoc RESOURCE_ICON_LIBRARY = "org/netbeans/modules/java/j2seproject/ui/resources/libraries.gif"; //NOI18N
91
private static String JavaDoc RESOURCE_ICON_ARTIFACT = "org/netbeans/modules/java/j2seproject/ui/resources/projectDependencies.gif"; //NOI18N
92
private static String JavaDoc RESOURCE_ICON_CLASSPATH = "org/netbeans/modules/java/j2seproject/ui/resources/referencedClasspath.gif"; //NOI18N
93
private static String JavaDoc RESOURCE_ICON_BROKEN_BADGE = "org/netbeans/modules/java/j2seproject/ui/resources/brokenProjectBadge.gif"; //NOI18N
94

95         
96         private static ImageIcon JavaDoc ICON_JAR = new ImageIcon JavaDoc( Utilities.loadImage( RESOURCE_ICON_JAR ) );
97         private static ImageIcon JavaDoc ICON_FOLDER = null;
98         private static ImageIcon JavaDoc ICON_LIBRARY = new ImageIcon JavaDoc( Utilities.loadImage( RESOURCE_ICON_LIBRARY ) );
99         private static ImageIcon JavaDoc ICON_ARTIFACT = new ImageIcon JavaDoc( Utilities.loadImage( RESOURCE_ICON_ARTIFACT ) );
100         private static ImageIcon JavaDoc ICON_CLASSPATH = new ImageIcon JavaDoc( Utilities.loadImage( RESOURCE_ICON_CLASSPATH ) );
101         private static ImageIcon JavaDoc ICON_BROKEN_BADGE = new ImageIcon JavaDoc( Utilities.loadImage( RESOURCE_ICON_BROKEN_BADGE ) );
102         
103         private static ImageIcon JavaDoc ICON_BROKEN_JAR;
104         private static ImageIcon JavaDoc ICON_BROKEN_LIBRARY;
105         private static ImageIcon JavaDoc ICON_BROKEN_ARTIFACT;
106                 
107         private PropertyEvaluator evaluator;
108         
109         // Contains well known paths in the J2SEProject
110
private static final Map JavaDoc WELL_KNOWN_PATHS_NAMES = new HashMap JavaDoc();
111         static {
112             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.JAVAC_CLASSPATH, NbBundle.getMessage( J2SEProjectProperties.class, "LBL_JavacClasspath_DisplayName" ) );
113             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.JAVAC_TEST_CLASSPATH, NbBundle.getMessage( J2SEProjectProperties.class,"LBL_JavacTestClasspath_DisplayName") );
114             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.RUN_CLASSPATH, NbBundle.getMessage( J2SEProjectProperties.class, "LBL_RunClasspath_DisplayName" ) );
115             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.RUN_TEST_CLASSPATH, NbBundle.getMessage( J2SEProjectProperties.class, "LBL_RunTestClasspath_DisplayName" ) );
116             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.BUILD_CLASSES_DIR, NbBundle.getMessage( J2SEProjectProperties.class, "LBL_BuildClassesDir_DisplayName" ) );
117             WELL_KNOWN_PATHS_NAMES.put( J2SEProjectProperties.BUILD_TEST_CLASSES_DIR, NbBundle.getMessage (J2SEProjectProperties.class,"LBL_BuildTestClassesDir_DisplayName") );
118         };
119                 
120         public ClassPathListCellRenderer( PropertyEvaluator evaluator ) {
121             super();
122             this.evaluator = evaluator;
123         }
124         
125         public Component JavaDoc getListCellRendererComponent( JList JavaDoc list, Object JavaDoc value, int index, boolean isSelected, boolean cellHasFocus) {
126             
127             ClassPathSupport.Item item = (ClassPathSupport.Item)value;
128             
129             super.getListCellRendererComponent( list, getDisplayName( item ), index, isSelected, cellHasFocus );
130             setIcon( getIcon( item ) );
131             setToolTipText( getToolTipText( item ) );
132             
133             return this;
134         }
135         
136         
137         private String JavaDoc getDisplayName( ClassPathSupport.Item item ) {
138             
139             switch ( item.getType() ) {
140                 
141                 case ClassPathSupport.Item.TYPE_LIBRARY:
142                     if ( item.isBroken() ) {
143                         return NbBundle.getMessage( J2SEClassPathUi.class, "LBL_MISSING_LIBRARY", getLibraryName( item ) );
144                     }
145                     else {
146                         return item.getLibrary().getDisplayName();
147                     }
148                 case ClassPathSupport.Item.TYPE_CLASSPATH:
149                     String JavaDoc name = (String JavaDoc)WELL_KNOWN_PATHS_NAMES.get( ClassPathSupport.getAntPropertyName( item.getReference() ) );
150                     return name == null ? item.getReference() : name;
151                 case ClassPathSupport.Item.TYPE_ARTIFACT:
152                     if ( item.isBroken() ) {
153                         return NbBundle.getMessage( J2SEClassPathUi.class, "LBL_MISSING_PROJECT", getProjectName( item ) );
154                     }
155                     else {
156                         Project p = item.getArtifact().getProject();
157                         ProjectInformation pi = ProjectUtils.getInformation(p);
158                         String JavaDoc projectName = pi.getDisplayName();
159                         return MessageFormat.format (NbBundle.getMessage(J2SEClassPathUi.class,"MSG_ProjectArtifactFormat"), new Object JavaDoc[] {
160                             projectName,
161                             item.getArtifactURI().toString()
162                         });
163                     }
164                 case ClassPathSupport.Item.TYPE_JAR:
165                     if ( item.isBroken() ) {
166                         return NbBundle.getMessage( J2SEClassPathUi.class, "LBL_MISSING_FILE", getFileRefName( item ) );
167                     }
168                     else {
169                         return item.getFile().getPath();
170                     }
171             }
172             
173             return item.getReference(); // XXX
174
}
175         
176         static Icon JavaDoc getIcon( ClassPathSupport.Item item ) {
177             
178             switch ( item.getType() ) {
179                 
180                 case ClassPathSupport.Item.TYPE_LIBRARY:
181                     if ( item.isBroken() ) {
182                         if ( ICON_BROKEN_LIBRARY == null ) {
183                             ICON_BROKEN_LIBRARY = new ImageIcon JavaDoc( Utilities.mergeImages( ICON_LIBRARY.getImage(), ICON_BROKEN_BADGE.getImage(), 7, 7 ) );
184                         }
185                         return ICON_BROKEN_LIBRARY;
186                     }
187                     else {
188                         return ICON_LIBRARY;
189                     }
190                 case ClassPathSupport.Item.TYPE_ARTIFACT:
191                     if ( item.isBroken() ) {
192                         if ( ICON_BROKEN_ARTIFACT == null ) {
193                             ICON_BROKEN_ARTIFACT = new ImageIcon JavaDoc( Utilities.mergeImages( ICON_ARTIFACT.getImage(), ICON_BROKEN_BADGE.getImage(), 7, 7 ) );
194                         }
195                         return ICON_BROKEN_ARTIFACT;
196                     }
197                     else {
198                         Project p = item.getArtifact().getProject();
199                         if (p != null) {
200                             ProjectInformation pi = ProjectUtils.getInformation(p);
201                             return pi.getIcon();
202                         }
203                         return ICON_ARTIFACT;
204                     }
205                 case ClassPathSupport.Item.TYPE_JAR:
206                     if ( item.isBroken() ) {
207                         if ( ICON_BROKEN_JAR == null ) {
208                             ICON_BROKEN_JAR = new ImageIcon JavaDoc( Utilities.mergeImages( ICON_JAR.getImage(), ICON_BROKEN_BADGE.getImage(), 7, 7 ) );
209                         }
210                         return ICON_BROKEN_JAR;
211                     }
212                     else {
213                         File JavaDoc file = item.getFile();
214                         return file.isDirectory() ? getFolderIcon() : ICON_JAR;
215                     }
216                 case ClassPathSupport.Item.TYPE_CLASSPATH:
217                     return ICON_CLASSPATH;
218                 
219             }
220             
221             return null; // XXX
222
}
223         
224         private String JavaDoc getToolTipText( ClassPathSupport.Item item ) {
225             if ( item.isBroken() &&
226                  ( item.getType() == ClassPathSupport.Item.TYPE_JAR ||
227                    item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT ) ) {
228                 return evaluator.evaluate( item.getReference() );
229             }
230             
231             return getDisplayName( item ); // XXX
232
}
233         
234         private static ImageIcon JavaDoc getFolderIcon() {
235         
236             if ( ICON_FOLDER == null ) {
237                 FileObject root = Repository.getDefault().getDefaultFileSystem().getRoot();
238                 DataFolder dataFolder = DataFolder.findFolder( root );
239                 ICON_FOLDER = new ImageIcon JavaDoc( dataFolder.getNodeDelegate().getIcon( BeanInfo.ICON_COLOR_16x16 ) );
240             }
241
242             return ICON_FOLDER;
243         }
244         
245         private String JavaDoc getProjectName( ClassPathSupport.Item item ) {
246             String JavaDoc ID = item.getReference();
247             // something in the form of "${reference.project-name.id}"
248
return ID.substring(12, ID.indexOf(".", 12)); // NOI18N
249
}
250
251         private String JavaDoc getLibraryName( ClassPathSupport.Item item ) {
252             String JavaDoc ID = item.getReference();
253             // something in the form of "${libs.junit.classpath}"
254
return ID.substring(7, ID.indexOf(".classpath")); // NOI18N
255
}
256
257         private String JavaDoc getFileRefName( ClassPathSupport.Item item ) {
258             String JavaDoc ID = item.getReference();
259             // something in the form of "${file.reference.smth.jar}"
260
Matcher JavaDoc m = FOREIGN_PLAIN_FILE_REFERENCE.matcher(ID);
261             if (m.matches()) {
262                 return m.group(1);
263             }
264             m = UNKNOWN_FILE_REFERENCE.matcher(ID);
265             if (m.matches()) {
266                 return m.group(1);
267             }
268             return ID;
269         }
270
271
272         
273     }
274     
275     
276     public static class EditMediator implements ActionListener JavaDoc, ListSelectionListener JavaDoc {
277                 
278         private final Project project;
279         private final JList JavaDoc list;
280         private final DefaultListModel JavaDoc listModel;
281         private final ListSelectionModel JavaDoc selectionModel;
282         private final ButtonModel JavaDoc addJar;
283         private final ButtonModel JavaDoc addLibrary;
284         private final ButtonModel JavaDoc addAntArtifact;
285         private final ButtonModel JavaDoc remove;
286         private final ButtonModel JavaDoc moveUp;
287         private final ButtonModel JavaDoc moveDown;
288                     
289         public EditMediator( Project project,
290                              JList JavaDoc list,
291                              DefaultListModel JavaDoc listModel,
292                              ButtonModel JavaDoc addJar,
293                              ButtonModel JavaDoc addLibrary,
294                              ButtonModel JavaDoc addAntArtifact,
295                              ButtonModel JavaDoc remove,
296                              ButtonModel JavaDoc moveUp,
297                              ButtonModel JavaDoc moveDown ) {
298                              
299             // Remember all buttons
300

301             this.list = list;
302             
303             if ( !( list.getModel() instanceof DefaultListModel JavaDoc ) ) {
304                 throw new IllegalArgumentException JavaDoc( "The list's model has to be of class DefaultListModel" ); // NOI18N
305
}
306             
307             this.listModel = (DefaultListModel JavaDoc)list.getModel();
308             this.selectionModel = list.getSelectionModel();
309             
310             this.addJar = addJar;
311             this.addLibrary = addLibrary;
312             this.addAntArtifact = addAntArtifact;
313             this.remove = remove;
314             this.moveUp = moveUp;
315             this.moveDown = moveDown;
316
317             this.project = project;
318         }
319
320         public static void register(Project project,
321                                     JList JavaDoc list,
322                                     DefaultListModel JavaDoc listModel,
323                                     ButtonModel JavaDoc addJar,
324                                     ButtonModel JavaDoc addLibrary,
325                                     ButtonModel JavaDoc addAntArtifact,
326                                     ButtonModel JavaDoc remove,
327                                     ButtonModel JavaDoc moveUp,
328                                     ButtonModel JavaDoc moveDown ) {
329             
330             EditMediator em = new EditMediator( project,
331                                                 list,
332                                                 listModel,
333                                                 addJar,
334                                                 addLibrary,
335                                                 addAntArtifact,
336                                                 remove,
337                                                 moveUp,
338                                                 moveDown );
339             
340             // Register the listener on all buttons
341
addJar.addActionListener( em );
342             addLibrary.addActionListener( em );
343             addAntArtifact.addActionListener( em );
344             remove.addActionListener( em );
345             moveUp.addActionListener( em );
346             moveDown.addActionListener( em );
347             // On list selection
348
em.selectionModel.addListSelectionListener( em );
349             // Set the initial state of the buttons
350
em.valueChanged( null );
351         }
352     
353         // Implementation of ActionListener ------------------------------------
354

355         /** Handles button events
356          */

357         public void actionPerformed( ActionEvent JavaDoc e ) {
358             
359             Object JavaDoc source = e.getSource();
360             
361             if ( source == addJar ) {
362                 // Let user search for the Jar file
363
JFileChooser JavaDoc chooser = new JFileChooser JavaDoc();
364                 FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
365                 chooser.setFileSelectionMode( JFileChooser.FILES_AND_DIRECTORIES );
366                 chooser.setMultiSelectionEnabled( true );
367                 chooser.setDialogTitle( NbBundle.getMessage( J2SEClassPathUi.class, "LBL_AddJar_DialogTitle" ) ); // NOI18N
368
//#61789 on old macosx (jdk 1.4.1) these two method need to be called in this order.
369
chooser.setAcceptAllFileFilterUsed( false );
370                 chooser.setFileFilter( new SimpleFileFilter(
371                     NbBundle.getMessage( J2SEClassPathUi.class, "LBL_ZipJarFolderFilter" ), // NOI18N
372
new String JavaDoc[] {"ZIP","JAR"} ) ); // NOI18N
373
File JavaDoc curDir = FoldersListSettings.getDefault().getLastUsedClassPathFolder();
374                 chooser.setCurrentDirectory (curDir);
375                 int option = chooser.showOpenDialog( SwingUtilities.getWindowAncestor( list ) ); // Sow the chooser
376

377                 if ( option == JFileChooser.APPROVE_OPTION ) {
378                     
379                     File JavaDoc files[] = chooser.getSelectedFiles();
380                     int[] newSelection = ClassPathUiSupport.addJarFiles( listModel, list.getSelectedIndices(), files );
381                     list.setSelectedIndices( newSelection );
382                     curDir = FileUtil.normalizeFile(chooser.getCurrentDirectory());
383                     FoldersListSettings.getDefault().setLastUsedClassPathFolder(curDir);
384                 }
385             }
386             else if ( source == addLibrary ) {
387                 Set JavaDoc/*<Library>*/includedLibraries = new HashSet JavaDoc ();
388                 for (int i=0; i< listModel.getSize(); i++) {
389                     ClassPathSupport.Item item = (ClassPathSupport.Item) listModel.get(i);
390                     if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY && !item.isBroken() ) {
391                         includedLibraries.add( item.getLibrary() );
392                     }
393                 }
394                 Object JavaDoc[] options = new Object JavaDoc[] {
395                     new JButton JavaDoc (NbBundle.getMessage (J2SEClassPathUi.class,"LBL_AddLibrary")),
396                     DialogDescriptor.CANCEL_OPTION
397                 };
398                 ((JButton JavaDoc)options[0]).setEnabled(false);
399                 ((JButton JavaDoc)options[0]).getAccessibleContext().setAccessibleDescription (NbBundle.getMessage (J2SEClassPathUi.class,"AD_AddLibrary"));
400                 LibrariesChooser panel = new LibrariesChooser ((JButton JavaDoc)options[0], includedLibraries);
401                 DialogDescriptor desc = new DialogDescriptor(panel,NbBundle.getMessage( J2SEClassPathUi.class, "LBL_CustomizeCompile_Classpath_AddLibrary" ),
402                     true, options, options[0], DialogDescriptor.DEFAULT_ALIGN,null,null);
403                 Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(desc);
404                 dlg.setVisible(true);
405                 if (desc.getValue() == options[0]) {
406                    int[] newSelection = ClassPathUiSupport.addLibraries( listModel, list.getSelectedIndices(), panel.getSelectedLibraries(), includedLibraries );
407                    list.setSelectedIndices( newSelection );
408                 }
409                 dlg.dispose();
410             }
411             else if ( source == addAntArtifact ) {
412                 AntArtifactChooser.ArtifactItem artifactItems[] = AntArtifactChooser.showDialog(
413                         new String JavaDoc[] { JavaProjectConstants.ARTIFACT_TYPE_JAR, JavaProjectConstants.ARTIFACT_TYPE_FOLDER},
414                         project, list.getParent() );
415                 if (artifactItems != null) {
416                     int[] newSelection = ClassPathUiSupport.addArtifacts( listModel, list.getSelectedIndices(), artifactItems);
417                     list.setSelectedIndices( newSelection );
418                 }
419             }
420             else if ( source == remove ) {
421                 int[] newSelection = ClassPathUiSupport.remove( listModel, list.getSelectedIndices() );
422                 list.setSelectedIndices( newSelection );
423             }
424             else if ( source == moveUp ) {
425                 int[] newSelection = ClassPathUiSupport.moveUp( listModel, list.getSelectedIndices() );
426                 list.setSelectedIndices( newSelection );
427             }
428             else if ( source == moveDown ) {
429                 int[] newSelection = ClassPathUiSupport.moveDown( listModel, list.getSelectedIndices() );
430                 list.setSelectedIndices( newSelection );
431             }
432         }
433         
434         
435         /** Handles changes in the selection
436          */

437         public void valueChanged( ListSelectionEvent JavaDoc e ) {
438             
439             // remove enabled only if selection is not empty
440
boolean canRemove = false;
441             // and when the selection does not contain unremovable item
442
if ( selectionModel.getMinSelectionIndex() != -1 ) {
443                 canRemove = true;
444                 int iMin = selectionModel.getMinSelectionIndex();
445                 int iMax = selectionModel.getMinSelectionIndex();
446                 for ( int i = iMin; i <= iMax; i++ ) {
447                     
448                     if ( selectionModel.isSelectedIndex( i ) ) {
449                         ClassPathSupport.Item item = (ClassPathSupport.Item)listModel.get( i );
450                         if ( item.getType() == ClassPathSupport.Item.TYPE_CLASSPATH ) {
451                             canRemove = false;
452                             break;
453                         }
454                     }
455                 }
456             }
457             
458             // addJar allways enabled
459
// addLibrary allways enabled
460
// addArtifact allways enabled
461
// editButton.setEnabled( edit );
462
remove.setEnabled( canRemove );
463             moveUp.setEnabled( ClassPathUiSupport.canMoveUp( selectionModel ) );
464             moveDown.setEnabled( ClassPathUiSupport.canMoveDown( selectionModel, listModel.getSize() ) );
465             
466         }
467     }
468     
469     private static class SimpleFileFilter extends FileFilter JavaDoc {
470
471         private String JavaDoc description;
472         private Collection JavaDoc extensions;
473
474
475         public SimpleFileFilter (String JavaDoc description, String JavaDoc[] extensions) {
476             this.description = description;
477             this.extensions = Arrays.asList(extensions);
478         }
479
480         public boolean accept(File JavaDoc f) {
481             if (f.isDirectory())
482                 return true;
483             String JavaDoc name = f.getName();
484             int index = name.lastIndexOf('.'); //NOI18N
485
if (index <= 0 || index==name.length()-1)
486                 return false;
487             String JavaDoc extension = name.substring (index+1).toUpperCase();
488             return this.extensions.contains(extension);
489         }
490
491         public String JavaDoc getDescription() {
492             return this.description;
493         }
494     }
495         
496 }
497
Popular Tags