@@ -83,22 +83,31 @@ public synchronized void updateIndex(ProgressListener progressListener) throws E
83
83
}
84
84
85
85
public synchronized void install (ContributedLibrary lib , ContributedLibrary replacedLib , ProgressListener progressListener ) throws Exception {
86
+ final MultiStepProgress progress = new MultiStepProgress (4 );
87
+
88
+ // Do install library (3 steps)
89
+ performInstall (lib , replacedLib , progressListener , progress );
90
+
91
+ // Rescan index (1 step)
92
+ rescanLibraryIndex (progress , progressListener );
93
+ }
94
+
95
+ private void performInstall (ContributedLibrary lib , ContributedLibrary replacedLib , ProgressListener progressListener , MultiStepProgress progress ) throws Exception {
86
96
if (lib .isInstalled ()) {
87
97
System .out .println (I18n .format (tr ("Library is already installed: {0} version {1}" ), lib .getName (), lib .getParsedVersion ()));
88
98
return ;
89
99
}
90
100
91
101
DownloadableContributionsDownloader downloader = new DownloadableContributionsDownloader (BaseNoGui .librariesIndexer .getStagingFolder ());
92
102
93
- final MultiStepProgress progress = new MultiStepProgress (3 );
94
-
95
103
// Step 1: Download library
96
104
try {
97
105
downloader .download (lib , progress , I18n .format (tr ("Downloading library: {0}" ), lib .getName ()), progressListener );
98
106
} catch (InterruptedException e ) {
99
107
// Download interrupted... just exit
100
108
return ;
101
109
}
110
+ progress .stepDone ();
102
111
103
112
// TODO: Extract to temporary folders and move to the final destination only
104
113
// once everything is successfully unpacked. If the operation fails remove
@@ -123,9 +132,6 @@ public synchronized void install(ContributedLibrary lib, ContributedLibrary repl
123
132
File destFolder = new File (libsFolder , lib .getName ().replaceAll (" " , "_" ));
124
133
tmpFolder .renameTo (destFolder );
125
134
progress .stepDone ();
126
-
127
- // Step 4: Rescan index
128
- rescanLibraryIndex (progress , progressListener );
129
135
}
130
136
131
137
public synchronized void remove (ContributedLibrary lib , ProgressListener progressListener ) throws IOException {
0 commit comments