Index: trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java
===================================================================
--- trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java	(revision 33)
+++ trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java	(revision 34)
@@ -35,22 +35,22 @@
 
 public class EbnfFormatterVisitor extends EbnfVisitor {
-	private StringBuffer buf;
-	private FormatterConfig config;
-	private int bufferPositionFormattedTextNoWhitespaces = 0;
-	private int bufferPositionOriginalText = 0;
-	private int allCommentsPosition = 0;
-	private ArrayList<LeafNode> allComments = new ArrayList<LeafNode>();
-	
-	private boolean lastWasSectionHeading=false;
-	private CompositeNode parserEtsiBnfNode;
-	private String originalText;
-	private int bufferPositionFormattedText;
-	private String formattedText;
-	private String formattedTextNoWhitespaces;
-	private String originalTextNoWhitespaces;
-	private int newLineOffsetCounter = 0;
-	private int rightHandSideRuleOffset = 0;
-	private Stack<Integer> ruleSpacingStack = new Stack<Integer>();
-	private Double averageSingleDefinitionLength;
+	protected StringBuffer buf;
+	protected FormatterConfig config;
+	protected int bufferPositionFormattedTextNoWhitespaces = 0;
+	protected int bufferPositionOriginalText = 0;
+	protected int allCommentsPosition = 0;
+	protected ArrayList<LeafNode> allComments = new ArrayList<LeafNode>();
+	
+	protected boolean lastWasSectionHeading=false;
+	protected CompositeNode parserEtsiBnfNode;
+	protected String originalText;
+	protected int bufferPositionFormattedText;
+	protected String formattedText;
+	protected String formattedTextNoWhitespaces;
+	protected String originalTextNoWhitespaces;
+	protected int newLineOffsetCounter = 0;
+	protected int rightHandSideRuleOffset = 0;
+	protected Stack<Integer> ruleSpacingStack = new Stack<Integer>();
+	protected Double averageSingleDefinitionLength;
 	
 	public EbnfFormatterVisitor(EObject rootNode, FormatterConfig config) {
@@ -392,5 +392,13 @@
 
 	protected void visitBefore(Import node) {
-		text("import \"" + node.getImportURI() + "\";");
+		text("import \"" + node.getImportURI() + "\"");
+		if (node.getGrammarType() != null) {
+			text("/" + node.getGrammarType());
+		}
+		if (node.getLabel() != null) {
+			space();
+			text("label: " + node.getLabel());
+		}
+		text(";");
 		newLine();
 	}
Index: trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfHtmlFormatterVisitor.java
===================================================================
--- trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfHtmlFormatterVisitor.java	(revision 34)
+++ trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfHtmlFormatterVisitor.java	(revision 34)
@@ -0,0 +1,14 @@
+package de.ugoe.cs.swe.bnftools.ui.formatter;
+
+import org.eclipse.emf.ecore.EObject;
+
+public class EbnfHtmlFormatterVisitor extends EbnfFormatterVisitor {
+
+	public EbnfHtmlFormatterVisitor(EObject rootNode, FormatterConfig config) {
+		super(rootNode, config);
+		this.config = config;
+		buf = new StringBuffer();
+	}
+
+
+}
Index: trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/HtmlFormatterHandler.java
===================================================================
--- trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/HtmlFormatterHandler.java	(revision 34)
+++ trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/HtmlFormatterHandler.java	(revision 34)
@@ -0,0 +1,73 @@
+package de.ugoe.cs.swe.bnftools.ui.formatter;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.xtext.parsetree.NodeAdapter;
+import org.eclipse.xtext.parsetree.NodeUtil;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
+
+import de.ugoe.cs.swe.bnftools.utils.RootEObjectFinder;
+
+public class HtmlFormatterHandler extends AbstractHandler {
+
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		XtextEditor editor = (XtextEditor) PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+
+		// TODO: better error handling
+		if (!(editor.getDocument() instanceof XtextDocument)) {
+			return null;
+		}
+
+		XtextDocument doc = (XtextDocument) editor.getDocument();
+
+		IContainer parent = editor.getResource().getParent();
+
+		EObject root = doc.readOnly(new RootEObjectFinder());
+		NodeAdapter rootNode = NodeUtil.getNodeAdapter(root);
+
+		FormatterConfig config = new FormatterConfig();
+		EbnfHtmlFormatterVisitor visitor = new EbnfHtmlFormatterVisitor(
+				rootNode.getParserNode().getElement(), config);
+		// visitor.accept(rootNode.getElement());
+
+		visitor.accept();
+
+		// System.out.println(visitor.getBuf());
+		IWorkspace workspace = ResourcesPlugin.getWorkspace();
+		IWorkspaceRoot workspaceRoot = workspace.getRoot();
+		IPath location = workspaceRoot.getLocation();
+
+		System.out.println(parent.getLocationURI().getPath());
+//		File f = new File(".");
+		writeFile(visitor.getBuf().toString(), parent.getLocationURI().getPath() + "/" + editor.getResource().getName() + ".html");
+
+		return null;
+	}
+
+	private void writeFile(String str, String filename) {
+		try {
+			FileWriter fstream = new FileWriter(filename);
+			BufferedWriter out = new BufferedWriter(fstream);
+			out.write(str);
+			out.close();
+		} catch (Exception e) {// Catch exception if any
+			System.err.println("Error: " + e.getMessage());
+		}
+	}
+
+}
