The final restructured version for automatic build using maven tycho
[Mograsim.git] / plugins / net.mograsim.plugin.core / src / net / mograsim / plugin / asm / editor / ValidatorDocumentSetupParticipant.java
1 package net.mograsim.plugin.asm.editor;
2
3 import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
4 import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension;
5 import org.eclipse.core.filebuffers.LocationKind;
6 import org.eclipse.core.resources.IFile;
7 import org.eclipse.core.resources.ResourcesPlugin;
8 import org.eclipse.core.runtime.IPath;
9 import org.eclipse.jface.text.IDocument;
10
11 public class ValidatorDocumentSetupParticipant implements IDocumentSetupParticipant, IDocumentSetupParticipantExtension
12 {
13
14         @Override
15         public void setup(IDocument document)
16         {
17         }
18
19         @Override
20         public void setup(IDocument document, IPath location, LocationKind locationKind)
21         {
22                 if (locationKind == LocationKind.IFILE)
23                 {
24                         IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(location);
25                         document.addDocumentListener(new AsmDocumentValidator(file));
26                 }
27         }
28
29 }