Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » WorkspaceModifyOperation and WizardNewFileCreationPage
WorkspaceModifyOperation and WizardNewFileCreationPage [message #314985] Mon, 30 April 2007 17:10 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>>
>
>
Previous Topic:Resize views and editors inside perspective
Next Topic:Switching between 2 version of 1 plugin?
Goto Forum:
  


Current Time: Mon May 13 00:59:12 GMT 2024

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

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

Back to the top