|
|
Re: Platform URIs [message #429364 is a reply to message #429356] |
Tue, 21 April 2009 12:25 |
Michael Spertus Messages: 78 Registered: July 2009 |
Member |
|
|
Ed Merks wrote:
> Michael,
> Comments below.
> Michael Spertus wrote:
>> I'm writing an RCP plug-in and having problems with using platform
>> URIs with EMF.
> RCP typically means there is no workspace so platform:/resource URIs
> don't work in that case.
Understood, but that doesn't affect the platform:/plugin problem I'm
having.
>> I'm working around it by resolving them to file URIs, but there are a
>> lot of code samples that successfully use platform URIs. What am I
>> doing wrong?
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>> URI myURI = URI.createURI("platform:/plugin/com.abc/data/my.deck");
>> Resource myResource = resourceSet.getResource(myURI, false); // Fails
> How does it fail? What's the exception?
No exception. It just returns null (I've edited the call slightly above).
>> myResource = resourceSet.getResource(CommonPlugin.resolve(myURI)); //
>> Succeeds
> I'd be surprised that this works but the other fails since the fact it
> resolve would seem to indicate that the platform:/plugin reference is
> resolving correct, which would imply you should be able to use it
> directly. If you create a URL from the original URI, does openStream
> return a stream? I'd expect it to, if the file actually exists in the
> plugin.
Yep. openStream works fine, just not getResource.
Am I supposed to something to setup the URIConverter?
Mike
>>
>> Thanks,
>>
>> Mike
>>
>>
>>
>>
|
|
|
Re: Platform URIs [message #429369 is a reply to message #429364] |
Tue, 21 April 2009 13:44 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Michael,
Comments below.
Michael Spertus wrote:
> Ed Merks wrote:
>
>> Michael,
>
>> Comments below.
>
>
>> Michael Spertus wrote:
>>> I'm writing an RCP plug-in and having problems with using platform
>>> URIs with EMF.
>> RCP typically means there is no workspace so platform:/resource URIs
>> don't work in that case.
> Understood, but that doesn't affect the platform:/plugin problem I'm
> having.
Indeed.
>
>>> I'm working around it by resolving them to file URIs, but there are
>>> a lot of code samples that successfully use platform URIs. What am I
>>> doing wrong?
>>>
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> URI myURI = URI.createURI("platform:/plugin/com.abc/data/my.deck");
>>> Resource myResource = resourceSet.getResource(myURI, false); // Fails
>> How does it fail? What's the exception?
> No exception. It just returns null (I've edited the call slightly above).
Returning null. Did you intend to pass in "true" given that you don't
seem to be expecting null.
>>> myResource = resourceSet.getResource(CommonPlugin.resolve(myURI));
>>> // Succeeds
Given there isn't a one argument version, did you perhaps leave out the
fact you used "true" in this case?
>> I'd be surprised that this works but the other fails since the fact
>> it resolve would seem to indicate that the platform:/plugin reference
>> is resolving correct, which would imply you should be able to use it
>> directly. If you create a URL from the original URI, does
>> openStream return a stream? I'd expect it to, if the file actually
>> exists in the plugin.
> Yep. openStream works fine, just not getResource.
>
> Am I supposed to something to setup the URIConverter?
It sounds like simply passing in true indicating you want to demand load
the resource if it's not already in the resource set would do the trick.
>
> Mike
>
>>>
>>> Thanks,
>>>
>>> Mike
>>>
>>>
>>>
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Platform URIs [message #429378 is a reply to message #429376] |
Tue, 21 April 2009 15:21 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Michael,
I've often found the smaller the mistake the harder it is to spot.
You'll note that I didn't spot it the first time either.
Michael Spertus wrote:
> I'm an idiot. As you suspected, I'd somehow gotten a false in there.
> Never mind.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03160 seconds