|
|
Re: Validation on Generated files [message #1753519 is a reply to message #1753518] |
Tue, 07 February 2017 12:02 |
|
package org.xtext.example.mydsl.ui;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class DummyBuilder extends IncrementalProjectBuilder {
@Override
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
IResourceDelta delta = getDelta(getProject());
if (delta != null) {
delta.accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.CHANGED) {
if (delta.getResource() instanceof IFile) {
System.out.println(delta);
// TODO file extensiion check
if (delta.getResource().getFullPath().toString().contains("/src-gen")) {
delta.getResource().touch(null);
}
}
}
return true;
}
});
}
return null;
}
}
mydsl.ui/plugin.xml
<extension
id="DummyBuilder" name="DummyBuilder"
point="org.eclipse.core.resources.builders">
in .project of model project
<builder >
<run
class="org.xtext.example.mydsl.ui.DummyBuilder">
</run>
</builder>
</extension>
<buildCommand>
<name>org.xtext.example.mydsl.ui.DummyBuilder</name>
<arguments>
</arguments>
</buildCommand>
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
Powered by
FUDForum. Page generated in 0.03470 seconds