|
|
Re: Edit popup issue [message #179061 is a reply to message #179008] |
Wed, 26 March 2008 09:50 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Hi Alex, thank you.
Here is my architecture :
************************************************************ ****
************************************************************ ****
=======
ELEMENTEditPart.java :
=======
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
...
installEditPolicy(EditPolicyRoles.OPEN_ROLE, createOpenEditPolicy());
}
private EditPolicy createOpenEditPolicy() {
return new ELEMENTDialogOpenEditPolicy((ELEMENT) ((View)
getModel()).getElement(), getViewer(), getEditingDomain());
}
=======
ELEMENTDialogOpenEditPolicy extends OpenEditPolicy
=======
protected Command getOpenCommand(Request request) {
if (null != _ELEMENT) {
Shell shell = viewer.getControl().getShell();
ELMENTEditDialog dialog = new
InvariantEditDialog(invariant,shell);
if (dialog.open() == Window.OK)
{
return new ELEMENTUpdateCommand(invariant,
dialog.getData());
}
return null;
}
=======
ELEMENTUpdateCommand extends Command
=======
public void execute()
{
getOldValues();
setValues();
}
************************************************************ ****
************************************************************ ****
So, my command extends Command class. What must I modify in my
architecture ?
Regards,
Philippe
Alex Shatalin a écrit :
> Hello Philippe,
>
> Subclass AbstractTransactionalCommand to perform your operation.
>
> -----------------
> Alex Shatalin
>
>
|
|
|
Re: Edit popup issue [message #179079 is a reply to message #179061] |
Wed, 26 March 2008 11:13 |
Boris Blajer Messages: 217 Registered: July 2009 |
Senior Member |
|
|
Hi Philippe,
ElementUpdateCommand should subclass AbstractTransactionalCommand. The
methods that return GEF commands should wrap your command into
ICommandProxy.
Best regards,
Boris
Philippe BLANC wrote:
> Hi Alex, thank you.
>
> Here is my architecture :
>
>
> ************************************************************ ****
> ************************************************************ ****
>
> =======
> ELEMENTEditPart.java :
> =======
> protected void createDefaultEditPolicies() {
> super.createDefaultEditPolicies();
> ...
> installEditPolicy(EditPolicyRoles.OPEN_ROLE, createOpenEditPolicy());
> }
>
> private EditPolicy createOpenEditPolicy() {
> return new ELEMENTDialogOpenEditPolicy((ELEMENT) ((View)
> getModel()).getElement(), getViewer(), getEditingDomain());
> }
>
> =======
> ELEMENTDialogOpenEditPolicy extends OpenEditPolicy
> =======
>
> protected Command getOpenCommand(Request request) {
> if (null != _ELEMENT) {
> Shell shell = viewer.getControl().getShell();
> ELMENTEditDialog dialog = new
> InvariantEditDialog(invariant,shell);
> if (dialog.open() == Window.OK)
> {
> return new ELEMENTUpdateCommand(invariant,
> dialog.getData());
> }
> return null;
> }
>
> =======
> ELEMENTUpdateCommand extends Command
> =======
>
> public void execute()
> {
> getOldValues();
> setValues();
> }
>
> ************************************************************ ****
> ************************************************************ ****
>
> So, my command extends Command class. What must I modify in my
> architecture ?
>
> Regards,
> Philippe
>
> Alex Shatalin a écrit :
>> Hello Philippe,
>>
>> Subclass AbstractTransactionalCommand to perform your operation.
>>
>> -----------------
>> Alex Shatalin
>>
>>
|
|
|
Re: Edit popup issue [message #179237 is a reply to message #179079] |
Wed, 26 March 2008 15:36 |
BLANC Philippe Messages: 89 Registered: July 2009 |
Member |
|
|
Thank you Boris and Alex, it works! Here is my implementation :
=======
ELEMENTDialogOpenEditPolicy extends OpenEditPolicy
=======
protected Command getOpenCommand(Request request) {
if (null != ELEMENT) {
Shell shell = viewer.getControl().getShell();
ELEMENTEditDialog dialog = new
ELEMENTEditDialog(invariant,shell);
if (dialog.open() == Window.OK)
{
Map data = dialog.getData();
return new ICommandProxy(new
InvariantUpdateCommand(editingDomain,ELEMENT,dialog.getData( )));
}
return null;
}
=======
ELEMENTUpdateCommand extends AbstractTransactionalCommand
=======
public InvariantUpdateCommand(TransactionalEditingDomain domain,
ELEMENT elt, Map data) {
super(domain,"ELEMENTUpdateCommand",null);
this.ELEMENT = elt;
}
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
getOldValues();
setValues();
return CommandResult.newOKCommandResult();
}
Best regards,
Philippe
Boris Blajer a écrit :
> Hi Philippe,
>
> ElementUpdateCommand should subclass AbstractTransactionalCommand. The
> methods that return GEF commands should wrap your command into
> ICommandProxy.
>
> Best regards,
> Boris
>
> Philippe BLANC wrote:
>> Hi Alex, thank you.
>>
>> Here is my architecture :
>>
>>
>> ************************************************************ ****
>> ************************************************************ ****
>>
>> =======
>> ELEMENTEditPart.java :
>> =======
>> protected void createDefaultEditPolicies() {
>> super.createDefaultEditPolicies();
>> ...
>> installEditPolicy(EditPolicyRoles.OPEN_ROLE, createOpenEditPolicy());
>> }
>>
>> private EditPolicy createOpenEditPolicy() {
>> return new ELEMENTDialogOpenEditPolicy((ELEMENT) ((View)
>> getModel()).getElement(), getViewer(), getEditingDomain());
>> }
>>
>> =======
>> ELEMENTDialogOpenEditPolicy extends OpenEditPolicy
>> =======
>>
>> protected Command getOpenCommand(Request request) {
>> if (null != _ELEMENT) {
>> Shell shell = viewer.getControl().getShell();
>> ELMENTEditDialog dialog = new
>> InvariantEditDialog(invariant,shell);
>> if (dialog.open() == Window.OK)
>> {
>> return new ELEMENTUpdateCommand(invariant,
>> dialog.getData());
>> }
>> return null;
>> }
>>
>> =======
>> ELEMENTUpdateCommand extends Command
>> =======
>>
>> public void execute()
>> {
>> getOldValues();
>> setValues();
>> }
>>
>> ************************************************************ ****
>> ************************************************************ ****
>>
>> So, my command extends Command class. What must I modify in my
>> architecture ?
>>
>> Regards,
>> Philippe
>>
>> Alex Shatalin a écrit :
>>> Hello Philippe,
>>>
>>> Subclass AbstractTransactionalCommand to perform your operation.
>>>
>>> -----------------
>>> Alex Shatalin
>>>
>>>
|
|
|
Powered by
FUDForum. Page generated in 0.02692 seconds