Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Re: GMF files with common navigator framework
Re: GMF files with common navigator framework [message #15862] Fri, 11 August 2006 09:59
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------010908020705060508020601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Sakae,

This is a question best asked on the GMF newsgroup. I would recommend
that you not use a file: URI for an IFile but rather create a platform
resource URI.

URI uri =
URI.createPlatformResourceURI(file.getFullPath().toString()) );



Sakae Nakajima wrote:
> Hi,
>
> I like to display contents of GMF semantic in common navigator.
>
> My common navigator displays the contents correctly and the triggered
> points listen to changes made in GMF editor.
>
> However, the triggered points stop lestening to changes when I open
> another semantic file.
>
> My ContentProvider is following:
>
> public class MyContentProvider extends
> AdapterFactoryContentProvider{
>
> static AdapterFactory adapterFactory;
> static
> {
> List factories = new ArrayList();
> factories.add(new MyItemProviderAdapterFactory());
> factories.add(new ResourceItemProviderAdapterFactory());
> factories.add(new ReflectiveItemProviderAdapterFactory());
> adapterFactory = new ComposedAdapterFactory(factories);
> }
>
> public FrameworkAdaptorFactoryContentProvider()
> {
> super(adapterFactory);
> }
>
> public Object[] getChildren(Object object)
> {
> if (object instanceof IFile)
> {
> IFile file = (IFile) object;
>
> ResourceSet resourceSet = new ResourceSetImpl();
> URI uri = RI.createFileURI(file.getLocation().toString());
> resource = resourceSet.createResource(uri);
>
> if (resource == null)
> return Collections.EMPTY_LIST.toArray();
>
> resource.load(null);
> return resource.getContents().toArray();
> }
>
> // Delegate the task to AdapterFactoryContentProvider
> return super.getChildren(object);
> }
>
> }
>
> Any advice or idea would be appreciated.


--------------010908020705060508020601
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">
Sakae,<br>
<br>
This is a question best asked on the GMF newsgroup.&nbsp;&nbsp; I would recommend
that you not use a file: URI for an IFile but rather create a platform
resource URI.<br>
<blockquote>URI uri =
URI.createPlatformResourceURI(file.getFullPath().toString()) );
<br>
</blockquote>
<br>
<br>
Sakae Nakajima wrote:
<blockquote cite="midebi052$qic$1@utils.eclipse.org" type="cite">Hi,
<br>
<br>
I like to display contents of GMF semantic in common navigator.
<br>
<br>
My common navigator displays the contents correctly and the triggered
<br>
points listen to changes made in GMF editor.
<br>
<br>
However, the triggered points stop lestening to changes when I open
another semantic file.
<br>
<br>
My ContentProvider is following:
<br>
<br>
public class MyContentProvider extends
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdapterFactoryContentProvider{
<br>
<br>
&nbsp;&nbsp; static AdapterFactory adapterFactory;
<br>
&nbsp;&nbsp; static
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List factories = new ArrayList();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factories.add(new MyItemProviderAdapterFactory());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factories.add(new ResourceItemProviderAdapterFactory());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factories.add(new ReflectiveItemProviderAdapterFactory());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adapterFactory = new ComposedAdapterFactory(factories);
<br>
&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp; public FrameworkAdaptorFactoryContentProvider()
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super(adapterFactory);
<br>
&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp; public Object[] getChildren(Object object)
<br>
&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (object instanceof IFile)
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; IFile file = (IFile) object;
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; ResourceSet resourceSet = new ResourceSetImpl();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; URI uri = RI.createFileURI(file.getLocation().toString());
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; resource = resourceSet.createResource(uri);
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp; if (resource == null)
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return Collections.EMPTY_LIST.toArray();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<br>
&nbsp;&nbsp;&nbsp;&nbsp; resource.load(null);
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; return resource.getContents().toArray();
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Delegate the task to AdapterFactoryContentProvider
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return super.getChildren(object);
<br>
&nbsp;&nbsp; }
<br>
<br>
}
<br>
<br>
Any advice or idea would be appreciated.
<br>
</blockquote>
<br>
</body>
</html>

--------------010908020705060508020601--
Previous Topic:How to refresh action contributed by AbstractContributionItemProvider?
Next Topic:Nesting a GMF FileDiagramEditor inside a org.eclipse.ui.part.MultiPageEditorPart
Goto Forum:
  


Current Time: Thu May 15 22:56:40 EDT 2025

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

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

Back to the top