Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » UI SWTException: Invalid thread access during a stack command
UI SWTException: Invalid thread access during a stack command [message #158186] Tue, 16 November 2004 23:46 Go to next message
Eclipse UserFriend
Originally posted by: brett.bock.embarcadero.com

I'm wondering if this is a bug, and if it is not a bug, what would be the
prefered method to fix this issue. Below you can see a stack trace of the
SWT exception.

What we are doing here is using an org.eclipse.ui.newWizards wizard to
create a new model element. The actual creation may take a while so the
creation of the model element has been placed into its own thread. Creating
the new model element then creates a command stack change, which sends an
update to the editor, which calls into the framework to update the text for
the diagram name. Since the name change is not in a UI thread we get the
SWT exception.

!ENTRY org.eclipse.core.runtime 4 2 2004-11-16 16:15:11.932
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.core.runtime".
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:2697)
at org.eclipse.swt.SWT.error(SWT.java:2622)
at org.eclipse.swt.SWT.error(SWT.java:2593)
at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:288)
at org.eclipse.swt.widgets.Widget.getData(Widget.java:415)
at
org.eclipse.ui.internal.presentations.defaultpresentation.De faultTabFolder.g
etTab(DefaultTabFolder.java:159)
at
org.eclipse.ui.internal.presentations.defaultpresentation.De faultTabFolder.g
etItems(DefaultTabFolder.java:211)
at
org.eclipse.ui.internal.presentations.newapi.AbstractTabFold er.findItem(Abst
ractTabFolder.java:169)
at
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.getTab(Pr
esentablePartFolder.java:378)
at
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.childProp
ertyChanged(PresentablePartFolder.java:311)
at
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.access$2(
PresentablePartFolder.java:310)
at
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder$3.propert
yChanged(PresentablePartFolder.java:84)
at
org.eclipse.ui.internal.presentations.PresentablePart.firePr opertyChange(Pre
sentablePart.java:90)
at
org.eclipse.ui.internal.presentations.PresentablePart$1.prop ertyChanged(Pres
entablePart.java:62)
at
org.eclipse.ui.internal.WorkbenchPartReference.firePropertyC hange(WorkbenchP
artReference.java:342)
at
org.eclipse.ui.internal.WorkbenchPartReference.partPropertyC hanged(Workbench
PartReference.java:139)
at
org.eclipse.ui.internal.WorkbenchPartReference$1.propertyCha nged(WorkbenchPa
rtReference.java:63)
at org.eclipse.ui.part.WorkbenchPart$1.run(WorkbenchPart.java:1 29)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
:616)
at org.eclipse.core.runtime.Platform.run(Platform.java:747)
at
org.eclipse.ui.part.WorkbenchPart.firePropertyChange(Workben chPart.java:127)
at
org.eclipse.gef.ui.parts.GraphicalEditor.firePropertyChange( GraphicalEditor.
java:145)
at
com.embarcadero.ui.infrastructure.gef.ui.parts.DiagramEditor .setDirty(Diagra
mEditor.java:580)
at
com.embarcadero.ui.infrastructure.gef.ui.parts.DiagramEditor .commandStackCha
nged(DiagramEditor.java:562)
at
org.eclipse.gef.commands.CommandStack.notifyListeners(Comman dStack.java:186)
at org.eclipse.gef.commands.CommandStack.execute(CommandStack.j ava:89)
at
com.embarcadero.infrastructure.core.undoredo.ETCommandManage r$ETCommandStack
..superExecute(ETCommandManager.java:57)
at
com.embarcadero.infrastructure.core.undoredo.ETCommandManage r.execute(ETComm
andManager.java:92)
at
com.embarcadero.infrastructure.core.utils.XMLManip.setAttrib uteValue(XMLMani
p.java:359)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
ment.setXMIID(VersionableElement.java:298)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
ment.buildNodePresence(VersionableElement.java:1114)
at
com.embarcadero.infrastructure.core.metamodel.core.construct s.Class.establis
hNodePresence(Class.java:99)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
ment.prepareNode(VersionableElement.java:87)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.CreationFactor
y.prepareNewElement(CreationFactory.java:144)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.CreationFactor
y.retrieveMetaType(CreationFactory.java:108)
at
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.FactoryRetriev
er.createType(FactoryRetriever.java:109)
at
com.embarcadero.ui.infrastructure.wizard.NewElementWizard.do Finish(NewElemen
tWizard.java:122)
at
com.embarcadero.ui.infrastructure.wizard.NewElementWizard$1. run(NewElementWi
zard.java:81)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext
..java:105)
92824 [ModalContext] ERROR
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
ment - java.lang.NullPointerException
Re: UI SWTException: Invalid thread access during a stack command [message #158203 is a reply to message #158186] Wed, 17 November 2004 02:21 Go to previous message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Put the code that needs UI thread access on the UI thread (look at
org.eclipse.swt.widgets.Display#syncExec() and asyncExec()).


"Brett Bock" <brett.bock@embarcadero.com> wrote in message
news:cne3g9$4r6$1@www.eclipse.org...
> I'm wondering if this is a bug, and if it is not a bug, what would be the
> prefered method to fix this issue. Below you can see a stack trace of the
> SWT exception.
>
> What we are doing here is using an org.eclipse.ui.newWizards wizard to
> create a new model element. The actual creation may take a while so the
> creation of the model element has been placed into its own thread.
Creating
> the new model element then creates a command stack change, which sends an
> update to the editor, which calls into the framework to update the text
for
> the diagram name. Since the name change is not in a UI thread we get the
> SWT exception.
>
> !ENTRY org.eclipse.core.runtime 4 2 2004-11-16 16:15:11.932
> !MESSAGE Problems occurred when invoking code from plug-in:
> "org.eclipse.core.runtime".
> !STACK 0
> org.eclipse.swt.SWTException: Invalid thread access
> at org.eclipse.swt.SWT.error(SWT.java:2697)
> at org.eclipse.swt.SWT.error(SWT.java:2622)
> at org.eclipse.swt.SWT.error(SWT.java:2593)
> at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
> at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:288)
> at org.eclipse.swt.widgets.Widget.getData(Widget.java:415)
> at
>
org.eclipse.ui.internal.presentations.defaultpresentation.De faultTabFolder.g
> etTab(DefaultTabFolder.java:159)
> at
>
org.eclipse.ui.internal.presentations.defaultpresentation.De faultTabFolder.g
> etItems(DefaultTabFolder.java:211)
> at
>
org.eclipse.ui.internal.presentations.newapi.AbstractTabFold er.findItem(Abst
> ractTabFolder.java:169)
> at
>
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.getTab(Pr
> esentablePartFolder.java:378)
> at
>
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.childProp
> ertyChanged(PresentablePartFolder.java:311)
> at
>
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder.access$2(
> PresentablePartFolder.java:310)
> at
>
org.eclipse.ui.internal.presentations.newapi.PresentablePart Folder$3.propert
> yChanged(PresentablePartFolder.java:84)
> at
>
org.eclipse.ui.internal.presentations.PresentablePart.firePr opertyChange(Pre
> sentablePart.java:90)
> at
>
org.eclipse.ui.internal.presentations.PresentablePart$1.prop ertyChanged(Pres
> entablePart.java:62)
> at
>
org.eclipse.ui.internal.WorkbenchPartReference.firePropertyC hange(WorkbenchP
> artReference.java:342)
> at
>
org.eclipse.ui.internal.WorkbenchPartReference.partPropertyC hanged(Workbench
> PartReference.java:139)
> at
>
org.eclipse.ui.internal.WorkbenchPartReference$1.propertyCha nged(WorkbenchPa
> rtReference.java:63)
> at org.eclipse.ui.part.WorkbenchPart$1.run(WorkbenchPart.java:1 29)
> at
>
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> :616)
> at org.eclipse.core.runtime.Platform.run(Platform.java:747)
> at
>
org.eclipse.ui.part.WorkbenchPart.firePropertyChange(Workben chPart.java:127)
> at
>
org.eclipse.gef.ui.parts.GraphicalEditor.firePropertyChange( GraphicalEditor.
> java:145)
> at
>
com.embarcadero.ui.infrastructure.gef.ui.parts.DiagramEditor .setDirty(Diagra
> mEditor.java:580)
> at
>
com.embarcadero.ui.infrastructure.gef.ui.parts.DiagramEditor .commandStackCha
> nged(DiagramEditor.java:562)
> at
>
org.eclipse.gef.commands.CommandStack.notifyListeners(Comman dStack.java:186)
> at org.eclipse.gef.commands.CommandStack.execute(CommandStack.j ava:89)
> at
>
com.embarcadero.infrastructure.core.undoredo.ETCommandManage r$ETCommandStack
> .superExecute(ETCommandManager.java:57)
> at
>
com.embarcadero.infrastructure.core.undoredo.ETCommandManage r.execute(ETComm
> andManager.java:92)
> at
>
com.embarcadero.infrastructure.core.utils.XMLManip.setAttrib uteValue(XMLMani
> p.java:359)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
> ment.setXMIID(VersionableElement.java:298)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
> ment.buildNodePresence(VersionableElement.java:1114)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.construct s.Class.establis
> hNodePresence(Class.java:99)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
> ment.prepareNode(VersionableElement.java:87)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.CreationFactor
> y.prepareNewElement(CreationFactory.java:144)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.CreationFactor
> y.retrieveMetaType(CreationFactory.java:108)
> at
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.FactoryRetriev
> er.createType(FactoryRetriever.java:109)
> at
>
com.embarcadero.ui.infrastructure.wizard.NewElementWizard.do Finish(NewElemen
> tWizard.java:122)
> at
>
com.embarcadero.ui.infrastructure.wizard.NewElementWizard$1. run(NewElementWi
> zard.java:81)
> at
>
org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext
> .java:105)
> 92824 [ModalContext] ERROR
>
com.embarcadero.infrastructure.core.metamodel.core.foundatio n.VersionableEle
> ment - java.lang.NullPointerException
>
>
Previous Topic:getTargetEditPart method
Next Topic:Always put focus back on SelectionToolEntry after new connection
Goto Forum:
  


Current Time: Sat Aug 17 17:43:37 GMT 2024

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

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

Back to the top