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

Select the current tab after displaying them #766

Conversation

fedejeanne
Copy link
Contributor

Call handleTabSelected right after displaying all tabs in the LaunchConfigurationTabGroupViewer::displayInstanceTabs so that the "activated" method of the tab is called.

This is necessary in order to give every tab the chance to compute/show its content when it is first selected by changing between Run configurations in the Run Configurations Dialog.

Contributes to eclipse-pde/eclipse.pde#674

How to test

  1. Run sdk.product
  2. Open the Run configurations Dialog
  3. Create 2 run configurations
  4. Select one configuration and click on any Tab other than the first tab
  5. Switch to the other configuration
  • The same tab should be active in the newly selected run configuration
  • The activated method of that tab should have been called (the method extends/overrides org.eclipse.debug.ui.ILaunchConfigurationTab.activated(ILaunchConfigurationWorkingCopy))

e.g. testing with Product Run Configurations (PDE)

  1. Run sdk.product
  2. Open the Run configurations Dialog
  3. Create 2 Product Run configurations
  4. Select one configuration and click on the Tab Java Arguments
    4.1. Add a breakpoint in org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab.activated(ILaunchConfigurationWorkingCopy)
  5. Switch to the other configuration
  • The tab Java Arguments should be active in the newly selected run configuration
  • The execution should stop at the breakpoint

@fedejeanne
Copy link
Contributor Author

FYI this PR is a must in order to be able to merge eclipse-pde/eclipse.pde#674

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2023

Test Results

     591 files  ±0       591 suites  ±0   1h 4m 49s ⏱️ - 2m 45s
  3 798 tests ±0    3 793 ✔️ +1    5 💤 ±0  0  - 1 
12 000 runs  ±0  11 964 ✔️ +1  36 💤 ±0  0  - 1 

Results for commit 1ea5dce. ± Comparison against base commit e0f98f9.

♻️ This comment has been updated with latest results.

@fedejeanne
Copy link
Contributor Author

Test failures already documented here: #596, #629, #768.

The new ones were documented here: #770, #771, #772.

None of the test failures seem to be related to the changes introduced in this PR though since no test failed again in the 2nd CI build.

Reviews are welcome!

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the necessity and goal of the change, but to me it does not look like a proper solution for the issue. Here are my concerns:

  • handleTabSelected() explicitly avoids a reactivation when the tab index did not change. Is it correct to remove that precondition? I see that if you want to (mis)use the method to reactivate a tab, this condition must be removed, but is that what the method is supposed to do (considering its other usages)? Otherwise it might make more sense to move that reactivation functionality into a separate method that is called in the scenario to be addressed without the precondition of the handleTabSelected() method. That might make sense anyway as handleTabSelected suggests that it should be called if a tab was selected, but this is not even the case here. It is rather about reloadTab or the like.
  • The displayInstanceTabs() methods does already process all the tabs in its call of showInstanceTabs(). It calls setActiveTab() for all tabs once and then calls it again for the one that that is to be active afterwards. However, these setActiveTab calls finally seem to do nothing else than calling handleTabSelected, which does nothing as fInitializingTabs is set to true, so the method immediately returns without doing anything. So maybe there is something broken in the overall functionality, as it looks to me as if the last lines of code in showInstanceTabs are supposed to do exactly what this PR is trying to fix. Please check what that code does. And if it is really not related to what this PR is supposed to achieve, it may at least point to a better solution of the problem.

@fedejeanne fedejeanne force-pushed the bugs/pde-674-call_handleTabSelected_when_displaying_tabs branch from 4889d80 to 477caa2 Compare October 30, 2023 12:38
@fedejeanne
Copy link
Contributor Author

fedejeanne commented Oct 30, 2023

@HeikoKlare I changed it so handleTabSelected() will only be called for this specific use case (switching between Run Configurations) and not in the other 2 use cases so it's safe now, the changes are contained.
It's still necessary to remove the condition fCurrentTabIndex == fTabFolder.getSelectionIndex() for these changes to work properly, but I tested all 3 use cases where the method handleTabSelected() is called and the changes don't cause any undesired behavior so it's safe to apply them.

The 3 use cases

  1. Switching between Run configurations
  2. Leaving the JRE tab having changed the JRE to a non-modular JRE/Execution environment (e.g. Java 1.8)
  3. Selecting another launcher for the Run configuration (this is only possible in certain circumstances)

This PR should be ready to be merged now.

@fedejeanne
Copy link
Contributor Author

The failed check is unrelated to the changes, it seems to be a problem with Tycho and the tests in Mac:

Error:  Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:4.0.4-SNAPSHOT:test (default-test) on 
project org.eclipse.core.tests.resources: Execution default-test of goal 
org.eclipse.tycho:tycho-surefire-plugin:4.0.4-SNAPSHOT:test failed: Exception creating test eclipse runtime: 
zip file is empty -> [Help 1]

@HeikoKlare
Copy link
Contributor

Please see my previous comment. From my understanding, there is already code that is supposed to do what this change is trying to do. Either correct me in case I am wrong or otherwise please fix or replace that code.

Make sure that the selected tab is activated (i.e. that its "activate"
method is called) when switching between existing run configurations in
the "Run configurations" dialog.

Contributes to eclipse-pde/eclipse.pde#674
@fedejeanne fedejeanne force-pushed the bugs/pde-674-call_handleTabSelected_when_displaying_tabs branch from 477caa2 to 1ea5dce Compare November 3, 2023 08:29
@fedejeanne
Copy link
Contributor Author

I re-read your previous comment and made some changes. I pushed the activation of the tabs all the way back to the end of displayInstanceTabs(...) (after the flag fInitializingTabs is switched-off) and I reverted my changes in handleTabSelected(). I even got rid of a small bug that activated the first tab unnecessarily.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the latest solution 👍 In my opinion, it is very comprehensible now. I have only minor comments to the fix itself. And could we add a regression test for it?

Please also fix the Javadoc of the refreshTabs0 method when touching it anway.

@fedejeanne fedejeanne merged commit 96daf27 into eclipse-platform:master Nov 6, 2023
16 checks passed
@fedejeanne
Copy link
Contributor Author

Thank you for your reviews, @HeikoKlare ! I merged this one so eclipse-pde/eclipse.pde#674 can be also merged.

And could we add a regression test for it?

Let's put a pin on that. The new functionality has been tested manually and it's looking fine.

Please also fix the Javadoc of the refreshTabs0 method when touching it anway.

I didn't touch that one.

@HannesWell
Copy link
Member

HannesWell commented Nov 6, 2023

And could we add a regression test for it?\n\nLet's put a pin on that. The new functionality has been tested manually and it's looking fine.

I want to mention that the addition of tests ist permitted all the time, so no reason to postpone that from a RelEng/freeze-time point of view. :)

fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
iloveeclipse pushed a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
iloveeclipse pushed a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 16, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 17, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 17, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 17, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit to fedejeanne/eclipse.platform that referenced this pull request Nov 29, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
fedejeanne added a commit that referenced this pull request Nov 29, 2023
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
#766

Fixes: #859
Michael5601 pushed a commit to CodeLtDave/eclipse.platform that referenced this pull request Feb 12, 2024
Also add a new test bundle that contains the proper regression test.

Bundle: org.eclipse.debug.ui.tests
Class: LaunchConfigurationTabGroupViewerTest

This class also contains a regression test for
eclipse-platform#766

Fixes: eclipse-platform#859
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.

3 participants