Changeset 69 in default
- Timestamp:
- 05/26/14 11:48:28 (11 years ago)
- Location:
- v2/trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/plugin.xml
r68 r69 248 248 </extension> 249 249 250 <!-- 250 <!----> 251 251 <extension 252 252 point="org.eclipse.xtext.builder.participant"> … … 255 255 </participant> 256 256 </extension> 257 -->258 259 <!--this is for using a button for generation -->257 258 259 <!--this is for using a button for generation 260 260 <extension 261 261 point="org.eclipse.ui.handlers"> 262 262 <handler 263 class="de.ugoe.cs.swe.bnftools.ui.E bnfExecutableExtensionFactory:de.ugoe.cs.swe.bnftools.ui.helper.GenerationHandler"263 class="de.ugoe.cs.swe.bnftools.ui.EBnfExecutableExtensionFactory:de.ugoe.cs.swe.bnftools.ui.helper.GenerationHandler" 264 264 commandId="de.ugoe.cs.swe.bnftools.ui.handler.GenerationCommand"> 265 265 </handler> … … 291 291 </menuContribution> 292 292 </extension> 293 <!---->293 --> 294 294 295 295 -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/handler/GenerationHandler.java
r68 r69 66 66 generator.doGenerate(r, fsa); 67 67 68 68 69 } 69 70 } -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/quickfix/EbnfQuickfixProvider.xtend
r66 r69 42 42 //***************************************************************************************** 43 43 //works but only in one file 44 @Fix(EbnfValidator.ruleReferencedOneDescription)45 def void fixInlineRuleReferencedOnce(Issue issue, IssueResolutionAcceptor acceptor) {46 acceptor.accept(47 issue,48 "Inline the rule",49 "Delete the rule and replace its single reference by the rule's right side",50 "upcase.png"51 ) [ element, context |52 var Rule rule = element as Rule;53 var IXtextDocument xtextDocument = context.getXtextDocument();54 var ICompositeNode node = NodeModelUtils.findActualNodeFor(rule);55 var String nodeText = node.text;56 var int textLength = nodeText.length - 2;57 var int offset = node.textRegion.offset;58 //rename references59 var ICompositeNode dList = NodeModelUtils.findActualNodeFor(rule.definitionList);60 var String refText = "(" + dList.text + ")";61 var int refLength = rule.name.length;62 var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule);63 //*********************************64 //is the reference in the rule itself?65 var boolean foundRule = false;66 var EObject r = references.get(0) as EObject;67 var Rule containingRule = null;68 while (!foundRule) {69 r = r.eContainer;70 if (r instanceof Rule) {71 containingRule = r as Rule;72 foundRule = true;73 }74 }75 if (!rule.equals(containingRule)) {76 77 for (ruleRef : references) {78 var ICompositeNode refNode = NodeModelUtils.findActualNodeFor(ruleRef);79 var int refOffset = refNode.textRegion.offset;80 81 xtextDocument.replace(refOffset, refLength, refText);82 if (refOffset < offset) {83 offset += refText.length - refLength;84 }85 }86 87 // delete rule88 }89 90 xtextDocument.replace(offset, textLength, "");91 ]92 93 }44 // @Fix(EbnfValidator.ruleReferencedOneDescription) 45 // def void fixInlineRuleReferencedOnce(Issue issue, IssueResolutionAcceptor acceptor) { 46 // acceptor.accept( 47 // issue, 48 // "Inline the rule", 49 // "Delete the rule and replace its single reference by the rule's right side", 50 // "upcase.png" 51 // ) [ element, context | 52 // var Rule rule = element as Rule; 53 // var IXtextDocument xtextDocument = context.getXtextDocument(); 54 // var ICompositeNode node = NodeModelUtils.findActualNodeFor(rule); 55 // var String nodeText = node.text; 56 // var int textLength = nodeText.length - 2; 57 // var int offset = node.textRegion.offset; 58 // //rename references 59 // var ICompositeNode dList = NodeModelUtils.findActualNodeFor(rule.definitionList); 60 // var String refText = "(" + dList.text + ")"; 61 // var int refLength = rule.name.length; 62 // var List<RuleReference> references = EbnfAnalysisUtils.findReferences(rule); 63 // //********************************* 64 // //is the reference in the rule itself? 65 // var boolean foundRule = false; 66 // var EObject r = references.get(0) as EObject; 67 // var Rule containingRule = null; 68 // while (!foundRule) { 69 // r = r.eContainer; 70 // if (r instanceof Rule) { 71 // containingRule = r as Rule; 72 // foundRule = true; 73 // } 74 // } 75 // if (!rule.equals(containingRule)) { 76 // 77 // for (ruleRef : references) { 78 // var ICompositeNode refNode = NodeModelUtils.findActualNodeFor(ruleRef); 79 // var int refOffset = refNode.textRegion.offset; 80 // 81 // xtextDocument.replace(refOffset, refLength, refText); 82 // if (refOffset < offset) { 83 // offset += refText.length - refLength; 84 // } 85 // } 86 // 87 // // delete rule 88 // } 89 // 90 // xtextDocument.replace(offset, textLength, ""); 91 // ] 92 // 93 // } 94 94 95 95 // // this is not working by unknown reasons 96 96 // @Fix(EbnfValidator.ruleReferencedOneDescription) 97 97 // def void fixInlineRuleReferencedOnce(Issue issue, IssueResolutionAcceptor acceptor) { 98 // System.out.println("test"); 98 99 // acceptor.accept( 99 100 // issue, … … 105 106 // var DefinitionList dlist = rule.definitionList; 106 107 // var List<Rule> rules=EbnfAnalysisUtils.getAllRules(rule.eContainer().eContainer() as EtsiBnf); 107 // var SingleDefinition sDef = rules.get(1).definitionList.singleDefinition.get(1); 108 // var SingleDefinition sDef = rules.get(0).definitionList.singleDefinition.get(0); 109 // 110 // System.out.println(dlist.singleDefinition); 108 111 // dlist.singleDefinition.add(sDef); 112 // System.out.println(dlist.singleDefinition); 113 // 109 114 // rule.name="bla"; 110 // ]111 // 115 // ] 116 112 117 // } 113 118 -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/.classpath
r61 r69 6 6 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> 7 7 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> 8 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/avalon-framework-4.2.0.jar"/> 9 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/batik-all-1.7.jar"/> 10 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/commons-io-1.3.1.jar"/> 11 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/commons-logging-1.0.4.jar"/> 12 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/serializer-2.7.0.jar"/> 13 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/xalan-2.7.0.jar"/> 14 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/xercesImpl-2.7.1.jar"/> 15 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/xml-apis-1.3.04.jar"/> 16 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/xml-apis-ext-1.3.04.jar"/> 17 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/lib/xmlgraphics-commons-1.5.jar"/> 18 <classpathentry kind="lib" path="C:/Users/hauke/Desktop/Uni/Hiwijob bnf tools/fop-1.1/build/fop.jar"/> 8 19 <classpathentry kind="output" path="bin"/> 9 20 </classpath> -
v2/trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/generator/EbnfGenerator.xtend
r65 r69 20 20 import de.ugoe.cs.swe.bnftools.ebnf.StringRule 21 21 import java.io.File 22 import org.eclipse.xtext.generator.IFileSystemAccessExtension2 23 import org.eclipse.emf.common.util.URI; 22 24 23 25 /** … … 32 34 if (e.bnfEntry.size!=0) { 33 35 fsa.generateFile(e.name + ".fo", e.compile) 36 37 //generate pdf 38 // var uri = (fsa as IFileSystemAccessExtension2).getURI(e.name+".fo"); 39 // (fsa as IFileSystemAccessExtension2). 40 // 41 // System.out.println(uri.hasAbsolutePath()); 42 // System.out.println(uri.path.substring(0,uri.path.length-3)); 43 // System.out.println(uri.file); 44 // System.out.println(uri.toString()); 45 // var File file = new File(uri.path).absoluteFile; 46 // System.out.println(file.exists); 47 // var String aPath = file.absolutePath; 48 // 49 // foToPdf.createPdfFromFo(file,aPath.substring(0,aPath.length-3)); 34 50 } 35 51 }
Note: See TracChangeset
for help on using the changeset viewer.