diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend')
-rw-r--r-- | rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend new file mode 100644 index 0000000..cbb9b51 --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend @@ -0,0 +1,67 @@ +package rba.tool.editor.ui.marker + +import org.eclipse.core.resources.IFile +import org.eclipse.core.resources.IFolder +import org.eclipse.core.resources.IMarker +import org.eclipse.core.resources.IResource +import org.eclipse.core.runtime.CoreException +import org.eclipse.core.runtime.IProgressMonitor +import org.eclipse.core.runtime.OperationCanceledException +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.xtext.ui.validation.DefaultResourceUIValidatorExtension +import org.eclipse.xtext.validation.CheckMode +import rba.tool.editor.util.RBAModelEditorNameUtil + +class RBAModelResourceUIValidatorExtension extends DefaultResourceUIValidatorExtension { + + private var path = new String + + override updateValidationMarkers(IFile file, Resource resource, CheckMode mode, + IProgressMonitor monitor) throws OperationCanceledException { + path = new String + var exist = existInBuildFolder(file.parent) + if (exist) { + if (!path.equals("")) { + path = "model" + "//" + path + } else { + path = "model" + } + val p = file.project + val d = p.getFolder(path) + val f = d.getFile(file.name) + super.updateValidationMarkers(f, resource, mode, monitor) + } + } + + def boolean existInBuildFolder(IResource res) { + if (res instanceof IFolder) { + if (res.name.equals(RBAModelEditorNameUtil.BUILD_FOLDER_NAME)) { + return true + } else { + if (!path.equals("")) { + path = res.name + "//" + path + } else { + path = res.name + } + return existInBuildFolder(res.parent) + } + } + return false + } + + override deleteValidationMarkers(IFile file, CheckMode checkMode, IProgressMonitor monitor) { + path = new String + var exist = existInBuildFolder(file.parent) + if (exist) { + if (!path.equals("")) { + path += "model" + "//" + path + } else { + path = "model" + } + val p = file.project + val d = p.getFolder(path) + val f = d.getFile(file.name) + super.deleteValidationMarkers(f, checkMode, monitor) + } + } +} |