Removed DocBookOutlineProvider. DocBook uses DefaultOutlineProvider now.

Change-Id: Ibe77cfc6799263529df5afde92f10bfcae7a9894
Signed-off-by: Carsten Hiesserich <carsten.hie@gmail.com>
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/css/CSS.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/css/CSS.java
index 9f24c59..1b3ab4f 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/css/CSS.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/css/CSS.java
@@ -130,7 +130,9 @@
 	public static final String Z_SPACING = "z-spacing";
 
 	// VEX specific properties
-	public static final String OUTLINE_CONTENT = "-vex-outline-content";
+	// we can't use a dash '-vex' here, because of a bug in the batik css parser
+	// see https://issues.apache.org/bugzilla/show_bug.cgi?id=47800
+	public static final String OUTLINE_CONTENT = "_vex-outline-content";
 
 	// suffixes to BORDER_XXX
 	public static final String COLOR_SUFFIX = "-color";
diff --git a/org.eclipse.vex.docbook/.classpath b/org.eclipse.vex.docbook/.classpath
index a955886..76ed9a7 100644
--- a/org.eclipse.vex.docbook/.classpath
+++ b/org.eclipse.vex.docbook/.classpath
@@ -1,7 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<classpath>

-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>

-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

-	<classpathentry kind="src" path="src/"/>

-	<classpathentry kind="output" path="target/classes"/>

-</classpath>

+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.vex.docbook/META-INF/MANIFEST.MF b/org.eclipse.vex.docbook/META-INF/MANIFEST.MF
index b49b49a..8759d7d 100644
--- a/org.eclipse.vex.docbook/META-INF/MANIFEST.MF
+++ b/org.eclipse.vex.docbook/META-INF/MANIFEST.MF
@@ -11,6 +11,5 @@
  org.eclipse.emf.ecore;bundle-version="[2.4.1,3.0.0)",
  org.eclipse.wst.xml.core
 Bundle-Localization: plugin
-Export-Package: org.eclipse.vex.docbook
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ClassPath: .
diff --git a/org.eclipse.vex.docbook/build.properties b/org.eclipse.vex.docbook/build.properties
index 2565473..93ada84 100644
--- a/org.eclipse.vex.docbook/build.properties
+++ b/org.eclipse.vex.docbook/build.properties
@@ -8,6 +8,5 @@
 src.includes = styles/,\
                4.5/,\
                5.0/
-source.. = src/
 jars.compile.order = .
 
diff --git a/org.eclipse.vex.docbook/plugin.xml b/org.eclipse.vex.docbook/plugin.xml
index 483aa50..1079b51 100644
--- a/org.eclipse.vex.docbook/plugin.xml
+++ b/org.eclipse.vex.docbook/plugin.xml
@@ -68,7 +68,6 @@
          name="%doctype.docbook4_5"
          point="org.eclipse.vex.ui.doctypes">
       <doctype
-            outlineProvider="org.eclipse.vex.docbook.DocBookOutlineProvider"
             publicId="-//OASIS//DTD DocBook XML V4.5//EN"
             systemId="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
             
@@ -110,7 +109,6 @@
          name="%doctype.docbook5_0_DTD"
          point="org.eclipse.vex.ui.doctypes">
       <doctype
-            outlineProvider="org.eclipse.vex.docbook.DocBookOutlineProvider"
             publicId="-//OASIS//DTD DocBook XML 5.0//EN"
             systemId="http://www.oasis-open.org/docbook/xml/5.0/docbook.dtd">
             
@@ -152,7 +150,6 @@
          name="%doctype.docbook5_0_XSD1"
          point="org.eclipse.vex.ui.doctypes">
       <doctype
-            outlineProvider="org.eclipse.vex.docbook.DocBookOutlineProvider"
             publicId="http://www.oasis-open.org/docbook/xml/5.0/xsd/docbook.xsd"
             systemId="5.0/xsd/docbook.xsd">
             
@@ -194,7 +191,6 @@
          name="%doctype.docbook5_0_XSD2"
          point="org.eclipse.vex.ui.doctypes">
       <doctype
-            outlineProvider="org.eclipse.vex.docbook.DocBookOutlineProvider"
             publicId="http://docbook.org/xml/5.0/xsd/docbook.xsd"
             systemId="5.0/xsd/docbook.xsd">
             
@@ -236,7 +232,6 @@
          name="%doctype.docbook5_0_XSD3"
          point="org.eclipse.vex.ui.doctypes">
       <doctype
-            outlineProvider="org.eclipse.vex.docbook.DocBookOutlineProvider"
             publicId="http://docbook.org/ns/docbook"
             systemId="5.0/xsd/docbook.xsd">
             
diff --git a/org.eclipse.vex.docbook/src/org/eclipse/vex/docbook/DocBookOutlineProvider.java b/org.eclipse.vex.docbook/src/org/eclipse/vex/docbook/DocBookOutlineProvider.java
deleted file mode 100644
index ea3cde0..0000000
--- a/org.eclipse.vex.docbook/src/org/eclipse/vex/docbook/DocBookOutlineProvider.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 John Krasnay and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     John Krasnay - initial API and implementation
- *     Igor Jacy Lino Campista - Java 5 warnings fixed (bug 311325)
- *******************************************************************************/
-package org.eclipse.vex.docbook;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.vex.core.provisional.dom.Filters;
-import org.eclipse.vex.core.provisional.dom.IDocument;
-import org.eclipse.vex.core.provisional.dom.IElement;
-import org.eclipse.vex.ui.internal.editor.VexEditor;
-import org.eclipse.vex.ui.internal.outline.IOutlineProvider;
-
-/**
- * Provides an outline of the sections of a DocBook document.
- */
-public class DocBookOutlineProvider implements IOutlineProvider {
-
-	public void init(final VexEditor editor) {
-	}
-
-	public ITreeContentProvider getContentProvider() {
-		return contentProvider;
-	}
-
-	public IBaseLabelProvider getLabelProvider() {
-		return labelProvider;
-	}
-
-	public IElement getOutlineElement(final IElement child) {
-		IElement element = child;
-		while (element.getParentElement() != null && !isTitledElement(element)) {
-			element = element.getParentElement();
-		}
-
-		return element;
-	}
-
-	private final ITreeContentProvider contentProvider = new ITreeContentProvider() {
-
-		public void dispose() {
-		}
-
-		public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
-		}
-
-		public Object[] getChildren(final Object parentElement) {
-			return getOutlineChildren((IElement) parentElement);
-		}
-
-		public Object getParent(final Object element) {
-			final IElement parent = ((IElement) element).getParentElement();
-			if (parent == null) {
-				return element;
-			} else {
-				return getOutlineElement(parent);
-			}
-		}
-
-		public boolean hasChildren(final Object element) {
-			return getOutlineChildren((IElement) element).length > 0;
-		}
-
-		public Object[] getElements(final Object inputElement) {
-			final IDocument document = (IDocument) inputElement;
-			return new Object[] { document.getRootElement() };
-		}
-
-	};
-
-	/**
-	 * Returns an array of the children of the given element that represent nodes in the outline. These are elements
-	 * such as "section" that contain "title" elements that we can use as label content.
-	 * 
-	 * @param element
-	 * @return
-	 */
-	private IElement[] getOutlineChildren(final IElement element) {
-		final List<IElement> children = new ArrayList<IElement>();
-		for (final IElement child : element.childElements()) {
-			if (titledElements.contains(child.getLocalName())) {
-				children.add(child);
-			}
-		}
-		return children.toArray(new IElement[children.size()]);
-	}
-
-	private final ILabelProvider labelProvider = new LabelProvider() {
-		@Override
-		public String getText(final Object o) {
-			final IElement e = (IElement) o;
-			IElement titleChild = findChild(e, "title");
-			if (titleChild != null) {
-				return titleChild.getText();
-			} else {
-				final IElement infoChild = findChild(e, e.getLocalName() + "info");
-				if (infoChild != null) {
-					titleChild = findChild(infoChild, "title");
-					if (titleChild != null) {
-						return titleChild.getText();
-					}
-				}
-			}
-			return e.getLocalName();
-		}
-	};
-
-	/**
-	 * Returns a value from a map of tag names that contain title elements The tags all have a similar characteristic.
-	 * Their content model includes a <title/> element as the first or second child.
-	 * 
-	 * For simplicity, we assume that the document is valid w.r.t. the DTD and thus the 'title' element is optional and
-	 * is one of the first two elements inside the given element.
-	 * 
-	 * @param element
-	 * @return
-	 */
-	private boolean isTitledElement(final IElement element) {
-		if (titledElements.contains(element.getLocalName()) || element.getParent() == null) {
-			return !element.childElements().to(1).matching(Filters.elementsNamed("title")).isEmpty();
-		}
-		return false;
-	}
-
-	/**
-	 * Finds the first child of the given element with the given name. Returns null if none found. We should move this
-	 * to XPath when we gain that facility.
-	 */
-	private IElement findChild(final IElement parent, final String childName) {
-		for (final IElement child : parent.childElements().matching(Filters.elementsNamed(childName))) {
-			return child;
-		}
-		return null;
-	}
-
-	private final static int MAPSIZE = 101; // prime greater than 65/.80
-
-	private final static HashSet<String> titledElements = new HashSet<String>(MAPSIZE);
-
-	static {
-		// Comment on each line indicates tags content model if different than title
-		// We are only interested in location of title tag within Content Model
-		// so any extra following content is ignored.
-
-		// In general, it is impossible to keep this sort of table accurate and 
-		// up-to-date for more than the most basic of cases. It would be better 
-		// to extract this information from the DTD for the document.
-
-		// For the moment, it is observed that this imperfect method works for 
-		// vast majority of DocBook documents.
-
-		titledElements.add("abstract"); // title?
-		titledElements.add("article");
-		//	titledElements.add("articleinfo"); 
-		titledElements.add("appendix");
-		//	titledElements.add("authorblurb"); // title?
-		//	titledElements.add("bibliodiv");
-		//	titledElements.add("calloutlist");
-		//	titledElements.add("caution"); // title?
-		titledElements.add("chapter"); // docinfo?, title
-		//	titledElements.add("colophon");
-		//	titledElements.add("constraintdef"); 
-		//	titledElements.add("dedication");
-
-		//	titledElements.add("equation"); // blockinfo?, title
-		//	titledElements.add("example"); // blockinfo?, title
-		//	titledElements.add("figure"); // blockinfo?, title
-		titledElements.add("glossary"); // glossaryinfo?, title
-		//	titledElements.add("glossdiv"); 
-		//	titledElements.add("glosslist"); // blockinfo?, title
-		//	titledElements.add("important"); // title?
-		//	titledElements.add("index"); // indexinfo, title
-		//	titledElements.add("indexdiv");
-		//	titledElements.add("itemizedlist"); // blockinfo?, title
-
-		//	titledElements.add("legalnotice"); // blockinfo?, title
-		//	titledElements.add("lot"); // beginpage?, title
-		//	titledElements.add("msg"); // title?
-		//	titledElements.add("msgexplan"); // title?
-		//	titledElements.add("msgmain"); // title?
-		//	titledElements.add("msgrel"); // title?
-		//	titledElements.add("msgset");
-		//	titledElements.add("msgsub"); // title?
-		//	titledElements.add("note"); // title?
-		//	titledElements.add("orderedlist"); // blockinfo?, title
-
-		titledElements.add("part"); // beginpage?, partinfo?, title
-		titledElements.add("partintro");
-		//	titledElements.add("personblurb"); // title?
-		titledElements.add("preface"); // beginpage?, prefaceinfo?, title
-		//	titledElements.add("procedure"); // blockinfo?, title
-		//	titledElements.add("productionset");
-		//	titledElements.add("qandadiv"); // blockinfo?, title
-		//	titledElements.add("qandaset"); // blockinfo?, title
-		//	titledElements.add("reference"); // beginpage?, referenceinfo?, title
-		//	titledElements.add("refsect1"); // refsect1info?, title
-
-		//	titledElements.add("refsect2"); // refsect2info, title
-		//	titledElements.add("refsect3"); // refsect3info, title
-		//	titledElements.add("refsection"); // refsectioninfo?, title
-		//	titledElements.add("refsynopsisdiv"); // refsynopsisdivinfo?, title
-		titledElements.add("sect1"); // sect1info?, title
-		titledElements.add("sect2"); // sect2info?, title
-		titledElements.add("sect3"); // sect3info?, title
-		titledElements.add("sect4"); // sect4info?, title
-		titledElements.add("sect5"); // sect5info?, title
-		titledElements.add("section"); // sectioninfo?, title
-
-		//	titledElements.add("segmentedlist"); 
-		//	titledElements.add("set");
-		//	titledElements.add("setindex"); // setindexinfo?, title
-		//	titledElements.add("sidebar"); // sidebarinfo?, title
-		titledElements.add("simplesect");
-		//	titledElements.add("step"); // table?
-		//	titledElements.add("table"); // blockinfo?, title
-		//	titledElements.add("task"); // blockinfo?, title
-		//	titledElements.add("taskprerequisites");// blockinfo?, title
-		//	titledElements.add("taskrelated"); // blockinfo?, title
-
-		//	titledElements.add("tasksummary"); // blockinfo?, title
-		//	titledElements.add("tip"); // title?
-		titledElements.add("toc"); // beginpage?, title
-		//	titledElements.add("variablelist"); // blockinfo?, title
-		//	titledElements.add("warning"); // title?
-	}
-
-}
diff --git a/org.eclipse.vex.docbook/styles/docbook-plain.css b/org.eclipse.vex.docbook/styles/docbook-plain.css
index 52dd96d..5540054 100644
--- a/org.eclipse.vex.docbook/styles/docbook-plain.css
+++ b/org.eclipse.vex.docbook/styles/docbook-plain.css
@@ -4,13 +4,16 @@
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  * 		John Krasnay - initial API and implementation
  *      Carsten Hiesserich - correct formatting of verbatim elements (bug 407828)
+ *      Carsten Hiesserich - added vex-outline import
  *******************************************************************************/
- 
- abbrev {
+
+@import url(vex-outline.css);
+
+abbrev {
 	display: inline;
 }
 
diff --git a/org.eclipse.vex.docbook/styles/vex-outline.css b/org.eclipse.vex.docbook/styles/vex-outline.css
new file mode 100644
index 0000000..41cd093
--- /dev/null
+++ b/org.eclipse.vex.docbook/styles/vex-outline.css
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Carsten Hiesserich and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * 		Carsten Hiesserich - initial API and implementation
+ *******************************************************************************/
+
+book,part,article,chapter,toc,preface,appendix {
+	_vex-outline-content: titleabbrev, title;
+}
+
+section,sect1,sect2,sect3,sect4,sect5,simplesect {
+	_vex-outline-content: titleabbrev, title;
+}
+
+example,info {
+	_vex-outline-content: titleabbrev, title;
+}
+
+orderedlist,itemizedlist {
+	_vex-outline-content: titleabbrev, title;	
+}
+
+imagedata,textdata {
+	_vex-outline-content: attr(fileref),info,none;
+}
+
+table {
+	_vex-outline-content: title,caption,none;
+}
\ No newline at end of file