File tree Expand file tree Collapse file tree 2 files changed +20
-15
lines changed
jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core Expand file tree Collapse file tree 2 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -296,25 +296,29 @@ public static String getModuleName(IJavaProject project) {
296
296
297
297
public static boolean checkImportStatus () {
298
298
IProject [] projects = ProjectUtils .getAllProjects ();
299
+ boolean hasError = false ;
299
300
for (IProject project : projects ) {
300
301
if (ProjectsManager .DEFAULT_PROJECT_NAME .equals (project .getName ())) {
301
302
continue ;
302
303
}
304
+
305
+ // if a Java project found, we think it as success import now.
306
+ if (ProjectUtils .isJavaProject (project )) {
307
+ return false ;
308
+ }
309
+
303
310
try {
304
- List <IMarker > markers = ResourceUtils .getErrorMarkers (project );
305
- if (markers != null ) {
306
- boolean hasError = markers .stream ().anyMatch (m -> {
307
- return m .getAttribute (IMarker .SEVERITY , 0 ) == IMarker .SEVERITY_ERROR ;
308
- });
309
- if (hasError ) {
310
- return true ;
311
- }
311
+ int maxProblemSeverity = project .findMaxProblemSeverity (null , true , IResource .DEPTH_ONE );
312
+ if (maxProblemSeverity == IMarker .SEVERITY_ERROR ) {
313
+ hasError = true ;
314
+ break ;
312
315
}
313
316
} catch (CoreException e ) {
314
317
JdtlsExtActivator .log (e );
315
318
}
316
319
}
317
- return false ;
320
+
321
+ return hasError ;
318
322
}
319
323
320
324
private static void reportExportJarMessage (String terminalId , int severity , String message ) {
Original file line number Diff line number Diff line change @@ -173,6 +173,12 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
173
173
return this . _rootItems ;
174
174
}
175
175
176
+ const hasJavaError : boolean = await Jdtls . checkImportStatus ( ) ;
177
+ if ( hasJavaError ) {
178
+ contextManager . setContextValue ( Context . IMPORT_FAILED , true ) ;
179
+ return [ ] ;
180
+ }
181
+
176
182
const rootItems : ExplorerNode [ ] = [ ] ;
177
183
const folders = workspace . workspaceFolders ;
178
184
if ( folders && folders . length ) {
@@ -192,12 +198,7 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
192
198
}
193
199
}
194
200
if ( _ . isEmpty ( rootItems ) ) {
195
- const hasJavaError : boolean = await Jdtls . checkImportStatus ( ) ;
196
- if ( hasJavaError ) {
197
- contextManager . setContextValue ( Context . IMPORT_FAILED , true ) ;
198
- } else {
199
- contextManager . setContextValue ( Context . NO_JAVA_PROJECT , true ) ;
200
- }
201
+ contextManager . setContextValue ( Context . NO_JAVA_PROJECT , true ) ;
201
202
}
202
203
return rootItems ;
203
204
} finally {
You can’t perform that action at this time.
0 commit comments