WorkspaceModifyOperation and WizardNewFileCreationPage [message #314985] |
Mon, 30 April 2007 17:10 |
Eclipse User |
|
|
|
Originally posted by: tstevens.roguewave.com
Hello
So, I'm doing some file creation stuff in eclipse and the build process was
being started before all the file creation stuff was finished. So I wrapped
everything in my Wizard.performFinish in a WorkspaceModifyOperation.
Unfortunately, when I call WizardNewFileCreationPage.createNewFile(), it
tries to hand execution off to another thread (I think) and the end result
is:
java.lang.IllegalStateException: Cannot fork a thread from a thread owning a
rule
at
org.eclipse.ui.actions.WorkspaceModifyOperation.threadChange (WorkspaceModifyOperation.java:143)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:323)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 851)
at
org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFi le(WizardNewFileCreationPage.java:341)
at
com.roguewave.rwsf.ide.servicewizard.NewWSDLWizard.performFi nish(NewWSDLWizard.java:102)
at
com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard.access$2(RWSF_NewWSDLWizard.java:1)
at
com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard$PerformFinishModifyOperation.execute(RWSF_NewWSDLWi zard.java:158)
Any thoughts on how to avoid this?
thanks,
-Trav
|
|
|
Re: WorkspaceModifyOperation and WizardNewFileCreationPage [message #314988 is a reply to message #314985] |
Mon, 30 April 2007 19:25 |
Eclipse User |
|
|
|
Originally posted by: tstevens.roguewave.com
I'll sorta answer my own question here.
WorkspaceModifyOperation has a default constructor which creates a
scheduling rule from the workspace root object. Instead of using the default
constructor, I used the constructory which takes a rule, but I passed it
null. I'm not sure what the consequences of doing this are besides that it
works on the surface.
-Trav
"Travis Stevens" <tstevens@roguewave.com> wrote in message
news:f157vc$ach$1@build.eclipse.org...
> Hello
>
> So, I'm doing some file creation stuff in eclipse and the build process
> was being started before all the file creation stuff was finished. So I
> wrapped everything in my Wizard.performFinish in a
> WorkspaceModifyOperation. Unfortunately, when I call
> WizardNewFileCreationPage.createNewFile(), it tries to hand execution off
> to another thread (I think) and the end result is:
>
> java.lang.IllegalStateException: Cannot fork a thread from a thread owning
> a rule
> at
> org.eclipse.ui.actions.WorkspaceModifyOperation.threadChange (WorkspaceModifyOperation.java:143)
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:323)
> at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 851)
> at
> org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFi le(WizardNewFileCreationPage.java:341)
> at
> com.roguewave.rwsf.ide.servicewizard.NewWSDLWizard.performFi nish(NewWSDLWizard.java:102)
> at
> com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard.access$2(RWSF_NewWSDLWizard.java:1)
> at
> com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard$PerformFinishModifyOperation.execute(RWSF_NewWSDLWi zard.java:158)
>
> Any thoughts on how to avoid this?
>
> thanks,
> -Trav
>
|
|
|
Re: WorkspaceModifyOperation and WizardNewFileCreationPage [message #315070 is a reply to message #314988] |
Wed, 02 May 2007 10:49 |
Eclipse User |
|
|
|
Originally posted by: jacek.pospychala.pl.ibm.com
Trav,
scheduling rules are used to get exclusive access to objects in
workspace. You can more details in Help contents in "Platform Plug-in
Developer Guide -> Programmer's Guide -> Runtime overview -> Concurrency
infrastructure -> Scheduling rules".
If you look into WizardNewFileCreationPage.createNewFile() method,
you'll see that it also creates and runs WorkspaceModifyOperation:
WorkspaceModifyOperation op = new
WorkspaceModifyOperation(createRule(newFileHandle)) {
....
}
....
getContainer().run(true, true, op);
so probably that operation conflicts with your own in performFinish()
I think the best practice would be to implement
WorkspaceModifyOperation's as short as possilbe and the way, that they
perform only operations that need acquired locks.
Travis Stevens wrote:
> I'll sorta answer my own question here.
>
> WorkspaceModifyOperation has a default constructor which creates a
> scheduling rule from the workspace root object. Instead of using the default
> constructor, I used the constructory which takes a rule, but I passed it
> null. I'm not sure what the consequences of doing this are besides that it
> works on the surface.
>
> -Trav
>
> "Travis Stevens" <tstevens@roguewave.com> wrote in message
> news:f157vc$ach$1@build.eclipse.org...
>> Hello
>>
>> So, I'm doing some file creation stuff in eclipse and the build process
>> was being started before all the file creation stuff was finished. So I
>> wrapped everything in my Wizard.performFinish in a
>> WorkspaceModifyOperation. Unfortunately, when I call
>> WizardNewFileCreationPage.createNewFile(), it tries to hand execution off
>> to another thread (I think) and the end result is:
>>
>> java.lang.IllegalStateException: Cannot fork a thread from a thread owning
>> a rule
>> at
>> org.eclipse.ui.actions.WorkspaceModifyOperation.threadChange (WorkspaceModifyOperation.java:143)
>> at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:323)
>> at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java: 851)
>> at
>> org.eclipse.ui.dialogs.WizardNewFileCreationPage.createNewFi le(WizardNewFileCreationPage.java:341)
>> at
>> com.roguewave.rwsf.ide.servicewizard.NewWSDLWizard.performFi nish(NewWSDLWizard.java:102)
>> at
>> com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard.access$2(RWSF_NewWSDLWizard.java:1)
>> at
>> com.roguewave.rwsf.ide.customnodes.servicewizards.RWSF_NewWS DLWizard$PerformFinishModifyOperation.execute(RWSF_NewWSDLWi zard.java:158)
>>
>> Any thoughts on how to avoid this?
>>
>> thanks,
>> -Trav
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02884 seconds