Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » how to modify attibute from non-gef editor
how to modify attibute from non-gef editor [message #147991] Mon, 27 August 2007 21:28 Go to next message
Eclipse UserFriend
Originally posted by: slorenc.infogix.com

I have an alternative editor which can be used to modify the name of my
object. I can modify it easily via the generated graphical editor. I see
that the commands used to accomplish this are derived from
org.eclipse.gef.commands.Command.

When I am editing the name in the alternate editor, I have access to the
semantic model but not the graphical editor - which is OK.

ControlType owner = getControl();
EditingDomain domain =
AdapterFactoryEditingDomain.getEditingDomainFor(owner);
EAttribute feature = DiagramPackage.eINSTANCE.getControlType_Name();
Command setCommand = SetCommand.create(domain, owner, feature, name);
domain.getCommandStack().execute(setCommand);

I tried the emf command first but the command is not actually executed
because the domain is 'read-only'. My model is stored in a database so it
doesn't follow the file, platform or any archive schemes.

Should I override the methods which test for read-only? To accomplish
reading and wrting I have a special resource type and output stream which
route the reading and writing from/to the database.

What is the purpose of marking the resource as read only?

So, I figured what command is used by GEF editor to set values in the model
and came up with the following replacement for command creatinon and
execution.

TransactionalEditingDomain tDomain = (TransactionalEditingDomain) domain;
Command setValueCommand = new SetValueCommand(new SetRequest(tDomain, owner,
feature, name));
tDomain.getCommandStack().execute(setValueCommand);

However, this approach doesn't even compile because in the code above the
Command is the org.eclipse.emf.common.command.Command and the one in the
graphical editor is org.eclipse.gef.commands.Command.

Should I attempt using gef command or make the resource writeable and get
the emf command to work?

Thanks,

Swavek
Re: how to modify attibute from non-gef editor [message #147997 is a reply to message #147991] Mon, 27 August 2007 21:41 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

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

Swavek,

Specializing the read only computing in the adapter factory editing
domain seems reasonable. The idea there is that a resource can be read
only in the work space and in that case, you can't edit it. For EMF 2.4
we are working on generalizing the URI converter so that things like
isReadOnly, exists, and delete can be more easily implemented and
specialized.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=191077

You'll actually be able to delete an EMF resource and delete the
underlying IFile as a resource. There's even a prototyped for an
HTTP-backed repository...


Swavek Lorenc wrote:
> I have an alternative editor which can be used to modify the name of my
> object. I can modify it easily via the generated graphical editor. I see
> that the commands used to accomplish this are derived from
> org.eclipse.gef.commands.Command.
>
> When I am editing the name in the alternate editor, I have access to the
> semantic model but not the graphical editor - which is OK.
>
> ControlType owner = getControl();
> EditingDomain domain =
> AdapterFactoryEditingDomain.getEditingDomainFor(owner);
> EAttribute feature = DiagramPackage.eINSTANCE.getControlType_Name();
> Command setCommand = SetCommand.create(domain, owner, feature, name);
> domain.getCommandStack().execute(setCommand);
>
> I tried the emf command first but the command is not actually executed
> because the domain is 'read-only'. My model is stored in a database so it
> doesn't follow the file, platform or any archive schemes.
>
> Should I override the methods which test for read-only? To accomplish
> reading and wrting I have a special resource type and output stream which
> route the reading and writing from/to the database.
>
> What is the purpose of marking the resource as read only?
>
> So, I figured what command is used by GEF editor to set values in the model
> and came up with the following replacement for command creatinon and
> execution.
>
> TransactionalEditingDomain tDomain = (TransactionalEditingDomain) domain;
> Command setValueCommand = new SetValueCommand(new SetRequest(tDomain, owner,
> feature, name));
> tDomain.getCommandStack().execute(setValueCommand);
>
> However, this approach doesn't even compile because in the code above the
> Command is the org.eclipse.emf.common.command.Command and the one in the
> graphical editor is org.eclipse.gef.commands.Command.
>
> Should I attempt using gef command or make the resource writeable and get
> the emf command to work?
>
> Thanks,
>
> Swavek
>
>
>
>
>
>
>
>


--------------040604050602080209000509
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">
Swavek,<br>
<br>
Specializing the read only computing in the adapter factory editing
domain seems reasonable.&nbsp; The idea there is that a resource can be read
only in the work space and in that case, you can't edit it.&nbsp; For EMF
2.4 we are working on generalizing the URI converter so that things
like isReadOnly, exists, and delete can be more easily implemented and
specialized. <br>
<blockquote><a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=191077">https://bugs.eclipse.org/bugs/show_bug.cgi?id=191077</a><br>
</blockquote>
You'll actually be able to delete an EMF resource and delete the
underlying IFile as a resource.&nbsp; There's even a prototyped for an
HTTP-backed repository...<br>
<br>
<br>
Swavek Lorenc wrote:
<blockquote cite="mid:favflo$qup$1@build.eclipse.org" type="cite">
<pre wrap="">I have an alternative editor which can be used to modify the name of my
object. I can modify it easily via the generated graphical editor. I see
that the commands used to accomplish this are derived from
org.eclipse.gef.commands.Command.

When I am editing the name in the alternate editor, I have access to the
semantic model but not the graphical editor - which is OK.

ControlType owner = getControl();
EditingDomain domain =
AdapterFactoryEditingDomain.getEditingDomainFor(owner);
EAttribute feature = DiagramPackage.eINSTANCE.getControlType_Name();
Command setCommand = SetCommand.create(domain, owner, feature, name);
domain.getCommandStack().execute(setCommand);

I tried the emf command first but the command is not actually executed
because the domain is 'read-only'. My model is stored in a database so it
doesn't follow the file, platform or any archive schemes.

Should I override the methods which test for read-only? To accomplish
reading and wrting I have a special resource type and output stream which
route the reading and writing from/to the database.

What is the purpose of marking the resource as read only?

So, I figured what command is used by GEF editor to set values in the model
and came up with the following replacement for command creatinon and
execution.

TransactionalEditingDomain tDomain = (TransactionalEditingDomain) domain;
Command setValueCommand = new SetValueCommand(new SetRequest(tDomain, owner,
feature, name));
tDomain.getCommandStack().execute(setValueCommand);

However, this approach doesn't even compile because in the code above the
Command is the org.eclipse.emf.common.command.Command and the one in the
graphical editor is org.eclipse.gef.commands.Command.

Should I attempt using gef command or make the resource writeable and get
the emf command to work?

Thanks,

Swavek







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

--------------040604050602080209000509--
Previous Topic:Re: GMF Help: no mapping options in mapping def wizard
Next Topic:Change the bend point
Goto Forum:
  


Current Time: Wed Jul 17 23:20:54 GMT 2024

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

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

Back to the top