Bug 553070 - [history] ref filter cell editing empty string leads to exception
Summary: [history] ref filter cell editing empty string leads to exception
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 5.6   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 5.6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-14 13:12 EST by Michael Keppler CLA
Modified: 2019-11-20 04:26 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keppler CLA 2019-11-14 13:12:14 EST
Use the direct cell editor in the ref filter configuration dialog to delete all text, then hit enter to leave the cell editor.


java.lang.IllegalArgumentException: Filter string is null or empty.
	at org.eclipse.egit.ui.internal.history.RefFilterHelper$RefFilter.setFilterString(RefFilterHelper.java:688)
	at org.eclipse.egit.ui.internal.history.GitHistoryRefFilterConfigurationDialog$7.modify(GitHistoryRefFilterConfigurationDialog.java:263)
	at org.eclipse.jface.viewers.ColumnViewer$2.setValue(ColumnViewer.java:260)
	at org.eclipse.jface.viewers.EditingSupport.saveCellEditorValue(EditingSupport.java:113)
	at org.eclipse.jface.viewers.ColumnViewerEditor.saveEditorValue(ColumnViewerEditor.java:453)
	at org.eclipse.jface.viewers.ColumnViewerEditor.applyEditorValue(ColumnViewerEditor.java:309)
	at org.eclipse.jface.viewers.ColumnViewerEditor.handleEditorActivationEvent(ColumnViewerEditor.java:436)
	at org.eclipse.jface.viewers.ColumnViewer.triggerEditorActivationEvent(ColumnViewer.java:677)
	at org.eclipse.jface.viewers.ColumnViewer.editElement(ColumnViewer.java:423)
	at org.eclipse.egit.ui.internal.history.GitHistoryRefFilterConfigurationDialog.editFilter(GitHistoryRefFilterConfigurationDialog.java:429)
	at org.eclipse.egit.ui.internal.history.GitHistoryRefFilterConfigurationDialog.editCurrentRow(GitHistoryRefFilterConfigurationDialog.java:423)
	at org.eclipse.egit.ui.internal.history.GitHistoryRefFilterConfigurationDialog.access$1(GitHistoryRefFilterConfigurationDialog.java:422)
	at org.eclipse.egit.ui.internal.history.GitHistoryRefFilterConfigurationDialog$5.doubleClick(GitHistoryRefFilterConfigurationDialog.java:237)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:833)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:173)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:830)
	at org.eclipse.jface.viewers.StructuredViewer.handleDoubleSelect(StructuredViewer.java:1151)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1264)
	at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:252)
	at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:249)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:311)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
	at org.eclipse.jface.window.Window.open(Window.java:794)
	at org.eclipse.egit.ui.internal.history.GitHistoryPage$GitHistoryPageActions$ConfigureFilterAction.run(GitHistoryPage.java:1068)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
	at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Comment 1 Thomas Wolf CLA 2019-11-14 15:00:01 EST
Quick fix: just don't update the filterString in that case.

Fuller fix: extract the MessagePopupTextCellEditor from https://git.eclipse.org/r/#/c/151813/ . Give it a boolean flag 'commitOnFocusLost' and cancel only if false. (In the repo view, I really think committing on focusLost is not good, but in this ref filter dialog it might make sense.) Then use it, and add a validator.

BTW, there is another funny behavior intrinsic to TextCellEditors in dialogs: when a cell editor is active and then the OK button is clicked directly, the cell editor does _not_ get a FocusLost event and does not commit. Can also be seen in the Push... dialog on the refspecs table. Clicking on other buttons does lead to a FocusLost, and the editor commits. (For instance, when I have an active editor and then click "Add Ref...".)
Comment 2 Eclipse Genie CLA 2019-11-19 02:52:54 EST
New Gerrit change created: https://git.eclipse.org/r/152933
Comment 3 Thomas Wolf CLA 2019-11-19 02:58:19 EST
I've decided not to use the MessagePopupTextCellEditor. Popping up a tooltip for the error message is fine for a view, where we don't want to waste space for a label to show validation errors. But in a dialog using a label is fine and is more consistent with the way other dialogs show input validation errors.
Comment 4 Eclipse Genie CLA 2019-11-20 03:59:52 EST
Gerrit change https://git.eclipse.org/r/152933 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=d27d58caf90e24ed4361fdf91a837cadba723d7f