Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Action propagation to editor input
Action propagation to editor input [message #512433] Fri, 05 February 2010 06:39 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi all,

i think this is more or less a newbie question, but since the project
deadline is quite close, i'm not able to spent to much time for
try/error attempts as commonly.

I have some view implemented that wrap my model and expose some buttons
(add a new element x) to the user. When the user invokes such an action,
i can easily modify the model, but how to change the tree editor's
isDirty state? I didn't want to store the modifications immediatiliy but
only when the user presses the 'save' button.

I was digging a bit in the generated tree editor stuff, but this is a
lot of code for someone who has limited time. If someone may state a
simple process way how to achieve this quickly (it could be a dirty
hack, primarily) i would be really grateful.

Thanks in advance
Timothy
Re: Action propagation to editor input [message #512525 is a reply to message #512433] Fri, 05 February 2010 11:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030800030802040508010205
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Timothy,

Comments below.

Timothy Marc wrote:
> Hi all,
>
> i think this is more or less a newbie question, but since the project
> deadline is quite close, i'm not able to spent to much time for
> try/error attempts as commonly.
>
> I have some view implemented that wrap my model and expose some
> buttons (add a new element x) to the user. When the user invokes such
> an action, i can easily modify the model, but how to change the tree
> editor's isDirty state? I didn't want to store the modifications
> immediatiliy but only when the user presses the 'save' button.
You need to use commands.
>
> I was digging a bit in the generated tree editor stuff, but this is a
> lot of code for someone who has limited time. If someone may state a
> simple process way how to achieve this quickly (it could be a dirty
> hack, primarily) i would be really grateful.
Dirtiness is based on the state of the command stack. See this code in
the generated editor?

// Add a listener to set the most recent command's affected
objects to be the selection of the viewer with focus.
//
commandStack.addCommandStackListener
(new CommandStackListener()
{
public void commandStackChanged(final EventObject event)
{
getContainer().getDisplay().asyncExec
(new Runnable()
{
public void run()
{
firePropertyChange(IEditorPart.PROP_DIRTY);

If you can't or don't want to use fine grained commands like
AddCommand/RemoveCommand you can use something like ChangeCommand to
record all the changes so they are undoable.
>
> Thanks in advance
> Timothy

--------------030800030802040508010205
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Timothy,<br>
<br>
Comments below.<br>
<br>
Timothy Marc wrote:
<blockquote cite="mid:hkgeei$1qu$1@build.eclipse.org" type="cite">Hi
all,
<br>
<br>
i think this is more or less a newbie question, but since the project
deadline is quite close, i'm not able to spent to much time for
try/error attempts as commonly.
<br>
<br>
I have some view implemented that wrap my model and expose some buttons
(add a new element x) to the user. When the user invokes such an
action, i can easily modify the model, but how to change the tree
editor's isDirty state? I didn't want to store the modifications
immediatiliy but only when the user presses the 'save' button.
<br>
</blockquote>
You need to use commands.<br>
<blockquote cite="mid:hkgeei$1qu$1@build.eclipse.org" type="cite"><br>
I was digging a bit in the generated tree editor stuff, but this is a
lot of code for someone who has limited time. If someone may state a
simple process way how to achieve this quickly (it could be a dirty
hack, primarily) i would be really grateful.
<br>
</blockquote>
Dirtiness is based on the state of the command stack. See this code in
the generated editor?<br>
<blockquote><small>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] Integration builds?
Next Topic:EMF Builder
Goto Forum:
  


Current Time: Thu Apr 25 23:09:06 GMT 2024

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

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

Back to the top