11package com .axellience .vuegwtplugin ;
22
3+ import java .util .Arrays ;
34import org .jetbrains .annotations .NotNull ;
45import org .jetbrains .annotations .Nullable ;
56import com .intellij .openapi .application .ApplicationManager ;
910import com .intellij .openapi .fileEditor .FileDocumentManagerListener ;
1011import com .intellij .openapi .module .Module ;
1112import com .intellij .openapi .project .Project ;
13+ import com .intellij .openapi .project .ProjectManager ;
1214import com .intellij .openapi .roots .ProjectFileIndex ;
1315import com .intellij .openapi .roots .ProjectRootManager ;
1416import com .intellij .openapi .vfs .VirtualFile ;
@@ -20,8 +22,10 @@ public class VueGWTFileWatcher implements FileDocumentManagerListener {
2022 private static final Logger LOGGER = Logger .getInstance (VueGWTFileWatcher .class );
2123 private final Project project ;
2224
23- VueGWTFileWatcher (Project project ) {
24- this .project = project ;
25+ VueGWTFileWatcher () {
26+ this .project = Arrays .stream (ProjectManager .getInstance ().getOpenProjects ())
27+ .findFirst ()
28+ .orElseThrow (RuntimeException ::new );
2529 }
2630
2731 @ Override
@@ -71,7 +75,7 @@ private void compileComponent(VirtualFile javaComponent, VirtualFile htmlTemplat
7175 CompilerManager compilerManager = CompilerManager .getInstance (project );
7276 if (!compilerManager .isCompilationActive ()
7377 && !compilerManager .isExcludedFromCompilation (javaComponent )) {
74- compilerManager .compile (new VirtualFile []{javaComponent , htmlTemplate }, null );
78+ compilerManager .compile (new VirtualFile [] {javaComponent , htmlTemplate }, null );
7579 }
7680 } catch (Exception e ) {
7781 LOGGER .error (e .getMessage (), e );
0 commit comments