Index: v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/quickfix/EbnfQuickfixProvider.xtend
===================================================================
--- v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/quickfix/EbnfQuickfixProvider.xtend	(revision 63)
+++ v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/quickfix/EbnfQuickfixProvider.xtend	(revision 64)
@@ -7,4 +7,17 @@
 import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor
 import org.eclipse.xtext.validation.Issue
+import de.ugoe.cs.swe.bnftools.validation.EbnfValidator
+import org.eclipse.xtext.ui.editor.model.IXtextDocument
+import org.eclipse.emf.ecore.EObject
+import de.ugoe.cs.swe.bnftools.ebnf.Rule
+import de.ugoe.cs.swe.bnftools.ebnf.EbnfFactory
+import org.eclipse.xtext.nodemodel.util.NodeModelUtils
+import org.eclipse.xtext.nodemodel.INode
+import de.ugoe.cs.swe.bnftools.validation.EbnfAnalysisUtils
+import java.util.List
+import de.ugoe.cs.swe.bnftools.ebnf.RuleReference
+import org.eclipse.xtext.nodemodel.ICompositeNode
+import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf
+import java.util.ArrayList
 
 /**
@@ -14,29 +27,107 @@
  */
 class EbnfQuickfixProvider extends org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider {
+	//works
+	@Fix(EbnfValidator.ruleReferencedOneDescription)
+	def void fixInlineRuleReferencedOnce(Issue issue, IssueResolutionAcceptor acceptor) {
+		acceptor.accept(
+			issue,
+			"Inline the rule",
+			"Delete the rule and replace its single reference by the rule's right side",
+			"upcase.png"
+		) [ element, context |
+			var Rule rule = element as Rule;
+			var IXtextDocument xtextDocument = context.getXtextDocument();
+			var ICompositeNode node = NodeModelUtils.findActualNodeFor(rule);
+			var String nodeText = node.text;
+			var int textLength = nodeText.length - 2;
+			var int offset = node.textRegion.offset;
+			//rename references
+			var ICompositeNode dList = NodeModelUtils.findActualNodeFor(rule.definitionList);
+			var String refText = "(" + dList.text + ")";
+			var int refLength = rule.name.length;
+			var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule);
+			//is the reference in the rule itself?
+			var boolean foundRule = false;
+			var EObject r = references.get(0) as EObject;
+			var Rule containingRule=null;
+			while (!foundRule) {
+				r = r.eContainer;
+				if (r instanceof Rule) {
+					containingRule = r as Rule;
+					foundRule = true;
+				}
+			}
+			if (!rule.equals(containingRule)) {
+				for (ruleRef : references) {
+					var ICompositeNode refNode = NodeModelUtils.findActualNodeFor(ruleRef);
+					var int refOffset = refNode.textRegion.offset;
 
+					xtextDocument.replace(refOffset, refLength, refText);
+					if (refOffset < offset) {
+						offset += refText.length - refLength;
+					}
+				}
+			}
+		
 
-	static final String ruleReferencedOneDescription = "The rule is only referenced by one other rule";
-	
-//	@Fix(MyDslValidator::INVALID_NAME)
-//	def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
-//		acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png') [
-//			context |
-//			val xtextDocument = context.xtextDocument
-//			val firstLetter = xtextDocument.get(issue.offset, 1)
-//			xtextDocument.replace(issue.offset, 1, firstLetter.toUpperCase)
-//		]
+		// delete rule
+		xtextDocument.replace(offset, textLength, "");
+		]
+
+	}
+
+	//works
+//		@Fix(EbnfValidator.passthroughRuleDescription)
+//	def void fixRemovePassthroughRule(Issue issue, IssueResolutionAcceptor acceptor) {
+//		acceptor.accept(
+//			issue,
+//			"Remove passthrough rule",
+//			"Delete the passthrough rule and replace its references with its right side",
+//			"upcase.png",
+//			[ element, context |
+//				var Rule rule = element as Rule;
+//				var IXtextDocument xtextDocument = context.getXtextDocument();
+//				var ICompositeNode node = NodeModelUtils.findActualNodeFor(rule);
+//				var String nodeText = node.text;
+//				var int textLength = nodeText.length - 2;
+//				var int offset = node.textRegion.offset;
+//				var ICompositeNode dList = NodeModelUtils.findActualNodeFor(rule.definitionList);
+//				var String refText = "(" + dList.text + ")";
+//				var int refLength = rule.name.length;
+//				var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule);
+//				//sort references by offset
+//				var int i = 0;
+//				var List<RuleReference> referenceHleper = new ArrayList<RuleReference>();
+//				while(i<references.length){
+//					
+//					i++;
+//				}
+//				for (ruleRef : references) {
+//					var ICompositeNode refNode = NodeModelUtils.findActualNodeFor(ruleRef);
+//					var int refOffset = refNode.textRegion.offset;
+//
+//					xtextDocument.replace(refOffset, refLength, refText);
+//					if (refOffset < offset) {
+//						offset += refText.length - refLength;
+//					}
+//				}
+//			]
+//		);
 //	}
 
+		@Fix(EbnfValidator.unusedRuleDescription)
+	def void fixUnusedRule(Issue issue, IssueResolutionAcceptor acceptor) {
 
-//	@Fix(value = ruleReferencedOneDescription)
-//	def void fixInlineRuleReferencedOnce(final Issue issue, IssueResolutionAcceptor acceptor) {
-//		InlineRuleModification inlineRuleModification = new InlineRuleModification(
-//				resourceDescriptions);
-//
-//		acceptor.accept(
-//				issue,
-//				"Inline the rule",
-//				"Delete the rule and replace its single reference by the rule's right side",
-//				"upcase.png", inlineRuleModification);
-//	}
+		acceptor.accept(issue, "Remove unused rule", "Delete the unused rule", "upcase.png",
+			[ element, context |
+				var Rule rule = element as Rule;
+				var IXtextDocument xtextDocument = context.getXtextDocument();
+				var ICompositeNode node = NodeModelUtils.findActualNodeFor(rule);
+				var int offset = node.textRegion.offset;
+				var String nodeText = node.text;
+				var int textLength = nodeText.length - 2;
+				xtextDocument.replace(offset, textLength, "");
+			])
+	}
 }
+		
