Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Edit popup issue
Edit popup issue [message #178932] Tue, 25 March 2008 12:49 Go to next message
Eclipse UserFriend
Hi,
I have modified my generated code so that when user double-click on a
label, a pop is displayed to edit it.
Here is the error displayed when I execute the pressedOk button action :

===========================

org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:205)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:168)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:155)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.performRequest(GraphicalEditPart.java:1098)
at
org.eclipse.gef.tools.SelectEditPartTracker.performOpen(Sele ctEditPartTracker.java:187)
at
org.eclipse.gef.tools.SelectEditPartTracker.handleDoubleClic k(SelectEditPartTracker.java:131)
at
org.eclipse.gef.tools.AbstractTool.mouseDoubleClick(Abstract Tool.java:944)
at
org.eclipse.gef.tools.SelectionTool.mouseDoubleClick(Selecti onTool.java:501)
at org.eclipse.gef.EditDomain.mouseDoubleClick(EditDomain.java: 204)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse DoubleClicked(DomainEventDispatcher.java:285)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseDoubl eClick(LightweightSystem.java:508)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:182)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Caused by: java.lang.IllegalStateException: Cannot modify resource set
without a write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:322)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:266)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:222)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at com.clearsy.eventB.impl.InvariantImpl.setLabel(InvariantImpl .java:153)
at
com.clearsy.eventB.machinecontent.diagram.edit.commands.Inva riantUpdateCommand.setValues(InvariantUpdateCommand.java:52)
at
com.clearsy.eventB.machinecontent.diagram.edit.commands.Inva riantUpdateCommand.execute(InvariantUpdateCommand.java:79)
at
org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy.doE xecuteWithResult(CommandProxy.java:49)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:134)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
... 37 more


===========================


Can somebody help me please ?

Thanks for your help.

Regards,

Philippe
Re: Edit popup issue [message #179008 is a reply to message #178932] Tue, 25 March 2008 14:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello Philippe,

Subclass AbstractTransactionalCommand to perform your operation.

-----------------
Alex Shatalin
Re: Edit popup issue [message #179061 is a reply to message #179008] Wed, 26 March 2008 05:50 Go to previous messageGo to next message
Eclipse UserFriend
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 07:13 Go to previous messageGo to next message
Eclipse UserFriend
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 11:36 Go to previous message
Eclipse UserFriend
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
>>>
>>>
Previous Topic:Connection source and target in XMI file
Next Topic:Restoring windows
Goto Forum:
  


Current Time: Tue Jul 08 01:57:54 EDT 2025

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

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

Back to the top