Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » On the use of Workspace and WorkManager API
On the use of Workspace and WorkManager API [message #1249883] Tue, 18 February 2014 18:39
El Arbi Aboussoror is currently offline El Arbi AboussororFriend
Messages: 90
Registered: June 2010

I was facing some troubles with an eclipse based product, I had the following exception raising at product startup:
	org.eclipse.core.runtime.AssertionFailedException: assertion failed: Operation was not prepared.
	at org.eclipse.core.runtime.Assert.isTrue(
	at org.eclipse.core.internal.resources.Workspace.beginOperation(
	at org.eclipse.jdt.internal.core.JavaModelManager$

Sometimes it raises from the and sometimes from another job (e.g. AutoBuildJob). The problem was our misuse of the WorkManager checkin/checkout, beginUnprotected/endUnprotected methods. It took me a while to understand that I should rather use workspace.prepareOperation / beginOperation instead of a checkin.
This misuse led to an Assert.isTrue(false) in the org.eclipse.core.internal.resources.Workspace.beginOperation(boolean) method:

	public void beginOperation(boolean createNewTree) throws CoreException {
		WorkManager workManager = getWorkManager();
		if (!workManager.isBalanced())
			Assert.isTrue(false, "Operation was not prepared.");
		if (workManager.getPreparedOperationDepth() > 1) {
			if (createNewTree && tree.isImmutable())

The WorkManager documentation says Quote:
" ...This class also tracks operation state for each thread that is involved in an operation. This includes prepared and running operation depth, auto-build strategy and cancel state."

But I still don't understand completely what is the semantics behind the WorkManager fields:
and org.eclipse.core.internal.resources.WorkManager.nestedOperations ?

And what is the meaning of an unbalanced WorkManger (workManager.isBalanced() == false) ?

[Updated on: Fri, 21 February 2014 18:15]

Report message to a moderator

Previous Topic:close swr-rcp application without confirmation
Next Topic:Remove System In-Place Editor
Goto Forum:

Current Time: Sat May 26 14:10:38 GMT 2018

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

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

Back to the top