@Override
  public boolean performOk() {
    String error = getPackageErrorMessages();
    if (!Strings.isNullOrEmpty(error)) {

      IStatus status =
          new Status(
              IStatus.ERROR,
              Activator.PLUGIN_ID,
              "Package Name shown below is incorrect."
                  + System.getProperty("line.separator")
                  + error);
      Shell shell = Display.getDefault().getActiveShell();
      ErrorDialog.openError(shell, "Validation Error", "Correct the errors shown below.", status);
      return false;
    }

    dao.storeOutputFolder(outputFolderCombo.getText());

    SpreadsheetPreference cellPreference = createSpreadsheetCellPreference();
    dao.storeSpreadsheetCell(cellPreference);
    CustomCodePreference customPreference = createCustomCodePreference();
    dao.storeCustomCode(customPreference);

    return true;
  }
  @Override
  protected void performDefaults() {

    outputFolderCombo.select(dao.getDefaultOutputFolder());

    SpreadsheetPreference sheetEntity = dao.getDefaultSpreadsheetCell();
    setText(sheetEntity);

    CustomCodePreference customEntity = dao.getDefaultCustomCode();
    setText(customEntity);

    packageCellColumnComp.setEnabled(true);
    packageCellRowComp.setEnabled(true);
  }
  @Override
  protected Control createContents(Composite parent) {

    CustomCodePreference customEntity = dao.findCustomCodePreference();

    GridLayout layout3 = new GridLayout(3, false);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setLayout(layout3);

    Label outputFolderLabel = new Label(composite, SWT.NONE);
    outputFolderLabel.setText("Output Folder:");
    GridData colspan2 = new GridData(GridData.VERTICAL_ALIGN_END);
    colspan2.horizontalSpan = 2;
    colspan2.horizontalAlignment = GridData.FILL;
    outputFolderCombo = new OutputFolderCombo(composite, SWT.READ_ONLY);
    outputFolderCombo.setLayoutData(colspan2);
    outputFolderCombo.select(dao.findOutputFolder());

    templatePathComp = new JavaFilePathComponent(composite, "Template File Path:");
    templatePathComp.setText(customEntity.getTemplateFilePath());

    Group customGroup = new Group(parent, SWT.NONE);
    customGroup.setText("Custom implements");
    customGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    customGroup.setLayout(layout3);

    codeSeedComp = new JavaClassPathComponent(customGroup, "CodeSeed:");
    codeSeedComp.setText(customEntity.getCodeSeedImplements());
    packageHasErrors.add(codeSeedComp);

    rootTagComp = new JavaClassPathComponent(customGroup, "RootTag:");
    rootTagComp.setText(customEntity.getRootTagImplements());
    packageHasErrors.add(rootTagComp);

    itemsTagComp = new JavaClassPathComponent(customGroup, "ItemsTag:");
    itemsTagComp.setText(customEntity.getItemsTagImplements());
    packageHasErrors.add(itemsTagComp);

    tagHandlerComp = new JavaClassPathComponent(customGroup, "TagHandler:");
    tagHandlerComp.setText(customEntity.getTagHandlerImplements());
    packageHasErrors.add(tagHandlerComp);

    SpreadsheetPreference spreadEntity = dao.findSpreadsheetPreference();

    GridLayout layout6 = new GridLayout(6, false);

    Group packageGroup = new Group(parent, SWT.NONE);
    packageGroup.setText("Package Name");
    GridData colspan6 = new GridData(GridData.FILL_HORIZONTAL);
    colspan6.horizontalSpan = 6;
    packageGroup.setLayoutData(colspan6);
    packageGroup.setLayout(layout6);

    packageUseSheetCheck = new Button(packageGroup, SWT.CHECK);
    packageUseSheetCheck.setText("use sheet name.");
    packageUseSheetCheck.setSelection(spreadEntity.isPackageUseSheet());
    packageUseSheetCheck.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent e) {}

          @Override
          public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.widget;
            setEnabledToUseSheet(button.getSelection());
          }
        });

    packageCellColumnComp = new SpreadSheetColumnCellComponent(packageGroup, "Column:");
    packageCellColumnComp.setText(spreadEntity.getPackageColumnCell());
    packageCellColumnComp.verify();
    packageCellRowComp = new SpreadSheetRowCellComponent(packageGroup, "Row:");
    packageCellRowComp.setText(spreadEntity.getPackageRowCell());
    packageCellRowComp.verify();
    new Label(packageGroup, SWT.NONE);

    basePackageNameComp = new JavaClassPathComponent(packageGroup, "Package Name Base:", false);
    basePackageNameComp.setLayoutData(colspan6);
    basePackageNameComp.setText(spreadEntity.getBasePackage());
    packageHasErrors.add(basePackageNameComp);

    Group spreadGroup = new Group(parent, SWT.NONE);
    spreadGroup.setText("Default SpreadSheet Cell. (It's a enum generator) ");
    spreadGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    spreadGroup.setLayout(layout6);

    classCommentComp = new SpreadSheetColumnCellComponent(spreadGroup, "Class Comment:");
    classCommentComp.setText(spreadEntity.getClassCommentCell());
    classCommentComp.verify();

    classNameComp = new SpreadSheetColumnCellComponent(spreadGroup, "Class Name:");
    classNameComp.setText(spreadEntity.getClassNameCell());
    classNameComp.verify();

    new Label(spreadGroup, SWT.NONE);
    new Label(spreadGroup, SWT.NONE);

    enumCommentComp = new SpreadSheetColumnCellComponent(spreadGroup, "Enum Type Comment:");
    enumCommentComp.setText(spreadEntity.getEnumCommentCell());
    enumCommentComp.verify();

    enumNameComp = new SpreadSheetColumnCellComponent(spreadGroup, "Enum Type Value:");
    enumNameComp.setText(spreadEntity.getEnumNameCell());
    enumNameComp.verify();

    enumValueComp = new SpreadSheetColumnCellComponent(spreadGroup, "Enum Code Value:");
    enumValueComp.setText(spreadEntity.getEnumValueCell());
    enumValueComp.verify();

    startRepeatRowComp =
        new SpreadSheetRowCellComponent(spreadGroup, "A row to start repeat (except empty) :");
    startRepeatRowComp.setText(String.valueOf(spreadEntity.getStartRepeatRow()));
    startRepeatRowComp.verify();

    setEnabledToUseSheet(spreadEntity.isPackageUseSheet());

    return parent;
  }