Changeset 34 in default
- Timestamp:
- 11/03/10 16:02:27 (14 years ago)
- Location:
- trunk/de.ugoe.cs.swe.bnftools.ebnf.ui
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/plugin.xml
r9 r34 119 119 class="de.ugoe.cs.swe.bnftools.ui.EbnfExecutableExtensionFactory:de.ugoe.cs.swe.bnftools.ui.formatter.FormatterHandler" 120 120 commandId="de.ugoe.cs.swe.bnftools.Ebnf.formatter"> 121 <activeWhen> 122 <reference 123 definitionId="de.ugoe.cs.swe.bnftools.Ebnf.Editor.opened"> 124 </reference> 125 </activeWhen> 126 </handler> 127 <handler 128 class="de.ugoe.cs.swe.bnftools.ui.EbnfExecutableExtensionFactory:de.ugoe.cs.swe.bnftools.ui.formatter.HtmlFormatterHandler" 129 commandId="de.ugoe.cs.swe.bnftools.Ebnf.htmlformatter"> 121 130 <activeWhen> 122 131 <reference … … 186 195 </command> 187 196 <command 197 description="Trigger custom bnftools html formatter" 198 id="de.ugoe.cs.swe.bnftools.Ebnf.htmlformatter" 199 name="Save as HTML"> 200 </command> 201 <command 188 202 description="Rename Refactoring" 189 203 id="de.ugoe.cs.swe.bnftools.Ebnf.refactoring.rename" … … 244 258 </visibleWhen> 245 259 </command> 246 260 <command 247 261 commandId="de.ugoe.cs.swe.bnftools.Ebnf.formatter" 248 262 style="push" 249 263 tooltip="Trigger custom bnftools formatting"> 264 <visibleWhen checkEnabled="false"> 265 <reference 266 definitionId="de.ugoe.cs.swe.bnftools.Ebnf.Editor.opened"> 267 </reference> 268 </visibleWhen> 269 </command> 270 <command 271 commandId="de.ugoe.cs.swe.bnftools.Ebnf.htmlformatter" 272 style="push" 273 tooltip="Save as HTML"> 250 274 <visibleWhen checkEnabled="false"> 251 275 <reference -
trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java
r32 r34 35 35 36 36 public class EbnfFormatterVisitor extends EbnfVisitor { 37 pr ivateStringBuffer buf;38 pr ivateFormatterConfig config;39 pr ivateint bufferPositionFormattedTextNoWhitespaces = 0;40 pr ivateint bufferPositionOriginalText = 0;41 pr ivateint allCommentsPosition = 0;42 pr ivateArrayList<LeafNode> allComments = new ArrayList<LeafNode>();43 44 pr ivateboolean lastWasSectionHeading=false;45 pr ivateCompositeNode parserEtsiBnfNode;46 pr ivateString originalText;47 pr ivateint bufferPositionFormattedText;48 pr ivateString formattedText;49 pr ivateString formattedTextNoWhitespaces;50 pr ivateString originalTextNoWhitespaces;51 pr ivateint newLineOffsetCounter = 0;52 pr ivateint rightHandSideRuleOffset = 0;53 pr ivateStack<Integer> ruleSpacingStack = new Stack<Integer>();54 pr ivateDouble averageSingleDefinitionLength;37 protected StringBuffer buf; 38 protected FormatterConfig config; 39 protected int bufferPositionFormattedTextNoWhitespaces = 0; 40 protected int bufferPositionOriginalText = 0; 41 protected int allCommentsPosition = 0; 42 protected ArrayList<LeafNode> allComments = new ArrayList<LeafNode>(); 43 44 protected boolean lastWasSectionHeading=false; 45 protected CompositeNode parserEtsiBnfNode; 46 protected String originalText; 47 protected int bufferPositionFormattedText; 48 protected String formattedText; 49 protected String formattedTextNoWhitespaces; 50 protected String originalTextNoWhitespaces; 51 protected int newLineOffsetCounter = 0; 52 protected int rightHandSideRuleOffset = 0; 53 protected Stack<Integer> ruleSpacingStack = new Stack<Integer>(); 54 protected Double averageSingleDefinitionLength; 55 55 56 56 public EbnfFormatterVisitor(EObject rootNode, FormatterConfig config) { … … 392 392 393 393 protected void visitBefore(Import node) { 394 text("import \"" + node.getImportURI() + "\";"); 394 text("import \"" + node.getImportURI() + "\""); 395 if (node.getGrammarType() != null) { 396 text("/" + node.getGrammarType()); 397 } 398 if (node.getLabel() != null) { 399 space(); 400 text("label: " + node.getLabel()); 401 } 402 text(";"); 395 403 newLine(); 396 404 }
Note: See TracChangeset
for help on using the changeset viewer.