Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Child setLocation
Child setLocation [message #237113] Tue, 21 July 2009 12:39 Go to next message
Daniel is currently offline DanielFriend
Messages: 19
Registered: July 2009
Junior Member
Hello,

I have a problem with the position of child.
My object A contains a child B and I would like to have the child at a
position when it is created (manually or automatically).

Do you have any clues?

I test with XX.setLocation(new Point(x,y)) but unfortunately it doesn't
work.

Thanks for any help
Re: Child setLocation [message #237195 is a reply to message #237113] Wed, 22 July 2009 09:32 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

You have to use org.eclipse.gmf.runtime.notation.Node.setLayoutConstraint()
instead.


-----------------
Alex Shatalin
Re: Child setLocation [message #237201 is a reply to message #237195] Wed, 22 July 2009 09:46 Go to previous messageGo to next message
Daniel is currently offline DanielFriend
Messages: 19
Registered: July 2009
Junior Member
But how can I use that?
Re: Child setLocation [message #237210 is a reply to message #237201] Wed, 22 July 2009 10:08 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Daniel,

> But how can I use that?
It depends on a place in code you are goint to do it...
In general from any EditPart you can getModel() getting View instance (superclass
of the Node), so in case of working with diagram Nodes you'll directly get
Node instance, so you'll be able to call get/setLayoutConstraint() there.

-----------------
Alex Shatalin
Re: Child setLocation [message #237557 is a reply to message #237210] Mon, 27 July 2009 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

Hi,

could you please provide a code sample at
http://wiki.eclipse.org/GMF_Tips

I think this question has been asked a lot of times and will be asked
again in the future. A code sample in the wiki would be a great help.

In my case, calling setLocation in refreshVisuals causes a
IllegalStateException. Is there a better place to call it?

Cheers,
Mark

> Hello Daniel,
>
>> But how can I use that?
> It depends on a place in code you are goint to do it...
> In general from any EditPart you can getModel() getting View instance
> (superclass of the Node), so in case of working with diagram Nodes
> you'll directly get Node instance, so you'll be able to call
> get/setLayoutConstraint() there.
>
> -----------------
> Alex Shatalin
Re: Child setLocation [message #237573 is a reply to message #237557] Mon, 27 July 2009 13:00 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mark L.,

>could you please provide a code sample at
See:
http://wiki.eclipse.org/GMF_Archived_Newsgroup_Q_and_A#How_c an_I_get_the_size_and_location_of_an_element.3F
http://wiki.eclipse.org/GMF_Archived_Newsgroup_Q_and_A#How_c an_I_build_a_diagram_programmatically.3F

> In my case, calling setLocation in refreshVisuals causes a
> IllegalStateException. Is there a better place to call it?
Is there any more details in this exception?

-----------------
Alex Shatalin
Re: Child setLocation [message #351588 is a reply to message #237573] Tue, 28 July 2009 09:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

Hi Alex,

thanks for the code sample at the given URL, but from my point of view
the most important thing is not shown: where to put the
getLayoutConstraint call (and where to alter the layout constraint).

Anyway, after adding my code refreshVisuals (in the appropriate
EditPart) looks like this:
/**
* @generated NOT
*/
@Override
protected void refreshVisuals() {
super.refreshVisuals();
LayoutConstraint lc = ((Node) getModel()).getLayoutConstraint();
if (lc instanceof Location) {
Location l = ((Location) lc);
l.setX(10);
l.setY(10);
}
}

The exceptions stacktrace says:

java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:280)
at
org.eclipse.gmf.runtime.notation.impl.LocationImpl.setX(Loca tionImpl.java:115)
at
de.hpi.sam.tgg.diagram.edit.parts.SourceModelDomainEditPart. refreshVisuals(SourceModelDomainEditPart.java:208)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:676)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:571)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.access$3(GraphicalEditPart.java:1)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt$3.run(GraphicalEditPart.java:855)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.runExclusive(TransactionalEditingDomainImpl.java:313)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.refresh(GraphicalEditPart.java:845)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:235)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:219)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.addChild(GraphicalEditPart.java:1313)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.handleNotificationEvent(GraphicalEditPart.java:1458)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.notifyChanged(GraphicalEditPart.java:1432)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.fireNotification(DiagramEventBroker.java:500)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.resourceSetChanged(DiagramEventBroker.java:395)
at
org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadS afe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73)
at
org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFac tory$DiagramEditingDomain.postcommit(DiagramEditingDomainFac tory.java:213)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.deactivate(TransactionalEditingDomainImpl.java:528)
at
org.eclipse.emf.transaction.impl.TransactionImpl.close(Trans actionImpl.java:712)
at
org.eclipse.emf.transaction.impl.TransactionImpl.commit(Tran sactionImpl.java:474)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:155)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.executeCommand(CanonicalEditPolicy.java:510)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.createViews(CanonicalEditPolicy.java:466)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.refreshSemanticChildren(CanonicalEditPolicy.java:111 6)
at
de.hpi.sam.tgg.diagram.edit.policies.TGGRuleCanonicalEditPol icy.refreshSemantic(TGGRuleCanonicalEditPolicy.java:147)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.refresh(CanonicalEditPolicy.java:979)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalCon nectionEditPolicy.refreshOnActivate(CanonicalConnectionEditP olicy.java:108)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.activate(CanonicalEditPolicy.java:646)
at
org.eclipse.gef.editparts.AbstractEditPart.activateEditPolic ies(AbstractEditPart.java:165)
at
org.eclipse.gef.editparts.AbstractEditPart.activate(Abstract EditPart.java:148)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.activate (AbstractGraphicalEditPart.java:193)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.access$0(GraphicalEditPart.java:1)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.activate(GraphicalEditPart.java:205)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart .activate(DiagramEditPart.java:349)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:201)
at
org.eclipse.gef.editparts.SimpleRootEditPart.setContents(Sim pleRootEditPart.java:101)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents( AbstractEditPartViewer.java:601)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalVie wer.setContents(DiagramGraphicalViewer.java:378)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents( AbstractEditPartViewer.java:610)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initi alizeGraphicalViewerContents(DiagramEditor.java:870)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initi alizeGraphicalViewer(DiagramEditor.java:863)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFl yOutPalette.initializeGraphicalViewer(DiagramEditorWithFlyOu tPalette.java:116)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.initializeGraphicalViewer(DiagramDocumen tEditor.java:175)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.creat eGraphicalViewer(DiagramEditor.java:807)
at
org.eclipse.gef.ui.parts.GraphicalEditor.createPartControl(G raphicalEditor.java:163)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.creat ePartControl(DiagramEditor.java:1555)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFl yOutPalette.createPartControl(DiagramEditorWithFlyOutPalette .java:328)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.createPartControl(DiagramDocumentEditor. java:1510)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:662)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:462)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
at
org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1256)
at
org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1209)
at
org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 08)
at
org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
at
org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
at
org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
at
org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
at
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:63)
at
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:225)
at
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:213)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:778)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:677)
at
org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:638)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2854)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2762)
at
org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2754)
at
org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2705)
at
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2701)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2685)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2668)
at
de.hpi.sam.tgg.diagram.part.TggDiagramEditorUtil.openDiagram (TggDiagramEditorUtil.java:83)
at
de.hpi.sam.tgg.diagram.part.TggCreationWizard$2.execute(TggC reationWizard.java:146)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:106)
at
org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1800)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:118)
at
org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
at
org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at
org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 944)
at
de.hpi.sam.tgg.diagram.part.TggCreationWizard.performFinish( TggCreationWizard.java:156)
at
org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDi alog.java:752)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:373)
at
org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:624)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at
org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
at
org.eclipse.jface.window.Window.open(Window.java:801)
at
org.eclipse.ui.internal.handlers.WizardHandler$New.executeHa ndler(WizardHandler.java:253)
at
org.eclipse.ui.internal.handlers.WizardHandler.execute(Wizar dHandler.java:273)
at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle rProxy.java:294)
at
org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
at
org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
at
org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
at
org.eclipse.ui.internal.handlers.SlaveHandlerService.execute Command(SlaveHandlerService.java:241)
at
org.eclipse.ui.internal.actions.CommandAction.runWithEvent(C ommandAction.java:157)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at
org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
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: 559)
at
org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at
org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at
org.eclipse.equinox.launcher.Main.main(Main.java:1287)



Regards,
Mark

> Hello Mark L.,
>
>> could you please provide a code sample at
> See:
> http://wiki.eclipse.org/GMF_Archived_Newsgroup_Q_and_A#How_c an_I_get_the_size_and_location_of_an_element.3F
>
> http://wiki.eclipse.org/GMF_Archived_Newsgroup_Q_and_A#How_c an_I_build_a_diagram_programmatically.3F
>
>
>> In my case, calling setLocation in refreshVisuals causes a
>> IllegalStateException. Is there a better place to call it?
> Is there any more details in this exception?
>
> -----------------
> Alex Shatalin
Re: Child setLocation [message #355201 is a reply to message #351588] Tue, 28 July 2009 11:27 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mark L.,

> The exceptions stacktrace says:
>
> java.lang.IllegalStateException: Cannot modify resource set without a
So, you have to create an instance (subclass) of AbstractEMFOperation, implement
doExecute method and run this operation using OperationHistoryFactory.getOperationHistory().execute().

-----------------
Alex Shatalin
Re: Child setLocation [message #364817 is a reply to message #355201] Tue, 28 July 2009 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

There are still problems with this method:

/**
* @generated NOT
*/
@Override
protected void refreshVisuals() {
super.refreshVisuals();

AbstractEMFOperation emfOp = new AbstractEMFOperation(this
.getEditingDomain(), "Location setting") {

@Override
protected IStatus doExecute(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
Location lc = (Location) ((Node) getModel())
.getLayoutConstraint();
lc.setX(10);
lc.setY(10);
return Status.OK_STATUS;
}

};

IStatus status;
try {
status = OperationHistoryFactory.getOperationHistory().execute(
emfOp, null, null);
} catch (ExecutionException e) {
e.printStackTrace();
}
}

What am I doing wrong?
Is it the editing domain?

Stacktrace:

org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
at
de.hpi.sam.tgg.diagram.edit.parts.SourceModelDomainEditPart. refreshVisuals(SourceModelDomainEditPart.java:229)
at
org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:676)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:571)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.access$3(GraphicalEditPart.java:1)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt$3.run(GraphicalEditPart.java:855)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.runExclusive(TransactionalEditingDomainImpl.java:313)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.refresh(GraphicalEditPart.java:845)
at
org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:235)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:219)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.addChild(GraphicalEditPart.java:1313)
at
org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.handleNotificationEvent(GraphicalEditPart.java:1458)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.notifyChanged(GraphicalEditPart.java:1432)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.fireNotification(DiagramEventBroker.java:500)
at
org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBr oker.resourceSetChanged(DiagramEventBroker.java:395)
at
org.eclipse.gmf.runtime.diagram.ui.DiagramEventBrokerThreadS afe.resourceSetChanged(DiagramEventBrokerThreadSafe.java:73)
at
org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFac tory$DiagramEditingDomain.postcommit(DiagramEditingDomainFac tory.java:213)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.deactivate(TransactionalEditingDomainImpl.java:528)
at
org.eclipse.emf.transaction.impl.TransactionImpl.close(Trans actionImpl.java:712)
at
org.eclipse.emf.transaction.impl.TransactionImpl.commit(Tran sactionImpl.java:474)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:155)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.executeCommand(CanonicalEditPolicy.java:510)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.createViews(CanonicalEditPolicy.java:466)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.refreshSemanticChildren(CanonicalEditPolicy.java:111 6)
at
de.hpi.sam.tgg.diagram.edit.policies.TGGRuleCanonicalEditPol icy.refreshSemantic(TGGRuleCanonicalEditPolicy.java:147)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.refresh(CanonicalEditPolicy.java:979)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalCon nectionEditPolicy.refreshOnActivate(CanonicalConnectionEditP olicy.java:108)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEdi tPolicy.activate(CanonicalEditPolicy.java:646)
at
org.eclipse.gef.editparts.AbstractEditPart.activateEditPolic ies(AbstractEditPart.java:165)
at
org.eclipse.gef.editparts.AbstractEditPart.activate(Abstract EditPart.java:148)
at
org.eclipse.gef.editparts.AbstractGraphicalEditPart.activate (AbstractGraphicalEditPart.java:193)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.access$0(GraphicalEditPart.java:1)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.activate(GraphicalEditPart.java:205)
at
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart .activate(DiagramEditPart.java:349)
at
org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:201)
at
org.eclipse.gef.editparts.SimpleRootEditPart.setContents(Sim pleRootEditPart.java:101)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents( AbstractEditPartViewer.java:601)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalVie wer.setContents(DiagramGraphicalViewer.java:378)
at
org.eclipse.gef.ui.parts.AbstractEditPartViewer.setContents( AbstractEditPartViewer.java:610)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initi alizeGraphicalViewerContents(DiagramEditor.java:870)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.initi alizeGraphicalViewer(DiagramEditor.java:863)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFl yOutPalette.initializeGraphicalViewer(DiagramEditorWithFlyOu tPalette.java:116)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.initializeGraphicalViewer(DiagramDocumen tEditor.java:175)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.creat eGraphicalViewer(DiagramEditor.java:807)
at
org.eclipse.gef.ui.parts.GraphicalEditor.createPartControl(G raphicalEditor.java:163)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor.creat ePartControl(DiagramEditor.java:1555)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFl yOutPalette.createPartControl(DiagramEditorWithFlyOutPalette .java:328)
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.createPartControl(DiagramDocumentEditor. java:1510)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:662)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:462)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
at
org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
at
org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
at
org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:270)
at
org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at
org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:473)
at
org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1256)
at
org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1209)
at
org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 08)
at
org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
at
org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
at
org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
at
org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
at
org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:63)
at
org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:225)
at
org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:213)
at
org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:778)
at
org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:677)
at
org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:638)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2854)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2762)
at
org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2754)
at
org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2705)
at
org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2701)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2685)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2668)
at
de.hpi.sam.tgg.diagram.part.TggDiagramEditorUtil.openDiagram (TggDiagramEditorUtil.java:83)
at
de.hpi.sam.tgg.diagram.part.TggCreationWizard$2.execute(TggC reationWizard.java:146)
at
org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(Worksp aceModifyOperation.java:106)
at
org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1800)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:118)
at
org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
at
org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at
org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 944)
at
de.hpi.sam.tgg.diagram.part.TggCreationWizard.performFinish( TggCreationWizard.java:156)
at
org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDi alog.java:752)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:373)
at
org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:624)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at
org.eclipse.jface.window.Window.runEventLoop(Window.java:825 )
at
org.eclipse.jface.window.Window.open(Window.java:801)
at
org.eclipse.ui.internal.handlers.WizardHandler$New.executeHa ndler(WizardHandler.java:253)
at
org.eclipse.ui.internal.handlers.WizardHandler.execute(Wizar dHandler.java:273)
at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle rProxy.java:294)
at
org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
at
org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
at
org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
at
org.eclipse.ui.internal.handlers.SlaveHandlerService.execute Command(SlaveHandlerService.java:241)
at
org.eclipse.ui.internal.actions.CommandAction.runWithEvent(C ommandAction.java:157)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:411)
at
org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at
org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at
org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at
org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at
org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at
org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at
org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at
org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
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: 559)
at
org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at
org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at
org.eclipse.equinox.launcher.Main.main(Main.java:1287)

Caused by: java.lang.IllegalStateException: Cannot activate read/write
transaction in read-only transaction context
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.acquire(TransactionalEditingDomainImpl.java:561)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.activate(TransactionalEditingDomainImpl.java:493)
at
org.eclipse.emf.transaction.impl.TransactionImpl.start(Trans actionImpl.java:204)
at
org.eclipse.emf.transaction.impl.TransactionalEditingDomainI mpl.startTransaction(TransactionalEditingDomainImpl.java:409 )
at
org.eclipse.emf.workspace.AbstractEMFOperation.createTransac tion(AbstractEMFOperation.java:617)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:147)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)

Cheers,
Mark
Re: Child setLocation [message #369102 is a reply to message #364817] Tue, 28 July 2009 15:24 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mark L.,

>Caused by: java.lang.IllegalStateException: Cannot activate read/write
>transaction in read-only transaction context
So, looks like you are performing this operation inside a read-only transaction.

Can you set location from any other places (not from refreshVisuals method)?
I think you cen perform this in activate() of the EditPart.

-----------------
Alex Shatalin
Re: Child setLocation [message #372713 is a reply to message #369102] Wed, 29 July 2009 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

> So, looks like you are performing this operation inside a read-only
> transaction.
> Can you set location from any other places (not from refreshVisuals
> method)? I think you cen perform this in activate() of the EditPart.

Placing the code in activate() does it. I added a new paragraph at
http://wiki.eclipse.org/GMF_Tips#Setting_Initial_Position_of _a_Node
describing the solution. Is it alright?

Thanks for the help,
Mark
Re: Child setLocation [message #422768 is a reply to message #372713] Thu, 30 July 2009 12:43 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Mark L.,

> describing the solution. Is it alright?
Yes, it's ok. Nevertheless, my position is: you should better perform diagram
elements layout inside layout subsystem, but doing it in a way you proposed
is perfectly legal.

-----------------
Alex Shatalin
Previous Topic:GMF Editor Migration Problems
Next Topic:Prevent illegal drag&drop
Goto Forum:
  


Current Time: Mon Mar 08 01:23:57 GMT 2021

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

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

Back to the top