Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » My DirectEdit works only if I override the DirectEditManager.commit() method?!
My DirectEdit works only if I override the DirectEditManager.commit() method?! [message #167828] Fri, 11 February 2005 10:52 Go to next message
Andreas Herz is currently offline Andreas HerzFriend
Messages: 196
Registered: July 2009
Senior Member
Hi,

1.)
------------
I have copy code snippets for direct edit a Label ....works fine.
(The code snippet has overriden the commit() method of DirectEditManager)


2.)
-----------
I have copy the code for the StickyNote in the digital-simulator example and the
new entered text of the direct edit will NOT transfer to my Model!

I always receive the old value!

protected Command <MyDirectEditPolicy>.getDirectEditCommand(DirectEditRequest request)
{
String labelText = (String)request.getCellEditor().getValue();
System.out.println("NEW VALUE:"+labelText);
// ERROR labelText is the old value!!!!!!!!!!!!!!!!!!!!
.
.
.
.
return cmd;
}

3.)
-----------
I override the commit() in MyDirectEditManager of the digital-simulator code snippet
and it work fine!

protected void <MyDirectEditManager>.commit()
{
if (committing)
return;
committing = true;
try
{
getCellEditor().getControl().setVisible(false);
if (isDirty())
{
CommandStack stack = getEditPart().getViewer().getEditDomain().getCommandStack();
Command command = getEditPart().getCommand(getDirectEditRequest());
if (command != null && command.canExecute())
stack.execute(command);
}
}
finally
{
bringDown();
committing = false;
}
}


Why works the DirectEdit in digitalSimulator and why must I override the
commit() method?!


greetings

Andreas
Re: My DirectEdit works only if I override the DirectEditManager.commit() method?! [message #168090 is a reply to message #167828] Sat, 12 February 2005 07:20 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Don't know what could be causing this. But the way it's done in the logic
example works there and elsewhere too. What code-base are you using?

The only difference I noticed between your commit() method and
DirectEditManager's is that you're invoking
getCellEditor().getControl().setVisible(false). Are you saying this is
what's making it work? What happens if you remove that line of code from
the overridden method?

"FreeGroup" <a.herz@FreeGroup.de> wrote in message
news:cui2tn$8le$1@www.eclipse.org...
> Hi,
>
> 1.)
> ------------
> I have copy code snippets for direct edit a Label ....works fine.
> (The code snippet has overriden the commit() method of DirectEditManager)
>
>
> 2.)
> -----------
> I have copy the code for the StickyNote in the digital-simulator example
and the
> new entered text of the direct edit will NOT transfer to my Model!
>
> I always receive the old value!
>
> protected Command
<MyDirectEditPolicy>.getDirectEditCommand(DirectEditRequest request)
> {
> String labelText = (String)request.getCellEditor().getValue();
> System.out.println("NEW VALUE:"+labelText);
> // ERROR labelText is the old value!!!!!!!!!!!!!!!!!!!!
> .
> .
> .
> .
> return cmd;
> }
>
> 3.)
> -----------
> I override the commit() in MyDirectEditManager of the digital-simulator
code snippet
> and it work fine!
>
> protected void <MyDirectEditManager>.commit()
> {
> if (committing)
> return;
> committing = true;
> try
> {
> getCellEditor().getControl().setVisible(false);
> if (isDirty())
> {
> CommandStack stack =
getEditPart().getViewer().getEditDomain().getCommandStack();
> Command command = getEditPart().getCommand(getDirectEditRequest());
> if (command != null && command.canExecute())
> stack.execute(command);
> }
> }
> finally
> {
> bringDown();
> committing = false;
> }
> }
>
>
> Why works the DirectEdit in digitalSimulator and why must I override the
> commit() method?!
>
>
> greetings
>
> Andreas
>
Re: My DirectEdit works only if I override the DirectEditManager.commit() method?! [message #168163 is a reply to message #168090] Mon, 14 February 2005 06:36 Go to previous message
Andreas Herz is currently offline Andreas HerzFriend
Messages: 196
Registered: July 2009
Senior Member
Hi,

1.)
I have removed the line

getCellEditor().getControl().setVisible(false)

and it works fine.

2.)
I have add the line

eraseFeedback()

and I have the problem. I always retrieve the old value
if the element!

I use eclipse 3.1 with GEF 3.0.1

greetings

Andreas



Pratik Shah wrote:
> Don't know what could be causing this. But the way it's done in the logic
> example works there and elsewhere too. What code-base are you using?
>
> The only difference I noticed between your commit() method and
> DirectEditManager's is that you're invoking
> getCellEditor().getControl().setVisible(false). Are you saying this is
> what's making it work? What happens if you remove that line of code from
> the overridden method?
>
Previous Topic:Is it possible create Microsoft office like Palette?
Next Topic:how to get the location of an image in a label?
Goto Forum:
  


Current Time: Thu Apr 25 00:55:41 GMT 2024

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

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

Back to the top