Changeset 17 in default
- Timestamp:
- 10/22/10 16:48:56 (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/actions/GenerateCompositeBNFAction.java
r5 r17 93 93 String coreName = null; 94 94 // get the core grammar 95 EList<Import> imports = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImport s();95 EList<Import> imports = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImportSection().getImports(); 96 96 for(int j=0; j< imports.size(); j++) { 97 97 if(imports.get(j).getGrammarType().equals("core")) … … 113 113 packageGrammars = new LinkedList<XtextResource>(); 114 114 deltas = new LinkedList<URI>(); 115 EList<Import> packages = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImport s();115 EList<Import> packages = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImportSection().getImports(); 116 116 for(int j=0; j<packages.size(); j++) { 117 117 if(packages.get(j).getGrammarType().equals("package")) { -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/actions/PackageConsistencyCheckerAction.java
r5 r17 65 65 Resource coreRes = null; 66 66 Resource updatedRes = null; 67 EList<Import> imports = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImport s();67 EList<Import> imports = ((EtsiBnfImpl) xtextResource.getParseResult().getRootNode().getElement()).getImportSection().getImports(); 68 68 69 69 for(int j=0; j<imports.size(); j++) { -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java
r13 r17 32 32 private FormatterConfig config; 33 33 34 private boolean lastWasSectionHeading=false; 35 34 36 public EbnfFormatterVisitor(EObject rootNode, FormatterConfig config) { 35 37 super(rootNode); … … 164 166 165 167 protected void visitBefore(Rule node) { 168 if (lastWasSectionHeading) 169 buf.append("\n"); 170 171 lastWasSectionHeading=false; 172 166 173 if (node.getRulenumber() > 0) 167 174 buf.append(node.getRulenumber() + ". "); … … 188 195 189 196 protected void visitBefore(SectionHeading node) { 190 if (! buf.substring(buf.length()-2).equals("\n\n"))197 if (!lastWasSectionHeading && !buf.substring(buf.length()-2).equals("\n\n")) 191 198 buf.append("\n"); 192 199 200 lastWasSectionHeading=true; 201 // if (!lastWasSectionHeading || !buf.substring(buf.length()-2).equals("\n\n")) 202 // if (!buf.substring(buf.length()-2).equals("\n\n")) 203 // buf.append("\n"); 204 193 205 buf.append(node.getSectionHeader()); 194 206 } 195 207 196 208 protected void visitAfter(SectionHeading node) { 197 buf.append("\n");209 // buf.append("\n"); 198 210 } 199 211 -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/refactoring/rename/RenameRefactoringHandler.java
r5 r17 72 72 "Error while applying refactoring to workbench/wizard: " 73 73 + e.getMessage()); 74 e.printStackTrace();74 //e.printStackTrace(); 75 75 } 76 76 return null; -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/utils/Utils.java
r5 r17 4 4 import java.util.List; 5 5 6 import org.eclipse.emf.common.util.EList;7 6 import org.eclipse.emf.ecore.EObject; 8 7 import org.eclipse.jface.text.BadLocationException; … … 22 21 import com.google.common.collect.Iterables; 23 22 23 import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry; 24 import de.ugoe.cs.swe.bnftools.ebnf.DeltaEntry; 24 25 import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf; 26 import de.ugoe.cs.swe.bnftools.ebnf.MergeEntry; 25 27 import de.ugoe.cs.swe.bnftools.ebnf.Rule; 26 28 … … 29 31 static public NodeAdapter findNodeFromSelection( 30 32 final XtextEditor xtextEditor, ITextSelection mySelection) { 31 NodeAdapter node = null;32 33 if ((xtextEditor == null) || (xtextEditor.getDocument() == null)) 33 34 return null; 34 35 EtsiBnf root = (EtsiBnf) xtextEditor.getDocument().readOnly( 35 36 new RootEObjectFinder()); 36 EList<Rule> rules = root.getRule(); 37 for (int i = 0; i < rules.size(); i++) { 38 node = NodeUtil.getNodeAdapter(rules.get(i)); 39 if ((node.getParserNode().getOffset() <= mySelection.getOffset()) 40 && (mySelection.getOffset() <= node.getParserNode() 41 .getOffset() 42 + node.getParserNode().getLength())) { 43 return node; 37 38 NodeAdapter resultNode = null; 39 if (root.getBnfEntry() != null) { 40 System.out.println("bnf grammar!"); 41 for (int i=0; i < root.getBnfEntry().size(); i++) { 42 BnfEntry entry = root.getBnfEntry().get(i); 43 if (entry.getRule() != null) { 44 resultNode = findNodeInRule(entry.getRule(), mySelection); 45 if (resultNode != null) 46 return resultNode; 47 } 48 } 49 } else if (root.getDeltaEntry() != null) { 50 for (int i=0; i < root.getDeltaEntry().size(); i++) { 51 DeltaEntry entry = root.getDeltaEntry().get(i); 52 if (entry.getRule() != null) { 53 resultNode = findNodeInRule(entry.getRule(), mySelection); 54 if (resultNode != null) 55 return resultNode; 56 } 57 } 58 } else if (root.getMergeEntry() != null) { 59 for (int i=0; i < root.getMergeEntry().size(); i++) { 60 MergeEntry entry = root.getMergeEntry().get(i); 61 if (entry.getMergeRule() != null) { 62 // TODO: doesn't work here... 63 // resultNode = findNodeInRule(entry.getgetRule(), mySelection); 64 // if (resultNode != null) 65 // return resultNode; 66 } 44 67 } 45 68 } 69 70 return resultNode; 71 } 72 73 // -------------------------------------------------------------------------------- 74 75 static private NodeAdapter findNodeInRule(Rule rule, ITextSelection mySelection) { 76 NodeAdapter node = NodeUtil.getNodeAdapter(rule); 77 if ((node.getParserNode().getOffset() <= mySelection.getOffset()) 78 && (mySelection.getOffset() <= node.getParserNode() 79 .getOffset() 80 + node.getParserNode().getLength())) { 81 return node; 82 } 83 46 84 return null; 47 85 } -
trunk/de.ugoe.cs.swe.bnftools.ebnf/src/de/ugoe/cs/swe/bnftools/validation/EbnfJavaValidator.java
r5 r17 67 67 Resource coreRes = null; 68 68 Resource updatedRes = null; 69 EList<Import> imports = bnf.getImport s();69 EList<Import> imports = bnf.getImportSection().getImports(); 70 70 71 71 for(int j=0; j<imports.size(); j++) {
Note: See TracChangeset
for help on using the changeset viewer.