Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Store Resource does not allow editing properties with EMF generated property editor
Store Resource does not allow editing properties with EMF generated property editor [message #109499] Wed, 30 January 2008 10:09 Go to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Hi!

After having solved the dependency problems with the plugins required by
Teneo, I'm now running into an odd quirk of the JPOXResource implementation
(though it could be EMF itself too). If I store the .ejdo within the plugin
and open the EMF editor using the URL I get from:

FileLocator.find(Activator.getDefault().getBundle(), new
Path("ejdo/masterDataEditor.ejdo"), null);

(bundleentry://65/ejdo/masterDataEditor.ejdo), the Property editor does not
allow any modifications. If however, I create the editor using a 'file:/'
based URL (file://home/fhackenberger/Desktop/masterDataEditor.ejdo), the
EMF property editor works as expected.

The code for the creation of the editor looks as follows:

final Properties props = readPropFile(file);
JpoxUtil.getCreateDataStore(props);
// now use the editor props to find the correct editor
final String editorextension =
doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
final String foundEditorID = getEditorID(editorid, editorextension);
// and open it
// property editor works with: page.openEditor(new
// URIEditorInput(URI.createURI(
// "file://home/fhackenberger/Desktop/masterDataEditor.ejdo")),
// foundEditorID);
//property editor does not work with:
page.openEditor(new URIEditorInput(URI.createURI(file.toString())),
foundEditorID);

I had a look at the Teneo source code, but was unable to find anything
related to read-only resources. Could someone knowledgeable please
elaborate?

Cheers,
Florian

--
Florian Hackenberger
Re: Store Resource does not allow editing properties with EMF generated property editor [message #109537 is a reply to message #109499] Wed, 30 January 2008 10:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Florian,

Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
might need to specialize it. I definitely wouldn't expect a bundleentry
URI to be writeable since such a URI implies its a resource in the
installed environment.


DI Florian Hackenberger wrote:
> Hi!
>
> After having solved the dependency problems with the plugins required by
> Teneo, I'm now running into an odd quirk of the JPOXResource implementation
> (though it could be EMF itself too). If I store the .ejdo within the plugin
> and open the EMF editor using the URL I get from:
>
> FileLocator.find(Activator.getDefault().getBundle(), new
> Path("ejdo/masterDataEditor.ejdo"), null);
>
> (bundleentry://65/ejdo/masterDataEditor.ejdo), the Property editor does not
> allow any modifications. If however, I create the editor using a 'file:/'
> based URL (file://home/fhackenberger/Desktop/masterDataEditor.ejdo), the
> EMF property editor works as expected.
>
> The code for the creation of the editor looks as follows:
>
> final Properties props = readPropFile(file);
> JpoxUtil.getCreateDataStore(props);
> // now use the editor props to find the correct editor
> final String editorextension =
> doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
> final String foundEditorID = getEditorID(editorid, editorextension);
> // and open it
> // property editor works with: page.openEditor(new
> // URIEditorInput(URI.createURI(
> // "file://home/fhackenberger/Desktop/masterDataEditor.ejdo")),
> // foundEditorID);
> //property editor does not work with:
> page.openEditor(new URIEditorInput(URI.createURI(file.toString())),
> foundEditorID);
>
> I had a look at the Teneo source code, but was unable to find anything
> related to read-only resources. Could someone knowledgeable please
> elaborate?
>
> Cheers,
> Florian
>
>
Re: Store Resource does not allow editing properties with EMF generated property editor [message #112630 is a reply to message #109537] Tue, 19 February 2008 09:59 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Ed Merks wrote:
> Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
> might need to specialize it. I definitely wouldn't expect a bundleentry
> URI to be writeable since such a URI implies its a resource in the
> installed environment.
Just for documentation purposes. This can be solved by creating a class
similar to this one:

/** This class ensures that a resource created from an .ejdo is writeable.
*
* @author Florian Hackenberger (florian.hackenberger@acoveo.com)
*
*/
public class CustomAdapterFactoryEditingDomain extends
AdapterFactoryEditingDomain {
public CustomAdapterFactoryEditingDomain(AdapterFactory adapterFactory,
CommandStack commandStack,
Map<Resource, Boolean> resourceToReadOnlyMap) {
super(adapterFactory, commandStack, resourceToReadOnlyMap);
}

@Override
protected boolean isReadOnlyURI(URI uri) {
boolean defaultReadOnly = super.isReadOnlyURI(uri);
if (defaultReadOnly == true
&& uri.fileExtension().compareTo(JpoxConstants.EJDO_EXTENSION) == 0) {
return false;
} else {
return defaultReadOnly;
}
}
}

And using an instance of this class as the editingDomain in the
initializeEditingDomain() method of the EMF generated XXXEditor class:
protected void initializeEditingDomain() {
.........
.........
editingDomain = new CustomAdapterFactoryEditingDomain(adapterFactory,
commandStack, new HashMap<Resource, Boolean>());
}

Cheers,
Florian

--
Florian Hackenberger
Re: Store Resource does not allow editing properties with EMF generated property editor [message #112706 is a reply to message #112630] Wed, 20 February 2008 15:46 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
Thanks for the update! Can I ask one (more) favor, can you enter a bugzilla for this and post the
code below in the bugzilla? Then I can add it to the documentation.

gr. Martin

DI Florian Hackenberger wrote:
> Ed Merks wrote:
>> Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
>> might need to specialize it. I definitely wouldn't expect a bundleentry
>> URI to be writeable since such a URI implies its a resource in the
>> installed environment.
> Just for documentation purposes. This can be solved by creating a class
> similar to this one:
>
> /** This class ensures that a resource created from an .ejdo is writeable.
> *
> * @author Florian Hackenberger (florian.hackenberger@acoveo.com)
> *
> */
> public class CustomAdapterFactoryEditingDomain extends
> AdapterFactoryEditingDomain {
> public CustomAdapterFactoryEditingDomain(AdapterFactory adapterFactory,
> CommandStack commandStack,
> Map<Resource, Boolean> resourceToReadOnlyMap) {
> super(adapterFactory, commandStack, resourceToReadOnlyMap);
> }
>
> @Override
> protected boolean isReadOnlyURI(URI uri) {
> boolean defaultReadOnly = super.isReadOnlyURI(uri);
> if (defaultReadOnly == true
> && uri.fileExtension().compareTo(JpoxConstants.EJDO_EXTENSION) == 0) {
> return false;
> } else {
> return defaultReadOnly;
> }
> }
> }
>
> And using an instance of this class as the editingDomain in the
> initializeEditingDomain() method of the EMF generated XXXEditor class:
> protected void initializeEditingDomain() {
> .........
> .........
> editingDomain = new CustomAdapterFactoryEditingDomain(adapterFactory,
> commandStack, new HashMap<Resource, Boolean>());
> }
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Store Resource does not allow editing properties with EMF generated property editor [message #113142 is a reply to message #112706] Mon, 25 February 2008 08:13 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:

> Hi Florian,
> Thanks for the update! Can I ask one (more) favor, can you enter a
> bugzilla for this and post the code below in the bugzilla? Then I can add
> it to the documentation.
Sure! It's the following bug entry:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220144

Cheers,
Florian

--
Florian Hackenberger
Re: Store Resource does not allow editing properties with EMF generated property editor [message #614230 is a reply to message #109499] Wed, 30 January 2008 10:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31900
Registered: July 2009
Senior Member
Florian,

Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
might need to specialize it. I definitely wouldn't expect a bundleentry
URI to be writeable since such a URI implies its a resource in the
installed environment.


DI Florian Hackenberger wrote:
> Hi!
>
> After having solved the dependency problems with the plugins required by
> Teneo, I'm now running into an odd quirk of the JPOXResource implementation
> (though it could be EMF itself too). If I store the .ejdo within the plugin
> and open the EMF editor using the URL I get from:
>
> FileLocator.find(Activator.getDefault().getBundle(), new
> Path("ejdo/masterDataEditor.ejdo"), null);
>
> (bundleentry://65/ejdo/masterDataEditor.ejdo), the Property editor does not
> allow any modifications. If however, I create the editor using a 'file:/'
> based URL (file://home/fhackenberger/Desktop/masterDataEditor.ejdo), the
> EMF property editor works as expected.
>
> The code for the creation of the editor looks as follows:
>
> final Properties props = readPropFile(file);
> JpoxUtil.getCreateDataStore(props);
> // now use the editor props to find the correct editor
> final String editorextension =
> doTrim(props.getProperty(Constants.PROP_EDITOR_EXTENSTION));
> final String editorid = doTrim(props.getProperty(Constants.PROP_EDITOR_ID));
> final String foundEditorID = getEditorID(editorid, editorextension);
> // and open it
> // property editor works with: page.openEditor(new
> // URIEditorInput(URI.createURI(
> // "file://home/fhackenberger/Desktop/masterDataEditor.ejdo")),
> // foundEditorID);
> //property editor does not work with:
> page.openEditor(new URIEditorInput(URI.createURI(file.toString())),
> foundEditorID);
>
> I had a look at the Teneo source code, but was unable to find anything
> related to read-only resources. Could someone knowledgeable please
> elaborate?
>
> Cheers,
> Florian
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Store Resource does not allow editing properties with EMF generated property editor [message #615514 is a reply to message #109537] Tue, 19 February 2008 09:59 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Ed Merks wrote:
> Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
> might need to specialize it. I definitely wouldn't expect a bundleentry
> URI to be writeable since such a URI implies its a resource in the
> installed environment.
Just for documentation purposes. This can be solved by creating a class
similar to this one:

/** This class ensures that a resource created from an .ejdo is writeable.
*
* @author Florian Hackenberger (florian.hackenberger@acoveo.com)
*
*/
public class CustomAdapterFactoryEditingDomain extends
AdapterFactoryEditingDomain {
public CustomAdapterFactoryEditingDomain(AdapterFactory adapterFactory,
CommandStack commandStack,
Map<Resource, Boolean> resourceToReadOnlyMap) {
super(adapterFactory, commandStack, resourceToReadOnlyMap);
}

@Override
protected boolean isReadOnlyURI(URI uri) {
boolean defaultReadOnly = super.isReadOnlyURI(uri);
if (defaultReadOnly == true
&& uri.fileExtension().compareTo(JpoxConstants.EJDO_EXTENSION) == 0) {
return false;
} else {
return defaultReadOnly;
}
}
}

And using an instance of this class as the editingDomain in the
initializeEditingDomain() method of the EMF generated XXXEditor class:
protected void initializeEditingDomain() {
.........
.........
editingDomain = new CustomAdapterFactoryEditingDomain(adapterFactory,
commandStack, new HashMap<Resource, Boolean>());
}

Cheers,
Florian

--
Florian Hackenberger
Re: Store Resource does not allow editing properties with EMF generated property editor [message #615520 is a reply to message #112630] Wed, 20 February 2008 15:46 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
Thanks for the update! Can I ask one (more) favor, can you enter a bugzilla for this and post the
code below in the bugzilla? Then I can add it to the documentation.

gr. Martin

DI Florian Hackenberger wrote:
> Ed Merks wrote:
>> Have a look at AdapterFactoryEditingDomain's isReadOnly methods. You
>> might need to specialize it. I definitely wouldn't expect a bundleentry
>> URI to be writeable since such a URI implies its a resource in the
>> installed environment.
> Just for documentation purposes. This can be solved by creating a class
> similar to this one:
>
> /** This class ensures that a resource created from an .ejdo is writeable.
> *
> * @author Florian Hackenberger (florian.hackenberger@acoveo.com)
> *
> */
> public class CustomAdapterFactoryEditingDomain extends
> AdapterFactoryEditingDomain {
> public CustomAdapterFactoryEditingDomain(AdapterFactory adapterFactory,
> CommandStack commandStack,
> Map<Resource, Boolean> resourceToReadOnlyMap) {
> super(adapterFactory, commandStack, resourceToReadOnlyMap);
> }
>
> @Override
> protected boolean isReadOnlyURI(URI uri) {
> boolean defaultReadOnly = super.isReadOnlyURI(uri);
> if (defaultReadOnly == true
> && uri.fileExtension().compareTo(JpoxConstants.EJDO_EXTENSION) == 0) {
> return false;
> } else {
> return defaultReadOnly;
> }
> }
> }
>
> And using an instance of this class as the editingDomain in the
> initializeEditingDomain() method of the EMF generated XXXEditor class:
> protected void initializeEditingDomain() {
> .........
> .........
> editingDomain = new CustomAdapterFactoryEditingDomain(adapterFactory,
> commandStack, new HashMap<Resource, Boolean>());
> }
>
> Cheers,
> Florian
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Store Resource does not allow editing properties with EMF generated property editor [message #615553 is a reply to message #112706] Mon, 25 February 2008 08:13 Go to previous message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:

> Hi Florian,
> Thanks for the update! Can I ask one (more) favor, can you enter a
> bugzilla for this and post the code below in the bugzilla? Then I can add
> it to the documentation.
Sure! It's the following bug entry:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=220144

Cheers,
Florian

--
Florian Hackenberger
Previous Topic:Storing GMF diagram object with teneo
Next Topic:Problem with Teneo Library Editor Tutorial
Goto Forum:
  


Current Time: Tue Jun 15 20:33:08 GMT 2021

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

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

Back to the top