Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Teneo: .ejdo usage in generated editor
|
Re: Teneo: .ejdo usage in generated editor [message #67458 is a reply to message #67303] |
Mon, 08 January 2007 21:18 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Or it maybe my documentation writing skills....
What happens if you use the library.ejdo example which available in the
http://www.elver.org/jpox/resource_utility.html (see the hyperlink in the ejdo file section) page
and then change the properties to fit your connection properties and package etc.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> This question might stem from either my stupidity
> or a lack of documentation in teneo.
>
> I have a working, JPOX-enabled editor-plugin,
> with host/db/user/passwd properties
> in a jpox.properties file.
>
> I'd like to use the ResourceUtility
> http://www.elver.org/jpox/resource_utility.html,
>
> but fail to see how to adapt the initialisation described in
> http://www.elver.org/jpox/tutorial2/tutorial2_1.html
>
> I also could not find a snippet using the .ejdo in the examples.
>
> If I use my existing MzdataEditorPlugin.start(BundleContext context)
> ths will obviously fail in another setting, so the connection
> properties have to be removed.
>
> But then I get "org.eclipse.emf.teneo.jpox.JpoxStoreException: Specific
> properties have not been set" et al.
>
> Any hints, or did I miss the obvious somewhere ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFompdir2msrPI0lQRAiP0AJ9Y+3WW4koGWblKo4StTWg2a7fEVQCf SE4t
> H+Rn/5rnnjfXnE/M75Nh/VY=
> =OqtQ
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor [message #67499 is a reply to message #67458] |
Tue, 09 January 2007 08:46 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Taal schrieb:
> Hi Steffen,
> Or it maybe my documentation writing skills....
>
> What happens if you use the library.ejdo example which available in the
> http://www.elver.org/jpox/resource_utility.html (see the hyperlink in
> the ejdo file section) page and then change the properties to fit your
> connection properties and package etc.
Yup, that's what I did. My current Editor has a working MzdataEditorPlugin.start(),
including setting up the JpoxDataStore:
public void start(BundleContext context) throws Exception
{
Properties properties = new Properties();
properties.load(MzdataEditor.class.getResourceAsStream("/jpox.properties "));
String pmfName = "mzdata"; // the name of the JpoxDataStore
JpoxDataStore jpoxDataStore = JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
jpoxDataStore.setProperties(properties);
jpoxDataStore.setEPackages(new EPackage[]{MzdataPackage.eINSTANCE});
jpoxDataStore.initialize();
// this is required to force the editor to retrieve the correct resource
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "mzdata", new JPOXResourceFactory());
super.start(context);
}
If I now open the mzData.ejdo, and edit some *.mzdata file,
the editor shows the database content. Fine. (BTW: shouldn't
"Teneo->Open Resource open an Editor ?)
If I change the mzdata.ejdo to point to a different database,
it still shows the database set in the jpox.properties
If I comment out the complete start(), I get an ClassNotFoundException,
if I remove only the JpoDataStore code I get an
org.eclipse.emf.teneo.StoreException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
even though both mzdata.jdo
name=mzdata
nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
and MzdataPackage.java have the nsuri in it:
String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
I think I have set the ResourceFactory settings in
Mzdata.model/plugin.xml correctly as well:
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
type="mzdata"
class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " />
</extension>
So the real question is what to put into MzdataEditorPlugin.start()
to register the Mzdata EPackage with JPOX ?!
Yours,
Steffen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFo1Zuir2msrPI0lQRAhN2AJ4nppPHMUY14Tqov5NvpjvzHy41lwCg gHRT
vj5h3ot06ikLfqQP3AYT4pM=
=cXF4
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: .ejdo usage in generated editor [message #67541 is a reply to message #67499] |
Tue, 09 January 2007 09:33 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Can you post the content of the ejdo file?
Yes it should open an editor but this depends if the editor can be found (see the editorextension
description in the sample ejdo file).
That it shows the 'previous' database is maybe because you use the same jpoxdatastore name which you
already set in the start method.
The epackage is registered in a global registry. The resource utility registers the epackage with
jpox but it can't find the epackage using the nsuri. The nsuri registration of an epackage takes
place epackage impl (of mzdatapackageimpl) in the init method or otherwise in a static initializer.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Or it maybe my documentation writing skills....
>>
>> What happens if you use the library.ejdo example which available in the
>> http://www.elver.org/jpox/resource_utility.html (see the hyperlink in
>> the ejdo file section) page and then change the properties to fit your
>> connection properties and package etc.
> Yup, that's what I did. My current Editor has a working MzdataEditorPlugin.start(),
> including setting up the JpoxDataStore:
>
> public void start(BundleContext context) throws Exception
> {
> Properties properties = new Properties();
> properties.load(MzdataEditor.class.getResourceAsStream("/jpox.properties "));
> String pmfName = "mzdata"; // the name of the JpoxDataStore
> JpoxDataStore jpoxDataStore = JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
> jpoxDataStore.setProperties(properties);
> jpoxDataStore.setEPackages(new EPackage[]{MzdataPackage.eINSTANCE});
> jpoxDataStore.initialize();
>
> // this is required to force the editor to retrieve the correct resource
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "mzdata", new JPOXResourceFactory());
>
> super.start(context);
> }
>
> If I now open the mzData.ejdo, and edit some *.mzdata file,
> the editor shows the database content. Fine. (BTW: shouldn't
> "Teneo->Open Resource open an Editor ?)
>
> If I change the mzdata.ejdo to point to a different database,
> it still shows the database set in the jpox.properties
>
> If I comment out the complete start(), I get an ClassNotFoundException,
> if I remove only the JpoDataStore code I get an
>
> org.eclipse.emf.teneo.StoreException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
>
> even though both mzdata.jdo
>
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
>
> and MzdataPackage.java have the nsuri in it:
>
> String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
>
> I think I have set the ResourceFactory settings in
> Mzdata.model/plugin.xml correctly as well:
>
> <extension point="org.eclipse.emf.ecore.extension_parser">
> <parser
> type="mzdata"
> class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " />
> </extension>
>
> So the real question is what to put into MzdataEditorPlugin.start()
> to register the Mzdata EPackage with JPOX ?!
>
> Yours,
> Steffen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFo1Zuir2msrPI0lQRAhN2AJ4nppPHMUY14Tqov5NvpjvzHy41lwCg gHRT
> vj5h3ot06ikLfqQP3AYT4pM=
> =cXF4
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: Teneo: .ejdo usage in generated editor [message #67629 is a reply to message #67563] |
Tue, 09 January 2007 16:27 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
So you don't get this error anymore?
org.eclipse.emf.teneo.StoreException: EPackage with nsuri:
http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
I am not sure why it can't find the de.ipb.msbi.Mzdata.PrecursorListType class.
Is this class in a different model package?
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Can you post the content of the ejdo file?
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
> editorextension=mzdata
> dbname=mzdata
> dburl=jdbc:postgresql://kons/mzdata
> dbuser=sneumann
> dbpassword=
> dbdriver=org.postgresql.Driver
>
>> Yes it should open an editor but this depends if the editor can be found
>> (see the editorextension description in the sample ejdo file).
>> That it shows the 'previous' database is maybe because you use the same
>> jpoxdatastore name which you already set in the start method.
> I habe changed both the pmfName and the ExtensionToFactoryMap
> to mzdata2 the start Method, and get the Exception:
>
> - ->started update@plugins/org.eclipse.emf.teneo.jpox.eclipse_0.7.5.v200701051518.jar [442]
> org.jpox.exceptions.ClassNotResolvedException: Class de.ipb.msbi.Mzdata.PrecursorListType,org.eclipse.emf.ecore.E Object,org.eclipse.emf.common.notify.Notifier was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
> at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:213)
> at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:372)
> at org.jpox.store.StoreManager.initialiseAutoStart(StoreManager .java:418)
> at org.jpox.store.rdbms.RDBMSManager.initialiseSchema(RDBMSMana ger.java:735)
> at org.jpox.store.rdbms.RDBMSManager.<init>(RDBMSManager.java:268)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:4 94)
> at org.jpox.util.ClassUtils.newInstance(ClassUtils.java:73)
> at org.jpox.store.StoreManagerFactory.getStoreManager(StoreMana gerFactory.java:73)
> at org.jpox.AbstractPersistenceManager.getStoreManager(Abstract PersistenceManager.java:292)
> at org.jpox.AbstractPersistenceManager.<init>(AbstractPersistenceManager.java:214)
> at org.jpox.PersistenceManagerImpl.<init>(PersistenceManagerImpl.java:42)
> at org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager (PersistenceManagerFactoryImpl.java:178)
> at org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager (PersistenceManagerFactoryImpl.java:153)
> at org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:464)
> at org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:195)
> at org.eclipse.emf.teneo.jpox.JpoxUtil.getCreateDataStore(JpoxU til.java:87)
> at org.eclipse.emf.teneo.jpox.eclipse.OpenResource.openDataStor e(OpenResource.java:33)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:80)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
> at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
> at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3164)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2840)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>> The epackage is registered in a global registry. The resource utility
>> registers the epackage with jpox but it can't find the epackage using
>> the nsuri. The nsuri registration of an epackage takes place epackage
>> impl (of mzdatapackageimpl) in the init method or otherwise in a static
>> initializer.
>
> I think the (generated) code has that:
>
> ../MzdataPackage.java:
> public interface MzdataPackage extends EPackage {
> String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
> }
>
> private MzdataPackageImpl() {
> public static MzdataPackage init() {
> X super(eNS_URI, MzdataFactory.eINSTANCE);
> }
> }
>
> and setting a breakpoint (at the X position) shows
> that MzdataPackage.init() is called.
>
> Steffen
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFo256ir2msrPI0lQRAhfYAJsFS+6HCR6o30Vg4sJB/HpNbT0WBwCg kv14
> hs6pOsMrMR2QI6yxVtvJH0s=
> =RFLa
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: Teneo: .ejdo usage in generated editor [message #67726 is a reply to message #67664] |
Wed, 10 January 2007 15:23 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Eclipse has a default editor definition by extension. Can you check what it says for mzdata?
Have you tried the editorid (instead of editorextension)?
The open resource action should open a JpoxResource. This resource checks if the file for which it
was opened has the ejdo extension, if so it reads the properties and creates/registers a datastore
using those properties. The registration of the ejdo extension is done in the static initializer of
the JpoxHelper. So if the JpoxResource is not started then you probably also need to touch the
JpoxHelper also.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> So you don't get this error anymore?
>> org.eclipse.emf.teneo.StoreException: EPackage with nsuri:
>> http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
> No, I have placed a dummy call which registers
> the package upon first instanciation of a class
> public MzdataEditorPlugin.Implementation() {
> super();
> MzdataPackage m1 = MzdataPackage.eINSTANCE;
> plugin = this;
> }
>
>> I am not sure why it can't find the de.ipb.msbi.Mzdata.PrecursorListType
> That was because I connected to a different database
> that had old package names. Once I realised that is was a sign
> that indeed the .ejdo worked ;-)
>
>>>>> Yes it should open an editor but this depends if the editor can be found
>>>>> (see the editorextension description in the sample ejdo file).
> It still doesn't launch the editor. I have to Teneo->Open Ressource
> and then open a dummy *.mzdata file to show the database.
>
> So as posted before I have
> mzdata.ejdo:
> name=mzdata
> editorextension=mzdata
> and mzdata.editor/plugin.xml has extensions = "mzdata"
>
> <extension point = "org.eclipse.ui.editors">
> <editor
> id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
> name = "%_UI_MzdataEditor_label"
> icon = "icons/full/obj16/MzdataModelFile.gif"
> extensions = "mzdata"
> class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
> contributorClass=" de.ipbhalle.msbi.Mzdata.presentation.MzdataActionBarContribu tor " >
> </editor>
> </extension>
>
> I am unsure about "IMPORTANT: this should be the same name as used in the calls to JPOXHelper",
> because I have nowhere a call to JPOXHelper. (BTW inconcistency: its now JpoxHelper).
>
> Adding JpoxHelper.INSTANCE.createRegisterDataStore("mzdata"); to EditorPlugin.start()
> seems not to be enough, but I cant call jpoxDataStore.initialize(); because
> I don't know the jdbc properties.
>
> Any hints how the start() should look like to start the Editor
> with jdbc properties from the .ejdo ?
>
> Yours,
> Steffen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpLeGir2msrPI0lQRAsslAJ9Q70M5eG90mL+f6VZM6BF+2X437QCf flEz
> /s89r57MQJF+z4hQWOeX7cM=
> =SKRL
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #67746 is a reply to message #67726] |
Wed, 10 January 2007 17:06 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Summary (the solution turned up during writing the message,
the rest is only for the records...)
1) Don't open the .ejdo in a text editor and try to teneo->open resource
2) the start() as mentioned in the tutorial can be removed
and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
I'd suggest modifying the library editor tutorial accordingly,
since even the simple ResourceUtility is better than
hardCoded jdbc porps.
Would you like me to create patches for the tutorial,
or would that be more hassle than dpoing it yourself
for the next release ?
Yours,
Steffen
Martin Taal schrieb:
> Hi Steffen,
> Eclipse has a default editor definition by extension. Can you check what
> it says for mzdata?
In the runtime I have correctly *.mzdata -> Mzdata Model Editor
> Have you tried the editorid (instead of editorextension)?
editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
doesn't help either. With a completely garbled EditorIDmbmnbmnb
I get the "Unable to open Editor" message box as expected.
> The open resource action should open a JpoxResource. This resource
> checks if the file for which it was opened has the ejdo extension, if so
> it reads the properties and creates/registers a datastore using those
> properties. The registration of the ejdo extension is done in the static
> initializer of the JpoxHelper. So if the JpoxResource is not started
> then you probably also need to touch the JpoxHelper also.
Ah: There is different behaviour if I try to Teneo->open resource,
depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
again irrespective whether
a) .ejdo opened: Things are fine
b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
....
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
(full trace at the end)
where
public void MzdataEditor.createPages() {
// Creates the model from the editor input
//
969: createModel();
}
and
public void MzdataEditor.createModel() {
// Assumes that the input is a file object.
//
IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
public void StoreOpenResource.run(IAction action)
{
final File propFile = (File)selection.getFirstElement();
try
{
final Properties props = StoreEclipseUtil.readPropFile(selection);
openDataStore(props);
// now use the editor props to find the correct editor
final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
final String foundEditorID = getEditorID(editorid, editorextension);
// and open it
final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = workbenchWindow.getActivePage();
91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
More ideas ?
Yours,
Steffen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
AKA6jhnkZ08dIlV4y81UGlM=
=pWgl
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #67873 is a reply to message #67746] |
Thu, 11 January 2007 12:56 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Thanks, good that it works.
I will adapt the tutorial. I am not sure if I will completely replace the hard coded jdbc properties
with an ejdo file. I'll probably add a section about using ejdo instead of hard-coded props.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Summary (the solution turned up during writing the message,
> the rest is only for the records...)
>
> 1) Don't open the .ejdo in a text editor and try to teneo->open resource
> 2) the start() as mentioned in the tutorial can be removed
> and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
>
> I'd suggest modifying the library editor tutorial accordingly,
> since even the simple ResourceUtility is better than
> hardCoded jdbc porps.
>
> Would you like me to create patches for the tutorial,
> or would that be more hassle than dpoing it yourself
> for the next release ?
>
> Yours,
> Steffen
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Eclipse has a default editor definition by extension. Can you check what
>> it says for mzdata?
> In the runtime I have correctly *.mzdata -> Mzdata Model Editor
>
>> Have you tried the editorid (instead of editorextension)?
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
>
> doesn't help either. With a completely garbled EditorIDmbmnbmnb
> I get the "Unable to open Editor" message box as expected.
>
>> The open resource action should open a JpoxResource. This resource
>> checks if the file for which it was opened has the ejdo extension, if so
>> it reads the properties and creates/registers a datastore using those
>> properties. The registration of the ejdo extension is done in the static
>> initializer of the JpoxHelper. So if the JpoxResource is not started
>> then you probably also need to touch the JpoxHelper also.
>
> Ah: There is different behaviour if I try to Teneo->open resource,
> depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
> again irrespective whether
>
> a) .ejdo opened: Things are fine
> b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
> Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
> ....
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> (full trace at the end)
>
> where
> public void MzdataEditor.createPages() {
> // Creates the model from the editor input
> //
> 969: createModel();
> }
>
> and
>
> public void MzdataEditor.createModel() {
> // Assumes that the input is a file object.
> //
> IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
> URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
> 935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
>
>
>
> public void StoreOpenResource.run(IAction action)
> {
> final File propFile = (File)selection.getFirstElement();
> try
> {
> final Properties props = StoreEclipseUtil.readPropFile(selection);
> openDataStore(props);
>
> // now use the editor props to find the correct editor
> final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
>
> final String foundEditorID = getEditorID(editorid, editorextension);
>
> // and open it
> final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> final IWorkbenchPage page = workbenchWindow.getActivePage();
> 91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
>
>
> More ideas ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
> AKA6jhnkZ08dIlV4y81UGlM=
> =pWgl
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #67935 is a reply to message #67746] |
Thu, 11 January 2007 12:58 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Thanks, good that it works.
I will adapt the tutorial. I am not sure if I will completely replace the hard coded jdbc properties
with an ejdo file. I'll probably add a section about using ejdo instead of hard-coded props.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Summary (the solution turned up during writing the message,
> the rest is only for the records...)
>
> 1) Don't open the .ejdo in a text editor and try to teneo->open resource
> 2) the start() as mentioned in the tutorial can be removed
> and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
>
> I'd suggest modifying the library editor tutorial accordingly,
> since even the simple ResourceUtility is better than
> hardCoded jdbc porps.
>
> Would you like me to create patches for the tutorial,
> or would that be more hassle than dpoing it yourself
> for the next release ?
>
> Yours,
> Steffen
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Eclipse has a default editor definition by extension. Can you check what
>> it says for mzdata?
> In the runtime I have correctly *.mzdata -> Mzdata Model Editor
>
>> Have you tried the editorid (instead of editorextension)?
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
>
> doesn't help either. With a completely garbled EditorIDmbmnbmnb
> I get the "Unable to open Editor" message box as expected.
>
>> The open resource action should open a JpoxResource. This resource
>> checks if the file for which it was opened has the ejdo extension, if so
>> it reads the properties and creates/registers a datastore using those
>> properties. The registration of the ejdo extension is done in the static
>> initializer of the JpoxHelper. So if the JpoxResource is not started
>> then you probably also need to touch the JpoxHelper also.
>
> Ah: There is different behaviour if I try to Teneo->open resource,
> depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
> again irrespective whether
>
> a) .ejdo opened: Things are fine
> b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
> Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
> ....
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> (full trace at the end)
>
> where
> public void MzdataEditor.createPages() {
> // Creates the model from the editor input
> //
> 969: createModel();
> }
>
> and
>
> public void MzdataEditor.createModel() {
> // Assumes that the input is a file object.
> //
> IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
> URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
> 935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
>
>
>
> public void StoreOpenResource.run(IAction action)
> {
> final File propFile = (File)selection.getFirstElement();
> try
> {
> final Properties props = StoreEclipseUtil.readPropFile(selection);
> openDataStore(props);
>
> // now use the editor props to find the correct editor
> final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
>
> final String foundEditorID = getEditorID(editorid, editorextension);
>
> // and open it
> final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> final IWorkbenchPage page = workbenchWindow.getActivePage();
> 91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
>
>
> More ideas ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
> AKA6jhnkZ08dIlV4y81UGlM=
> =pWgl
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Teneo: [Regression].ejdo usage in generated editor [message #103671 is a reply to message #67303] |
Mon, 26 November 2007 10:23 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I think I found a regression between earlier versions
of EMFT and now. I have a working editor which connects to a Postgres using an .ejdo.
This includes Eclipse 3.2, EMF 2.2 and Teneo 0.7.5
If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
I get the dreaded "EPackage with nsuri: http://psidev.so...ta/mzdata.xsd can not be found"
I also rebuilt the whole project using the current EMF, to no avail.
I also included my hack to Register the Package by creating a dummy Instance.
public static class Implementation extends EclipseUIPlugin { public Implementation() {
super();
// Dummy call to register Package for EMF Teneo's ejdo
MzdataPackage m1 = MzdataPackage.eINSTANCE;
// Remember the static instance.
//
plugin = this;
}
}
Has anything changed which is not reflected in the library tutorial on the elver.org site ?
Yours
Steffen
[INFO] JpoxHelper - Registering a jpox resource factory for all uri's with jpox as the protocol/extension
[INFO] JpoxHelper - Registering a jpox resource factory for all uri's with ejdo as the protocol/extension
[INFO] JpoxHelper - Registering a jpox resource dao factory for all uri's with jpoxdao as the protocol/extension
[ERROR] TeneoException - EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found, <org.eclipse.emf.teneo.TeneoException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,>org.eclipse.emf.teneo.TeneoException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
at org.eclipse.emf.teneo.util.StoreUtil.getEPackages(StoreUtil. java:494)
at org.eclipse.emf.teneo.jpox.JpoxUtil.getCreateDataStore(JpoxU til.java:81)
at org.eclipse.emf.teneo.jpox.eclipse.OpenResource.openDataStor e(OpenResource.java:33)
at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:68)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:256)
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
- ------------------------------------------------------------ -------------------------
Can't read normal XML Files anymore:
If I change the mzdata model parser to JPOXResourceFactory
as described in the tutorial, I can't read normal XML files anymore,
giving me an NPE (stack below):
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser type="mzdata"
class="de.ipbhalle.msbi.Mzdata.util.MzdataResourceFactoryImpl " />
<!-- parser type="mzdata"
class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " -->
</extension>
If I check the resourceURI, it has "platform:/resource/IPB%20MSBI%20Data/example_kai.mzdata"
but the getResource() fails.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:1005)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:283)
at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
at org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
at org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
at org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3296)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2974)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
at org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3296)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2974)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
- ------------------------------------------------------------ -------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSp6Gir2msrPI0lQRAuqcAJ9EDR5zLS+jB8pWnjAFoxhg/9i4SACe NEUy
P6sg7kw/2H9v9ASONnuzHEE=
=Tu7a
-----END PGP SIGNATURE-----
|
|
| | |
Re: Teneo: [Regression].ejdo usage in generated editor [message #103729 is a reply to message #103701] |
Mon, 26 November 2007 12:37 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Taal schrieb:
....
> Is the line:
> MzdataPackage m1 = MzdataPackage.eINSTANCE;
> executed before you open the ejdo file?
> Maybe you should look at the way emf initializes the plugins (just
> guessing here).
But a good guess ;-) If right after the start I open an ejdo,
the breakpoint inside MzdataEditorPlugin.implementation() is not hit,
actually not even the constructor MzdataEditorPlugin().
<extension point = "org.eclipse.ui.editors">
<editor
id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
extensions = "mzdata"
class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
</editor>
</extension>
name=mzdata
nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
dbname=mzData
dburl=jdbc:postgresql://kons/mzData
In the old eclipse-3.2 The breakpoint in Implementation() is being hit
upon opening the ejdo.
> Regarding the npe, it is difficult for me to comment on that as I do not
> know what is present on line 970 in the MzdataEditor.java. Can you post
> part of the code and let me know what is null?
Sorry, I am catching a Cold which makes me think a bit slow today.
There seems to be a problem because resource==NULL without an exception thrown.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
955: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
970: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
new BasicDiagnostic
(Diagnostic.ERROR,
"mzData.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
new Object [] { exception == null ? (Object)resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
}
>
> gr. Martin
>
> sneumann wrote:
> sneumann schrieb:
>>>> If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
> That should read 0.8.0.v200709051239
>
> Yours,
> Steffe
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSr31ir2msrPI0lQRAnjOAKCCuN/nHXHtZ1/J04F9XctlWkWhGQCg hPFa
upBqlKn+yKqYXazIqZAIpVc=
=FmHu
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: [Regression].ejdo usage in generated editor [message #103741 is a reply to message #103729] |
Mon, 26 November 2007 13:45 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Teneo will try to find the epackage before the editor is opened so the initialization code should
probably be located somewhere else (in a location called when eclipse starts). I am not sure but I
can think that you can specify in the plugin that it should be initialized at startup.
Regarding the npe, I don't know why it won't find the resource, can you try to debug into the code
(editingDomain.getResourceSet().getResource(...)) and see what happens?
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
> ....
>> Is the line:
>> MzdataPackage m1 = MzdataPackage.eINSTANCE;
>> executed before you open the ejdo file?
>> Maybe you should look at the way emf initializes the plugins (just
>> guessing here).
>
> But a good guess ;-) If right after the start I open an ejdo,
> the breakpoint inside MzdataEditorPlugin.implementation() is not hit,
> actually not even the constructor MzdataEditorPlugin().
>
> <extension point = "org.eclipse.ui.editors">
> <editor
> id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
> extensions = "mzdata"
> class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
> </editor>
> </extension>
>
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
> dbname=mzData
> dburl=jdbc:postgresql://kons/mzData
>
> In the old eclipse-3.2 The breakpoint in Implementation() is being hit
> upon opening the ejdo.
>
>> Regarding the npe, it is difficult for me to comment on that as I do not
>> know what is present on line 970 in the MzdataEditor.java. Can you post
>> part of the code and let me know what is null?
> Sorry, I am catching a Cold which makes me think a bit slow today.
> There seems to be a problem because resource==NULL without an exception thrown.
>
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
>
> public void createModel() {
> URI resourceURI = EditUIUtil.getURI(getEditorInput());
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 955: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
> 970: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
> new BasicDiagnostic
> (Diagnostic.ERROR,
> "mzData.editor",
> 0,
> getString("_UI_CreateModelError_message", resource.getURI()),
> new Object [] { exception == null ? (Object)resource : exception });
> basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
> return basicDiagnostic;
> }
>
>> gr. Martin
>>
>> sneumann wrote:
>> sneumann schrieb:
>>>>> If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
>> That should read 0.8.0.v200709051239
>>
>> Yours,
>> Steffe
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHSr31ir2msrPI0lQRAnjOAKCCuN/nHXHtZ1/J04F9XctlWkWhGQCg hPFa
> upBqlKn+yKqYXazIqZAIpVc=
> =FmHu
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| | | | | | | | | |
Re: Teneo: .ejdo usage in generated editor [message #600981 is a reply to message #67303] |
Mon, 08 January 2007 21:18 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Or it maybe my documentation writing skills....
What happens if you use the library.ejdo example which available in the
http://www.elver.org/jpox/resource_utility.html (see the hyperlink in the ejdo file section) page
and then change the properties to fit your connection properties and package etc.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> This question might stem from either my stupidity
> or a lack of documentation in teneo.
>
> I have a working, JPOX-enabled editor-plugin,
> with host/db/user/passwd properties
> in a jpox.properties file.
>
> I'd like to use the ResourceUtility
> http://www.elver.org/jpox/resource_utility.html,
>
> but fail to see how to adapt the initialisation described in
> http://www.elver.org/jpox/tutorial2/tutorial2_1.html
>
> I also could not find a snippet using the .ejdo in the examples.
>
> If I use my existing MzdataEditorPlugin.start(BundleContext context)
> ths will obviously fail in another setting, so the connection
> properties have to be removed.
>
> But then I get "org.eclipse.emf.teneo.jpox.JpoxStoreException: Specific
> properties have not been set" et al.
>
> Any hints, or did I miss the obvious somewhere ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFompdir2msrPI0lQRAiP0AJ9Y+3WW4koGWblKo4StTWg2a7fEVQCf SE4t
> H+Rn/5rnnjfXnE/M75Nh/VY=
> =OqtQ
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor [message #600995 is a reply to message #67458] |
Tue, 09 January 2007 08:46 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Taal schrieb:
> Hi Steffen,
> Or it maybe my documentation writing skills....
>
> What happens if you use the library.ejdo example which available in the
> http://www.elver.org/jpox/resource_utility.html (see the hyperlink in
> the ejdo file section) page and then change the properties to fit your
> connection properties and package etc.
Yup, that's what I did. My current Editor has a working MzdataEditorPlugin.start(),
including setting up the JpoxDataStore:
public void start(BundleContext context) throws Exception
{
Properties properties = new Properties();
properties.load(MzdataEditor.class.getResourceAsStream("/jpox.properties "));
String pmfName = "mzdata"; // the name of the JpoxDataStore
JpoxDataStore jpoxDataStore = JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
jpoxDataStore.setProperties(properties);
jpoxDataStore.setEPackages(new EPackage[]{MzdataPackage.eINSTANCE});
jpoxDataStore.initialize();
// this is required to force the editor to retrieve the correct resource
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "mzdata", new JPOXResourceFactory());
super.start(context);
}
If I now open the mzData.ejdo, and edit some *.mzdata file,
the editor shows the database content. Fine. (BTW: shouldn't
"Teneo->Open Resource open an Editor ?)
If I change the mzdata.ejdo to point to a different database,
it still shows the database set in the jpox.properties
If I comment out the complete start(), I get an ClassNotFoundException,
if I remove only the JpoDataStore code I get an
org.eclipse.emf.teneo.StoreException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
even though both mzdata.jdo
name=mzdata
nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
and MzdataPackage.java have the nsuri in it:
String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
I think I have set the ResourceFactory settings in
Mzdata.model/plugin.xml correctly as well:
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
type="mzdata"
class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " />
</extension>
So the real question is what to put into MzdataEditorPlugin.start()
to register the Mzdata EPackage with JPOX ?!
Yours,
Steffen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFo1Zuir2msrPI0lQRAhN2AJ4nppPHMUY14Tqov5NvpjvzHy41lwCg gHRT
vj5h3ot06ikLfqQP3AYT4pM=
=cXF4
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: .ejdo usage in generated editor [message #601005 is a reply to message #67499] |
Tue, 09 January 2007 09:33 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Can you post the content of the ejdo file?
Yes it should open an editor but this depends if the editor can be found (see the editorextension
description in the sample ejdo file).
That it shows the 'previous' database is maybe because you use the same jpoxdatastore name which you
already set in the start method.
The epackage is registered in a global registry. The resource utility registers the epackage with
jpox but it can't find the epackage using the nsuri. The nsuri registration of an epackage takes
place epackage impl (of mzdatapackageimpl) in the init method or otherwise in a static initializer.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Or it maybe my documentation writing skills....
>>
>> What happens if you use the library.ejdo example which available in the
>> http://www.elver.org/jpox/resource_utility.html (see the hyperlink in
>> the ejdo file section) page and then change the properties to fit your
>> connection properties and package etc.
> Yup, that's what I did. My current Editor has a working MzdataEditorPlugin.start(),
> including setting up the JpoxDataStore:
>
> public void start(BundleContext context) throws Exception
> {
> Properties properties = new Properties();
> properties.load(MzdataEditor.class.getResourceAsStream("/jpox.properties "));
> String pmfName = "mzdata"; // the name of the JpoxDataStore
> JpoxDataStore jpoxDataStore = JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
> jpoxDataStore.setProperties(properties);
> jpoxDataStore.setEPackages(new EPackage[]{MzdataPackage.eINSTANCE});
> jpoxDataStore.initialize();
>
> // this is required to force the editor to retrieve the correct resource
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "mzdata", new JPOXResourceFactory());
>
> super.start(context);
> }
>
> If I now open the mzData.ejdo, and edit some *.mzdata file,
> the editor shows the database content. Fine. (BTW: shouldn't
> "Teneo->Open Resource open an Editor ?)
>
> If I change the mzdata.ejdo to point to a different database,
> it still shows the database set in the jpox.properties
>
> If I comment out the complete start(), I get an ClassNotFoundException,
> if I remove only the JpoDataStore code I get an
>
> org.eclipse.emf.teneo.StoreException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
>
> even though both mzdata.jdo
>
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
>
> and MzdataPackage.java have the nsuri in it:
>
> String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
>
> I think I have set the ResourceFactory settings in
> Mzdata.model/plugin.xml correctly as well:
>
> <extension point="org.eclipse.emf.ecore.extension_parser">
> <parser
> type="mzdata"
> class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " />
> </extension>
>
> So the real question is what to put into MzdataEditorPlugin.start()
> to register the Mzdata EPackage with JPOX ?!
>
> Yours,
> Steffen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFo1Zuir2msrPI0lQRAhN2AJ4nppPHMUY14Tqov5NvpjvzHy41lwCg gHRT
> vj5h3ot06ikLfqQP3AYT4pM=
> =cXF4
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: Teneo: .ejdo usage in generated editor [message #601032 is a reply to message #67563] |
Tue, 09 January 2007 16:27 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
So you don't get this error anymore?
org.eclipse.emf.teneo.StoreException: EPackage with nsuri:
http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
I am not sure why it can't find the de.ipb.msbi.Mzdata.PrecursorListType class.
Is this class in a different model package?
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Can you post the content of the ejdo file?
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
> editorextension=mzdata
> dbname=mzdata
> dburl=jdbc:postgresql://kons/mzdata
> dbuser=sneumann
> dbpassword=
> dbdriver=org.postgresql.Driver
>
>> Yes it should open an editor but this depends if the editor can be found
>> (see the editorextension description in the sample ejdo file).
>> That it shows the 'previous' database is maybe because you use the same
>> jpoxdatastore name which you already set in the start method.
> I habe changed both the pmfName and the ExtensionToFactoryMap
> to mzdata2 the start Method, and get the Exception:
>
> - ->started update@plugins/org.eclipse.emf.teneo.jpox.eclipse_0.7.5.v200701051518.jar [442]
> org.jpox.exceptions.ClassNotResolvedException: Class de.ipb.msbi.Mzdata.PrecursorListType,org.eclipse.emf.ecore.E Object,org.eclipse.emf.common.notify.Notifier was not found in the CLASSPATH. Please check your specification and your CLASSPATH.
> at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:213)
> at org.jpox.JDOClassLoaderResolver.classForName(JDOClassLoaderR esolver.java:372)
> at org.jpox.store.StoreManager.initialiseAutoStart(StoreManager .java:418)
> at org.jpox.store.rdbms.RDBMSManager.initialiseSchema(RDBMSMana ger.java:735)
> at org.jpox.store.rdbms.RDBMSManager.<init>(RDBMSManager.java:268)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ e Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Native ConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De legatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:4 94)
> at org.jpox.util.ClassUtils.newInstance(ClassUtils.java:73)
> at org.jpox.store.StoreManagerFactory.getStoreManager(StoreMana gerFactory.java:73)
> at org.jpox.AbstractPersistenceManager.getStoreManager(Abstract PersistenceManager.java:292)
> at org.jpox.AbstractPersistenceManager.<init>(AbstractPersistenceManager.java:214)
> at org.jpox.PersistenceManagerImpl.<init>(PersistenceManagerImpl.java:42)
> at org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager (PersistenceManagerFactoryImpl.java:178)
> at org.jpox.PersistenceManagerFactoryImpl.getPersistenceManager (PersistenceManagerFactoryImpl.java:153)
> at org.eclipse.emf.teneo.jpox.JpoxDataStore.createSchema(JpoxDa taStore.java:464)
> at org.eclipse.emf.teneo.jpox.JpoxDataStore.initialize(JpoxData Store.java:195)
> at org.eclipse.emf.teneo.jpox.JpoxUtil.getCreateDataStore(JpoxU til.java:87)
> at org.eclipse.emf.teneo.jpox.eclipse.OpenResource.openDataStor e(OpenResource.java:33)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:80)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
> at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
> at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3164)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2840)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>> The epackage is registered in a global registry. The resource utility
>> registers the epackage with jpox but it can't find the epackage using
>> the nsuri. The nsuri registration of an epackage takes place epackage
>> impl (of mzdatapackageimpl) in the init method or otherwise in a static
>> initializer.
>
> I think the (generated) code has that:
>
> ../MzdataPackage.java:
> public interface MzdataPackage extends EPackage {
> String eNS_URI = "http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd";
> }
>
> private MzdataPackageImpl() {
> public static MzdataPackage init() {
> X super(eNS_URI, MzdataFactory.eINSTANCE);
> }
> }
>
> and setting a breakpoint (at the X position) shows
> that MzdataPackage.init() is called.
>
> Steffen
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFo256ir2msrPI0lQRAhfYAJsFS+6HCR6o30Vg4sJB/HpNbT0WBwCg kv14
> hs6pOsMrMR2QI6yxVtvJH0s=
> =RFLa
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| |
Re: Teneo: .ejdo usage in generated editor [message #601062 is a reply to message #67664] |
Wed, 10 January 2007 15:23 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Eclipse has a default editor definition by extension. Can you check what it says for mzdata?
Have you tried the editorid (instead of editorextension)?
The open resource action should open a JpoxResource. This resource checks if the file for which it
was opened has the ejdo extension, if so it reads the properties and creates/registers a datastore
using those properties. The registration of the ejdo extension is done in the static initializer of
the JpoxHelper. So if the JpoxResource is not started then you probably also need to touch the
JpoxHelper also.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
>> So you don't get this error anymore?
>> org.eclipse.emf.teneo.StoreException: EPackage with nsuri:
>> http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
> No, I have placed a dummy call which registers
> the package upon first instanciation of a class
> public MzdataEditorPlugin.Implementation() {
> super();
> MzdataPackage m1 = MzdataPackage.eINSTANCE;
> plugin = this;
> }
>
>> I am not sure why it can't find the de.ipb.msbi.Mzdata.PrecursorListType
> That was because I connected to a different database
> that had old package names. Once I realised that is was a sign
> that indeed the .ejdo worked ;-)
>
>>>>> Yes it should open an editor but this depends if the editor can be found
>>>>> (see the editorextension description in the sample ejdo file).
> It still doesn't launch the editor. I have to Teneo->Open Ressource
> and then open a dummy *.mzdata file to show the database.
>
> So as posted before I have
> mzdata.ejdo:
> name=mzdata
> editorextension=mzdata
> and mzdata.editor/plugin.xml has extensions = "mzdata"
>
> <extension point = "org.eclipse.ui.editors">
> <editor
> id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
> name = "%_UI_MzdataEditor_label"
> icon = "icons/full/obj16/MzdataModelFile.gif"
> extensions = "mzdata"
> class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
> contributorClass=" de.ipbhalle.msbi.Mzdata.presentation.MzdataActionBarContribu tor " >
> </editor>
> </extension>
>
> I am unsure about "IMPORTANT: this should be the same name as used in the calls to JPOXHelper",
> because I have nowhere a call to JPOXHelper. (BTW inconcistency: its now JpoxHelper).
>
> Adding JpoxHelper.INSTANCE.createRegisterDataStore("mzdata"); to EditorPlugin.start()
> seems not to be enough, but I cant call jpoxDataStore.initialize(); because
> I don't know the jdbc properties.
>
> Any hints how the start() should look like to start the Editor
> with jdbc properties from the .ejdo ?
>
> Yours,
> Steffen
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpLeGir2msrPI0lQRAsslAJ9Q70M5eG90mL+f6VZM6BF+2X437QCf flEz
> /s89r57MQJF+z4hQWOeX7cM=
> =SKRL
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #601068 is a reply to message #67726] |
Wed, 10 January 2007 17:06 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Summary (the solution turned up during writing the message,
the rest is only for the records...)
1) Don't open the .ejdo in a text editor and try to teneo->open resource
2) the start() as mentioned in the tutorial can be removed
and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
I'd suggest modifying the library editor tutorial accordingly,
since even the simple ResourceUtility is better than
hardCoded jdbc porps.
Would you like me to create patches for the tutorial,
or would that be more hassle than dpoing it yourself
for the next release ?
Yours,
Steffen
Martin Taal schrieb:
> Hi Steffen,
> Eclipse has a default editor definition by extension. Can you check what
> it says for mzdata?
In the runtime I have correctly *.mzdata -> Mzdata Model Editor
> Have you tried the editorid (instead of editorextension)?
editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
doesn't help either. With a completely garbled EditorIDmbmnbmnb
I get the "Unable to open Editor" message box as expected.
> The open resource action should open a JpoxResource. This resource
> checks if the file for which it was opened has the ejdo extension, if so
> it reads the properties and creates/registers a datastore using those
> properties. The registration of the ejdo extension is done in the static
> initializer of the JpoxHelper. So if the JpoxResource is not started
> then you probably also need to touch the JpoxHelper also.
Ah: There is different behaviour if I try to Teneo->open resource,
depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
again irrespective whether
a) .ejdo opened: Things are fine
b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
....
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
(full trace at the end)
where
public void MzdataEditor.createPages() {
// Creates the model from the editor input
//
969: createModel();
}
and
public void MzdataEditor.createModel() {
// Assumes that the input is a file object.
//
IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
public void StoreOpenResource.run(IAction action)
{
final File propFile = (File)selection.getFirstElement();
try
{
final Properties props = StoreEclipseUtil.readPropFile(selection);
openDataStore(props);
// now use the editor props to find the correct editor
final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
final String foundEditorID = getEditorID(editorid, editorextension);
// and open it
final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = workbenchWindow.getActivePage();
91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
More ideas ?
Yours,
Steffen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
AKA6jhnkZ08dIlV4y81UGlM=
=pWgl
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #601121 is a reply to message #67746] |
Thu, 11 January 2007 12:56 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Thanks, good that it works.
I will adapt the tutorial. I am not sure if I will completely replace the hard coded jdbc properties
with an ejdo file. I'll probably add a section about using ejdo instead of hard-coded props.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Summary (the solution turned up during writing the message,
> the rest is only for the records...)
>
> 1) Don't open the .ejdo in a text editor and try to teneo->open resource
> 2) the start() as mentioned in the tutorial can be removed
> and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
>
> I'd suggest modifying the library editor tutorial accordingly,
> since even the simple ResourceUtility is better than
> hardCoded jdbc porps.
>
> Would you like me to create patches for the tutorial,
> or would that be more hassle than dpoing it yourself
> for the next release ?
>
> Yours,
> Steffen
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Eclipse has a default editor definition by extension. Can you check what
>> it says for mzdata?
> In the runtime I have correctly *.mzdata -> Mzdata Model Editor
>
>> Have you tried the editorid (instead of editorextension)?
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
>
> doesn't help either. With a completely garbled EditorIDmbmnbmnb
> I get the "Unable to open Editor" message box as expected.
>
>> The open resource action should open a JpoxResource. This resource
>> checks if the file for which it was opened has the ejdo extension, if so
>> it reads the properties and creates/registers a datastore using those
>> properties. The registration of the ejdo extension is done in the static
>> initializer of the JpoxHelper. So if the JpoxResource is not started
>> then you probably also need to touch the JpoxHelper also.
>
> Ah: There is different behaviour if I try to Teneo->open resource,
> depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
> again irrespective whether
>
> a) .ejdo opened: Things are fine
> b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
> Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
> ....
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> (full trace at the end)
>
> where
> public void MzdataEditor.createPages() {
> // Creates the model from the editor input
> //
> 969: createModel();
> }
>
> and
>
> public void MzdataEditor.createModel() {
> // Assumes that the input is a file object.
> //
> IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
> URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
> 935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
>
>
>
> public void StoreOpenResource.run(IAction action)
> {
> final File propFile = (File)selection.getFirstElement();
> try
> {
> final Properties props = StoreEclipseUtil.readPropFile(selection);
> openDataStore(props);
>
> // now use the editor props to find the correct editor
> final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
>
> final String foundEditorID = getEditorID(editorid, editorextension);
>
> // and open it
> final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> final IWorkbenchPage page = workbenchWindow.getActivePage();
> 91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
>
>
> More ideas ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
> AKA6jhnkZ08dIlV4y81UGlM=
> =pWgl
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Teneo: .ejdo usage in generated editor (Solved) [message #601150 is a reply to message #67746] |
Thu, 11 January 2007 12:58 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Steffen,
Thanks, good that it works.
I will adapt the tutorial. I am not sure if I will completely replace the hard coded jdbc properties
with an ejdo file. I'll probably add a section about using ejdo instead of hard-coded props.
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Summary (the solution turned up during writing the message,
> the rest is only for the records...)
>
> 1) Don't open the .ejdo in a text editor and try to teneo->open resource
> 2) the start() as mentioned in the tutorial can be removed
> and _must not_ contain an JpoxHelper.INSTANCE.createRegisterDataStore(pmfName);
>
> I'd suggest modifying the library editor tutorial accordingly,
> since even the simple ResourceUtility is better than
> hardCoded jdbc porps.
>
> Would you like me to create patches for the tutorial,
> or would that be more hassle than dpoing it yourself
> for the next release ?
>
> Yours,
> Steffen
>
> Martin Taal schrieb:
>> Hi Steffen,
>> Eclipse has a default editor definition by extension. Can you check what
>> it says for mzdata?
> In the runtime I have correctly *.mzdata -> Mzdata Model Editor
>
>> Have you tried the editorid (instead of editorextension)?
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
>
> doesn't help either. With a completely garbled EditorIDmbmnbmnb
> I get the "Unable to open Editor" message box as expected.
>
>> The open resource action should open a JpoxResource. This resource
>> checks if the file for which it was opened has the ejdo extension, if so
>> it reads the properties and creates/registers a datastore using those
>> properties. The registration of the ejdo extension is done in the static
>> initializer of the JpoxHelper. So if the JpoxResource is not started
>> then you probably also need to touch the JpoxHelper also.
>
> Ah: There is different behaviour if I try to Teneo->open resource,
> depending whether the mzdata.ejdo is opened in a (text-) editor in the runtime workbench,
> again irrespective whether
>
> a) .ejdo opened: Things are fine
> b) .ejdo closed: An (editor) tab named mzdata.ejdo opens with
> Unable to create this part due to an internal error. Reason for the failure: An unexpected exception was thrown.
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:935)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:920)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:969)
> ....
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2470)
> at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:91)
> at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
> (full trace at the end)
>
> where
> public void MzdataEditor.createPages() {
> // Creates the model from the editor input
> //
> 969: createModel();
> }
>
> and
>
> public void MzdataEditor.createModel() {
> // Assumes that the input is a file object.
> //
> IFileEditorInput modelFile = (IFileEditorInput)getEditorInput();
> URI resourceURI = URI.createPlatformResourceURI(modelFile.getFile().getFullPat h().toString());;
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 920: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic MzdataEditor.analyzeResourceProblems(Resource resource, Exception exception) {
> 935: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
>
>
>
> public void StoreOpenResource.run(IAction action)
> {
> final File propFile = (File)selection.getFirstElement();
> try
> {
> final Properties props = StoreEclipseUtil.readPropFile(selection);
> openDataStore(props);
>
> // now use the editor props to find the correct editor
> final String editorextension = doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
>
> final String foundEditorID = getEditorID(editorid, editorextension);
>
> // and open it
> final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
> final IWorkbenchPage page = workbenchWindow.getActivePage();
> 91: page.openEditor(new FileEditorInput(propFile), foundEditorID);
>
>
> More ideas ?
>
> Yours,
> Steffen
>
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFpR0Sir2msrPI0lQRAkHxAJsHcd1NRco9g3MgDNb+2yLMHQ53EACf dxf2
> AKA6jhnkZ08dIlV4y81UGlM=
> =pWgl
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Teneo: [Regression].ejdo usage in generated editor [message #612661 is a reply to message #67303] |
Mon, 26 November 2007 10:23 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I think I found a regression between earlier versions
of EMFT and now. I have a working editor which connects to a Postgres using an .ejdo.
This includes Eclipse 3.2, EMF 2.2 and Teneo 0.7.5
If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
I get the dreaded "EPackage with nsuri: http://psidev.so...ta/mzdata.xsd can not be found"
I also rebuilt the whole project using the current EMF, to no avail.
I also included my hack to Register the Package by creating a dummy Instance.
public static class Implementation extends EclipseUIPlugin { public Implementation() {
super();
// Dummy call to register Package for EMF Teneo's ejdo
MzdataPackage m1 = MzdataPackage.eINSTANCE;
// Remember the static instance.
//
plugin = this;
}
}
Has anything changed which is not reflected in the library tutorial on the elver.org site ?
Yours
Steffen
[INFO] JpoxHelper - Registering a jpox resource factory for all uri's with jpox as the protocol/extension
[INFO] JpoxHelper - Registering a jpox resource factory for all uri's with ejdo as the protocol/extension
[INFO] JpoxHelper - Registering a jpox resource dao factory for all uri's with jpoxdao as the protocol/extension
[ERROR] TeneoException - EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found, <org.eclipse.emf.teneo.TeneoException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,>org.eclipse.emf.teneo.TeneoException: EPackage with nsuri: http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd can not be found,
at org.eclipse.emf.teneo.util.StoreUtil.getEPackages(StoreUtil. java:494)
at org.eclipse.emf.teneo.jpox.JpoxUtil.getCreateDataStore(JpoxU til.java:81)
at org.eclipse.emf.teneo.jpox.eclipse.OpenResource.openDataStor e(OpenResource.java:33)
at org.eclipse.emf.teneo.eclipse.resourcehandler.StoreOpenResou rce.run(StoreOpenResource.java:68)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:256)
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3319)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
- ------------------------------------------------------------ -------------------------
Can't read normal XML Files anymore:
If I change the mzdata model parser to JPOXResourceFactory
as described in the tutorial, I can't read normal XML files anymore,
giving me an NPE (stack below):
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser type="mzdata"
class="de.ipbhalle.msbi.Mzdata.util.MzdataResourceFactoryImpl " />
<!-- parser type="mzdata"
class="org.eclipse.emf.teneo.jpox.resource.JPOXResourceFactory " -->
</extension>
If I check the resourceURI, it has "platform:/resource/IPB%20MSBI%20Data/example_kai.mzdata"
but the getResource() fails.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createPage s(MzdataEditor.java:1005)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Mu ltiPageEditorPart.java:283)
at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:661)
at org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:426)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:592)
at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(Ed itorAreaHelper.java:263)
at org.eclipse.ui.internal.EditorManager.setVisibleEditor(Edito rManager.java:1405)
at org.eclipse.ui.internal.EditorManager$5.runWithException(Edi torManager.java:939)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3296)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2974)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:801)
at org.eclipse.ui.internal.Workbench$25.runWithException(Workbe nch.java:1342)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3296)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2974)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2309)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
- ------------------------------------------------------------ -------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSp6Gir2msrPI0lQRAuqcAJ9EDR5zLS+jB8pWnjAFoxhg/9i4SACe NEUy
P6sg7kw/2H9v9ASONnuzHEE=
=Tu7a
-----END PGP SIGNATURE-----
|
|
| | |
Re: Teneo: [Regression].ejdo usage in generated editor [message #612668 is a reply to message #103701] |
Mon, 26 November 2007 12:37 |
Steffen Neumann Messages: 41 Registered: July 2009 |
Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Taal schrieb:
....
> Is the line:
> MzdataPackage m1 = MzdataPackage.eINSTANCE;
> executed before you open the ejdo file?
> Maybe you should look at the way emf initializes the plugins (just
> guessing here).
But a good guess ;-) If right after the start I open an ejdo,
the breakpoint inside MzdataEditorPlugin.implementation() is not hit,
actually not even the constructor MzdataEditorPlugin().
<extension point = "org.eclipse.ui.editors">
<editor
id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
extensions = "mzdata"
class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
</editor>
</extension>
name=mzdata
nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
dbname=mzData
dburl=jdbc:postgresql://kons/mzData
In the old eclipse-3.2 The breakpoint in Implementation() is being hit
upon opening the ejdo.
> Regarding the npe, it is difficult for me to comment on that as I do not
> know what is present on line 970 in the MzdataEditor.java. Can you post
> part of the code and let me know what is null?
Sorry, I am catching a Cold which makes me think a bit slow today.
There seems to be a problem because resource==NULL without an exception thrown.
java.lang.NullPointerException
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
955: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
970: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic =
new BasicDiagnostic
(Diagnostic.ERROR,
"mzData.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
new Object [] { exception == null ? (Object)resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
}
>
> gr. Martin
>
> sneumann wrote:
> sneumann schrieb:
>>>> If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
> That should read 0.8.0.v200709051239
>
> Yours,
> Steffe
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHSr31ir2msrPI0lQRAnjOAKCCuN/nHXHtZ1/J04F9XctlWkWhGQCg hPFa
upBqlKn+yKqYXazIqZAIpVc=
=FmHu
-----END PGP SIGNATURE-----
|
|
|
Re: Teneo: [Regression].ejdo usage in generated editor [message #612670 is a reply to message #103729] |
Mon, 26 November 2007 13:45 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Teneo will try to find the epackage before the editor is opened so the initialization code should
probably be located somewhere else (in a location called when eclipse starts). I am not sure but I
can think that you can specify in the plugin that it should be initialized at startup.
Regarding the npe, I don't know why it won't find the resource, can you try to debug into the code
(editingDomain.getResourceSet().getResource(...)) and see what happens?
gr. Martin
sneumann wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Martin Taal schrieb:
> ....
>> Is the line:
>> MzdataPackage m1 = MzdataPackage.eINSTANCE;
>> executed before you open the ejdo file?
>> Maybe you should look at the way emf initializes the plugins (just
>> guessing here).
>
> But a good guess ;-) If right after the start I open an ejdo,
> the breakpoint inside MzdataEditorPlugin.implementation() is not hit,
> actually not even the constructor MzdataEditorPlugin().
>
> <extension point = "org.eclipse.ui.editors">
> <editor
> id = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID"
> extensions = "mzdata"
> class = "de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor"
> </editor>
> </extension>
>
> name=mzdata
> nsuri=http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd
> editorid=de.ipbhalle.msbi.Mzdata.presentation.MzdataEditorID
> dbname=mzData
> dburl=jdbc:postgresql://kons/mzData
>
> In the old eclipse-3.2 The breakpoint in Implementation() is being hit
> upon opening the ejdo.
>
>> Regarding the npe, it is difficult for me to comment on that as I do not
>> know what is present on line 970 in the MzdataEditor.java. Can you post
>> part of the code and let me know what is null?
> Sorry, I am catching a Cold which makes me think a bit slow today.
> There seems to be a problem because resource==NULL without an exception thrown.
>
> java.lang.NullPointerException
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.analyzeRes ourceProblems(MzdataEditor.java:970)
> at de.ipbhalle.msbi.Mzdata.presentation.MzdataEditor.createMode l(MzdataEditor.java:955)
>
> public void createModel() {
> URI resourceURI = EditUIUtil.getURI(getEditorInput());
> Exception exception = null;
> Resource resource = null;
> try {
> // Load the resource through the editing domain.
> //
> resource = editingDomain.getResourceSet().getResource(resourceURI, true);
> }
> catch (Exception e) {
> exception = e;
> resource = editingDomain.getResourceSet().getResource(resourceURI, false);
> }
>
> 955: Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
>
> public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
> 970: if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
> BasicDiagnostic basicDiagnostic =
> new BasicDiagnostic
> (Diagnostic.ERROR,
> "mzData.editor",
> 0,
> getString("_UI_CreateModelError_message", resource.getURI()),
> new Object [] { exception == null ? (Object)resource : exception });
> basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
> return basicDiagnostic;
> }
>
>> gr. Martin
>>
>> sneumann wrote:
>> sneumann schrieb:
>>>>> If I open the same project in Eclipse 3.3, EMF 2.3 and Teneo 200709,
>> That should read 0.8.0.v200709051239
>>
>> Yours,
>> Steffe
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHSr31ir2msrPI0lQRAnjOAKCCuN/nHXHtZ1/J04F9XctlWkWhGQCg hPFa
> upBqlKn+yKqYXazIqZAIpVc=
> =FmHu
> -----END PGP SIGNATURE-----
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
| | | | | | | | | |
Goto Forum:
Current Time: Sat Nov 09 00:20:10 GMT 2024
Powered by FUDForum. Page generated in 0.07032 seconds
|