Skip to content

Commit

Permalink
Added toc file parser to insure consistency
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Huebner <[email protected]>
  • Loading branch information
dhuebner committed Jan 14, 2015
1 parent 0986844 commit a1ed13b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion org.eclipse.xtext.xdoc.generator/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.xtext.xdoc;visibility:=reexport,
org.eclipse.xtend.typesystem.emf;visibility:=reexport,
org.eclipse.xtext.builder,
org.apache.commons.logging;visibility:=reexport,
org.apache.commons.lang;bundle-version="2.0.0";visibility:=reexport
org.apache.commons.lang;bundle-version="2.0.0";visibility:=reexport,
org.eclipse.help;bundle-version="3.4.0"
Import-Package: org.apache.log4j;version="1.2.15"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: templates,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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
*******************************************************************************/
package workflow;

import org.apache.log4j.Logger;
import org.eclipse.emf.mwe2.runtime.workflow.IWorkflowComponent;
import org.eclipse.emf.mwe2.runtime.workflow.IWorkflowContext;
import org.eclipse.help.IToc;
import org.eclipse.help.internal.toc.TocContribution;
import org.eclipse.help.internal.toc.TocFile;
import org.eclipse.help.internal.toc.TocFileParser;

/**
* @author dhuebner - Initial contribution and API
*/
@SuppressWarnings("restriction")
public class TocFileValidator implements IWorkflowComponent {
private String tocFile;
private static final Logger LOG = Logger.getLogger(TocFileValidator.class);

@Override
public void preInvoke() {

}

@Override
public void invoke(IWorkflowContext ctx) {
TocFileParser parser = new TocFileParser();
TocFile toc = new TocFile(null, tocFile, true, null, null, null);
try {
TocContribution parsed = parser.parse(toc);
IToc iToc = parsed.getToc();
LOG.info("Successfully parsed " + iToc.getLabel() + " from " + tocFile);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
public void postInvoke() {

}

public String getTocFile() {
return tocFile;
}

public void setTocFile(String tocFile) {
this.tocFile = tocFile;
}

}

0 comments on commit a1ed13b

Please sign in to comment.