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/TCLogFormatPreferencePage.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/TCLogFormatPreferencePage.java')
-rw-r--r-- | rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatPreferencePage.java | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatPreferencePage.java b/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatPreferencePage.java new file mode 100644 index 0000000..fd6afdf --- /dev/null +++ b/rba.tool.editor.ui/src/rba/tool/editor/ui/coverage/TCLogFormatPreferencePage.java @@ -0,0 +1,83 @@ +package rba.tool.editor.ui.coverage; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.RadioGroupFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +public class TCLogFormatPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore preferenceStore; + + private RadioGroupFieldEditor tclogFileFormat; + + private static final String DESCRIPTION = "tclog File Format"; + + private static final String TEXT_FORMAT = "text"; + + private static final String ZIP_FORMAT = "zip"; + + private String selectedFormat = TEXT_FORMAT; + + private TCLogFormatSettingManager manager = TCLogFormatSettingManager.INSTANCE; + + public TCLogFormatPreferencePage() { + super(GRID); + } + + @Override + public void init(IWorkbench workbench) { + if (!getPreferenceStore().getString("FileFormat").isEmpty()) { + selectedFormat = getPreferenceStore().getString("FileFormat"); + } + } + + @Override + protected void createFieldEditors() { + + String[][] btnArr = new String[][] { { "&Text", TEXT_FORMAT }, { "&Zip", ZIP_FORMAT } }; + tclogFileFormat = new RadioGroupFieldEditor("FileFormat", DESCRIPTION, 2, btnArr, getFieldEditorParent(), true); + + Composite composite = tclogFileFormat.getRadioBoxControl(getFieldEditorParent()); + Control[] controls = composite.getChildren(); + + for (Control control : controls) { + control.addListener(SWT.Selection, new Listener() { + + @Override + public void handleEvent(Event event) { + + Button btn = (Button) event.widget; + selectedFormat = (String) btn.getData(); + } + }); + } + + addField(tclogFileFormat); + } + + @Override + public boolean performOk() { + + manager.saveTCLogFileFormat(selectedFormat); + return super.performOk(); + } + + @Override + public IPreferenceStore getPreferenceStore() { + if (preferenceStore == null) { + preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, manager.ID_PREFERENCE_NODE); + } + return preferenceStore; + } + +} |