Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Unable to View contents in EMF Editor
Unable to View contents in EMF Editor [message #417322] Wed, 05 March 2008 13:31 Go to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 191
Registered: July 2009
Senior Member
Hi,

I am playing with the Generated EMF editor by removing the inline pages
and creating the Pages as Seperate EditorParts and adding the same to the
Multipage editor.

When my input to the Editor Part is called i see the a XXXResourceImpl is
passed as input

I have added the AdapterFactoryContent and LabelProvider to my tree, when
the editor is opened I am unable to see the Root Element Object or
anything else in the Tree , just an empty tree is visible ..

Can anyone let me know where i would have gone wrong ??

My EditorPart code snippet :

public class TableTreeEditorPart extends AbstractPortalStructureEditPart {
private TreeViewer treeViewer;
private Tree tree;

public TableTreeEditorPart(PortalStructureEditor editor) {
super(editor);

}

/*
* (non-Javadoc)
*
* @see
org.eclipse.ui.part.WorkbenchPart#createPartControl(org.ecli pse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent, SWT.NONE);
tree = treeViewer.getTree();
tree.setLayout(new FillLayout());
tree.setLinesVisible(true);
tree.setHeaderVisible(true);

treeViewer.setContentProvider(new AdapterFactoryContentProvider(
getAdapterFactory()));
treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(
getAdapterFactory()));
createContextMenuFor(treeViewer);
getEditorSite().setSelectionProvider(treeViewer);

}

/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
tree.setFocus();

}

/*
* (non-Javadoc)
*
* @see
com.accenture.portal.tools.xasgen.portalstructure.presentati on.parts.AbstractPortalStructureEditPart#setInput(java.lang. Object)
*/
@Override
public void setInput(Object input) {
System.out.println("TableTreeEditorPart.setInput() : " + input);
assert input != null;
assert treeViewer != null;
treeViewer.setInput(input);

}
}
Re: Unable to View contents in EMF Editor [message #417323 is a reply to message #417322] Wed, 05 March 2008 13:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Kamesh,

Are you using a composed adapter factory that includes the
ResourceItemProviderAdapterFactory?


Kamesh Sampath wrote:
> Hi,
>
> I am playing with the Generated EMF editor by removing the inline
> pages and creating the Pages as Seperate EditorParts and adding the
> same to the Multipage editor.
>
> When my input to the Editor Part is called i see the a XXXResourceImpl
> is passed as input
> I have added the AdapterFactoryContent and LabelProvider to my tree,
> when the editor is opened I am unable to see the Root Element Object
> or anything else in the Tree , just an empty tree is visible ..
> Can anyone let me know where i would have gone wrong ??
>
> My EditorPart code snippet :
> public class TableTreeEditorPart extends
> AbstractPortalStructureEditPart {
> private TreeViewer treeViewer;
> private Tree tree;
>
> public TableTreeEditorPart(PortalStructureEditor editor) {
> super(editor);
>
> }
>
> /*
> * (non-Javadoc)
> * * @see
> org.eclipse.ui.part.WorkbenchPart#createPartControl(org.ecli pse.swt.widgets.Composite)
>
> */
> @Override
> public void createPartControl(Composite parent) {
> treeViewer = new TreeViewer(parent, SWT.NONE);
> tree = treeViewer.getTree();
> tree.setLayout(new FillLayout());
> tree.setLinesVisible(true);
> tree.setHeaderVisible(true);
>
> treeViewer.setContentProvider(new AdapterFactoryContentProvider(
> getAdapterFactory()));
> treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(
> getAdapterFactory()));
> createContextMenuFor(treeViewer);
> getEditorSite().setSelectionProvider(treeViewer);
>
> }
>
> /*
> * (non-Javadoc)
> * * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
> */
> @Override
> public void setFocus() {
> tree.setFocus();
>
> }
>
> /*
> * (non-Javadoc)
> * * @see
> com.accenture.portal.tools.xasgen.portalstructure.presentati on.parts.AbstractPortalStructureEditPart#setInput(java.lang. Object)
>
> */
> @Override
> public void setInput(Object input) {
> System.out.println("TableTreeEditorPart.setInput() : " + input);
> assert input != null;
> assert treeViewer != null;
> treeViewer.setInput(input);
>
> }
> }
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to View contents in EMF Editor [message #417324 is a reply to message #417323] Wed, 05 March 2008 15:00 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 191
Registered: July 2009
Senior Member
Hi Ed,

Yes I do have it, am just using those parts for the EMF generated editor

adapterFactory = new ComposedAdapterFactory(
ComposedAdapterFactory.Descriptor.Registry.INSTANCE);

adapterFactory
.addAdapterFactory(new ResourceItemProviderAdapterFactory());
adapterFactory
.addAdapterFactory(new PortalStructureItemProviderAdapterFactory());
adapterFactory
.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

thats what wonders me .. instead of ViewerPane I am using the sepaerate
EditorPart for the Pages ... the idea behiend is to integrate the Diagram
Editor at later point of time adding flexibility.

Is that has anything to do with IEditorProxy ??? as suggested in the
Integrating EMF-GMF Editor article ??

Regards,
Kamesh
Re: Unable to View contents in EMF Editor [message #417325 is a reply to message #417324] Wed, 05 March 2008 15:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Kamesh,

Given that you're sure an Resource instance is being set as input (when
you say that, do you really mean
org.eclipse.emf.ecore.resource.Resource?) and you've set the content and
label providers with the correct factories, it should just work. My
suspicion would be that the input object isn't what you're assuming.


Kamesh Sampath wrote:
> Hi Ed,
>
> Yes I do have it, am just using those parts for the EMF generated editor
>
> adapterFactory = new ComposedAdapterFactory(
> ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
>
> adapterFactory
> .addAdapterFactory(new
> ResourceItemProviderAdapterFactory());
> adapterFactory
> .addAdapterFactory(new
> PortalStructureItemProviderAdapterFactory());
> adapterFactory
> .addAdapterFactory(new
> ReflectiveItemProviderAdapterFactory());
>
> thats what wonders me .. instead of ViewerPane I am using the
> sepaerate EditorPart for the Pages ... the idea behiend is to
> integrate the Diagram Editor at later point of time adding flexibility.
>
> Is that has anything to do with IEditorProxy ??? as suggested in the
> Integrating EMF-GMF Editor article ??
>
> Regards,
> Kamesh
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to View contents in EMF Editor [message #417326 is a reply to message #417324] Wed, 05 March 2008 15:31 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 191
Registered: July 2009
Senior Member
Hi Ed,

I debugged the issue , the issue was with the ContentOutlineSelection. Its
not able to provide the proper selection element since there was a bug in
the code that I wrote..

I also gave a treeviwer.refresh() after setting the input ..

I have one quick question, how to make the Tree listen to the
ContentOutlineSelection by just navigating to the Selected Element in the
Outline view , I dont need it to go to its children , just stay at the
same element selected by the Outline.
Re: Unable to View contents in EMF Editor [message #417331 is a reply to message #417326] Wed, 05 March 2008 15:55 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Kamesh,

The generated editor's handleContentOutlineSelection shows how to do
that doesn't it?


Kamesh Sampath wrote:
> Hi Ed,
>
> I debugged the issue , the issue was with the ContentOutlineSelection.
> Its not able to provide the proper selection element since there was a
> bug in the code that I wrote..
> I also gave a treeviwer.refresh() after setting the input ..
> I have one quick question, how to make the Tree listen to the
> ContentOutlineSelection by just navigating to the Selected Element in
> the Outline view , I dont need it to go to its children , just stay at
> the same element selected by the Outline.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to View contents in EMF Editor [message #417333 is a reply to message #417331] Wed, 05 March 2008 16:01 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
Thanks Ed. I am able to rectify it .. Also i do have a one more question on
the Selection ,

I am using the MultipageSelectionProvider for the Editor , in my tree when i
click on the node and add a child or sibling my Selection still remains on
the Node from which I initiated the Command , my question is how do I move
the selection to the newly added element ???

This works fine with the Generated editor , my doubt is that am making a
mess with the Selection with my dissected EMF editor ???

Thoughts please ...



"Ed Merks" <merks@ca.ibm.com> wrote in message
news:fqmfqi$du0$2@build.eclipse.org...
> Kamesh,
>
> The generated editor's handleContentOutlineSelection shows how to do that
> doesn't it?
>
>
> Kamesh Sampath wrote:
>> Hi Ed,
>>
>> I debugged the issue , the issue was with the ContentOutlineSelection.
>> Its not able to provide the proper selection element since there was a
>> bug in the code that I wrote..
>> I also gave a treeviwer.refresh() after setting the input ..
>> I have one quick question, how to make the Tree listen to the
>> ContentOutlineSelection by just navigating to the Selected Element in the
>> Outline view , I dont need it to go to its children , just stay at the
>> same element selected by the Outline.
>>
Re: Unable to View contents in EMF Editor [message #417335 is a reply to message #417333] Wed, 05 March 2008 16:13 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070604040008000608000209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Kamesh,

The generated editor's setCurrentView method handles updating the
selection and listening to the current view to forward its selection.
So I guess you need to hook up your MultipageSelectionProvider thing so
that it serves the same kind of purpose...


Kamesh Sampath wrote:
> Thanks Ed. I am able to rectify it .. Also i do have a one more question on
> the Selection ,
>
> I am using the MultipageSelectionProvider for the Editor , in my tree when i
> click on the node and add a child or sibling my Selection still remains on
> the Node from which I initiated the Command , my question is how do I move
> the selection to the newly added element ???
>
> This works fine with the Generated editor , my doubt is that am making a
> mess with the Selection with my dissected EMF editor ???
>
> Thoughts please ...
>
>
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:fqmfqi$du0$2@build.eclipse.org...
>
>> Kamesh,
>>
>> The generated editor's handleContentOutlineSelection shows how to do that
>> doesn't it?
>>
>>
>> Kamesh Sampath wrote:
>>
>>> Hi Ed,
>>>
>>> I debugged the issue , the issue was with the ContentOutlineSelection.
>>> Its not able to provide the proper selection element since there was a
>>> bug in the code that I wrote..
>>> I also gave a treeviwer.refresh() after setting the input ..
>>> I have one quick question, how to make the Tree listen to the
>>> ContentOutlineSelection by just navigating to the Selected Element in the
>>> Outline view , I dont need it to go to its children , just stay at the
>>> same element selected by the Outline.
>>>
>>>
>
>
>


--------------070604040008000608000209
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">
Kamesh,<br>
<br>
The generated editor's setCurrentView method handles updating the
selection and listening to the current view to forward its selection.&nbsp;
So I guess you need to hook up your MultipageSelectionProvider thing so
that it serves the same kind of purpose...<br>
<br>
<br>
Kamesh Sampath wrote:
<blockquote cite="mid:fqmg51$hjj$1@build.eclipse.org" type="cite">
<pre wrap="">Thanks Ed. I am able to rectify it .. Also i do have a one more question on
the Selection ,

I am using the MultipageSelectionProvider for the Editor , in my tree when i
click on the node and add a child or sibling my Selection still remains on
the Node from which I initiated the Command , my question is how do I move
the selection to the newly added element ???

This works fine with the Generated editor , my doubt is that am making a
mess with the Selection with my dissected EMF editor ???

Thoughts please ...



"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:fqmfqi$du0$2@build.eclipse.org">news:fqmfqi$du0$2@build.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Kamesh,

The generated editor's handleContentOutlineSelection shows how to do that
doesn't it?


Kamesh Sampath wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hi Ed,

I debugged the issue , the issue was with the ContentOutlineSelection.
Its not able to provide the proper selection element since there was a
bug in the code that I wrote..
I also gave a treeviwer.refresh() after setting the input ..
I have one quick question, how to make the Tree listen to the
ContentOutlineSelection by just navigating to the Selected Element in the
Outline view , I dont need it to go to its children , just stay at the
same element selected by the Outline.

</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
<br>
</body>
</html>

--------------070604040008000608000209--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to View contents in EMF Editor [message #417337 is a reply to message #417335] Wed, 05 March 2008 17:25 Go to previous message
Kamesh Sampath is currently offline Kamesh SampathFriend
Messages: 213
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C87F14.09C1FA00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Ed,

Thanks for your toughts ! The reason it was not working is that 1. As =
you said the currentViewer was not set and there by when the commands =
are fired the setSelectionToViewer method was not able to perform its =
task of setting the selection to recentlyAffectedObjects .

So I tried to set the CurrentViewer on pageChange where each page of my =
multipage editor part is associated with an StructuredViewer.

~Kamesh
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:fqmgs9$o5b$1@build.eclipse.org...
Kamesh,

The generated editor's setCurrentView method handles updating the =
selection and listening to the current view to forward its selection. =
So I guess you need to hook up your MultipageSelectionProvider thing so =
that it serves the same kind of purpose...


Kamesh Sampath wrote:=20
Thanks Ed. I am able to rectify it .. Also i do have a one more question =
on=20
the Selection ,

I am using the MultipageSelectionProvider for the Editor , in my tree =
when i=20
click on the node and add a child or sibling my Selection still remains =
on=20
the Node from which I initiated the Command , my question is how do I =
move=20
the selection to the newly added element ???

This works fine with the Generated editor , my doubt is that am making =
a=20
mess with the Selection with my dissected EMF editor ???

Thoughts please ...



"Ed Merks" <merks@ca.ibm.com> wrote in message=20
news:fqmfqi$du0$2@build.eclipse.org...
Kamesh,

The generated editor's handleContentOutlineSelection shows how to do =
that=20
doesn't it?


Kamesh Sampath wrote:
Hi Ed,

I debugged the issue , the issue was with the ContentOutlineSelection.=20
Its not able to provide the proper selection element since there was a=20
bug in the code that I wrote..
I also gave a treeviwer.refresh() after setting the input ..
I have one quick question, how to make the Tree listen to the=20
ContentOutlineSelection by just navigating to the Selected Element in =
the=20
Outline view , I dont need it to go to its children , just stay at the=20
same element selected by the Outline.

=20

=20

------=_NextPart_000_000B_01C87F14.09C1FA00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.6000.16608" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DVerdana size=3D2>Ed,</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>Thanks for your toughts ! The reason =
it was not=20
working is that&nbsp; 1. As you said the currentViewer was not set and =
there by=20
when the commands are fired the setSelectionToViewer method was not able =
to=20
perform its task of setting the selection to recentlyAffectedObjects=20
..</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>So I tried to set the CurrentViewer =
on pageChange=20
where each page of my multipage editor part is associated with an=20
StructuredViewer.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>~Kamesh</FONT></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>&gt;=20
wrote in message <A=20
=
href=3D"news:fqmgs9$o5b$1@build.eclipse.org">news:fqmgs9$o5b$1@build.ecli=
pse.org</A>...</DIV>Kamesh,<BR><BR>The=20
generated editor's setCurrentView method handles updating the =
selection and=20
listening to the current view to forward its selection.&nbsp; So I =
guess you=20
need to hook up your MultipageSelectionProvider thing so that it =
serves the=20
same kind of purpose...<BR><BR><BR>Kamesh Sampath wrote:=20
<BLOCKQUOTE cite=3Dmid:fqmg51$hjj$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Thanks Ed. I am able to rectify it .. Also =
i do have a one more question on=20
the Selection ,

I am using the MultipageSelectionProvider for the Editor , in my tree =
when i=20
click on the node and add a child or sibling my Selection still remains =
on=20
the Node from which I initiated the Command , my question is how do I =
move=20
the selection to the newly added element ???

This works fine with the Generated editor , my doubt is that am making =
a=20
mess with the Selection with my dissected EMF editor ???

Thoughts please ...



"Ed Merks" <A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto:merks@ca.ibm.com">&lt;merks@ca.ibm.com&gt;</A> wrote in =
message=20
<A class=3Dmoz-txt-link-freetext =
href=3D"news:fqmfqi$du0$2@build.eclipse.org">news:fqmfqi$du0$2@build.ecli=
pse.org</A>...
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Kamesh,

The generated editor's handleContentOutlineSelection shows how to do =
that=20
doesn't it?


Kamesh Sampath wrote:
</PRE>
<BLOCKQUOTE type=3D"cite"><PRE wrap=3D"">Hi Ed,

I debugged the issue , the issue was with the ContentOutlineSelection.=20
Its not able to provide the proper selection element since there was a=20
bug in the code that I wrote..
I also gave a treeviwer.refresh() after setting the input ..
I have one quick question, how to make the Tree listen to the=20
ContentOutlineSelection by just navigating to the Selected Element in =
the=20
Outline view , I dont need it to go to its children , just stay at the=20
same element selected by the Outline.

</PRE></BLOCKQUOTE></BLOCKQUOTE><PRE wrap=3D""><!---->

</PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_000B_01C87F14.09C1FA00--
Previous Topic:Handle comments in xml file on Resource load/save
Next Topic:using org.eclipse.emf.databinding* in emf 2.3 environment
Goto Forum:
  


Current Time: Fri Apr 19 21:09:19 GMT 2024

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

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

Back to the top