Skip to main content



      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 05:52 Go to next message
Eclipse UserFriend
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 02:20 Go to previous messageGo to next message
Eclipse UserFriend
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 01:36 Go to previous message
Eclipse UserFriend
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: Sun Jun 22 23:46:54 EDT 2025

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

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

Back to the top