Bug 460837 - [visualizer] Add persistent information storage in the MV
Summary: [visualizer] Add persistent information storage in the MV
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: Next   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.7.0   Edit
Assignee: Marc Dumais CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 460476
  Show dependency tree
 
Reported: 2015-02-25 12:58 EST by Marc Dumais CLA
Modified: 2015-03-04 12:46 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Dumais CLA 2015-02-25 12:58:07 EST
It would be nice to have an easy way to save/restore persistent settings in the Multicore Visualizer.
Comment 1 Eclipse Genie CLA 2015-02-27 09:16:23 EST
New Gerrit change created: https://git.eclipse.org/r/42901
Comment 2 Eclipse Genie CLA 2015-02-27 09:16:36 EST
New Gerrit change created: https://git.eclipse.org/r/42902
Comment 3 Eclipse Genie CLA 2015-02-27 09:42:19 EST
New Gerrit change created: https://git.eclipse.org/r/42907
Comment 4 Marc Dumais CLA 2015-02-27 10:01:02 EST
I think I have come-up with a nice solution. It's almost a drop-in replacement, at the java code level, for (a few supported) types of variables, with the added benefit that any value set will be persisted in the preference store (at the workspace level).

Here is an example, inspired by the changes to MulticoreVisualizer.java (adapted for readability): 

// original variables
Boolean m_loadMetersEnabled;
int m_loadMeterTimerPeriod;

// replacement: 
PersistentSetting<Boolean> m_loadMetersEnabled;
PersistentSetting<Integer> m_loadMeterTimerPeriod;

// There is a bit of setup to be done before using the PersistentSetting variables: 
PersistentSettingsManager m_persistentSettingsManager = new PersistentSettingsManager(ECLIPSE_PLUGIN_ID, visualizerViewInstanceId);

boolean appliesToAllMVViews = false;
m_loadMetersEnabled = m_persistentSettingsManager.getNewParameter(Boolean.class,"enableLoadMeters", appliesToAllMVViews, false);
m_loadMeterTimerPeriod = m_persistentSettingsManager.getNewParameter(Integer.class, "loadMeterTimerPeriod", appliesToAllMVViews, 500); 

Then the persistent variables use a a setter/getter instead of being accessed directly: 

if (!m_loadMetersEnabled.value()) return;

m_loadMetersEnabled.set(true);

if (m_loadMeterTimerPeriod.value() > 5000) 
   m_loadMeterTimerPeriod.set(5000);
Comment 6 Marc Dumais CLA 2015-03-04 07:05:46 EST
committed to master
Comment 7 Eclipse Genie CLA 2015-03-04 11:48:52 EST
New Gerrit change created: https://git.eclipse.org/r/43176