1   package com.stateofflow.eclipse.metrics.preferences.builder;
2   
3   import java.util.Collection;
4   
5   import org.eclipse.jface.preference.FieldEditor;
6   import org.eclipse.jface.preference.IPreferenceStore;
7   import org.eclipse.swt.widgets.Composite;
8   import org.eclipse.swt.widgets.Group;
9   import org.eclipse.swt.widgets.TabFolder;
10  
11  import com.stateofflow.eclipse.metrics.calculators.linesofcode.LinesOfCodeCalculator;
12  
13  public final class LinesOfCodeTabBuilder extends TabBuilder {
14      public LinesOfCodeTabBuilder(final Collection<FieldEditor> fieldEditors, final IPreferenceStore preferenceStore) {
15          super(fieldEditors, preferenceStore);
16      }
17  
18      private void addOptionsGroup(final Composite root) {
19          final Group group = createGroup(root, "Options", 1);
20          addBooleanEditor(group, LinesOfCodeCalculator.INCLUDE_METHOD_COMMENTS_KEY, "Include JavaDoc");
21          addBooleanEditor(group, LinesOfCodeCalculator.IGNORE_COMMENTS_BLANKS_KEY, "Ignore blank and comment-only lines");
22      }
23  
24      private void addUpperBoundsGroup(final Composite root) {
25          final Group group = createGroupForPreferredUpperBounds(root);
26          addEnableMetricFields(group, LinesOfCodeCalculator.METRIC_ID, "Lines of Code");
27      }
28  
29      @Override
30      public void create(final TabFolder folder) {
31          final Composite root = createCompositeForTabItem(folder, "LoC", "Lines of Code Metrics");
32          addUpperBoundsGroup(root);
33          addOptionsGroup(root);
34      }
35  }
36