Strange problem [message #550578] |
Fri, 30 July 2010 17:29  |
Eclipse User |
|
|
|
I have a strange problem :
When I drag and drop an element from a different jar and click save,
The Save failed the first time with the following error:
Save Failed
Cannot modify resource set without a write transaction
then when I redo the second time it works.
looks like the resource is locked or busy doing some operations how to get around of this problem ?
In fact when I save my icremental builder is executing another long task
how can I fix that so that the saving run in a different thread
java.lang.IllegalStateException: Cannot modify resource set without a write transaction
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:280)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:255)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList. java:307)
at org.eclipse.emf.common.util.BasicEMap.put(BasicEMap.java:591 )
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveIm pl.java:292)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:270)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:206)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:1406)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfC hangedWithMemoryBuffer(ResourceImpl.java:1127)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:980)
at org.eclipse.stp.sca.diagram.part.ScaDocumentProvider.doSaveD ocument(ScaDocumentProvider.java:723)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$1SaveOperation.execute(AbstractDoc umentProvider.java:596)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider$DocumentProviderOperation.run(Abst ractDocumentProvider.java:66)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.executeOperation(AbstractDocumentP rovider.java:530)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.document .AbstractDocumentProvider.saveDocument(AbstractDocumentProvi der.java:579)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.performSave(DiagramDocumentEditor.java:8 60)
at org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.doSave(DiagramDocumentEditor.java:680)
at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper. java:151)
at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper. java:274)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread( ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.ja va:372)
at org.eclipse.jface.window.ApplicationWindow$1.run(Application Window.java:759)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWi ndow.java:756)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow. java:2579)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:282)
at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOpe ration(SaveableHelper.java:261)
at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelp er.java:156)
at org.eclipse.ui.internal.EditorManager.savePart(EditorManager .java:1357)
at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage .java:3328)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPa ge.java:3341)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:76)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3910)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3503)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
|
|
|
|
Re: Strange problem [message #550901 is a reply to message #550639] |
Wed, 04 August 2010 11:21   |
Eclipse User |
|
|
|
It seems the problem was resolved using ICommandProxy;
SetRequest reqSet = new SetRequest(editPart.getEditingDomain(),
SuperNode, XXX, name);
SetValueCommand operation = new SetValueCommand(reqSet);
editPart.getDiagramEditDomain().getDiagramCommandStack().exe cute(
new ICommandProxy(operation));
But My problem is I want to do two operations :
- set the name
- add another subnode
So I created two operations and followed the above code:
for operation1 and operation2 like this:
SetRequest reqSet1 = new SetRequest(editPart.getEditingDomain(),
SuperNode, XXX, name);
SetValueCommand operation1 = new SetValueCommand(reqSet1);
editPart.getDiagramEditDomain().getDiagramCommandStack().exe cute(
new ICommandProxy(operation1));
SetRequest reqSet2 = new SetRequest(editPart.getEditingDomain(),
SuperNode, XXX, name);
SetValueCommand operation2 = new SetValueCommand(reqSet2);
editPart.getDiagramEditDomain().getDiagramCommandStack().exe cute(
new ICommandProxy(operation2));
At this time I got the exception.
So bottom line it works for one operation but not for two.
Any hints, help ? Thanks
|
|
|
Re: Strange problem [message #550920 is a reply to message #550901] |
Wed, 04 August 2010 11:50   |
Eclipse User |
|
|
|
The stack trace you show involves doing a save. How does that fit in
with what you're describing here?
bachra04 wrote:
> It seems the problem was resolved using ICommandProxy;
>
> SetRequest reqSet = new
> SetRequest(editPart.getEditingDomain(),
> SuperNode, XXX, name);
> SetValueCommand operation = new SetValueCommand(reqSet);
> editPart.getDiagramEditDomain().getDiagramCommandStack().exe
> cute(
> new ICommandProxy(operation));
>
> But My problem is I want to do two operations :
>
> - set the name
> - add another subnode
>
> So I created two operations and followed the above code:
>
> for operation1 and operation2 like this:
>
>
> SetRequest reqSet1 = new
> SetRequest(editPart.getEditingDomain(),
> SuperNode, XXX, name);
> SetValueCommand operation1 = new SetValueCommand(reqSet1);
> editPart.getDiagramEditDomain().getDiagramCommandStack().exe
> cute(
> new ICommandProxy(operation1));
>
>
>
> SetRequest reqSet2 = new
> SetRequest(editPart.getEditingDomain(),
> SuperNode, XXX, name);
> SetValueCommand operation2 = new SetValueCommand(reqSet2);
> editPart.getDiagramEditDomain().getDiagramCommandStack().exe
> cute(
> new ICommandProxy(operation2));
>
>
>
>
> At this time I got the exception.
>
> So bottom line it works for one operation but not for two.
>
> Any hints, help ? Thanks
>
|
|
|
|
|
Re: Strange problem [message #900073 is a reply to message #550578] |
Fri, 03 August 2012 15:43  |
Eclipse User |
|
|
|
I just encountered this problem. Here is the solution I came up with: do not propagate the notifications from the xmlns prefix map feature in my DocumentRootImpl like so:
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@SuppressWarnings("serial")
public EMap<String, String> getXMLNSPrefixMap() {
if (xMLNSPrefixMap == null) {
xMLNSPrefixMap = new EcoreEMap<String, String>(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY,
EStringToStringMapEntryImpl.class, null) {
{
initializeDelegateEList();
}
@Override
protected void initializeDelegateEList() {
delegateEList = new DelegateEObjectContainmentEList<Entry<String, String>>(entryClass,
DocumentRootImpl.this, SwitchyardPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP) {
@Override
protected void dispatchNotification(Notification notification) {
// don't forward the notification
}
};
}
};
}
return xMLNSPrefixMap;
}
|
|
|
Powered by
FUDForum. Page generated in 0.19856 seconds