Re: GMF files with common navigator framework [message #15862] |
Fri, 11 August 2006 09:59 |
Eclipse User |
|
|
|
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. 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>
AdapterFactoryContentProvider{
<br>
<br>
static AdapterFactory adapterFactory;
<br>
static
<br>
{
<br>
List factories = new ArrayList();
<br>
factories.add(new MyItemProviderAdapterFactory());
<br>
factories.add(new ResourceItemProviderAdapterFactory());
<br>
factories.add(new ReflectiveItemProviderAdapterFactory());
<br>
adapterFactory = new ComposedAdapterFactory(factories);
<br>
}
<br>
<br>
public FrameworkAdaptorFactoryContentProvider()
<br>
{
<br>
super(adapterFactory);
<br>
}
<br>
<br>
public Object[] getChildren(Object object)
<br>
{
<br>
if (object instanceof IFile)
<br>
{
<br>
IFile file = (IFile) object;
<br>
<br>
ResourceSet resourceSet = new ResourceSetImpl();
<br>
URI uri = RI.createFileURI(file.getLocation().toString());
<br>
resource = resourceSet.createResource(uri);
<br>
<br>
if (resource == null)
<br>
return Collections.EMPTY_LIST.toArray();
<br>
<br>
resource.load(null);
<br>
return resource.getContents().toArray();
<br>
}
<br>
<br>
// Delegate the task to AdapterFactoryContentProvider
<br>
return super.getChildren(object);
<br>
}
<br>
<br>
}
<br>
<br>
Any advice or idea would be appreciated.
<br>
</blockquote>
<br>
</body>
</html>
--------------010908020705060508020601--
|
|
|
Powered by
FUDForum. Page generated in 0.03767 seconds