>
>
> When I try to run the below program, I get an exception regarding a "closed
> workspace".
> Is there another way for getting the AST, that doesn't involve Eclipse?
>
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at JavaApp.main(InstrumentMe.java:18)
> Caused by: java.lang.IllegalStateException: Workspace is closed.
> at
> org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java
> :340)
> at org.eclipse.cdt.internal.core.model.CModel.<init>(CModel.java:37)
> at
> org.eclipse.cdt.internal.core.model.CModelManager.<init>(CModelManager.java:
> 90)
> at
> org.eclipse.cdt.internal.core.model.CModelManager.getDefault(CModelManager.j
> ava:175)
> at org.eclipse.cdt.core.model.CoreModel.<clinit>(CoreModel.java:68)
> ... 1 more
>
>
> import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
> import org.eclipse.cdt.core.model.CoreModel;
> import org.eclipse.cdt.core.model.ITranslationUnit;
> import org.eclipse.core.runtime.IPath;
> import org.eclipse.core.runtime.Path;
>
> public class JavaApp {
>
> public static void main(String[] args) {
> try
> {
> String FN="C:\\CFILES\\File.c";
> IPath iPath=new Path(FN);
> ITranslationUnit TemplateTransUnit=(ITranslationUnit)
> CoreModel.getDefault().create(iPath);
> IASTTranslationUnit TemplateAST=TemplateTransUnit.getAST();
> System.out.println(TemplateAST.getRawSignature());
> }catch (Exception e) {e.printStackTrace();}
> }
>
> }
>
>
>
> _______________________________________________
> cdt-dev mailing list
>
cdt-dev@xxxxxxxxxxx>
https://dev.eclipse.org/mailman/listinfo/cdt-dev>
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxxhttps://dev.eclipse.org/mailman/listinfo/cdt-dev