Skip to content

Commit 3643cee

Browse files
Gijsadrienbaron
authored andcommitted
Adjust file watcher setup
1 parent 1e5e4af commit 3643cee

File tree

3 files changed

+9
-61
lines changed

3 files changed

+9
-61
lines changed

src/main/java/com/axellience/vuegwtplugin/VueGWTApplicationComponent.java

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/main/java/com/axellience/vuegwtplugin/VueGWTFileWatcher.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.axellience.vuegwtplugin;
22

3+
import java.util.Arrays;
34
import org.jetbrains.annotations.NotNull;
45
import org.jetbrains.annotations.Nullable;
56
import com.intellij.openapi.application.ApplicationManager;
@@ -9,6 +10,7 @@
910
import com.intellij.openapi.fileEditor.FileDocumentManagerListener;
1011
import com.intellij.openapi.module.Module;
1112
import com.intellij.openapi.project.Project;
13+
import com.intellij.openapi.project.ProjectManager;
1214
import com.intellij.openapi.roots.ProjectFileIndex;
1315
import com.intellij.openapi.roots.ProjectRootManager;
1416
import 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);

src/main/resources/META-INF/plugin.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@
106106
language="any"
107107
id="VueGWTCompletionContributor"
108108
implementationClass="com.axellience.vuegwtplugin.codeinsight.attributes.VueGWTCompletionContributor"/>
109-
</extensions>
110109

111-
<project-components>
112-
<component>
113-
<implementation-class>com.axellience.vuegwtplugin.VueGWTApplicationComponent
114-
</implementation-class>
115-
</component>
116-
</project-components>
110+
<fileDocumentManagerListener implementation="com.axellience.vuegwtplugin.VueGWTFileWatcher" />
111+
</extensions>
117112
</idea-plugin>

0 commit comments

Comments
 (0)