summaryrefslogtreecommitdiffstats
path: root/rba.tool.editor.ui/src/rba/tool/editor/ui/marker
diff options
context:
space:
mode:
Diffstat (limited to 'rba.tool.editor.ui/src/rba/tool/editor/ui/marker')
-rw-r--r--rba.tool.editor.ui/src/rba/tool/editor/ui/marker/PositionInfo.xtend76
-rw-r--r--rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelMarkerCreator.xtend34
-rw-r--r--rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelResourceUIValidatorExtension.xtend67
3 files changed, 177 insertions, 0 deletions
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/PositionInfo.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/PositionInfo.xtend
new file mode 100644
index 0000000..a43191a
--- /dev/null
+++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/PositionInfo.xtend
@@ -0,0 +1,76 @@
+package rba.tool.editor.ui.marker
+
+class PositionInfo {
+ private int beforeStartLine
+ private int beforeOffset
+ private int beforeCharCount
+ private int beforeEndLine
+ private int afterStartLine
+ private int afterOffset
+ private int afterCharCount
+ private int afterExpendedLine
+
+ def void setBeforeStartLine(int start) {
+ this.beforeStartLine = start
+ }
+
+ def void setBeforeOffset(int offset) {
+ this.beforeOffset = offset
+ }
+
+ def void setBeforeCharCount(int charCount) {
+ this.beforeCharCount = charCount
+ }
+
+ def void setBeforeEndLine(int end) {
+ this.beforeEndLine = end
+ }
+
+ def void setAfterStartLine(int start) {
+ this.afterStartLine = start
+ }
+
+ def void setAfterOffset(int offset) {
+ this.afterOffset = offset
+ }
+
+ def void setAfterCharCount(int charCount) {
+ this.afterCharCount = charCount
+ }
+
+ def void setAfterExpendedLine(int expendLine) {
+ this.afterExpendedLine = expendLine
+ }
+
+ def int getBeforeStartLine() {
+ return this.beforeStartLine
+ }
+
+ def int getBeforeOffset() {
+ return this.beforeOffset
+ }
+
+ def int getBeforeCharCount() {
+ return this.beforeCharCount
+ }
+
+ def int getBeforeEndLine() {
+ return this.beforeEndLine
+ }
+
+ def int getAfterStartLine() {
+ return this.afterStartLine
+ }
+
+ def int getAfterOffset() {
+ return this.afterOffset
+ }
+
+ def int getAfterCharCount() {
+ return this.afterCharCount
+ }
+
+ def int getAfterExpendedLine() {
+ return this.afterExpendedLine
+ }
+}
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelMarkerCreator.xtend b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelMarkerCreator.xtend
new file mode 100644
index 0000000..c982375
--- /dev/null
+++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/marker/RBAModelMarkerCreator.xtend
@@ -0,0 +1,34 @@
+package rba.tool.editor.ui.marker
+
+import org.eclipse.core.resources.IMarker
+import org.eclipse.core.resources.IResource
+import org.eclipse.core.runtime.CoreException
+import org.eclipse.xtext.ui.editor.validation.MarkerCreator
+import org.eclipse.xtext.validation.Issue
+import rba.tool.editor.util.RBAModelEditorNameUtil
+
+class RBAModelMarkerCreator extends MarkerCreator {
+
+ override protected setMarkerAttributes(Issue issue, IResource resource, IMarker marker) throws CoreException {
+ super.setMarkerAttributes(issue, resource, marker)
+ var isInModelFolder = false
+ var isInBuildFolder = false
+ var uri = issue.uriToProblem
+ if (uri !== null) {
+ for (seg : uri.segments) {
+ if (seg.equals(RBAModelEditorNameUtil.BUILD_FOLDER_NAME)) {
+ isInBuildFolder = true
+ }
+ }
+ }
+ var path = marker.resource.fullPath
+ if (path !== null) {
+ for (seg : path.segments) {
+ if (seg.equals(RBAModelEditorNameUtil.MODEL_FOLDER_NAME)) {
+ isInModelFolder = true
+ }
+ }
+ }
+ }
+
+}
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)
+ }
+ }
+}