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