Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » RCP editor woes
RCP editor woes [message #414727] Tue, 20 November 2007 12:05 Go to next message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 32
Registered: July 2009
Member
Hi,

I've got an EMF model which is persisted using Teneo & Hibernate to a
Derby database in an RCP application. I have three problems with the
generated RCP editor:

1) It is read-only (I can't edit anything).
2) Only the "Selection" tab of the multi-page editor works.
3) In one specific case of a aggregation relation, the contained objects
are listed only as a comma-separated list in the property sheet, rather
than as separate nodes under their parent (therefore one can not focus
on the child object to see its properties in the property sheet).

I believe my problem is not so much Teneo-related. I can edit the model
instance by code and persist my changes, it's just the editor GUI that
defaults to read-only behaviour.

My RCP application adds a dependency to the generated editor plug-in and
has a command that opens the editor with the following code:

public class MyHandler extends AbstractHandler {
static final String uri= "hibernate://?dsname=testModel";
public Object execute(ExecutionEvent event) throws
ExecutionException {

IWorkbenchWindow window = HandlerUtil
.getActiveWorkbenchWindowChecked(event);
try {
window.getActivePage().openEditor(
new URIEditorInput(
URI.createURI(uri)),
"testmodel.presentation.TestmodelEditorID");
} catch (PartInitException e) {
throw new ExecutionException(
"Failed to open case portfolio editor",
e);
}
return null;
}
}
Re: RCP editor woes [message #414731 is a reply to message #414727] Tue, 20 November 2007 12:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030108080701060905000308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Alexandros,

Comments below.

Alexandros Karypidis wrote:
> Hi,
>
> I've got an EMF model which is persisted using Teneo & Hibernate to a
> Derby database in an RCP application. I have three problems with the
> generated RCP editor:
>
> 1) It is read-only (I can't edit anything).
It should be possible to improve this kind of behavior in EMF 2.4 since
URIHandler will support isReadOnly directly. Right now that's supported
in AdapterFactoryEditingDomain like this which basically assumes that
anything that's not platform:/resource, or file:/whatever will be read only.

protected boolean isReadOnlyURI(URI uri)
{
if (uri.isArchive())
{
return isReadOnlyURI(URI.createURI(uri.authority()));
}

return !uri.isPlatformResource() && (uri.isRelative() ||
!uri.isFile());
}

You'll need to specialize this method.
> 2) Only the "Selection" tab of the multi-page editor works.
What do you mean by only that one works? Normally each is driven by the
selection of the outline view and if that's not working, I imagine there
would be logged exception in the Error log view.
> 3) In one specific case of a aggregation relation, the contained
> objects are listed only as a comma-separated list in the property
> sheet, rather than as separate nodes under their parent (therefore one
> can not focus on the child object to see its properties in the
> property sheet).
Perhaps you changed the feature from being a non-containment reference
to be a containment reference after the GenModel already existed. Have
a look at the properties for the GenFeature corresponding to that
structure feature and make sure the Children property is set
appropriately; look closely at all the settings since probably you'll
want Create Children to be true and PropertyType to be None.
>
> I believe my problem is not so much Teneo-related. I can edit the
> model instance by code and persist my changes, it's just the editor
> GUI that defaults to read-only behaviour.
I think that's true.
>
> My RCP application adds a dependency to the generated editor plug-in
> and has a command that opens the editor with the following code:
>
> public class MyHandler extends AbstractHandler {
> static final String uri= "hibernate://?dsname=testModel";
> public Object execute(ExecutionEvent event) throws
> ExecutionException {
>
> IWorkbenchWindow window = HandlerUtil
> .getActiveWorkbenchWindowChecked(event);
> try {
> window.getActivePage().openEditor(
> new URIEditorInput(
> URI.createURI(uri)),
> "testmodel.presentation.TestmodelEditorID");
> } catch (PartInitException e) {
> throw new ExecutionException(
> "Failed to open case portfolio editor",
> e);
> }
> return null;
> }
> }
I should talk to Martin about providing a HibernateURIHandlerImpl for
the Teneo version that goes with EMF 2.4 for handling things like
isReadOnly, delete and things like timestamps...

--------------030108080701060905000308
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Alexandros,<br>
<br>
Comments below.<br>
<br>
Alexandros Karypidis wrote:
<blockquote cite="mid:fhuiij$tor$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I've got an EMF model which is persisted using Teneo &amp; Hibernate to
a Derby database in an RCP application. I have three problems with the
generated RCP editor:
<br>
<br>
1) It is read-only (I can't edit anything).
<br>
</blockquote>
It should be possible to improve this kind of behavior in EMF 2.4 since
URIHandler will support isReadOnly directly.&nbsp; Right now that's
supported in AdapterFactoryEditingDomain like this which basically
assumes that anything that's not platform:/resource, or <a class="moz-txt-link-freetext" href="file:/whatever">file:/whatever</a>
will be read only.<br>
<blockquote><small>&nbsp; protected boolean isReadOnlyURI(URI uri)</small><br>
<small>&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp; if (uri.isArchive())</small><br>
<small>&nbsp;&nbsp;&nbsp; {</small><br>
<small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return isReadOnlyURI(URI.createURI(uri.authority()));</small><br>
<small>&nbsp;&nbsp;&nbsp; }</small><br>
<br>
<small>&nbsp;&nbsp;&nbsp; return !uri.isPlatformResource() &amp;&amp;
(uri.isRelative() || !uri.isFile());</small><br>
<small>&nbsp; }</small><br>
</blockquote>
You'll need to specialize this method.<br>
<blockquote cite="mid:fhuiij$tor$1@build.eclipse.org" type="cite">2)
Only the "Selection" tab of the multi-page editor works.
<br>
</blockquote>
What do you mean by only that one works?&nbsp; Normally each is driven by
the selection of the outline view and if that's not working, I imagine
there would be logged exception in the Error log view.<br>
<blockquote cite="mid:fhuiij$tor$1@build.eclipse.org" type="cite">3) In
one specific case of a aggregation relation, the contained objects are
listed only as a comma-separated list in the property sheet, rather
than as separate nodes under their parent (therefore one can not focus
on the child object to see its properties in the property sheet).
<br>
</blockquote>
Perhaps you changed the feature from being a non-containment reference
to be a containment reference after the GenModel already existed.&nbsp; Have
a look at the properties for the GenFeature corresponding to that
structure feature and make sure the Children property is set
appropriately; look closely at all the settings since probably you'll
want Create Children to be true and PropertyType to be None.<br>
<blockquote cite="mid:fhuiij$tor$1@build.eclipse.org" type="cite"><br>
I believe my problem is not so much Teneo-related. I can edit the model
instance by code and persist my changes, it's just the editor GUI that
defaults to read-only behaviour.
<br>
</blockquote>
I think that's true.<br>
<blockquote cite="mid:fhuiij$tor$1@build.eclipse.org" type="cite"><br>
My RCP application adds a dependency to the generated editor plug-in
and has a command that opens the editor with the following code:
<br>
<br>
public class MyHandler extends AbstractHandler {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;static final String uri= "hibernate://?dsname=testModel";
<br>
&nbsp;&nbsp;&nbsp;&nbsp;public Object execute(ExecutionEvent event) throws
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ExecutionException {
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; IWorkbenchWindow window = HandlerUtil
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .getActiveWorkbenchWindowChecked(event);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; try {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window.getActivePage().openEditor(
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; new URIEditorInput(
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; URI.createURI(uri)),
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "testmodel.presentation.TestmodelEditorID");
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; } catch (PartInitException e) {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new ExecutionException(
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "Failed to open case portfolio editor",
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return null;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;}
<br>
}
<br>
</blockquote>
I should talk to Martin about providing a HibernateURIHandlerImpl for
the Teneo version that goes with EMF 2.4 for handling things like
isReadOnly, delete and things like timestamps...<br>
</body>
</html>

--------------030108080701060905000308--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: RCP editor woes [message #414733 is a reply to message #414731] Tue, 20 November 2007 13:18 Go to previous messageGo to next message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 32
Registered: July 2009
Member
Hello Ed,

I've just solved (3) which was exactly what you said. I'll look into (1)
now, following the pointers you gave me. Regarding (2), here are the
details:

The editor is a MultiPage one which has: "Selection", "Parent", "List",
.... tabs. The "Selection" tab shows a tree viewer which displays my
EObject instances correctly. I can browse it, expand/collapse nodes and
the properties view is kept in sync, showing a property sheet for the
EObject in focus.

If I switch to any of the other tabs, I see nothing. They're empty. I've
deleted and regenerated the model, .edit and .editor plug-ins with no luck.

Ed Merks wrote:

> Alexandros,
>
> Comments below.
>
> Alexandros Karypidis wrote:
>> Hi,
>>
>> I've got an EMF model which is persisted using Teneo & Hibernate to a
>> Derby database in an RCP application. I have three problems with the
>> generated RCP editor:
>>
>> 1) It is read-only (I can't edit anything).
> It should be possible to improve this kind of behavior in EMF 2.4 since
> URIHandler will support isReadOnly directly. Right now that's supported
> in AdapterFactoryEditingDomain like this which basically assumes that
> anything that's not platform:/resource, or file:/whatever will be read only.
>
> protected boolean isReadOnlyURI(URI uri)
> {
> if (uri.isArchive())
> {
> return isReadOnlyURI(URI.createURI(uri.authority()));
> }
>
> return !uri.isPlatformResource() && (uri.isRelative() ||
> !uri.isFile());
> }
>
> You'll need to specialize this method.
>> 2) Only the "Selection" tab of the multi-page editor works.
> What do you mean by only that one works? Normally each is driven by the
> selection of the outline view and if that's not working, I imagine there
> would be logged exception in the Error log view.
>> 3) In one specific case of a aggregation relation, the contained
>> objects are listed only as a comma-separated list in the property
>> sheet, rather than as separate nodes under their parent (therefore one
>> can not focus on the child object to see its properties in the
>> property sheet).
> Perhaps you changed the feature from being a non-containment reference
> to be a containment reference after the GenModel already existed. Have
> a look at the properties for the GenFeature corresponding to that
> structure feature and make sure the Children property is set
> appropriately; look closely at all the settings since probably you'll
> want Create Children to be true and PropertyType to be None.
>>
>> I believe my problem is not so much Teneo-related. I can edit the
>> model instance by code and persist my changes, it's just the editor
>> GUI that defaults to read-only behaviour.
> I think that's true.
>>
>> My RCP application adds a dependency to the generated editor plug-in
>> and has a command that opens the editor with the following code:
>>
>> public class MyHandler extends AbstractHandler {
>> static final String uri= "hibernate://?dsname=testModel";
>> public Object execute(ExecutionEvent event) throws
>> ExecutionException {
>>
>> IWorkbenchWindow window = HandlerUtil
>> .getActiveWorkbenchWindowChecked(event);
>> try {
>> window.getActivePage().openEditor(
>> new URIEditorInput(
>> URI.createURI(uri)),
>> "testmodel.presentation.TestmodelEditorID");
>> } catch (PartInitException e) {
>> throw new ExecutionException(
>> "Failed to open case portfolio editor",
>> e);
>> }
>> return null;
>> }
>> }
> I should talk to Martin about providing a HibernateURIHandlerImpl for
> the Teneo version that goes with EMF 2.4 for handling things like
> isReadOnly, delete and things like timestamps...
Re: RCP editor woes [message #414742 is a reply to message #414733] Tue, 20 November 2007 14:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Alexandros,

So if you select a node with children in the outline, the other tabs
don't show those children?


Alexandros Karypidis wrote:
> Hello Ed,
>
> I've just solved (3) which was exactly what you said. I'll look into
> (1) now, following the pointers you gave me. Regarding (2), here are
> the details:
>
> The editor is a MultiPage one which has: "Selection", "Parent",
> "List", .... tabs. The "Selection" tab shows a tree viewer which
> displays my EObject instances correctly. I can browse it,
> expand/collapse nodes and the properties view is kept in sync, showing
> a property sheet for the EObject in focus.
>
> If I switch to any of the other tabs, I see nothing. They're empty.
> I've deleted and regenerated the model, .edit and .editor plug-ins
> with no luck.
>
> Ed Merks wrote:
>
>> Alexandros,
>>
>> Comments below.
>>
>> Alexandros Karypidis wrote:
>>> Hi,
>>>
>>> I've got an EMF model which is persisted using Teneo & Hibernate to
>>> a Derby database in an RCP application. I have three problems with
>>> the generated RCP editor:
>>>
>>> 1) It is read-only (I can't edit anything).
>> It should be possible to improve this kind of behavior in EMF 2.4
>> since URIHandler will support isReadOnly directly. Right now that's
>> supported in AdapterFactoryEditingDomain like this which basically
>> assumes that anything that's not platform:/resource, or
>> file:/whatever will be read only.
>>
>> protected boolean isReadOnlyURI(URI uri)
>> {
>> if (uri.isArchive())
>> {
>> return isReadOnlyURI(URI.createURI(uri.authority()));
>> }
>>
>> return !uri.isPlatformResource() && (uri.isRelative() ||
>> !uri.isFile());
>> }
>>
>> You'll need to specialize this method.
>>> 2) Only the "Selection" tab of the multi-page editor works.
>> What do you mean by only that one works? Normally each is driven by
>> the selection of the outline view and if that's not working, I
>> imagine there would be logged exception in the Error log view.
>>> 3) In one specific case of a aggregation relation, the contained
>>> objects are listed only as a comma-separated list in the property
>>> sheet, rather than as separate nodes under their parent (therefore
>>> one can not focus on the child object to see its properties in the
>>> property sheet).
>> Perhaps you changed the feature from being a non-containment
>> reference to be a containment reference after the GenModel already
>> existed. Have a look at the properties for the GenFeature
>> corresponding to that structure feature and make sure the Children
>> property is set appropriately; look closely at all the settings since
>> probably you'll want Create Children to be true and PropertyType to
>> be None.
>>>
>>> I believe my problem is not so much Teneo-related. I can edit the
>>> model instance by code and persist my changes, it's just the editor
>>> GUI that defaults to read-only behaviour.
>> I think that's true.
>>>
>>> My RCP application adds a dependency to the generated editor plug-in
>>> and has a command that opens the editor with the following code:
>>>
>>> public class MyHandler extends AbstractHandler {
>>> static final String uri= "hibernate://?dsname=testModel";
>>> public Object execute(ExecutionEvent event) throws
>>> ExecutionException {
>>>
>>> IWorkbenchWindow window = HandlerUtil
>>> .getActiveWorkbenchWindowChecked(event);
>>> try {
>>> window.getActivePage().openEditor(
>>> new URIEditorInput(
>>> URI.createURI(uri)),
>>> "testmodel.presentation.TestmodelEditorID");
>>> } catch (PartInitException e) {
>>> throw new ExecutionException(
>>> "Failed to open case portfolio editor",
>>> e);
>>> }
>>> return null;
>>> }
>>> }
>> I should talk to Martin about providing a HibernateURIHandlerImpl for
>> the Teneo version that goes with EMF 2.4 for handling things like
>> isReadOnly, delete and things like timestamps...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: RCP editor woes [message #414743 is a reply to message #414733] Tue, 20 November 2007 14:21 Go to previous messageGo to next message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 32
Registered: July 2009
Member
I've added a body with an override for isReadOnly() and removed the
@generated annotation from initializeEditingDomain(). It's a kludge
(always returns true), but I know I will always use the editor with
Teneo. I've started a thread on the emft newsgroup to see if I may
perhaps contribute proper support for this.

The empty multi-page problem persists. I was hoping it had something to
do with considering the resource read-only, but it's something else. I'm
going through the editor GUI code now to see if I can find something
concrete.

Alexandros Karypidis wrote:

> Hello Ed,
>
> I've just solved (3) which was exactly what you said. I'll look into (1)
> now, following the pointers you gave me. Regarding (2), here are the
> details:
>
> The editor is a MultiPage one which has: "Selection", "Parent", "List",
> ... tabs. The "Selection" tab shows a tree viewer which displays my
> EObject instances correctly. I can browse it, expand/collapse nodes and
> the properties view is kept in sync, showing a property sheet for the
> EObject in focus.
>
> If I switch to any of the other tabs, I see nothing. They're empty. I've
> deleted and regenerated the model, .edit and .editor plug-ins with no luck.
>
> Ed Merks wrote:
>
>> Alexandros,
>>
>> Comments below.
>>
>> Alexandros Karypidis wrote:
>>> Hi,
>>>
>>> I've got an EMF model which is persisted using Teneo & Hibernate to a
>>> Derby database in an RCP application. I have three problems with the
>>> generated RCP editor:
>>>
>>> 1) It is read-only (I can't edit anything).
>> It should be possible to improve this kind of behavior in EMF 2.4
>> since URIHandler will support isReadOnly directly. Right now that's
>> supported in AdapterFactoryEditingDomain like this which basically
>> assumes that anything that's not platform:/resource, or file:/whatever
>> will be read only.
>>
>> protected boolean isReadOnlyURI(URI uri)
>> {
>> if (uri.isArchive())
>> {
>> return isReadOnlyURI(URI.createURI(uri.authority()));
>> }
>>
>> return !uri.isPlatformResource() && (uri.isRelative() ||
>> !uri.isFile());
>> }
>>
>> You'll need to specialize this method.
>>> 2) Only the "Selection" tab of the multi-page editor works.
>> What do you mean by only that one works? Normally each is driven by
>> the selection of the outline view and if that's not working, I imagine
>> there would be logged exception in the Error log view.
>>> 3) In one specific case of a aggregation relation, the contained
>>> objects are listed only as a comma-separated list in the property
>>> sheet, rather than as separate nodes under their parent (therefore
>>> one can not focus on the child object to see its properties in the
>>> property sheet).
>> Perhaps you changed the feature from being a non-containment reference
>> to be a containment reference after the GenModel already existed.
>> Have a look at the properties for the GenFeature corresponding to that
>> structure feature and make sure the Children property is set
>> appropriately; look closely at all the settings since probably you'll
>> want Create Children to be true and PropertyType to be None.
>>>
>>> I believe my problem is not so much Teneo-related. I can edit the
>>> model instance by code and persist my changes, it's just the editor
>>> GUI that defaults to read-only behaviour.
>> I think that's true.
>>>
>>> My RCP application adds a dependency to the generated editor plug-in
>>> and has a command that opens the editor with the following code:
>>>
>>> public class MyHandler extends AbstractHandler {
>>> static final String uri= "hibernate://?dsname=testModel";
>>> public Object execute(ExecutionEvent event) throws
>>> ExecutionException {
>>>
>>> IWorkbenchWindow window = HandlerUtil
>>> .getActiveWorkbenchWindowChecked(event);
>>> try {
>>> window.getActivePage().openEditor(
>>> new URIEditorInput(
>>> URI.createURI(uri)),
>>> "testmodel.presentation.TestmodelEditorID");
>>> } catch (PartInitException e) {
>>> throw new ExecutionException(
>>> "Failed to open case portfolio editor",
>>> e);
>>> }
>>> return null;
>>> }
>>> }
>> I should talk to Martin about providing a HibernateURIHandlerImpl for
>> the Teneo version that goes with EMF 2.4 for handling things like
>> isReadOnly, delete and things like timestamps...
Re: RCP editor woes [message #414745 is a reply to message #414742] Tue, 20 November 2007 14:25 Go to previous messageGo to next message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 32
Registered: July 2009
Member
Exactly. When I select a node, in the "Selection" page/tab, the status
line is updated and reads "Selected Object: xxxx" and the property sheet
lets me edit the attributes. If I press on one of the other tabs, the
status line reads "Selected Nothing" and the view pane is totally empty.

I'm going to step through the code and get back with more info. At least
editing now works. Thanks for your help.

Ed Merks wrote:

> Alexandros,
>
> So if you select a node with children in the outline, the other tabs
> don't show those children?
>
>
> Alexandros Karypidis wrote:
>> Hello Ed,
>>
>> I've just solved (3) which was exactly what you said. I'll look into
>> (1) now, following the pointers you gave me. Regarding (2), here are
>> the details:
>>
>> The editor is a MultiPage one which has: "Selection", "Parent",
>> "List", .... tabs. The "Selection" tab shows a tree viewer which
>> displays my EObject instances correctly. I can browse it,
>> expand/collapse nodes and the properties view is kept in sync, showing
>> a property sheet for the EObject in focus.
>>
>> If I switch to any of the other tabs, I see nothing. They're empty.
>> I've deleted and regenerated the model, .edit and .editor plug-ins
>> with no luck.
>>
>> Ed Merks wrote:
>>
>>> Alexandros,
>>>
>>> Comments below.
>>>
>>> Alexandros Karypidis wrote:
>>>> Hi,
>>>>
>>>> I've got an EMF model which is persisted using Teneo & Hibernate to
>>>> a Derby database in an RCP application. I have three problems with
>>>> the generated RCP editor:
>>>>
>>>> 1) It is read-only (I can't edit anything).
>>> It should be possible to improve this kind of behavior in EMF 2.4
>>> since URIHandler will support isReadOnly directly. Right now that's
>>> supported in AdapterFactoryEditingDomain like this which basically
>>> assumes that anything that's not platform:/resource, or
>>> file:/whatever will be read only.
>>>
>>> protected boolean isReadOnlyURI(URI uri)
>>> {
>>> if (uri.isArchive())
>>> {
>>> return isReadOnlyURI(URI.createURI(uri.authority()));
>>> }
>>>
>>> return !uri.isPlatformResource() && (uri.isRelative() ||
>>> !uri.isFile());
>>> }
>>>
>>> You'll need to specialize this method.
>>>> 2) Only the "Selection" tab of the multi-page editor works.
>>> What do you mean by only that one works? Normally each is driven by
>>> the selection of the outline view and if that's not working, I
>>> imagine there would be logged exception in the Error log view.
>>>> 3) In one specific case of a aggregation relation, the contained
>>>> objects are listed only as a comma-separated list in the property
>>>> sheet, rather than as separate nodes under their parent (therefore
>>>> one can not focus on the child object to see its properties in the
>>>> property sheet).
>>> Perhaps you changed the feature from being a non-containment
>>> reference to be a containment reference after the GenModel already
>>> existed. Have a look at the properties for the GenFeature
>>> corresponding to that structure feature and make sure the Children
>>> property is set appropriately; look closely at all the settings since
>>> probably you'll want Create Children to be true and PropertyType to
>>> be None.
>>>>
>>>> I believe my problem is not so much Teneo-related. I can edit the
>>>> model instance by code and persist my changes, it's just the editor
>>>> GUI that defaults to read-only behaviour.
>>> I think that's true.
>>>>
>>>> My RCP application adds a dependency to the generated editor plug-in
>>>> and has a command that opens the editor with the following code:
>>>>
>>>> public class MyHandler extends AbstractHandler {
>>>> static final String uri= "hibernate://?dsname=testModel";
>>>> public Object execute(ExecutionEvent event) throws
>>>> ExecutionException {
>>>>
>>>> IWorkbenchWindow window = HandlerUtil
>>>> .getActiveWorkbenchWindowChecked(event);
>>>> try {
>>>> window.getActivePage().openEditor(
>>>> new URIEditorInput(
>>>> URI.createURI(uri)),
>>>> "testmodel.presentation.TestmodelEditorID");
>>>> } catch (PartInitException e) {
>>>> throw new ExecutionException(
>>>> "Failed to open case portfolio editor",
>>>> e);
>>>> }
>>>> return null;
>>>> }
>>>> }
>>> I should talk to Martin about providing a HibernateURIHandlerImpl for
>>> the Teneo version that goes with EMF 2.4 for handling things like
>>> isReadOnly, delete and things like timestamps...
Re: RCP editor woes [message #414746 is a reply to message #414745] Tue, 20 November 2007 14:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Alexandros,

What about selecting nodes in the outline view? The other views get
their input from the selection in the outline...


Alexandros Karypidis wrote:
> Exactly. When I select a node, in the "Selection" page/tab, the status
> line is updated and reads "Selected Object: xxxx" and the property
> sheet lets me edit the attributes. If I press on one of the other
> tabs, the status line reads "Selected Nothing" and the view pane is
> totally empty.
>
> I'm going to step through the code and get back with more info. At
> least editing now works. Thanks for your help.
>
> Ed Merks wrote:
>
>> Alexandros,
>>
>> So if you select a node with children in the outline, the other tabs
>> don't show those children?
>>
>>
>> Alexandros Karypidis wrote:
>>> Hello Ed,
>>>
>>> I've just solved (3) which was exactly what you said. I'll look into
>>> (1) now, following the pointers you gave me. Regarding (2), here
>>> are the details:
>>>
>>> The editor is a MultiPage one which has: "Selection", "Parent",
>>> "List", .... tabs. The "Selection" tab shows a tree viewer which
>>> displays my EObject instances correctly. I can browse it,
>>> expand/collapse nodes and the properties view is kept in sync,
>>> showing a property sheet for the EObject in focus.
>>>
>>> If I switch to any of the other tabs, I see nothing. They're empty.
>>> I've deleted and regenerated the model, .edit and .editor plug-ins
>>> with no luck.
>>>
>>> Ed Merks wrote:
>>>
>>>> Alexandros,
>>>>
>>>> Comments below.
>>>>
>>>> Alexandros Karypidis wrote:
>>>>> Hi,
>>>>>
>>>>> I've got an EMF model which is persisted using Teneo & Hibernate
>>>>> to a Derby database in an RCP application. I have three problems
>>>>> with the generated RCP editor:
>>>>>
>>>>> 1) It is read-only (I can't edit anything).
>>>> It should be possible to improve this kind of behavior in EMF 2.4
>>>> since URIHandler will support isReadOnly directly. Right now
>>>> that's supported in AdapterFactoryEditingDomain like this which
>>>> basically assumes that anything that's not platform:/resource, or
>>>> file:/whatever will be read only.
>>>>
>>>> protected boolean isReadOnlyURI(URI uri)
>>>> {
>>>> if (uri.isArchive())
>>>> {
>>>> return isReadOnlyURI(URI.createURI(uri.authority()));
>>>> }
>>>>
>>>> return !uri.isPlatformResource() && (uri.isRelative() ||
>>>> !uri.isFile());
>>>> }
>>>>
>>>> You'll need to specialize this method.
>>>>> 2) Only the "Selection" tab of the multi-page editor works.
>>>> What do you mean by only that one works? Normally each is driven
>>>> by the selection of the outline view and if that's not working, I
>>>> imagine there would be logged exception in the Error log view.
>>>>> 3) In one specific case of a aggregation relation, the contained
>>>>> objects are listed only as a comma-separated list in the property
>>>>> sheet, rather than as separate nodes under their parent (therefore
>>>>> one can not focus on the child object to see its properties in the
>>>>> property sheet).
>>>> Perhaps you changed the feature from being a non-containment
>>>> reference to be a containment reference after the GenModel already
>>>> existed. Have a look at the properties for the GenFeature
>>>> corresponding to that structure feature and make sure the Children
>>>> property is set appropriately; look closely at all the settings
>>>> since probably you'll want Create Children to be true and
>>>> PropertyType to be None.
>>>>>
>>>>> I believe my problem is not so much Teneo-related. I can edit the
>>>>> model instance by code and persist my changes, it's just the
>>>>> editor GUI that defaults to read-only behaviour.
>>>> I think that's true.
>>>>>
>>>>> My RCP application adds a dependency to the generated editor
>>>>> plug-in and has a command that opens the editor with the following
>>>>> code:
>>>>>
>>>>> public class MyHandler extends AbstractHandler {
>>>>> static final String uri= "hibernate://?dsname=testModel";
>>>>> public Object execute(ExecutionEvent event) throws
>>>>> ExecutionException {
>>>>>
>>>>> IWorkbenchWindow window = HandlerUtil
>>>>> .getActiveWorkbenchWindowChecked(event);
>>>>> try {
>>>>> window.getActivePage().openEditor(
>>>>> new URIEditorInput(
>>>>> URI.createURI(uri)),
>>>>> "testmodel.presentation.TestmodelEditorID");
>>>>> } catch (PartInitException e) {
>>>>> throw new ExecutionException(
>>>>> "Failed to open case portfolio editor",
>>>>> e);
>>>>> }
>>>>> return null;
>>>>> }
>>>>> }
>>>> I should talk to Martin about providing a HibernateURIHandlerImpl
>>>> for the Teneo version that goes with EMF 2.4 for handling things
>>>> like isReadOnly, delete and things like timestamps...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: RCP editor woes [message #414747 is a reply to message #414746] Tue, 20 November 2007 14:59 Go to previous message
Alexandros Karypidis is currently offline Alexandros KarypidisFriend
Messages: 32
Registered: July 2009
Member
Ed Merks wrote:
> Alexandros,
>
> What about selecting nodes in the outline view? The other views get
> their input from the selection in the outline...
>
>
> Alexandros Karypidis wrote:

I see what is happening now. My perspective does not display the outline
view. I added it and the other views now sync with its selection.
Previous Topic:Zip/Jar archive schemes not acknowledged by UriConverter?
Next Topic:Error found in EMF 2.4, extension of map creates "The interface Entry cannot be implemented mor
Goto Forum:
  


Current Time: Wed Apr 24 16:18:38 GMT 2024

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

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

Back to the top