Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330142

Summary: [Compatibility] Parts that implement ISaveableSources do not have their Saveables queried or saved
Product: [Eclipse Project] e4 Reporter: Michael Valenta <Michael.Valenta>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact: Remy Suen <remy.suen>
Severity: major    
Priority: P3 CC: pwebster, remy.suen
Version: 1.0   
Target Milestone: 4.1 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Saveable handling patch v1 none

Description Michael Valenta CLA 2010-11-12 15:57:14 EST
We have an editor that uses the Saveable interface to perform a background save. When I tried to save in Eclipse 4.1 I got the following exception because we do not support saving without a progress monitor.

eclipse.buildId=I20101029-1118
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -console -consolelog -debug


Error
Fri Nov 12 14:55:04 EST 2010


java.lang.UnsupportedOperationException
at com.ibm.team.filesystem.ui.views.TeamPlacePart2.doSave(TeamPlacePart2.java:386)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.doSave(CompatibilityPart.java:244)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:208)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:214)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:178)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:86)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.savePart(PartServiceImpl.java:942)
at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:2409)
at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:2427)
at org.eclipse.ui.internal.SaveAction.run(SaveAction.java:76)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:121)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:208)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:189)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:123)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:122)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:266)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:465)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:515)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:348)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:294)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:76)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1254)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103)
at org.eclipse.swt.widgets.Text.sendKeyEvent(Text.java:1454)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4273)
at org.eclipse.swt.widgets.Text.WM_CHAR(Text.java:2252)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4165)
at org.eclipse.swt.widgets.Text.windowProc(Text.java:2247)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4891)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2460)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$6.run(PartRenderingEngine.java:783)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:692)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:104)
at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:542)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:524)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:621)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:576)
at org.eclipse.equinox.launcher.Main.run(Main.java:1409)
at org.eclipse.equinox.launcher.Main.main(Main.java:1385)
Comment 1 Remy Suen CLA 2010-11-12 16:30:17 EST
(In reply to comment #0)
> We have an editor that uses the Saveable interface to perform a background
> save. When I tried to save in Eclipse 4.1 I got the following exception because
> we do not support saving without a progress monitor.

This is very weird because the value should be non-null. Unless the UOE is asserting on something else?

void doSave(@Optional IProgressMonitor monitor) {
  monitor = SubMonitor.convert(monitor);
  if (wrapped instanceof ISaveablePart) {
    ((ISaveablePart) wrapped).doSave(monitor);
  }
}
Comment 2 Paul Webster CLA 2010-11-12 16:44:52 EST
I thought it was asserting on calling doSave(*) at all, as they expect it to be done as part of a background save?

PW
Comment 3 Michael Valenta CLA 2010-11-15 08:19:03 EST
Sorry, I was off on my original assessment. The part in question is returning a saveable from getSaveables() so it doesn't expect its (i.e. the part's) doSave to be called but instead expects save to be called on the saveable.
Comment 4 Remy Suen CLA 2010-11-15 08:28:27 EST
(In reply to comment #3)
> The part in question is returning a
> saveable from getSaveables() so it doesn't expect its (i.e. the part's) doSave
> to be called but instead expects save to be called on the saveable.

Noted. We need to check if the IWorkbenchPart implementation is also an implementation of ISaveablesSource and then take it from there instead of invoking doSave(IProgressMonitor) directly on the part in question.
Comment 5 Remy Suen CLA 2010-11-15 14:10:11 EST
Created attachment 183150 [details]
Saveable handling patch v1
Comment 6 Remy Suen CLA 2010-11-15 14:11:57 EST
(In reply to comment #5)
> Created an attachment (id=183150) [details]
> Saveable handling patch v1

Fix released to CVS HEAD.

Thanks for the bug report, Michael.