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
diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/asm/editor/ValidatorDocumentSetupParticipant.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/asm/editor/ValidatorDocumentSetupParticipant.java
new file mode 100644 (file)
index 0000000..8b0b573
--- /dev/null
@@ -0,0 +1,29 @@
+package net.mograsim.plugin.asm.editor;
+
+import org.eclipse.core.filebuffers.IDocumentSetupParticipant;
+import org.eclipse.core.filebuffers.IDocumentSetupParticipantExtension;
+import org.eclipse.core.filebuffers.LocationKind;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+public class ValidatorDocumentSetupParticipant implements IDocumentSetupParticipant, IDocumentSetupParticipantExtension
+{
+
+       @Override
+       public void setup(IDocument document)
+       {
+       }
+
+       @Override
+       public void setup(IDocument document, IPath location, LocationKind locationKind)
+       {
+               if (locationKind == LocationKind.IFILE)
+               {
+                       IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(location);
+                       document.addDocumentListener(new AsmDocumentValidator(file));
+               }
+       }
+
+}