diff options
author | 2021-08-03 18:42:39 +0900 | |
---|---|---|
committer | 2021-08-06 19:32:38 +0900 | |
commit | be4f78978faba3d3ceb88df02a7f93a2e09ff1e0 (patch) | |
tree | 1f3f1a96251ac4f655c8a96fc33d5d4ee779cd06 /rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java | |
parent | 71ca7c6cab863767ef30c8bd05b2bbfda8731cb5 (diff) |
Initial commit
Bug-AGL: SPEC-4033
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com>
Diffstat (limited to 'rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java')
-rw-r--r-- | rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java b/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java new file mode 100644 index 0000000..c8bed99 --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatSettingManager.java @@ -0,0 +1,42 @@ +package rba.tool.editor.ui.coverage; + +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.BackingStoreException; +import org.osgi.service.prefs.Preferences; + +public class TCLogFormatSettingManager { + + public static final TCLogFormatSettingManager INSTANCE = new TCLogFormatSettingManager(); + + public static final String ID_PREFERENCE_NODE = "rba.model.tool"; //$NON-NLS-1$ + + private static final String ID_PREFERENCES = "rba.model.tool.coverage.tclogFormat"; //$NON-NLS-1$ + + private static final String ID_TCLOG_FORMAT = "TCLogFormat"; //$NON-NLS-1$ + + public void saveTCLogFileFormat(final String format) { + final String oldFormat = TCLogFormatSettingManager.INSTANCE.getTCLogFileFormat(); + if (!oldFormat.equals(format)) { + IEclipsePreferences preferences = getPreferences(); + Preferences sub = preferences.node(ID_PREFERENCES); + sub.put(ID_TCLOG_FORMAT, format); + try { + // forces the application to save the preferences + preferences.flush(); + } catch (BackingStoreException e) { + e.printStackTrace(); + } + } + } + + public String getTCLogFileFormat() { + IEclipsePreferences preferences = getPreferences(); + Preferences sub = preferences.node(ID_PREFERENCES); + return sub.get(ID_TCLOG_FORMAT, "text"); + } + + private IEclipsePreferences getPreferences() { + return InstanceScope.INSTANCE.getNode(ID_PREFERENCE_NODE); + } +} |