Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh option not available for some resources that are not closed p… #2601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DaveCarpeneto
Copy link
Contributor

…rojects #2538

Change made since the fix to #1438 unintentionally removed the "refresh" contextual menu for resources that are not projects.

With this change the "refresh" contextual menu is shown if ANY navigator selection is either (A) an open project, or (B) a non-project resource. Put another way: the 'refresh' item is NOT shown if ALL selections are closed projects.

Fixes #2538

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Test Results

 1 214 files   1 214 suites   1h 36m 59s ⏱️
 7 734 tests  7 500 ✅ 233 💤 1 ❌
16 242 runs  15 726 ✅ 515 💤 1 ❌

For more details on these failures, see this check.

Results for commit 39da4c6.

♻️ This comment has been updated with latest results.

…rojects eclipse-platform#2538

Change made since the fix to eclipse-platform#1438 unintentionally removed the "refresh" contextual menu for resources that are not projects.

With this change the "refresh" contextual menu is shown if ANY navigator selection is either (A) an open project, or (B) a non-project resource. Put another way: the 'refresh' item is NOT shown if ALL selections are closed projects.

Fixes eclipse-platform#2538
@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

@mickaelistria can you review this? #2003 (comment)

@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

The failing ProgressContantsTest.testKeepOneProperty is unrelated see #370

@mickaelistria
Copy link
Contributor

Code looks good and safe enough. However we didn't get any build completing from https://ci.eclipse.org/platform/job/eclipse.platform.ui/job/PR-2601/ , and I wouldn't feel comfortable merging until we have 1 build running entirely.
This is either a regression in performance (not necessarily related to this PR as some other PR builds sshow the same issue) or an infrastructure issue, but it's IMO worth blocking pending PRs until we can have reliable testing.

@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

For the record: Build failed with OutOfMemoryError, i have not seen that elsewhere. @DaveCarpeneto can you help investigate the reason for OOME? May be its even related to this PR?

Exception in thread "WorkbenchTestable" org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: Java heap space)
	at org.eclipse.swt.SWT.error(SWT.java:4922)
	at org.eclipse.swt.SWT.error(SWT.java:4837)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:209)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
	at org.eclipse.swt.widgets.Display.syncExec(Unknown Source)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.runTest(E4Testable.java:118)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.runTests(AbstractUITestApplication.java:38)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$0(E4Testable.java:79)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at org.eclipse.swt.widgets.Synchronizer.asyncExec(Synchronizer.java:101)
	at org.eclipse.ui.internal.UISynchronizer.asyncExec(UISynchronizer.java:112)
	at org.eclipse.swt.widgets.Display.asyncExec(Display.java:931)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.lambda$1(HandledContributionItem.java:174)
	at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$$Lambda$416/0x0000000800fca8b0.commandChanged(Unknown Source)
	at org.eclipse.core.commands.Command$1.run(Command.java:529)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.commands.Command.fireCommandChanged(Command.java:522)
	at org.eclipse.core.commands.Command.lambda$0(Command.java:1000)
	at org.eclipse.core.commands.Command$$Lambda$219/0x0000000800ed3328.handlerChanged(Unknown Source)
	at org.eclipse.core.commands.AbstractHandler.fireHandlerChanged(AbstractHandler.java:77)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.fireHandlerChanged(HandlerServiceHandler.java:189)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.handlerChanged(E4HandlerProxy.java:116)
	at org.eclipse.core.commands.AbstractHandler.fireHandlerChanged(AbstractHandler.java:77)
	at org.eclipse.ui.internal.handlers.HandlerProxy.lambda$0(HandlerProxy.java:242)
	at org.eclipse.ui.internal.handlers.HandlerProxy$$Lambda$280/0x0000000800f644d8.propertyChange(Unknown Source)
	at org.eclipse.ui.internal.services.EvaluationReference.evaluate(EvaluationReference.java:116)
	at org.eclipse.ui.internal.services.EvaluationReference.changed(EvaluationReference.java:100)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374)
	at org.eclipse.ui.internal.services.EvaluationService$1.changed(EvaluationService.java:78)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:105)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:358)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:374)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.activate(EclipseContext.java:661)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.activateBranch(EclipseContext.java:670)
	at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener$1.run(ShellActivationListener.java:106)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.processWindow(ShellActivationListener.java:102)
	at org.eclipse.e4.ui.internal.workbench.swt.ShellActivationListener.handleEvent(ShellActivationListener.java:65)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)

@mickaelistria
Copy link
Contributor

The OutOfMemory seems to be already discussed in #2432

@iloveeclipse
Copy link
Member

@jukzi : regarding OOM: #2432. Would be nice if you could look at it if you have time.

@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

The CI logfile contains messages like
org.eclipse.core.commands.NotHandledException: There is no handler to execute for command org.eclipse.ui.file.refresh)]

Running UiTestSuite org.eclipse.ui.tests.commands.CommandsTestSuite org.eclipse.ui.tests.commands.CommandExecutionTest
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.refresh,Refresh,
		Refresh the selected items,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.refresh"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@94dad7b)), (notHandled,
	org.eclipse.core.commands.NotHandledException: There is no handler to execute for command org.eclipse.ui.file.refresh)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closePart,Close Part,
		Close the active workbench part,
		Category(org.eclipse.ui.category.window,Window,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closePart"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@599fb753)), (postExecuteSuccess,
	null)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closePart,Close Part,
		Close the active workbench part,
		Category(org.eclipse.ui.category.window,Window,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closePart"),
		,,true),{},null,org.eclipse.e4.core.commands.ExpressionContext@3fc2d0b1)), (postExecuteSuccess,
	null)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closePart,Close Part,
		Close the active workbench part,
		Category(org.eclipse.ui.category.window,Window,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closePart"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@69e6c4e4)), (postExecuteSuccess,
	null)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.refresh,Refresh,
		Refresh the selected items,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.refresh"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@46264648)), (notHandled,
	org.eclipse.core.commands.NotHandledException: There is no handler to execute for command org.eclipse.ui.file.refresh)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.refresh,Refresh,
		Refresh the selected items,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.refresh"),
		,,true),{},null,org.eclipse.e4.core.commands.ExpressionContext@7aa7a2e)), (notHandled,
	org.eclipse.core.commands.NotHandledException: There is no handler to execute for command org.eclipse.ui.file.refresh)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closeOthers,Close Others,
		Close all editors except the one that is active,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closeOthers"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@4c121d2a)), (notEnabled,
	org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.ui.file.closeOthers)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closeOthers,Close Others,
		Close all editors except the one that is active,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closeOthers"),
		,,true),{},null,org.eclipse.e4.core.commands.ExpressionContext@38f216e6)), (notEnabled,
	org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.ui.file.closeOthers)]
[(preExecute,
	ExecutionEvent(Command(org.eclipse.ui.file.closeOthers,Close Others,
		Close all editors except the one that is active,
		Category(org.eclipse.ui.category.file,File,null,true),
		WorkbenchHandlerServiceHandler("org.eclipse.ui.file.closeOthers"),
		,,true),{},null,org.eclipse.core.expressions.EvaluationContext@6cdd60dc)), (notEnabled,
	org.eclipse.core.commands.NotEnabledException: Trying to execute the disabled command org.eclipse.ui.file.closeOthers)]
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.163 s -- in UiTestSuite org.eclipse.ui.tests.commands.CommandsTestSuite org.eclipse.ui.tests.commands.CommandExecutionTest

does it relate to this PR?

@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

i don't get if the added tests are useful: Only one of them fails when the PR is reverted and has an error message that is not understandable to me:

java.lang.AssertionError: Unexpected menu membership for org.eclipse.ui.RefreshAction (false)
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.eclipse.ui.tests.navigator.resources.ResourceMgmtActionProviderTests.checkMenuHasCorrectContributions(ResourceMgmtActionProviderTests.java:203)
	at org.eclipse.ui.tests.navigator.resources.ResourceMgmtActionProviderTests.testFillContextMenu_folderSelection(ResourceMgmtActionProviderTests.java:76)

@DaveCarpeneto
Copy link
Contributor Author

i don't get if the added tests are useful: Only one of them fails when the PR is reverted [...]

The one test that fails relates directly to the code change. The other 4 handle other situations where eclipse behaves as expected today. I added those 4 tests in the hope that future changes do not introduce a regression bug, like was done in the code added for #1438 .

[...] and has an error message that is not understandable to me:

java.lang.AssertionError: Unexpected menu membership for org.eclipse.ui.RefreshAction (false)
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.eclipse.ui.tests.navigator.resources.ResourceMgmtActionProviderTests.checkMenuHasCorrectContributions(ResourceMgmtActionProviderTests.java:203)
	at org.eclipse.ui.tests.navigator.resources.ResourceMgmtActionProviderTests.testFillContextMenu_folderSelection(ResourceMgmtActionProviderTests.java:76)

My hope was that the error message was enough that if this test failed that people investigating would have enough information to see what went wrong. In this case RefreshAction was not included, where the test was expecting to be included. If you feel that further elaboration is needed for a unit test failure message please let me know & I will submit another change to cover this.

@DaveCarpeneto
Copy link
Contributor Author

The CI logfile contains messages like org.eclipse.core.commands.NotHandledException: There is no handler to execute for command org.eclipse.ui.file.refresh)]
[...]
does it relate to this PR?

No. I see this in the stdout when I grab pretty much any recent build & run these tests (which succeed). The NotHandledException is in fact what was expected by the test. These lines come from things like the following in org.eclipse.ui.tests.commands.CommandExecutionTest :

System.out.println(listener.methods);

... which were added as part of the tests in 2012. These lines have been reported in builds for quite some time :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refresh option not available for some resources that are not closed projects
4 participants