Home » Eclipse Projects » Eclipse Platform » Urgent : Problem with importing resources
Urgent : Problem with importing resources [message #80832] |
Mon, 23 June 2003 12:52  |
Eclipse User |
|
|
|
Originally posted by: bharatkhatri2000.yahoo.com
Hi All,
I have created a view which shows all resources in workspace, rooted at
workspace root. The components of the view are objects of my own class.
Then I have a context menu on top of my view where I do normal operations
like copy/paste/delete/move/rename. To do these operations, I am using the
wprksapce api. I implement a resoucechangeListener, which updates my view
when any of these operations in my context menu is executed. So far so
good.
The next menu item I added is import, and implemented is using the class
ImportResourcesAction (all implementation is already provided, I just
added this action to my menu). When the action is executed, the import is
done successfully, but I get an error when I try to refresh my view after
updating it. The exception is as follows:
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:2332)
at org.eclipse.swt.SWT.error(SWT.java:2262)
at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:315)
at org.eclipse.swt.widgets.Tree.setSelection(Tree.java:996)
at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer .java:226)
at
org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToW idget(AbstractTreeViewer.java:1249)
at
org.eclipse.jface.viewers.StructuredViewer.setSelectionToWid get(StructuredViewer.java:1055)
at
org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:808)
at
org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:859)
at
org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:821)
at TreeViewer.AdaTreeView.refresh(AdaTreeView.java:357)
at
Actions.ResourceChangeListener.resourceChanged(ResourceChang eListener.java:54)
at
org.eclipse.core.internal.events.NotificationManager$1.run(N otificationManager.java:137)
at
org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java:889)
at org.eclipse.core.runtime.Platform.run(Platform.java:413)
at
org.eclipse.core.internal.events.NotificationManager.notify( NotificationManager.java:152)
at
org.eclipse.core.internal.events.NotificationManager.broadca stChanges(NotificationManager.java:67)
at
org.eclipse.core.internal.resources.Workspace.broadcastChang es(Workspace.java:161)
at
org.eclipse.core.internal.resources.Workspace.endOperation(W orkspace.java:892)
at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1600)
at
org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation.java:85)
at
org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:101)
Any help will be appreciated
Thanks
Bharat
|
|
| |
Re: Urgent : Problem with importing resources [message #80841 is a reply to message #80837] |
Mon, 23 June 2003 14:22   |
Eclipse User |
|
|
|
Originally posted by: bharatkhatri2000.yahoo.com
Hi David,
Thanks for the reply. I am not using multi-threading anywhere in my code.
Apart from that, as I said before, the same listener updates the view
alright when I do a copy/paste etc. It only fails for importing resources.
And this is my main cause of concern.
Thanks
Bharat
David Bidermanas wrote:
> Hello,
> I am not an expert with Eclipse but I am writng JFace/SWT apps.
> Your problem is in my opinion that you are accessing the SWT ressources from
> a diffrerent thread from the one that created the UI.
> SWT, you all know does native calls to the system, and the Windows GUI does
> not allow display resources to be accessed from a thread other that the one
> that created it. Hence the exception.
> I believe you should run your plug-in in the debugger and check which thread
> receives the RessourceChangeListener event.
> I had to sort out similar things with JFace, but as I control most of the
> process in my app, I could find easy ways to send back the message to the
> correct thread.
> Hope it works,
> David Bidermanas
> "bharat" <bharatkhatri2000@yahoo.com> a écrit dans le message de news:
> bd7b7v$pgl$1@rogue.oti.com...
> >
> > Hi All,
> >
> > I have created a view which shows all resources in workspace, rooted at
> > workspace root. The components of the view are objects of my own class.
> > Then I have a context menu on top of my view where I do normal operations
> > like copy/paste/delete/move/rename. To do these operations, I am using the
> > wprksapce api. I implement a resoucechangeListener, which updates my view
> > when any of these operations in my context menu is executed. So far so
> > good.
> >
> > The next menu item I added is import, and implemented is using the class
> > ImportResourcesAction (all implementation is already provided, I just
> > added this action to my menu). When the action is executed, the import is
> > done successfully, but I get an error when I try to refresh my view after
> > updating it. The exception is as follows:
> >
> > org.eclipse.swt.SWTException: Invalid thread access
> > at org.eclipse.swt.SWT.error(SWT.java:2332)
> > at org.eclipse.swt.SWT.error(SWT.java:2262)
> > at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
> > at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:315)
> > at org.eclipse.swt.widgets.Tree.setSelection(Tree.java:996)
> > at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer .java:226)
> > at
> >
> org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToW idget(AbstractTr
> eeViewer.java:1249)
> > at
> >
> org.eclipse.jface.viewers.StructuredViewer.setSelectionToWid get(StructuredVi
> ewer.java:1055)
> > at
> >
> org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredVie
> wer.java:808)
> > at
> >
> org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:859
> )
> > at
> >
> org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:821
> )
> > at TreeViewer.AdaTreeView.refresh(AdaTreeView.java:357)
> > at
> >
> Actions.ResourceChangeListener.resourceChanged(ResourceChang eListener.java:5
> 4)
> > at
> >
> org.eclipse.core.internal.events.NotificationManager$1.run(N otificationManag
> er.java:137)
> > at
> >
> org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
> :889)
> > at org.eclipse.core.runtime.Platform.run(Platform.java:413)
> > at
> >
> org.eclipse.core.internal.events.NotificationManager.notify( NotificationMana
> ger.java:152)
> > at
> >
> org.eclipse.core.internal.events.NotificationManager.broadca stChanges(Notifi
> cationManager.java:67)
> > at
> >
> org.eclipse.core.internal.resources.Workspace.broadcastChang es(Workspace.jav
> a:161)
> > at
> >
> org.eclipse.core.internal.resources.Workspace.endOperation(W orkspace.java:89
> 2)
> > at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1600)
> > at
> >
> org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation
> ..java:85)
> > at
> >
> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext
> ..java:101)
> >
> >
> > Any help will be appreciated
> >
> > Thanks
> >
> > Bharat
> >
> >
> >
|
|
|
Re: Urgent : Problem with importing resources [message #84307 is a reply to message #80841] |
Fri, 27 June 2003 17:47  |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
It doesn't matter if you're doing any multi-threading yourself. Your
resource change listener can be called from any thread. Often, this
does not correspond to the UI thread. This is described in the "thread
safety" section of the article on writing resource change listeners:
http://www.eclipse.org/articles/Article-Resource-deltas/reso urce-deltas.html
--
bharat wrote:
> Hi David,
>
> Thanks for the reply. I am not using multi-threading anywhere in my code.
> Apart from that, as I said before, the same listener updates the view
> alright when I do a copy/paste etc. It only fails for importing resources.
> And this is my main cause of concern.
>
> Thanks
>
> Bharat
>
>
>
>
>
>
> David Bidermanas wrote:
>
>
>>Hello,
>
>
>>I am not an expert with Eclipse but I am writng JFace/SWT apps.
>
>
>>Your problem is in my opinion that you are accessing the SWT ressources from
>>a diffrerent thread from the one that created the UI.
>>SWT, you all know does native calls to the system, and the Windows GUI does
>>not allow display resources to be accessed from a thread other that the one
>>that created it. Hence the exception.
>
>
>>I believe you should run your plug-in in the debugger and check which thread
>>receives the RessourceChangeListener event.
>
>
>>I had to sort out similar things with JFace, but as I control most of the
>>process in my app, I could find easy ways to send back the message to the
>>correct thread.
>
>
>>Hope it works,
>
>
>>David Bidermanas
>
>
>
>>"bharat" <bharatkhatri2000@yahoo.com> a écrit dans le message de news:
>>bd7b7v$pgl$1@rogue.oti.com...
>>
>>>Hi All,
>>>
>>>I have created a view which shows all resources in workspace, rooted at
>>>workspace root. The components of the view are objects of my own class.
>>>Then I have a context menu on top of my view where I do normal operations
>>>like copy/paste/delete/move/rename. To do these operations, I am using the
>>>wprksapce api. I implement a resoucechangeListener, which updates my view
>>>when any of these operations in my context menu is executed. So far so
>>>good.
>>>
>>>The next menu item I added is import, and implemented is using the class
>>>ImportResourcesAction (all implementation is already provided, I just
>>>added this action to my menu). When the action is executed, the import is
>>>done successfully, but I get an error when I try to refresh my view after
>>>updating it. The exception is as follows:
>>>
>>>org.eclipse.swt.SWTException: Invalid thread access
>>>at org.eclipse.swt.SWT.error(SWT.java:2332)
>>>at org.eclipse.swt.SWT.error(SWT.java:2262)
>>>at org.eclipse.swt.widgets.Widget.error(Widget.java:385)
>>>at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:315)
>>>at org.eclipse.swt.widgets.Tree.setSelection(Tree.java:996)
>>>at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer .java:226)
>>>at
>>>
>>
>> org.eclipse.jface.viewers.AbstractTreeViewer.setSelectionToW idget(AbstractTr
>>eeViewer.java:1249)
>>
>>>at
>>>
>>
>> org.eclipse.jface.viewers.StructuredViewer.setSelectionToWid get(StructuredVi
>>ewer.java:1055)
>>
>>>at
>>>
>>
>> org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredVie
>>wer.java:808)
>>
>>>at
>>>
>>
>> org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:859
>>)
>>
>>>at
>>>
>>
>> org.eclipse.jface.viewers.StructuredViewer.refresh(Structure dViewer.java:821
>>)
>>
>>>at TreeViewer.AdaTreeView.refresh(AdaTreeView.java:357)
>>>at
>>>
>>
>> Actions.ResourceChangeListener.resourceChanged(ResourceChang eListener.java:5
>>4)
>>
>>>at
>>>
>>
>> org.eclipse.core.internal.events.NotificationManager$1.run(N otificationManag
>>er.java:137)
>>
>>>at
>>>
>>
>> org.eclipse.core.internal.runtime.InternalPlatform.run(Inter nalPlatform.java
>>:889)
>>
>>>at org.eclipse.core.runtime.Platform.run(Platform.java:413)
>>>at
>>>
>>
>> org.eclipse.core.internal.events.NotificationManager.notify( NotificationMana
>>ger.java:152)
>>
>>>at
>>>
>>
>> org.eclipse.core.internal.events.NotificationManager.broadca stChanges(Notifi
>>cationManager.java:67)
>>
>>>at
>>>
>>
>> org.eclipse.core.internal.resources.Workspace.broadcastChang es(Workspace.jav
>>a:161)
>>
>>>at
>>>
>>
>> org.eclipse.core.internal.resources.Workspace.endOperation(W orkspace.java:89
>>2)
>>
>>>at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1600)
>>>at
>>>
>>
>> org.eclipse.ui.actions.WorkspaceModifyOperation.run(Workspac eModifyOperation
>>..java:85)
>>
>>>at
>>>
>>
>> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext
>>..java:101)
>>
>>>
>>>Any help will be appreciated
>>>
>>>Thanks
>>>
>>>Bharat
>>>
>>>
>>>
>>
>
>
>
>
>
|
|
|
Goto Forum:
Current Time: Mon May 12 16:36:59 EDT 2025
Powered by FUDForum. Page generated in 0.02763 seconds
|