KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > autoupdate > SignVerifier


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.autoupdate;
21
22 import java.io.File JavaDoc;
23 import java.io.FileInputStream JavaDoc;
24 import java.io.FileOutputStream JavaDoc;
25 import java.io.IOException JavaDoc;
26 import java.io.InputStream JavaDoc;
27 import java.io.OutputStream JavaDoc;
28 import java.security.KeyStore JavaDoc;
29 import java.security.KeyStoreException JavaDoc;
30 import java.security.MessageDigest JavaDoc;
31 import java.security.NoSuchAlgorithmException JavaDoc;
32 import java.security.cert.Certificate JavaDoc;
33 import java.security.cert.CertificateException JavaDoc;
34 import java.security.cert.X509Certificate JavaDoc;
35 import java.util.ArrayList JavaDoc;
36 import java.util.Collection JavaDoc;
37 import java.util.Enumeration JavaDoc;
38 import java.util.HashSet JavaDoc;
39 import java.util.Iterator JavaDoc;
40 import java.util.LinkedList JavaDoc;
41 import java.util.List JavaDoc;
42 import java.util.Set JavaDoc;
43 import java.util.jar.JarEntry JavaDoc;
44 import java.util.jar.JarFile JavaDoc;
45 import java.util.jar.JarInputStream JavaDoc;
46 import java.util.jar.Manifest JavaDoc;
47 import java.util.logging.Level JavaDoc;
48 import java.util.logging.Logger JavaDoc;
49 import org.netbeans.api.progress.ProgressHandle;
50 import org.netbeans.api.progress.ProgressHandleFactory;
51 import org.openide.util.NbBundle;
52
53 /** Class for verifying signs in NBM Files.
54  * @author Martin Ryzl, Petr Hrebejk
55  */

56 class SignVerifier extends Object JavaDoc {
57
58     /** The password to the Forte keystore */
59     private static final String JavaDoc KS_PSSWD = "open4all"; // NOI18N
60

61     private static final String JavaDoc ENTRY_SEPARATOR = "/"; // NOI18N
62
private static final String JavaDoc NBM_MAIN = "main"; // NOI18N
63
private static final String JavaDoc NBM_MODULES = "netbeans/modules"; // NOI18N
64
private static final String JavaDoc NBM_AUTOLOAD = NBM_MODULES + ENTRY_SEPARATOR + SafeModule.PROP_AUTOLOAD; // NOI18N
65
private static final String JavaDoc NBM_EAGER = NBM_MODULES + ENTRY_SEPARATOR + SafeModule.PROP_EAGER; // NOI18N
66
private static final String JavaDoc JAR_EXT = ".jar";
67
68     public static final int NOT_CHECKED = -1;
69     public static final int BAD_DOWNLOAD = 0;
70     public static final int CORRUPTED = 1;
71     public static final int NOT_SIGNED = 2;
72     public static final int SIGNED = 3;
73     public static final int TRUSTED = 4;
74
75     private static final String JavaDoc NEW_LINE = "\n"; // NOI18N
76
private static final String JavaDoc SPACE = " "; // NOI18N
77
private static final String JavaDoc TAB = "\t"; //NOI18N
78

79     /** The update check progress panel */
80     DownloadProgressPanel progressDialog;
81     /** Wizard validator, enables the Next button in wizard */
82     private Wizard.Validator validator;
83     /** Total size of the verify */
84     private int verifySize;
85     /** KBytes verified */
86     private int totalVerified;
87     /** Number of modules to verify */
88     private long modulesCount;
89
90     private boolean verifyCanceled = false;
91     private boolean wizardCanceled = false;
92     
93     // progress
94
ProgressHandle partialHandle;
95     ProgressHandle overallHandle;
96     long startTime;
97     
98     private static final Logger JavaDoc err = Logger.getLogger("org.netbeans.modules.autoupdate"); // NOI18N
99

100     /** Creates new VeriSign */
101     SignVerifier (DownloadProgressPanel progressDialog, Wizard.Validator validator) {
102         this.validator = validator;
103         this.progressDialog = progressDialog;
104     }
105
106
107     /** Verifies all downloaded modules */
108     void doVerify() {
109         verifyCanceled = false;
110         progressDialog.setPartialLabel (getBundle( "CTL_PreparingVerify_Label")); // NOI18N
111

112         verifySize = getTotalVerifySize();
113         err.log(Level.FINE,
114                 "Runing doVerify, check the total size " + verifySize +
115                 ", verifyCanceled? " + verifyCanceled);
116
117         if ( verifyCanceled )
118             return;
119
120         verifyAll();
121
122         err.log(Level.FINE, "Verification done.");
123         if ( verifyCanceled )
124             return;
125
126         validator.setValid( true );
127     }
128
129
130     /** Total size for verify in KBytes */
131     private int getTotalVerifySize( ) {
132         int result = 0;
133         modulesCount = 0;
134
135         Iterator JavaDoc it = Wizard.getAllModules().iterator();
136
137         while( it.hasNext() ) {
138             ModuleUpdate mu = (ModuleUpdate)it.next();
139
140             if ( mu.isSelected() && mu.isDownloadOK() &&
141                     (mu.getSecurity() == NOT_CHECKED || mu.getSecurity() == BAD_DOWNLOAD )) {
142                 File JavaDoc file = Downloader.getNBM( mu );
143                 result += file.length();
144                 modulesCount++;
145             }
146         }
147         return result;
148     }
149
150
151     void verifyAll() {
152
153         overallHandle = getOverallHandle (verifySize);
154
155         progressDialog.setPartialLabel (""); // NOI18N
156
progressDialog.setOverallLabel (""); // NOI18N
157
progressDialog.setExtraLabel (""); // NOI18N
158

159         int currentModule = 0;
160         totalVerified = 0;
161
162         Iterator JavaDoc it = Wizard.getAllModules().iterator();
163
164         while( it.hasNext() ) {
165
166             if ( verifyCanceled )
167                 return;
168
169             ModuleUpdate mu = (ModuleUpdate)it.next();
170             if ( mu.isSelected() && mu.isDownloadOK() &&
171                     (mu.getSecurity() == NOT_CHECKED || mu.getSecurity() == BAD_DOWNLOAD )) {
172
173                 if ( verifyCanceled )
174                     return;
175
176                 progressDialog.setPartialLabel (mu.getName() + " [" + (currentModule + 1) + "/" + modulesCount + "]" ); //NOI18N
177

178                 File JavaDoc file = Downloader.getNBM( mu );
179                 try {
180                     Collection JavaDoc certificates = verifyJar( file, mu );
181
182                     if ( certificates == null ) {
183                         err.log(Level.FINE,
184                                 mu.getName() + " was verified as NOT_SIGNED");
185
186                         mu.setSecurity( NOT_SIGNED );
187                         mu.setInstallApproved( false );
188                     }
189                     else {
190                         mu.setCerts( certificates );
191
192                         if ( isTrusted( certificates ) ) {
193                             err.log(Level.FINE,
194                                     mu.getName() + " was verified as TRUSTED");
195                             mu.setSecurity( TRUSTED );
196                             mu.setInstallApproved( true );
197                         }
198                         else {
199                             err.log(Level.FINE,
200                                     mu.getName() + " was verified as SIGNED");
201                             mu.setSecurity( SIGNED );
202                             mu.setInstallApproved( false );
203                         }
204                     }
205                 }
206                 catch( SecurityException JavaDoc e ) {
207                     err.log(Level.FINE,
208                             mu.getName() + " was verified as CORRUPTED");
209                     mu.setSecurity( CORRUPTED );
210                     mu.setInstallApproved( false );
211                 }
212                 catch( IOException JavaDoc e ) {
213                     err.log(Level.FINE,
214                             mu.getName() + " was verified as BAD_DOWNLOAD");
215                     mu.setSecurity( BAD_DOWNLOAD );
216                     mu.setInstallApproved( false );
217                     mu.setDownloadOK( false );
218                 }
219                 catch( NullPointerException JavaDoc npe ) {
220                     err.log(Level.FINE,
221                             mu.getName() + " was verified as BAD_DOWNLOAD");
222                     mu.setSecurity( BAD_DOWNLOAD );
223                     mu.setInstallApproved( false );
224                     mu.setDownloadOK( false );
225                 }
226
227                 currentModule++;
228                 overallHandle.progress (totalVerified);
229             }
230         }
231         
232         overallHandle.finish ();
233         String JavaDoc mssgTotal = NbBundle.getMessage( SignVerifier.class, "FMT_VerifiedTotal", // NOT_SIGNED
234
new Object JavaDoc[] { new Integer JavaDoc( verifySize / 1024 ),
235                                           new Integer JavaDoc( verifySize / 1024 ) } );
236         progressDialog.setOverallLabel (mssgTotal);
237     }
238
239
240     /**
241     * @param args the command line arguments
242     */

243     /*
244     public void check ( File file ) throws Exception {
245       Collection certificates = verifyJar( file );
246       
247       showCollection(certificates);
248       KeyStore keyStore = getKeyStore(KEYSTORE, "changeit", null);
249       showCollection(getCertificates(keyStore));
250 }
251     */

252     
253     static void processJarEntry (JarEntry JavaDoc entry, ModuleUpdate mu) {
254         // dangerous modules should be updated into install directory
255
if ( entry.getName().startsWith( "netbeans/" + ModuleUpdate.NBM_LIB + "/")) { // NOI18N
256
mu.setDepending( true );
257         }
258
259         if ( entry.getName().startsWith( NBM_MAIN ) )
260             mu.setSafeToInstall( false );
261
262         String JavaDoc jarname = null;
263         if ( entry.getName().startsWith( NBM_AUTOLOAD ) && entry.getName().endsWith( JAR_EXT ) ) {
264             jarname = getJarModuleName( entry.getName(), NBM_AUTOLOAD + ENTRY_SEPARATOR );
265             if ( jarname != null )
266                 mu.addToJarList( jarname );
267         }
268         else if ( entry.getName().startsWith( NBM_EAGER ) && entry.getName().endsWith( JAR_EXT ) ) {
269             jarname = getJarModuleName( entry.getName(), NBM_EAGER + ENTRY_SEPARATOR );
270             if ( jarname != null )
271                 mu.addToJarList( jarname );
272         }
273         else if( entry.getName().startsWith( NBM_MODULES ) && entry.getName().endsWith( JAR_EXT ) ) {
274             jarname = getJarModuleName( entry.getName(), NBM_MODULES + ENTRY_SEPARATOR );
275             if ( jarname != null )
276                 mu.addToJarList( jarname );
277         }
278     }
279
280     /** Verify jar file.
281     * @return Collection of certificates
282     */

283     private Collection JavaDoc verifyJar( File JavaDoc jarName, ModuleUpdate mu ) throws SecurityException JavaDoc, IOException JavaDoc {
284
285         JarInputStream JavaDoc jis = null;
286         boolean anySigned = false;
287         boolean anyUnsigned = false;
288         int moduleVerified = 0;
289
290         int flen = (int) jarName.length();
291
292         partialHandle = getPartialHandle (flen);
293
294         JarFile JavaDoc jf = new JarFile JavaDoc(jarName);
295         Manifest JavaDoc man = jf.getManifest();
296         
297         Enumeration JavaDoc entries = jf.entries();
298         LinkedList JavaDoc entriesList = new LinkedList JavaDoc();
299         byte[] buffer = new byte[8192];
300         
301         try {
302             while (entries.hasMoreElements()) {
303                 JarEntry JavaDoc entry = (JarEntry JavaDoc)entries.nextElement();
304                 
305                 processJarEntry (entry, mu);
306
307                 entriesList.add(entry);
308                 InputStream JavaDoc is = null;
309                 try {
310                     is = jf.getInputStream(entry);
311                     int n;
312                     while ((n = is.read(buffer, 0, buffer.length)) != -1) {
313                         // we just read. this will throw a SecurityException
314
moduleVerified ++;
315                         if ( moduleVerified % 4096 == 0 ) {
316                             partialHandle.progress (moduleVerified < flen ? moduleVerified : flen);
317                         }
318                         // if a signature/digest check fails.
319
if ( verifyCanceled )
320                                 return null;
321                     }
322                 } finally {
323                     if (is != null) is.close();
324                     totalVerified += entry.getCompressedSize();
325
326                     String JavaDoc mssgTotal = NbBundle.getMessage( SignVerifier.class, "FMT_VerifiedTotal",
327                                        new Object JavaDoc[] { new Integer JavaDoc( totalVerified / 1024 ),
328                                                       new Integer JavaDoc( verifySize / 1024 ) } );
329                     progressDialog.setOverallLabel (mssgTotal);
330                 }
331             }
332             
333             err.log(Level.FINE,
334                     "Update " + mu.getCodeNameBase() +
335                     " was verified as forced to intall global: " +
336                     mu.isForcedGlobal() + " and safeToInstall: " +
337                     mu.isSafeToInstall());
338             
339             if ( verifyCanceled )
340                 return null;
341         } finally {
342             jf.close();
343             if ( wizardCanceled )
344                 Downloader.getNBM( mu ).delete();
345         }
346
347         partialHandle.finish ();
348         
349         Set JavaDoc certificates = new HashSet JavaDoc();
350         if (man != null) {
351             Iterator JavaDoc e = entriesList.iterator();
352             while (e.hasNext()) {
353                 JarEntry JavaDoc je = (JarEntry JavaDoc) e.next();
354                 String JavaDoc name = je.getName();
355                 Certificate JavaDoc[] certs = je.getCertificates();
356                 boolean isSigned = ((certs != null) && (certs.length > 0));
357                 anySigned |= isSigned;
358                 if (certs != null) {
359                     for(int i = 0; i < certs.length; i++) {
360                         certificates.add(certs[i]);
361                         if ( verifyCanceled )
362                             return null;
363                     }
364                 }
365                 else { // The entry is not signed
366
if ( !je.isDirectory() && !name.toUpperCase().startsWith( "META-INF/" ) // NOI18N
367
&& je.getSize() != 0 ) {
368                         anyUnsigned = true;
369                     }
370                 }
371             }
372         }
373
374         if ( anySigned && anyUnsigned ) {
375             throw new SecurityException JavaDoc( getBundle( "EXC_NotSignedEntity" ) );
376         }
377
378         return anySigned ? certificates : null;
379     }
380
381     public static String JavaDoc formatCerts(Collection JavaDoc collection) {
382         StringBuffer JavaDoc sb = new StringBuffer JavaDoc( collection.size() * 300 );
383
384
385         Iterator JavaDoc it = collection.iterator();
386         while(it.hasNext()) {
387             Certificate JavaDoc cert = (Certificate JavaDoc)it.next();
388
389             if ( cert instanceof X509Certificate JavaDoc ) {
390                 try {
391                     sb.append( "\n\n" ); // NOI18N
392
sb.append( X509CertToString( (X509Certificate JavaDoc) cert ) );
393                 }
394                 catch ( Exception JavaDoc e ) {
395                     sb.append( cert.toString() );
396                 }
397             }
398             else {
399                 sb.append( cert.toString() );
400             }
401             sb.append( "\n\n" ); // NOI18N
402
}
403
404         return sb.toString();
405     }
406
407     /** Tests whether the cets are trusted
408      */

409     boolean isTrusted( Collection JavaDoc certs ) {
410
411         Collection JavaDoc trustedCerts = getTrustedCerts();
412
413         if ( trustedCerts.size() <= 0 || certs.size() <= 0 )
414             return false;
415
416         return trustedCerts.containsAll( certs );
417     }
418
419     /** Adds certificates into keystore
420     */

421
422     static void addCertificates( Collection JavaDoc certs )
423     throws CertificateException JavaDoc, KeyStoreException JavaDoc, IOException JavaDoc, NoSuchAlgorithmException JavaDoc {
424
425         KeyStore JavaDoc ks = getKeyStore( Autoupdater.Support.getKSFile (), KS_PSSWD, null);
426
427         Iterator JavaDoc it = certs.iterator();
428
429         while ( it.hasNext() ) {
430             Certificate JavaDoc c = (Certificate JavaDoc) it.next();
431             
432             // don't add certificate twice
433
if ( ks.getCertificateAlias( c ) != null )
434                 continue;
435
436             // Find free alias name
437
String JavaDoc alias = null;
438             for ( int i = 0; i < 9999; i++ ) {
439                 alias = "genAlias" + i; // NOI18N
440
if ( !ks.containsAlias( alias ) )
441                     break;
442             }
443             if ( alias == null )
444                 throw new KeyStoreException JavaDoc( getBundle( "EXC_TooManyCertificates" ) );
445
446             ks.setCertificateEntry( alias, c ) ;
447         }
448
449
450         saveKeyStore( ks, Autoupdater.Support.getKSFile (), KS_PSSWD, null);
451     }
452
453     /** Removes certificates from the keystore */
454     static void removeCertificates( Collection JavaDoc certs )
455     throws CertificateException JavaDoc, KeyStoreException JavaDoc, IOException JavaDoc, NoSuchAlgorithmException JavaDoc {
456
457         KeyStore JavaDoc ks = getKeyStore( Autoupdater.Support.getKSFile (), KS_PSSWD, null);
458
459         Iterator JavaDoc it = certs.iterator();
460
461         while ( it.hasNext() ) {
462             Certificate JavaDoc c = (Certificate JavaDoc) it.next();
463
464             String JavaDoc alias = ks.getCertificateAlias( c );
465
466             if ( alias != null )
467                 ks.deleteEntry( alias );
468
469         }
470
471         saveKeyStore( ks, Autoupdater.Support.getKSFile (), KS_PSSWD, null);
472
473     }
474
475
476     // Keystore utility methods --------------------------------------------------------
477

478
479     /** Gets all trusted certificates */
480     Collection JavaDoc getTrustedCerts() {
481
482         Collection JavaDoc trustedCerts = new ArrayList JavaDoc( 10 );
483
484         File JavaDoc ksFile = Autoupdater.Support.getKSFile ();
485
486         try {
487             if ( ksFile.canRead() ) {
488                 KeyStore JavaDoc ks = getKeyStore (ksFile, KS_PSSWD, null);
489                 trustedCerts.addAll ( getCertificates( ks ) );
490             }
491         }
492         // In case of exception let the collection empty
493
catch ( CertificateException JavaDoc e ) {
494         }
495         catch ( KeyStoreException JavaDoc e ) {
496         }
497         catch ( IOException JavaDoc e ) {
498         }
499         catch ( NoSuchAlgorithmException JavaDoc e ) {
500         }
501
502         return trustedCerts;
503     }
504
505     /** Creates keystore and loads data from file.
506     * @param filename - name of the keystore
507     * @param storetype - type of the keystore
508     * @param password
509     */

510     private static KeyStore JavaDoc getKeyStore(File JavaDoc file, String JavaDoc password, String JavaDoc storetype)
511     throws IOException JavaDoc, CertificateException JavaDoc, KeyStoreException JavaDoc, NoSuchAlgorithmException JavaDoc {
512         if (file == null) return null;
513
514         InputStream JavaDoc is = null;
515
516         try {
517             is = new FileInputStream JavaDoc( file );
518         }
519         catch ( IOException JavaDoc e ) {
520             // Do nothing leaving is null creates empty key store
521
}
522
523         KeyStore JavaDoc keyStore = null;
524
525         if ( storetype == null ) {
526             keyStore = KeyStore.getInstance( KeyStore.getDefaultType() );
527             keyStore.load( is, password.toCharArray() );
528             if ( is != null )
529                 is.close();
530         }
531
532         return keyStore;
533     }
534
535     /** Creates keystore and loads data from file.
536     * @param keyStore - keystore
537     * @param filename - name of the keystore
538     * @param storetype - type of the keystore
539     * @param password
540     */

541     public static void saveKeyStore(KeyStore JavaDoc keyStore, File JavaDoc file, String JavaDoc password, String JavaDoc storetype)
542     throws CertificateException JavaDoc, KeyStoreException JavaDoc, IOException JavaDoc, NoSuchAlgorithmException JavaDoc {
543         
544         if (file == null) return ;
545         
546         OutputStream JavaDoc os = new FileOutputStream JavaDoc( file );
547         keyStore.store(os, password.toCharArray( ) );
548         os.close();
549     }
550
551     /** Return all certificates in system ( Form central and user's directory )
552     */

553     public static Collection JavaDoc getCertificates(KeyStore JavaDoc keyStore) throws KeyStoreException JavaDoc {
554
555         List JavaDoc certificates = new ArrayList JavaDoc( 10 );
556
557         Enumeration JavaDoc en = keyStore.aliases();
558         while (en.hasMoreElements()) {
559             String JavaDoc alias = (String JavaDoc)en.nextElement();
560             Certificate JavaDoc cert = keyStore.getCertificate(alias);
561             certificates.add(cert);
562         }
563         return certificates;
564     }
565
566     void cancelVerify(boolean wizardCanceled) {
567         verifyCanceled = true;
568         this.wizardCanceled = wizardCanceled;
569     }
570
571
572     /** Prints a X509 certificate in a human readable format.
573     */

574     private static String JavaDoc X509CertToString(X509Certificate JavaDoc cert )
575     throws Exception JavaDoc
576     {
577         return getBundle("MSG_Owner") + SPACE + (cert.getSubjectDN()) + NEW_LINE +
578                getBundle("MSG_Issuer") + SPACE + (cert.getIssuerDN()) + NEW_LINE +
579                getBundle("MSG_SerNumber") + SPACE + cert.getSerialNumber().toString(16) + NEW_LINE +
580                getBundle("MSG_Valid") + SPACE + cert.getNotBefore().toString() +
581                SPACE + getBundle("MSG_Until") + SPACE + cert.getNotAfter().toString() + NEW_LINE +
582                getBundle("MSG_CertFinger") + NEW_LINE +
583                SPACE + TAB + getBundle("MSG_MD5") + SPACE + SPACE + getCertFingerPrint("MD5", cert) + NEW_LINE +
584                SPACE + TAB + getBundle("MSG_SHA1") + SPACE + getCertFingerPrint("SHA1", cert);
585     }
586
587     /** Gets the requested finger print of the certificate.
588     */

589     private static String JavaDoc getCertFingerPrint(String JavaDoc mdAlg, Certificate JavaDoc cert)
590     throws Exception JavaDoc
591     {
592         byte[] encCertInfo = cert.getEncoded();
593         MessageDigest JavaDoc md = MessageDigest.getInstance(mdAlg);
594         byte[] digest = md.digest(encCertInfo);
595         return toHexString(digest);
596     }
597
598     /**Converts a byte array to hex string
599      */

600     private static String JavaDoc toHexString(byte[] block) {
601         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
602         int len = block.length;
603         for (int i = 0; i < len; i++) {
604             byte2hex(block[i], buf);
605             if (i < len-1) {
606                 buf.append(":"); // NOI18N
607
}
608         }
609         return buf.toString();
610     }
611
612
613     /** Converts a byte to hex digit and writes to the supplied buffer
614     */

615     private static void byte2hex(byte b, StringBuffer JavaDoc buf) {
616         char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
617                             '9', 'A', 'B', 'C', 'D', 'E', 'F' };
618         int high = ((b & 0xf0) >> 4);
619         int low = (b & 0x0f);
620         buf.append(hexChars[high]);
621         buf.append(hexChars[low]);
622     }
623     
624     private static String JavaDoc getJarModuleName( String JavaDoc name, String JavaDoc prefix ) {
625         if ( name.substring( prefix.length() ).indexOf( ENTRY_SEPARATOR ) == -1 ) {
626             String JavaDoc common = NBM_MODULES + ENTRY_SEPARATOR;
627             return name.substring( common.length() );
628         }
629         return null;
630     }
631
632     private static String JavaDoc getBundle( String JavaDoc key ) {
633         return NbBundle.getMessage( SignVerifier.class, key );
634     }
635
636     private ProgressHandle getPartialHandle (int units) {
637         assert progressDialog != null;
638         ProgressHandle handle = ProgressHandleFactory.createHandle (getBundle ("DownloadProgressPanel_partialHandle_name")); // NOI18N
639
progressDialog.setPartialProgressComponent (handle);
640         handle.start (units);
641         return handle;
642     }
643     
644     private ProgressHandle getOverallHandle (int units) {
645         assert progressDialog != null;
646         final ProgressHandle handle = ProgressHandleFactory.createHandle (getBundle ("DownloadProgressPanel_overallHandle_name")); // NOI18N
647
progressDialog.setOverallProgressComponent (handle);
648         handle.start (units);
649         return handle;
650     }
651
652 }
653
Popular Tags