Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] using generated .edit with CDO repo
[CDO] using generated .edit with CDO repo [message #422634] Thu, 11 September 2008 14:48 Go to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
I have been working to get a sample editor, equivalent to the EMF
generated editor, working with CDO. I have been trying to use the new
enhanced editor submitted by Vik and the new launcher...but still not
there.

I plan to give a demo tomorrow to some developers and would like to be
able to show an editor, or even just a viewer for a CDO repository hosted
model. I have a repository populating with data from a real time source.
Since my demo is geared toward leveraging the EMF generated code from a
beginning UML model I would like to be able to use the generated .edit
project in this demo at least, if not the editor after modifications.

So, the real question is this. Would someone be able to give me
suggestions on how best to accomplish this. Do you recommend modifying the
generated editor, use a new view, say a TreeViewer and use the .edit
ItemProviders, or modify the enhance editor submitted by Vik.

I realize this is not seamless, yet, but I want to emphasize the benefits
of using the generated code in the case where we persist with CDO.

Thanks for any help in advance,
Mark.
Re: [CDO] using generated .edit with CDO repo [message #422637 is a reply to message #422634] Thu, 11 September 2008 15:30 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Mark,

I tried today the editor generator and launcher in the Ganymede release,
and worked fine. So you don't even need latest head to make both work :(
Is strange, but could it be related with the machine/OS you are using?
(Linux/x86-64)

I believe you made the generator work, so your problems are related with
launching the editor. If the editor launcher doesn't work for you, maybe
you could try making your own action that opens the editor with the
resource? You could even use the method ".open()" provided in the
generated editor.

Another quick and dirty hack could be maybe modifying the
OpenEditorAction under org.eclipse.emf.cdo.internal.ui.actions, and
change CDOEditor with the CDO enhanced generated editor.

@Override
protected void doRun() throws Exception
{
CDOView view = getEntry().getView();
String resourcePath = getEntry().getResourcePath();
CDOEditor.open(getPage(), view, resourcePath);
}

Just change CDOEditor.open() with <GENERATED_EDITOR>.open(...).

I assume using windows is not an option for you, right? (using a windows
virtual machine maybe...)

HTH,
ViK.

Mark Geib escribió:
> I have been working to get a sample editor, equivalent to the EMF
> generated editor, working with CDO. I have been trying to use the new
> enhanced editor submitted by Vik and the new launcher...but still not
> there.
>
> I plan to give a demo tomorrow to some developers and would like to be
> able to show an editor, or even just a viewer for a CDO repository
> hosted model. I have a repository populating with data from a real time
> source. Since my demo is geared toward leveraging the EMF generated code
> from a beginning UML model I would like to be able to use the generated
> .edit project in this demo at least, if not the editor after modifications.
>
> So, the real question is this. Would someone be able to give me
> suggestions on how best to accomplish this. Do you recommend modifying
> the generated editor, use a new view, say a TreeViewer and use the .edit
> ItemProviders, or modify the enhance editor submitted by Vik.
>
> I realize this is not seamless, yet, but I want to emphasize the
> benefits of using the generated code in the case where we persist with CDO.
>
> Thanks for any help in advance,
> Mark.
>
Re: [CDO] using generated .edit with CDO repo [message #422646 is a reply to message #422637] Thu, 11 September 2008 16:32 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Vik,

I bit the bullet and I am moving all this to a windows machine to see if
the road is a little smoother. I will post back later with the results.

Mark.
Re: [CDO] UPDATE..SOLVED? using generated .edit with CDO repo [message #422651 is a reply to message #422637] Thu, 11 September 2008 21:25 Go to previous messageGo to next message
Mark Geib is currently offline Mark GeibFriend
Messages: 432
Registered: July 2009
Senior Member
Vik,

OK, I have everything running...on both windows and linux. I don't
understand, but here is what I found.

I moved to windows and the same problems as on linux. So, I wrote a simple
test program to create and save objects, then read and print the attribute
values of each. The test worked on both windows and linux, but only after
I dropped the database and started new. Then I drop the database again and
ran the program that populates the database from stream of real time data.
That program runs find, but when I go and run my test program to just dump
the objects I get an exception on the first object access, maybe the
resource.getContents() call, I am not sure.

After digging a bit I noticed that the real time program was executing all
the model access and whatever, inside a try-catch block for some other
reasons. I removed the encapsulating try-catch and just wrapped the calls
that required a try-catch and magically EVERYTHING works, on both
platforms.

Summarizing, it appears that if the code that creates and populates the
EMF model has the big try-catch then subsequent access to the model fails.
Without the encapsulating try-catch everything works just fine.

Finally, the launcher and enhanced editor work very nice, thanks again.

Mark.
Re: [CDO] UPDATE..SOLVED? using generated .edit with CDO repo [message #422655 is a reply to message #422651] Fri, 12 September 2008 04:50 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6465
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070200000304030408090300
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Mark,

I'm glad that you managed to make it run, although the explanation
sounds a bit like voodoo ;-)

If you have the feeling that the problem somehow relates with CDO it
would be good if you were able to reproduce it with the help of the CDO
test models and the AbstractCDOTest framework. It's really easy to use,
e.g.

|*public class Initial*Test *extends *AbstractCDOTest
{
*public **void *testWriteClean() *throws *Exception
{
CDOSession session = openModel1Session();
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource("/test1");

Supplier supplier = Model1Factory.eINSTANCE.createSupplier();
supplier.setName("Stepper");

resource.getContents().add(supplier);
transaction.commit();

Supplier s = (Supplier)resource.getContents().get(0);
s.setName("Eike");

assertEquals("Eike", s.getName());
assertEquals(CDOState.DIRTY, supplier.cdoState());
assertEquals(CDOState.CLEAN, resource.cdoState());
}
}
|


Cheers
/Eike


Mark Geib schrieb:
> Vik,
>
> OK, I have everything running...on both windows and linux. I don't
> understand, but here is what I found.
> I moved to windows and the same problems as on linux. So, I wrote a
> simple test program to create and save objects, then read and print
> the attribute values of each. The test worked on both windows and
> linux, but only after I dropped the database and started new. Then I
> drop the database again and ran the program that populates the
> database from stream of real time data. That program runs find, but
> when I go and run my test program to just dump the objects I get an
> exception on the first object access, maybe the resource.getContents()
> call, I am not sure.
>
> After digging a bit I noticed that the real time program was executing
> all the model access and whatever, inside a try-catch block for some
> other reasons. I removed the encapsulating try-catch and just wrapped
> the calls that required a try-catch and magically EVERYTHING works, on
> both platforms.
>
> Summarizing, it appears that if the code that creates and populates
> the EMF model has the big try-catch then subsequent access to the
> model fails. Without the encapsulating try-catch everything works just
> fine.
>
> Finally, the launcher and enhanced editor work very nice, thanks again.
>
> Mark.
>

--------------070200000304030408090300
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Mark,<br>
<br>
I'm glad that you managed to make it run, although the explanation
sounds a bit like voodoo ;-)<br>
<br>
If you have the feeling that the problem somehow relates with CDO it
would be good if you were able to reproduce it with the help of the CDO
test models and the AbstractCDOTest framework. It's really easy to use,
e.g. <br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#7f0055"><b>public


Re: [CDO] UPDATE..SOLVED? using generated .edit with CDO repo [message #422662 is a reply to message #422651] Fri, 12 September 2008 09:08 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Mark,

glad that everything went fine. Remember, switch to HEAD if you have the
oportunity, there are many nice features available now! (like external
references, detach and some performance optimizations!).

Regards,
ViK.
Previous Topic:Error when using proxy in teneo/hibernate
Next Topic:[CDO] Listening to changes in a CDOResource
Goto Forum:
  


Current Time: Thu Jan 23 01:38:38 GMT 2020

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

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

Back to the top