Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323134 - [JUnit] JUnit view loses several action states on restart
Summary: [JUnit] JUnit view loses several action states on restart
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6.1   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-19 08:52 EDT by Dani Megert CLA
Modified: 2010-08-26 02:47 EDT (History)
1 user (show)

See Also:
daniel_megert: review+


Attachments
Fix for 3.6.1 (1.47 KB, patch)
2010-08-23 09:37 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-08-19 08:52:19 EDT
3.6.

Oh Boy.

The way the JUnit view gets its UI states is a mess! Some are stored in the settings, some are stored in the preferences and some use mementos. This results in different states of actions when doing e.g. close/reopen or after a restart.

The biggest problem which we have to fix is that we loose the state for those actions that set their state via  
    new InstanceScope().getNode(JUnitCorePlugin.CORE_PLUGIN_ID)
because no one saves that node on shutdown. So, the simplest fix for 3.6.1 is to add the following line to JUnitCorePlugin.stop(BundleContext):
    new InstanceScope().getNode(JUnitCorePlugin.CORE_PLUGIN_ID).flush();
We could probably just sneak that into bug 317755.

Another issue: why are the UI-only settings stored in the JUnit Core plug-in? I think we should move all that code to the UI and clean this up.

Test Case:
1. start new workspace
2. open JUnit view
3. toggle 'Activate on Error/Failure Only'
4. exit
5. start
==> verify state
Comment 1 Markus Keller CLA 2010-08-23 09:37:34 EDT
Created attachment 177214 [details]
Fix for 3.6.1

In 3.5, the preferences were saved automatically because JUnitPlugin extends AbstractUIPlugin and AbstractUIPlugin#stop(..) saves all preferences.

The fix implements Dani's suggestion and does the same in JUnitCorePlugin#stop(BundleContext). Dani, OK for 3.6.1?


> Another issue: why are the UI-only settings stored in the JUnit Core plug-in? I
> think we should move all that code to the UI and clean this up.

During the JUnit plug-ins split, all preferences were moved to org.eclipse.jdt.junit.core. We could revert this for some of the preferences, but that would make the migration more complex. Wontfix for 3.6.1. IMO, also too much work for too little gain in HEAD.
Comment 2 Dani Megert CLA 2010-08-24 06:28:36 EDT
>The fix implements Dani's suggestion and does the same in
>JUnitCorePlugin#stop(BundleContext). Dani, OK for 3.6.1?
+1 for 3.6.1

Moving the constants back to UI has less priority than cleaning up the different behavior of the action when it comes to restart and close/reopen.
Comment 3 Markus Keller CLA 2010-08-24 16:21:14 EDT
Released to R3_6_maintenance (and earlier released into I20100824-0800).
Comment 4 Dani Megert CLA 2010-08-26 02:47:07 EDT
Verified on Windows 7 using M20100825-0800.