Changeset 34 in default


Ignore:
Timestamp:
11/03/10 16:02:27 (14 years ago)
Author:
zeiss
Message:
 
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  
    119119              class="de.ugoe.cs.swe.bnftools.ui.EbnfExecutableExtensionFactory:de.ugoe.cs.swe.bnftools.ui.formatter.FormatterHandler" 
    120120              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"> 
    121130            <activeWhen> 
    122131                <reference 
     
    186195      </command> 
    187196      <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 
    188202            description="Rename Refactoring" 
    189203            id="de.ugoe.cs.swe.bnftools.Ebnf.refactoring.rename" 
     
    244258            </visibleWhen> 
    245259         </command> 
    246              <command 
     260         <command 
    247261                 commandId="de.ugoe.cs.swe.bnftools.Ebnf.formatter" 
    248262                 style="push" 
    249263                 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"> 
    250274            <visibleWhen checkEnabled="false"> 
    251275                <reference 
  • trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java

    r32 r34  
    3535 
    3636public class EbnfFormatterVisitor extends EbnfVisitor { 
    37         private StringBuffer buf; 
    38         private FormatterConfig config; 
    39         private int bufferPositionFormattedTextNoWhitespaces = 0; 
    40         private int bufferPositionOriginalText = 0; 
    41         private int allCommentsPosition = 0; 
    42         private ArrayList<LeafNode> allComments = new ArrayList<LeafNode>(); 
    43          
    44         private boolean lastWasSectionHeading=false; 
    45         private CompositeNode parserEtsiBnfNode; 
    46         private String originalText; 
    47         private int bufferPositionFormattedText; 
    48         private String formattedText; 
    49         private String formattedTextNoWhitespaces; 
    50         private String originalTextNoWhitespaces; 
    51         private int newLineOffsetCounter = 0; 
    52         private int rightHandSideRuleOffset = 0; 
    53         private Stack<Integer> ruleSpacingStack = new Stack<Integer>(); 
    54         private Double 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; 
    5555         
    5656        public EbnfFormatterVisitor(EObject rootNode, FormatterConfig config) { 
     
    392392 
    393393        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(";"); 
    395403                newLine(); 
    396404        } 
Note: See TracChangeset for help on using the changeset viewer.