Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » JMERGE without Eclipse
JMERGE without Eclipse [message #402861] Tue, 08 August 2006 14:11 Go to next message
Ben is currently offline Ben
Messages: 46
Registered: July 2009
Member
Hello,
I'd like to tun JMerge in the command line without eclipse. It works
succefully when I run jmerge into my eclipse plugin. But when I use this
part of the code in the command line, without eclipse, I'm getting this
exception:

java.lang.NullPointerException
at org.eclipse.jdt.internal.core.util.Util.getLineSeparator(Uti l.java:881)
at org.eclipse.jdt.core.jdom.DOMFactory.<init>(DOMFactory.java:32)
at
org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHel per.getJDOMFactory(JDOMFacadeHelper.java:60)
at
org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHel per.createCompilationUnit(JDOMFacadeHelper.java:67)
at
org.eclipse.emf.codegen.merge.java.JMerger.createCompilation UnitForContents(JMerger.java:285)
at
fr.dcn.components.sdk.arogenerator.utils.JMergeUtils.merge(J MergeUtils.java:165)
at
fr.dcn.components.sdk.arogenerator.codegenerator.VegaGenerat or.generate(VegaGenerator.java:109)
at AnnuaireTest.main(AnnuaireTest.java:45)

Line 881 is:
lineSeparator =
Platform.getPreferencesService().getString(Platform.PI_RUNTI ME,
Platform.PREF_LINE_SEPARATOR, null, scopeContext);
So, I think Preferences service is not initialized because i'm don't
running it into an eclipse application. What should I do?

I initialize JMerge with this code:

private JMerger getJMerger() {
String uri = "";
try {
uri = new
URI(getClass().getResource("/conf/merge.xml").toString()).toString();
} catch (URISyntaxException e) {
e.printStackTrace();
}
System.out.println("CWD: " + uri);
JControlModel controlModel = new JControlModel();
JDOMFacadeHelper helper = new JDOMFacadeHelper();
//ASTFacadeHelper helper = new ASTFacadeHelper();
controlModel.initialize(helper, uri);

JMerger jmerger = new JMerger(controlModel);

return jmerger;
}

I tried the ASTFacadeHelper but it doesn't merge anything.

Thanks

Ben
Re: JMERGE without Eclipse [message #402863 is a reply to message #402861] Tue, 08 August 2006 14:27 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26137
Registered: July 2009
Senior Member
Ben,

Yes, I didn't think JDT was completely set up to work standalone so
you'll need to run headless if you need to use the capability. Perhaps
when we switch from using JDOM to using AST
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=124372), we'll find that
AST will work standalone. We've not experimented with that yet.


Ben wrote:
> Hello,
> I'd like to tun JMerge in the command line without eclipse. It works
> succefully when I run jmerge into my eclipse plugin. But when I use
> this part of the code in the command line, without eclipse, I'm
> getting this exception:
>
> java.lang.NullPointerException
> at
> org.eclipse.jdt.internal.core.util.Util.getLineSeparator(Uti l.java:881)
> at org.eclipse.jdt.core.jdom.DOMFactory.<init>(DOMFactory.java:32)
> at
> org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHel per.getJDOMFactory(JDOMFacadeHelper.java:60)
>
> at
> org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMFacadeHel per.createCompilationUnit(JDOMFacadeHelper.java:67)
>
> at
> org.eclipse.emf.codegen.merge.java.JMerger.createCompilation UnitForContents(JMerger.java:285)
>
> at
> fr.dcn.components.sdk.arogenerator.utils.JMergeUtils.merge(J MergeUtils.java:165)
>
> at
> fr.dcn.components.sdk.arogenerator.codegenerator.VegaGenerat or.generate(VegaGenerator.java:109)
>
> at AnnuaireTest.main(AnnuaireTest.java:45)
>
> Line 881 is:
> lineSeparator =
> Platform.getPreferencesService().getString(Platform.PI_RUNTI ME,
> Platform.PREF_LINE_SEPARATOR, null, scopeContext);
> So, I think Preferences service is not initialized because i'm don't
> running it into an eclipse application. What should I do?
>
> I initialize JMerge with this code:
>
> private JMerger getJMerger() { String uri = "";
> try {
> uri = new
> URI(getClass().getResource("/conf/merge.xml").toString()).toString();
> } catch (URISyntaxException e) {
> e.printStackTrace();
> }
> System.out.println("CWD: " + uri);
> JControlModel controlModel = new JControlModel();
> JDOMFacadeHelper helper = new JDOMFacadeHelper();
> //ASTFacadeHelper helper = new ASTFacadeHelper();
> controlModel.initialize(helper, uri);
>
> JMerger jmerger = new JMerger(controlModel);
> return jmerger;
> }
>
> I tried the ASTFacadeHelper but it doesn't merge anything.
>
> Thanks
>
> Ben
>
>
Previous Topic:Should ItemPropertyDescriptor#isMany handle unspecified multiplicities?
Next Topic:Resource Set and Resources
Goto Forum:
  


Current Time: Thu Oct 23 02:00:25 GMT 2014

Powered by FUDForum. Page generated in 0.02046 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software