Skip to content

Commit 70b5105

Browse files
committed
Remove copy from source to target for HTML templates
If the Maven project is configured correctly this step is not necessary. This also simplify greatly the plugin code.
1 parent bdbec8e commit 70b5105

File tree

9 files changed

+41
-245
lines changed

9 files changed

+41
-245
lines changed

build.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ output.. = bin/
33
bin.includes = plugin.xml,\
44
META-INF/,\
55
.,
6-
jars.compile.order = .,\
7-
lib/
8-
src.includes = lib/
6+
jars.compile.order = .

src/com/axellience/vuegwt/eclipse/projectmanager/VueProjectInfo.java

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

src/com/axellience/vuegwt/eclipse/projectmanager/VueProjectsManager.java

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.axellience.vuegwt.eclipse.templatewatcher;
2+
3+
import java.io.File;
4+
import java.util.HashSet;
5+
import java.util.Set;
6+
7+
import org.eclipse.core.resources.IFile;
8+
import org.eclipse.core.resources.WorkspaceJob;
9+
import org.eclipse.core.runtime.CoreException;
10+
import org.eclipse.core.runtime.IProgressMonitor;
11+
import org.eclipse.core.runtime.IStatus;
12+
import org.eclipse.core.runtime.Status;
13+
14+
public class RefreshVueTemplateJob extends WorkspaceJob {
15+
private final Set<IFile> templatesToRefresh;
16+
17+
public RefreshVueTemplateJob(Set<IFile> templatesToRefresh) {
18+
super("Vue GWT Refresh");
19+
this.templatesToRefresh = new HashSet<>(templatesToRefresh);
20+
}
21+
22+
@Override
23+
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
24+
this.templatesToRefresh.stream().forEach(this::touchFile);
25+
return Status.OK_STATUS;
26+
}
27+
28+
public void touchFile(IFile javaFile) {
29+
new File(javaFile.getFullPath().toString()).setLastModified(System.currentTimeMillis());
30+
try {
31+
javaFile.touch(null);
32+
} catch (CoreException e) {
33+
}
34+
}
35+
}

src/com/axellience/vuegwt/eclipse/templatewatcher/VueTemplateInfo.java

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

src/com/axellience/vuegwt/eclipse/templatewatcher/VueTemplateWatcher.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,21 @@
1212
import org.eclipse.core.runtime.CoreException;
1313
import org.eclipse.core.runtime.Path;
1414

15-
import com.axellience.vuegwt.eclipse.projectmanager.VueProjectsManager;
16-
import com.axellience.vuegwt.eclipse.templatewatcher.refreshvuetemplate.RefreshVueTemplateJob;
17-
1815
public class VueTemplateWatcher implements IResourceChangeListener, IResourceDeltaVisitor {
19-
private final VueProjectsManager vueProjectManager;
20-
private final Set<VueTemplateInfo> templatesToRefresh;
16+
private final Set<IFile> javaFilesToRefresh;
2117

2218
public VueTemplateWatcher() {
23-
vueProjectManager = new VueProjectsManager();
24-
templatesToRefresh = new HashSet<>();
19+
javaFilesToRefresh = new HashSet<>();
2520
}
2621

2722
public void resourceChanged(IResourceChangeEvent event) {
2823
if (event.getType() != IResourceChangeEvent.POST_CHANGE)
2924
return;
3025

3126
try {
32-
templatesToRefresh.clear();
27+
javaFilesToRefresh.clear();
3328
event.getDelta().accept(this);
34-
new RefreshVueTemplateJob(templatesToRefresh).schedule();
29+
new RefreshVueTemplateJob(javaFilesToRefresh).schedule();
3530
} catch (CoreException e) {
3631
e.printStackTrace();
3732
}
@@ -49,14 +44,7 @@ public boolean visit(IResourceDelta delta) {
4944
if (!componentJavaFile.exists())
5045
return true;
5146

52-
vueProjectManager.getInfoForProject(htmlFile.getProject()).ifPresent(vueProjectInfo -> {
53-
vueProjectInfo.getResourceSourcePath(htmlFile)
54-
.flatMap(sourcePath ->
55-
vueProjectInfo.getOutputPath()
56-
.map(outputPath -> new VueTemplateInfo(htmlFile, componentJavaFile, sourcePath, outputPath))
57-
)
58-
.ifPresent(templatesToRefresh::add);
59-
});
47+
javaFilesToRefresh.add(componentJavaFile);
6048
return true;
6149
}
6250

src/com/axellience/vuegwt/eclipse/templatewatcher/refreshvuetemplate/OperationCallback.java

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

src/com/axellience/vuegwt/eclipse/templatewatcher/refreshvuetemplate/RefreshVueTemplateJob.java

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

src/com/axellience/vuegwt/eclipse/templatewatcher/refreshvuetemplate/TouchFileUtil.java

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

0 commit comments

Comments
 (0)