示例#1
0
 private void createStartServletFlowLink(Composite parent, final int port) {
   Label label = new Label(parent, SWT.NONE);
   label.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
   label.setText(
       "<a href=\"http://localhost:" + port + "/oauth\" target=\"_blank\">Link to Servlet</a>");
   addDescription(
       parent, "<- This link starts the OAuth flow in another tab using plain servlets only.");
 }
示例#2
0
  protected String layoutBeforeChild(
      Control control,
      String labelText,
      String elementName,
      Map<String, String> attributes,
      Composite composite,
      SwtMetawidget metawidget) {

    // Add label

    if (SimpleLayoutUtils.needsLabel(labelText, elementName)) {
      Label label = new Label(composite, SWT.None);
      label.setData(NAME, attributes.get(NAME) + LABEL_NAME_SUFFIX);

      if (mLabelFont != null) {
        label.setFont(mLabelFont);
      }

      if (mLabelForeground != null) {
        label.setForeground(mLabelForeground);
      }

      label.setAlignment(mLabelAlignment);

      // Required

      String labelTextToUse = labelText;

      if (mRequiredText != null
          && TRUE.equals(attributes.get(REQUIRED))
          && !WidgetBuilderUtils.isReadOnly(attributes)
          && !metawidget.isReadOnly()) {
        if (mRequiredAlignment == SWT.CENTER) {
          labelTextToUse += mRequiredText;
        } else if (mRequiredAlignment == SWT.LEFT) {
          labelTextToUse = mRequiredText + labelTextToUse;
        }
      }

      if (mLabelSuffix != null) {
        labelTextToUse += mLabelSuffix;
      }

      label.setText(labelTextToUse);

      GridData labelLayoutData = new GridData();
      labelLayoutData.horizontalAlignment = SWT.FILL;
      labelLayoutData.verticalAlignment = SWT.FILL;

      label.setLayoutData(labelLayoutData);
      label.moveAbove(control);
    }

    return labelText;
  }
  @Override
  public Control contribute(Composite parent) {
    Composite result = new Composite(parent, SWT.INHERIT_DEFAULT);
    result.setLayout(new FormLayout());

    Label separator = new Label(result, SWT.NONE);
    separator.setData(RWT.CUSTOM_VARIANT, "footer_separator");
    FormData separatorData = new FormData();
    separator.setLayoutData(separatorData);
    separatorData.top = new FormAttachment(0, 0);
    separatorData.left = new FormAttachment(0, 0);
    separatorData.right = new FormAttachment(100, 0);
    separatorData.height = SEPARATOR_HEIGHT;

    Label versionInfo = new Label(result, SWT.NONE);
    versionInfo.setText(getVersionInfo());
    versionInfo.pack();
    FormData versionInfoData = new FormData();
    versionInfo.setLayoutData(versionInfoData);
    Point size = versionInfo.getSize();
    versionInfoData.top = new FormAttachment(50, -(size.y / 2) + (SEPARATOR_HEIGHT / 2));
    versionInfoData.left = new FormAttachment(50, -(size.x / 2));
    return result;
  }
  @Override
  public void createPartControl(Composite parent) {
    // TODO Auto-generated method stub
    toolkit = new FormToolkit(parent.getDisplay());
    form = toolkit.createForm(parent);
    form.setText("MetaData Editor:");

    toolkit.decorateFormHeading(form);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.minimumWidth = 200;
    //		FormLayout gridLayout = new FormLayout();
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.horizontalSpacing = 5;
    form.getBody().setLayout(gridLayout);

    FormData formDate = new FormData();
    formDate.height = 250;
    formDate.width = 300;

    FormData formDate0 = new FormData();
    formDate0.height = 150;
    formDate0.width = 300;
    FormData formDate2 = new FormData();
    formDate2.height = 550;
    formDate2.width = 550;

    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText("Attribute Modifier");
    Composite sectionClient = toolkit.createComposite(section);
    sectionClient.setLayout(new FormLayout());
    section.setClient(sectionClient);

    GridData gridData2 = new GridData();
    gridData2.verticalSpan = 2;
    section.setLayoutData(gridData2);

    Section section2 = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section2.setText("Collector");
    Composite sectionClient2 = toolkit.createComposite(section2);
    sectionClient2.setLayout(new FormLayout());
    section2.setClient(sectionClient2);

    Section section3 = toolkit.createSection(form.getBody(), Section.TITLE_BAR); // printStackTrace
    section3.setText("Collection Code");
    Composite sectionClient3 = toolkit.createComposite(section3);
    sectionClient3.setLayout(new FormLayout());
    section3.setClient(sectionClient3);

    final Table table2 =
        toolkit.createTable(
            sectionClient2, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.NONE);
    table2.setHeaderVisible(true);

    final Button submitCollectionCode = toolkit.createButton(sectionClient2, "submit", SWT.None);

    TableColumn column01 = new TableColumn(table2, SWT.NONE);
    column01.setWidth(25);
    column01.setText("#");
    TableColumn column02 = new TableColumn(table2, SWT.NONE);
    column02.setWidth(100);
    column02.setText("Name");
    TableColumn column03 = new TableColumn(table2, SWT.NONE);
    column03.setWidth(100);
    column03.setText("Collection No");
    table2.setLayoutData(formDate);
    int index = 1;
    for (SpecCollectorMap map : spec.getSpecCollectorMaps()) {
      Collector c = map.getCollector();
      TableItem item = new TableItem(table2, SWT.FULL_SELECTION);
      item.setData("collector", c);
      item.setText(0, index + "");
      index++;
      item.setText(1, c.getCollectorFullName()); // c.exe
      if (spec.getRecordNumber() == null) {
        item.setText(2, "");
      } else item.setText(2, spec.getRecordNumber());

      table2.setSelection(index);
    }

    table2.addListener(
        SWT.MouseDoubleClick,
        new Listener() {
          @Override
          public void handleEvent(Event arg0) {
            Point pt = new Point(arg0.x, arg0.y);
            int ret;
            for (final TableItem item : table2.getItems()) {

              for (int i = 0; i < table2.getColumnCount(); i++) {
                Rectangle rect = item.getBounds(i);
                if (rect.contains(pt)) {
                  Collector c = (Collector) item.getData("collector");
                  CollectorModDialog dialog =
                      new CollectorModDialog(Display.getDefault().getActiveShell(), c);
                  ret = dialog.open();
                }
              }
            }
          }
        });
    final Table table3 =
        toolkit.createTable(
            sectionClient3, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.NONE);
    table3.setHeaderVisible(true);

    TableColumn column31 = new TableColumn(table3, SWT.NONE);
    column31.setWidth(25);
    column31.setText("#");
    TableColumn column32 = new TableColumn(table3, SWT.NONE);
    column32.setWidth(50);
    column32.setText("Collection Code");
    TableColumn column33 = new TableColumn(table3, SWT.NONE);
    column33.setWidth(150);
    column33.setText("Collection Info");
    table3.setLayoutData(formDate0);

    Collection ccc = this.spec.getCollection();

    TableItem item31 = new TableItem(table3, SWT.NONE);
    item31.setText(0, "1");
    if (ccc != null) {
      if (ccc.getCollectionCode() == null) ccc.setCollectionCode("");
      if (ccc.getCollectionInfo() == null) ccc.setCollectionInfo("");
      item31.setText(1, ccc.getCollectionCode());
      item31.setText(2, ccc.getCollectionInfo());
    }

    final TableEditor collectionEditor = new TableEditor(table3);
    collectionEditor.horizontalAlignment = SWT.LEFT;
    collectionEditor.grabHorizontal = true;
    collectionEditor.minimumWidth = 50;
    collectionSelectionListener =
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void widgetSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub
            Control oldEditor = collectionEditor.getEditor();
            if (oldEditor != null) oldEditor.dispose();
          }
        };

    table3.addSelectionListener(collectionSelectionListener);
    tableListener2 =
        new Listener() {
          @Override
          public void handleEvent(Event arg0) {
            // TODO Auto-generated method stub
            Point pt = new Point(arg0.x, arg0.y);
            for (final TableItem item : table.getItems()) {
              String editable = (String) item.getData("editable");
              if (editable.equals("true")) {}
            }
          }
        };

    tableListener2 =
        new Listener() {
          @Override
          public void handleEvent(Event arg0) {
            Point pt = new Point(arg0.x, arg0.y);
            for (final TableItem item : table3.getItems()) {

              for (int i = 0; i < table3.getColumnCount(); i++) {
                Rectangle rect = item.getBounds(i);
                if (rect.contains(pt)) {
                  Control oldEditor = collectionEditor.getEditor();
                  if (oldEditor != null) oldEditor.dispose();

                  final Combo newEditor = new Combo(table3, SWT.NONE);
                  DataUtilsService service = new DataUtilsService();
                  DataUtilsDelegate delegate = service.getDataUtilsPort();
                  final List<Collection> collections = delegate.getCollections();
                  for (Collection col : collections) {
                    newEditor.add(col.getCollectionCode());
                  }

                  newEditor.addDisposeListener(
                      new DisposeListener() {
                        @Override
                        public void widgetDisposed(DisposeEvent e) {
                          // TODO Auto-generated method stub
                          Combo combo = (Combo) collectionEditor.getEditor();
                          Collection collection = collections.get(combo.getSelectionIndex());
                          collectionEditor.getItem().setText(1, collection.getCollectionCode());
                          collectionEditor.getItem().setText(2, collection.getCollectionInfo());
                          collectionEditor
                              .getItem()
                              .setBackground(new Color(Display.getCurrent(), 255, 250, 160));

                          String methodName = (String) item.getData();
                        }
                      });

                  newEditor.setFocus();
                  collectionEditor.setEditor(newEditor, item, 1);
                }
              }
            }
          }
        };
    table3.addListener(SWT.MouseDoubleClick, tableListener2);

    final Table table =
        toolkit.createTable(sectionClient, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLayoutData(formDate2);
    TableColumn column = new TableColumn(table, SWT.NONE);
    column.setWidth(200);
    column.setText("Name");
    TableColumn column2 = new TableColumn(table, SWT.NONE);
    column2.setWidth(250);
    column2.setText("Data");
    TableColumn column3 = new TableColumn(table, SWT.NONE);
    column3.setWidth(100);

    //		table.setLayoutData(gridData);
    /*
    		final TableItem itemName = new TableItem(table,SWT.NONE);
    		itemName.setText(0,"Scientific Name:");
    		final TableItem itemFamily = new TableItem(table, SWT.NONE);
    		itemFamily.setText(0, "Family:");
    		itemFamily.setData("setFamily");
    		final TableItem itemGenus = new TableItem(table, SWT.NONE);
    		itemGenus.setText(0, "Genus:");
    		itemGenus.setData("setGenus");
    		final TableItem itemSpecies = new TableItem(table, SWT.NONE);
    		itemSpecies.setText(0, "Species:");
    		itemSpecies.setData("setSpecies");
    		final TableItem itemCollectAt = new TableItem(table, SWT.NONE);
    		itemCollectAt.setText(0, "Collect At:");
    		itemCollectAt.setData("setCountry");
    		final TableItem itemCollectAtDarwin = new TableItem(table, SWT.NONE);
    		itemCollectAtDarwin.setText(0, "Name in Darwin's time:");
    		itemCollectAtDarwin.setData("setDcountry");
    		final TableItem itemSheetNote = new TableItem(table, SWT.NONE);
    		itemSheetNote.setText(0, "Sheet Notes:");
    		itemSheetNote.setData("setSheetNotes");
    		final TableItem itemState = new TableItem(table, SWT.NONE);
    		itemState.setText(0, "State:");
    		itemState.setData("setStateProvince");
    		final TableItem itemTown = new TableItem(table, SWT.NONE);
    		itemTown.setText(0, "Town:");
    		itemTown.setData("setTown");


    		itemName.setText(1,spec.getScientificName());
    		itemFamily.setText(1, spec.getFamily());
    		itemGenus.setText(1, spec.getGenus());
    		itemSpecies.setText(1, spec.getSpecificEpithet());
    		itemCollectAt.setText(1, spec.getCountry());
    		itemCollectAtDarwin.setText(1, spec.getDarwinCountry());
    		itemSheetNote.setText(1, spec.getSheetNotes());
    		itemState.setText(1, spec.getStateProvince());
    		itemTown.setText(1, spec.getTown());
    */

    try {
      Element root = this.configXml.selectElement("system/editor");
      for (int i = 0; i < root.getChildNodes().getLength(); i++) {
        if (root.getChildNodes().item(i).getNodeType() == Element.ELEMENT_NODE) {
          Element child = (Element) root.getChildNodes().item(i);
          System.out.println("child name = " + child.getAttribute("field"));
          if (child.getAttribute("display").equals("true")) {
            final TableItem itemName = new TableItem(table, SWT.NONE);
            System.out.println(itemName);
            itemName.setData("set" + child.getAttribute("field"));
            itemName.setData("editable", child.getAttribute("editable"));
            itemName.setData("type", child.getAttribute("type"));
            itemName.setText(0, child.getAttribute("name"));
            if (child.getAttribute("field").equals("RecordNumber")) {
              System.out.println(child.getAttribute("editable"));
            }
            Method m;

            try {
              m = spec.getClass().getMethod("get" + child.getAttribute("field"));
              System.out.println("function name = " + m.getName());
              if (child.getAttribute("type").equals("date")) {
                XMLGregorianCalendar cal = (XMLGregorianCalendar) m.invoke(spec);

                String calstr = "";
                if (cal != null) {
                  calstr = cal.toString();
                  itemName.setText(1, calstr);
                  itemName.setData("date", cal);
                }
              } else if (child.getAttribute("type").equals("string")) {
                String str = (String) m.invoke(spec);
                if (str == null) {
                  str = "";
                }
                itemName.setText(1, str);
              } else if (child.getAttribute("type").equals("int")) {
                Integer inte = (Integer) m.invoke(spec);
                itemName.setText(1, inte + "");
              }
            } catch (NoSuchMethodException e) {
              // TODO Auto-generated catch block
              System.out.println("field==" + child.getAttribute("field"));
              //						e.printStackTrace();
            } catch (SecurityException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            } catch (IllegalAccessException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            } catch (IllegalArgumentException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            } catch (InvocationTargetException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        }
      }
    } catch (XmlToolException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    final TableEditor editor = new TableEditor(table);
    // The editor must have the same size as the cell and must
    // not be any smaller than 50 pixels.
    editor.horizontalAlignment = SWT.LEFT;
    editor.grabHorizontal = true;
    editor.minimumWidth = 50;
    // editing the second column
    final int EDITABLECOLUMN = 1;
    tableSelectionListener =
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void widgetSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub
            Control oldEditor = editor.getEditor();
            if (oldEditor != null) oldEditor.dispose();
          }
        };

    final Button submitButton = toolkit.createButton(form.getBody(), "submit", SWT.None);
    submitButton.setEnabled(false);
    final Label label2 = new Label(form.getBody(), SWT.NONE);
    label2.setData("name", "label2");
    label2.setText("Modification Save Successfully");
    label2.setFont(new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD));
    label2.setForeground(new Color(Display.getCurrent(), 0, 128, 64));
    label2.setVisible(false);

    final Label label3 = new Label(form.getBody(), SWT.NONE);
    label3.setData("name", "label2");
    label3.setText("Modification Save Error!");
    label3.setFont(new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD));
    label3.setForeground(new Color(Display.getCurrent(), 128, 0, 0));
    label3.setVisible(false);

    final Label label4 = new Label(form.getBody(), SWT.NONE);
    label4.setData("name", "label4");
    label4.setFont(new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD));
    label4.setForeground(new Color(Display.getCurrent(), 200, 0, 0));
    label4.setVisible(false);

    final TableEditor edit = new TableEditor(table);
    // The editor must have the same size as the cell and must
    // not be any smaller than 50 pixels.
    edit.horizontalAlignment = SWT.LEFT;
    edit.grabHorizontal = true;
    edit.minimumWidth = 50;
    // editing the second column
    tableSelectionListener =
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void widgetSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub
            Control oldEditor = editor.getEditor();
            if (oldEditor != null) oldEditor.dispose();
          }
        };
    table.addSelectionListener(tableSelectionListener);
    tableListener =
        new Listener() {
          @Override
          public void handleEvent(Event arg0) {
            // TODO Auto-generated method stub
            Point pt = new Point(arg0.x, arg0.y);
            for (final TableItem item : table.getItems()) {
              String editable = (String) item.getData("editable");
              if (editable.equals("true")) {
                for (int i = 0; i < table.getColumnCount(); i++) {
                  Rectangle rect = item.getBounds(i);
                  if (rect.contains(pt)) {
                    Control oldEditor = editor.getEditor();
                    if (oldEditor != null) oldEditor.dispose();

                    if (item.getData("type").equals("int")) {
                      Text newEditor = new Text(table, SWT.NONE);
                      newEditor.setText(item.getText(EDITABLECOLUMN));
                      newEditor.addDisposeListener(
                          new DisposeListener() {
                            @Override
                            public void widgetDisposed(DisposeEvent arg0) {
                              // TODO Auto-generated method stub
                              Text text = (Text) editor.getEditor();
                              editor.getItem().setText(EDITABLECOLUMN, text.getText());
                              String methodName = (String) item.getData();
                              for (Method m : spec.getClass().getMethods()) {
                                if (m.getName().equals(methodName)) {
                                  try {
                                    m.invoke(spec, new Object[] {Integer.parseInt(text.getText())});
                                  } catch (IllegalArgumentException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (IllegalAccessException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (InvocationTargetException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  }
                                  break;
                                }
                              }

                              item.setBackground(new Color(Display.getCurrent(), 255, 250, 160));
                              item.setData("modified", "true");
                              submitButton.setEnabled(true);
                            }
                          });
                      newEditor.selectAll();
                      newEditor.setFocus();
                      editor.setEditor(newEditor, item, EDITABLECOLUMN);
                      break;
                    }

                    if (item.getData("type").equals("string")) {
                      Text newEditor = new Text(table, SWT.NONE);
                      newEditor.setText(item.getText(EDITABLECOLUMN));
                      newEditor.addDisposeListener(
                          new DisposeListener() {
                            @Override
                            public void widgetDisposed(DisposeEvent arg0) {
                              // TODO Auto-generated method stub
                              Text text = (Text) editor.getEditor();
                              editor.getItem().setText(EDITABLECOLUMN, text.getText());
                              String methodName = (String) item.getData();
                              for (Method m : spec.getClass().getMethods()) {
                                if (m.getName().equals(methodName)) {
                                  try {
                                    m.invoke(spec, new Object[] {text.getText()});
                                  } catch (IllegalArgumentException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (IllegalAccessException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (InvocationTargetException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  }
                                  break;
                                }
                              }

                              item.setBackground(new Color(Display.getCurrent(), 255, 250, 160));
                              item.setData("modified", "true");
                              submitButton.setEnabled(true);
                            }
                          });
                      newEditor.selectAll();
                      newEditor.setFocus();
                      editor.setEditor(newEditor, item, EDITABLECOLUMN);
                      break;
                    } else if (item.getData("type").equals("date")) {
                      CalendarCombo calendar = new CalendarCombo(table, SWT.CALENDAR);
                      XMLGregorianCalendar cal = (XMLGregorianCalendar) item.getData("date");
                      if (cal == null) {
                        calendar.setDate(new Date(System.currentTimeMillis()));
                      } else {
                        GregorianCalendar ca = cal.toGregorianCalendar();
                        calendar.setDate(ca.getTime());
                      }
                      //
                      calendar.addDisposeListener(
                          new DisposeListener() {
                            @Override
                            public void widgetDisposed(DisposeEvent arg0) {
                              // TODO Auto-generated method stub
                              CalendarCombo cc = (CalendarCombo) editor.getEditor();
                              editor.getItem().setText(EDITABLECOLUMN, cc.getDateAsString());

                              String methodName = (String) item.getData();
                              for (Method m : spec.getClass().getMethods()) {
                                if (m.getName().equals(methodName)) {
                                  try {
                                    GregorianCalendar gc = new GregorianCalendar();
                                    gc.setTime(cc.getDate().getTime());
                                    XMLGregorianCalendar date2 =
                                        DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
                                    m.invoke(spec, new Object[] {date2});
                                  } catch (IllegalArgumentException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (IllegalAccessException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (InvocationTargetException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  } catch (DatatypeConfigurationException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                  }
                                  break;
                                }
                              }

                              item.setBackground(new Color(Display.getCurrent(), 255, 250, 160));
                              item.setData("modified", "true");
                              submitButton.setEnabled(true);
                            }
                          });

                      calendar.setFocus();
                      editor.setEditor(calendar, item, EDITABLECOLUMN);
                      break;
                    }
                  }
                } // for
              }
            }
          }
        };
    table.addListener(SWT.MouseDoubleClick, tableListener);
    submitButton.setLayoutData(gridData);
    buttonSelectionListener =
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub

          }

          @Override
          public void widgetSelected(SelectionEvent arg0) {
            // TODO Auto-generated method stub
            try {
              //					Specimen speca = null;
              //					for(IWorkbenchPage p : pages){
              //						IViewReference ivrs [] = p.getViewReferences();
              //						for(IViewReference ivr : ivrs){
              //							if(ivr.getId().equals("TestView.view")){
              //								View v = (View)ivr.getView(true);
              //								speca = v.getGallery().getSelection()[0].getData("spec", spec);
              //								if(spec.getMissingInfo()==0){
              //									v.getGallery().getSelection()[0].setBackground(new
              // Color(Display.getCurrent(), 255,255,255));
              //								}
              //								break;
              //							}
              //						}
              //					}
              DataUtilsService service = new DataUtilsService(); // Missing
              DataUtilsDelegate delegate = service.getDataUtilsPort();
              //					Specimen ss = delegate.getSpecimenById(spec.getSpecimenId());//getView

              List<SpecCollectorMap> scms = delegate.getScms(spec.getSpecimenId());
              //					System.out.println(ss.getSpecimenId()+"***"+scms.size());
              if (spec == null) {
                System.out.println("NULL ID!");
              }
              if (scms == null) {
                System.out.println("NULL SCMS!");
              }
              String scmIds = "";
              int index = 0;
              for (SpecCollectorMap scm : scms) {
                if (index == 0) {
                  scmIds += scm.getSpecCollectorMapId();
                } else {
                  scmIds += ("-" + scm.getSpecCollectorMapId());
                }
                index++;
              }
              System.out.println("scmIds = " + scmIds);
              System.out.println("specimen Id = " + spec.getSpecimenId());
              if (scmIds.equals("")) scmIds = "0";
              Specimen updatedSpecimen = delegate.updateSpecimen(spec, scmIds);
              for (TableItem item : table.getItems()) {
                item.setBackground(new Color(Display.getCurrent(), 255, 255, 255));
                submitButton.setEnabled(false);
              }
              IWorkbenchPage pages[] = getEditorSite().getWorkbenchWindow().getPages();
              for (IWorkbenchPage p : pages) {
                IViewReference ivrs[] = p.getViewReferences();
                for (IViewReference ivr : ivrs) {
                  if (ivr.getId().equals("TestView.view")) {
                    View v = (View) ivr.getView(true);
                    v.getGallery().getSelection()[0].setData(updatedSpecimen);
                    if (spec.getMissingInfo() == 0) {
                      v.getGallery()
                          .getSelection()[0]
                          .setBackground(new Color(Display.getCurrent(), 255, 255, 255));
                    }
                    spec = updatedSpecimen;
                    break;
                  }
                }
              }
              label2.setVisible(true);
              label3.setVisible(false);
              label4.setVisible(false);
            } catch (Exception e) {
              label2.setVisible(false);
              label3.setVisible(true);
              //					label4.setText(e.getMessage());
              label4.setVisible(true);
              e.printStackTrace();
            }
          }
        }; // scientific name inserting
    submitButton.addSelectionListener(buttonSelectionListener);
    System.out.println(Platform.getInstallLocation().getURL().getPath());
    System.out.println(Platform.getInstanceLocation().getURL().getPath());
    Image image = ImageFactory.loadImage(Display.getCurrent(), ImageFactory.ACTION_SYNC);
    IStatusLineManager manager = this.getEditorSite().getActionBars().getStatusLineManager();
    Action toggleBotton =
        new SyncIDropAction("Sync with iDrop", ImageDescriptor.createFromImage(image), manager);
    if (spec.getIdropSync() == null || spec.getIdropSync() == 0) {
      toggleBotton.setEnabled(true);
    } else toggleBotton.setEnabled(true);
    form.getToolBarManager().add(toggleBotton);
    form.getToolBarManager().update(true);
  }
  private Composite createFrame() {
    Composite frameComp = new Composite(getParent(), SWT.NONE);
    frameComp.setData(WidgetUtil.CUSTOM_VARIANT, "compGray"); // $NON-NLS-1$
    frameComp.setLayout(new FormLayout());
    frameComp.setBackgroundMode(SWT.INHERIT_FORCE);

    Label left = new Label(frameComp, SWT.NONE);
    left.setData(WidgetUtil.CUSTOM_VARIANT, "stackBorder"); // $NON-NLS-1$
    left.setBackgroundImage(borderLeft);
    FormData fdLeft = new FormData();
    left.setLayoutData(fdLeft);
    fdLeft.top = new FormAttachment(0, borderTop.getBounds().height);
    fdLeft.bottom = new FormAttachment(100, -borderBottom.getBounds().height + 1);
    fdLeft.left = new FormAttachment(0);
    fdLeft.width = borderLeft.getBounds().width;
    labelMap.put(LEFT_BORDER, left);

    Label right = new Label(frameComp, SWT.NONE);
    right.setData(WidgetUtil.CUSTOM_VARIANT, "stackBorder"); // $NON-NLS-1$
    right.setBackgroundImage(borderRight);
    FormData fdRight = new FormData();
    right.setLayoutData(fdRight);
    fdRight.top = new FormAttachment(0, borderTop.getBounds().height);
    fdRight.bottom = new FormAttachment(100, -borderBottom.getBounds().height + 1);
    fdRight.right = new FormAttachment(100);
    fdRight.width = borderRight.getBounds().width;
    labelMap.put(RIGHT_BORDER, right);

    Label top = new Label(frameComp, SWT.NONE);
    top.setData(WidgetUtil.CUSTOM_VARIANT, "stackBorder"); // $NON-NLS-1$
    top.setBackgroundImage(borderTop);
    FormData fdTop = new FormData();
    top.setLayoutData(fdTop);
    fdTop.top = new FormAttachment(0);
    fdTop.left = new FormAttachment(left);
    fdTop.right = new FormAttachment(right);
    fdTop.height = borderTop.getBounds().height;
    labelMap.put(TOP_BORDER, top);

    Label bottom = new Label(frameComp, SWT.NONE);
    bottom.setData(WidgetUtil.CUSTOM_VARIANT, "stackBorder"); // $NON-NLS-1$
    bottom.setBackgroundImage(borderBottom);
    FormData fdBottom = new FormData();
    bottom.setLayoutData(fdBottom);
    fdBottom.bottom = new FormAttachment(100);
    fdBottom.left = new FormAttachment(left);
    fdBottom.right = new FormAttachment(right);
    fdBottom.height = borderBottom.getBounds().height;
    labelMap.put(BOTTOM_BORDER, bottom);

    Composite result = new Composite(frameComp, SWT.NONE);
    result.setData(WidgetUtil.CUSTOM_VARIANT, "compGray"); // $NON-NLS-1$
    FormData fdResult = new FormData();
    result.setLayoutData(fdResult);
    fdResult.top = new FormAttachment(top);
    fdResult.left = new FormAttachment(left);
    fdResult.right = new FormAttachment(right);
    fdResult.bottom = new FormAttachment(bottom);

    return result;
  }
  /**
   * Create contents of the dialog.
   *
   * @param parent
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.numColumns = 2;
    gridLayout.verticalSpacing = 5;
    gridLayout.horizontalSpacing = 5;
    gridLayout.marginHeight = 5;
    gridLayout.marginWidth = 5;

    Composite compositeLeftBtn = new Composite(container, SWT.NONE);
    compositeLeftBtn.setLayout(new GridLayout(1, false));

    Button button = new Button(compositeLeftBtn, SWT.NONE);
    button.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    button.setImage(
        ResourceManager.getPluginImage(
            BrowserActivator.ID, "resources/TadpoleOverView.png")); // $NON-NLS-1$

    compositeLogin = new Composite(container, SWT.NONE);
    compositeLogin.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    compositeLogin.setLayout(new GridLayout(3, false));

    lblEmail = new Label(compositeLogin, SWT.NONE);
    lblEmail.setText(Messages.get().LoginDialog_1);

    textEMail = new Text(compositeLogin, SWT.BORDER);
    textEMail.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              if (!"".equals(textPasswd.getText())) okPressed(); // $NON-NLS-1$
              else textPasswd.setFocus();
            }
          }
        });
    textEMail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnCheckButton = new Button(compositeLogin, SWT.CHECK);
    btnCheckButton.setText(Messages.get().LoginDialog_9); // $NON-NLS-1$

    lblPassword = new Label(compositeLogin, SWT.NONE);
    lblPassword.setText(Messages.get().LoginDialog_4);

    textPasswd = new Text(compositeLogin, SWT.BORDER | SWT.PASSWORD);
    textPasswd.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              okPressed();
            }
          }
        });
    textPasswd.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnLogin = new Button(compositeLogin, SWT.NONE);
    btnLogin.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            okPressed();
          }
        });
    btnLogin.setText(Messages.get().LoginDialog_15);

    lblLanguage = new Label(compositeLogin, SWT.NONE);
    lblLanguage.setText(Messages.get().LoginDialog_lblLanguage_text);

    comboLanguage = new Combo(compositeLogin, SWT.READ_ONLY);
    comboLanguage.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            changeUILocale();
          }
        });
    comboLanguage.add(Locale.ENGLISH.getDisplayLanguage());
    comboLanguage.add(Locale.KOREAN.getDisplayLanguage());

    comboLanguage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    comboLanguage.setData(Locale.ENGLISH.getDisplayLanguage(), Locale.ENGLISH);
    comboLanguage.setData(Locale.KOREAN.getDisplayLanguage(), Locale.KOREAN);

    //		comboLanguage.select(0);

    // ---------------------  Registered database
    // ----------------------------------------------------
    //		try {
    //			listDBMart = getDBMart();
    //			if(!listDBMart.isEmpty()) {
    //				Group grpSponser = new Group(container, SWT.NONE);
    //				GridLayout gl_grpSponser = new GridLayout(1, false);
    //				gl_grpSponser.verticalSpacing = 0;
    //				gl_grpSponser.horizontalSpacing = 0;
    //				gl_grpSponser.marginHeight = 0;
    //				gl_grpSponser.marginWidth = 0;
    //				grpSponser.setLayout(gl_grpSponser);
    //				grpSponser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    //				grpSponser.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
    //				grpSponser.setText(Messages.get().LoginDialog_grpSponser_text);
    //
    //				makeBarChart(grpSponser, listDBMart);
    //			}
    //		} catch(Exception e) {
    //			logger.error("get initdata", e); //$NON-NLS-1$
    //		}

    compositeLetter = new Group(container, SWT.NONE);
    compositeLetter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    GridLayout gl_compositeLetter = new GridLayout(2, false);
    compositeLetter.setLayout(gl_compositeLetter);
    compositeLetter.setText(Messages.get().LoginDialog_grpShowInformation_text);

    lblSite = new Label(compositeLetter, SWT.NONE);
    lblSite.setText(Messages.get().LoginDialog_lblSite_text);

    Label lblNewLabel = new Label(compositeLetter, SWT.NONE);
    lblNewLabel.setText(
        "<a href='"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "' target='_blank'>"
            + Messages.get().LoginDialog_lblNewLabel_text_1
            + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    lblNewLabel.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblUserGuide = new Label(compositeLetter, SWT.NONE);
    lblUserGuide.setText(Messages.get().LoginDialog_lblUserGuide_text);

    Composite compositeUserGide = new Composite(compositeLetter, SWT.NONE);
    compositeUserGide.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_compositeUserGide = new GridLayout(3, false);
    gl_compositeUserGide.verticalSpacing = 1;
    gl_compositeUserGide.horizontalSpacing = 1;
    gl_compositeUserGide.marginHeight = 1;
    gl_compositeUserGide.marginWidth = 1;
    compositeUserGide.setLayout(gl_compositeUserGide);

    Label lblUserKor = new Label(compositeUserGide, SWT.NONE);
    lblUserKor.setText(
        "<a href='https://tadpoledbhub.atlassian.net/wiki/pages/viewpage.action?pageId=20578325' target='_blank'>(Korean)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserKor.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserEng = new Label(compositeUserGide, SWT.NONE);
    lblUserEng.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-Eng' target='_blank'>(English)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserEng.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblUserIndonesia = new Label(compositeUserGide, SWT.NONE);
    lblUserIndonesia.setText(
        "<a href='https://github.com/hangum/TadpoleForDBTools/wiki/RDB-User-Guide-ID' target='_blank'>(Indonesia)</a>"); //$NON-NLS-1$ //$NON-NLS-2$
    lblUserIndonesia.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    //		Label lblIssues = new Label(compositeLetter, SWT.NONE);
    //		lblIssues.setText(Messages.get().LoginDialog_lblIssues_text);
    //
    //		Label lblIssue = new Label(compositeLetter, SWT.NONE);
    //		lblIssue.setText("<a href='https://github.com/hangum/TadpoleForDBTools/issues'
    // target='_blank'>https://github.com/hangum/TadpoleForDBTools/issues</a>"); //$NON-NLS-1$
    // //$NON-NLS-2$
    //		lblIssue.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    lblContact = new Label(compositeLetter, SWT.NONE);
    lblContact.setText(Messages.get().LoginDialog_lblContact_text_1);

    Label lblContactUrl = new Label(compositeLetter, SWT.NONE);
    try {
      UserDAO systemUserDao = TadpoleApplicationContextManager.getSystemAdmin();
      lblContactUrl.setText(
          String.format(
              "<a href='mailto:%s'>%s(%s)</a>",
              systemUserDao.getEmail(),
              systemUserDao.getName(),
              systemUserDao.getEmail())); // $NON-NLS-1$ //$NON-NLS-2$
    } catch (Exception e1) {
      lblContactUrl.setText(
          "<a href='mailto:[email protected]'>Admin([email protected])</a>"); //$NON-NLS-1$
      // //$NON-NLS-2$
    }
    lblContactUrl.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Label lblDonation = new Label(compositeLetter, SWT.NONE);
    //		lblDonation.setText(Messages.get().LoginDialog_lblDonation_text);

    Browser browser = new Browser(compositeLetter, SWT.NONE);
    browser.setLayoutData(new GridData(SWT.FILL, SWT.RIGHT, false, false, 1, 1));
    browser.setText(strPaypal);

    AnalyticCaller.track("login"); // $NON-NLS-1$

    initUI();

    return compositeLogin;
  }
  public Composite configSectionCreate(final Composite parent) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");

    GridData gridData;
    GridLayout layout;

    final Composite cBR = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cBR.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    cBR.setLayout(layout);

    Label info_label = new Label(cBR, SWT.WRAP);
    Messages.setLanguageText(info_label, "ConfigView.section.br.overview");
    gridData = Utils.getWrappableLabelGridData(1, GridData.HORIZONTAL_ALIGN_FILL);

    info_label.setLayoutData(gridData);

    // wiki link

    final Label linkLabel = new Label(cBR, SWT.NULL);
    linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here"));
    linkLabel.setData("http://wiki.vuze.com/w/Backup_And_Restore");
    linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    linkLabel.setForeground(Colors.blue);
    gridData = Utils.getWrappableLabelGridData(1, 0);
    linkLabel.setLayoutData(gridData);
    linkLabel.addMouseListener(
        new MouseAdapter() {
          public void mouseDoubleClick(MouseEvent arg0) {
            Utils.launch((String) ((Label) arg0.widget).getData());
          }

          public void mouseDown(MouseEvent arg0) {
            Utils.launch((String) ((Label) arg0.widget).getData());
          }
        });
    ClipboardCopy.addCopyToClipMenu(linkLabel);

    final BackupManager backup_manager =
        BackupManagerFactory.getManager(AzureusCoreFactory.getSingleton());

    // backup

    Group gBackup = new Group(cBR, SWT.NULL);
    Messages.setLanguageText(gBackup, "br.backup");
    layout = new GridLayout(2, false);
    gBackup.setLayout(layout);
    gBackup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // info

    Label last_backup_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(last_backup_label, "br.backup.last.time");

    final Label last_backup_time = new Label(gBackup, SWT.NULL);

    Label last_backup_error_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(last_backup_error_label, "br.backup.last.error");

    final Label last_backup_error = new Label(gBackup, SWT.NULL);

    final Runnable stats_updater =
        new Runnable() {
          public void run() {
            long backup_time = backup_manager.getLastBackupTime();

            last_backup_time.setText(backup_time == 0 ? "" : String.valueOf(new Date(backup_time)));

            last_backup_error.setText(backup_manager.getLastBackupError());
          };
        };

    stats_updater.run();

    // manual button

    Label backup_manual_label = new Label(gBackup, SWT.NULL);
    Messages.setLanguageText(backup_manual_label, "br.backup.manual.info");

    Button backup_button = new Button(gBackup, SWT.PUSH);
    Messages.setLanguageText(backup_button, "br.backup");

    backup_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);

            if (def_dir != null) {
              dialog.setFilterPath(def_dir);
            }

            dialog.setMessage(MessageText.getString("br.backup.folder.info"));
            dialog.setText(MessageText.getString("br.backup.folder.title"));

            String path = dialog.open();

            if (path != null) {

              COConfigurationManager.setParameter("br.backup.folder.default", path);

              runBackup(backup_manager, path, stats_updater);
            }
          }
        });

    final BooleanParameter auto_backup_enable =
        new BooleanParameter(gBackup, "br.backup.auto.enable", "br.backup.auto.enable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    auto_backup_enable.setLayoutData(gridData);

    Composite gDefaultDir = new Composite(gBackup, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 2;
    gDefaultDir.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gDefaultDir.setLayoutData(gridData);

    Label lblDefaultDir = new Label(gDefaultDir, SWT.NONE);
    Messages.setLanguageText(lblDefaultDir, "ConfigView.section.file.defaultdir.ask");
    lblDefaultDir.setLayoutData(new GridData());

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final StringParameter pathParameter =
        new StringParameter(gDefaultDir, "br.backup.auto.dir", "");
    pathParameter.setLayoutData(gridData);

    if (pathParameter.getValue().length() == 0) {
      String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

      pathParameter.setValue(def_dir);
    }

    Button browse = new Button(gDefaultDir, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));

    browse.addListener(
        SWT.Selection,
        new Listener() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
           */
          public void handleEvent(Event event) {
            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
            dialog.setFilterPath(pathParameter.getValue());
            dialog.setMessage(MessageText.getString("br.backup.auto.dir.select"));
            dialog.setText(MessageText.getString("ConfigView.section.file.defaultdir.ask"));
            String path = dialog.open();
            if (path != null) {
              pathParameter.setValue(path);

              COConfigurationManager.setParameter("br.backup.folder.default", path);
            }
          }
        });

    Label lbl_backup_days = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(lbl_backup_days, "br.backup.auto.everydays");

    IntParameter backup_everydays =
        new IntParameter(gDefaultDir, "br.backup.auto.everydays", 1, Integer.MAX_VALUE);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    backup_everydays.setLayoutData(gridData);

    Label lbl_backup_retain = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(lbl_backup_retain, "br.backup.auto.retain");

    IntParameter backup_retain =
        new IntParameter(gDefaultDir, "br.backup.auto.retain", 1, Integer.MAX_VALUE);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    backup_retain.setLayoutData(gridData);

    BooleanParameter chkNotify =
        new BooleanParameter(gDefaultDir, "br.backup.notify", "br.backup.notify");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    chkNotify.setLayoutData(gridData);

    Label backup_auto_label = new Label(gDefaultDir, SWT.NULL);
    Messages.setLanguageText(backup_auto_label, "br.backup.auto.now");

    Button backup_auto_button = new Button(gDefaultDir, SWT.PUSH);
    Messages.setLanguageText(backup_auto_button, "br.test");

    backup_auto_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            runBackup(backup_manager, null, stats_updater);
          }
        });

    auto_backup_enable.setAdditionalActionPerformer(
        new ChangeSelectionActionPerformer(gDefaultDir));

    // restore

    Group gRestore = new Group(cBR, SWT.NULL);
    Messages.setLanguageText(gRestore, "br.restore");
    layout = new GridLayout(2, false);
    gRestore.setLayout(layout);
    gRestore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label restore_label = new Label(gRestore, SWT.NULL);
    Messages.setLanguageText(restore_label, "br.restore.info");

    Button restore_button = new Button(gRestore, SWT.PUSH);
    Messages.setLanguageText(restore_button, "br.restore");

    restore_button.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            String def_dir = COConfigurationManager.getStringParameter("br.backup.folder.default");

            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);

            if (def_dir != null) {
              dialog.setFilterPath(def_dir);
            }

            dialog.setMessage(MessageText.getString("br.restore.folder.info"));

            dialog.setText(MessageText.getString("br.restore.folder.title"));

            final String path = dialog.open();

            if (path != null) {

              MessageBoxShell mb =
                  new MessageBoxShell(
                      SWT.ICON_WARNING | SWT.OK | SWT.CANCEL,
                      MessageText.getString("br.restore.warning.title"),
                      MessageText.getString("br.restore.warning.info"));

              mb.setDefaultButtonUsingStyle(SWT.CANCEL);
              mb.setParent(parent.getShell());

              mb.open(
                  new UserPrompterResultListener() {
                    public void prompterClosed(int returnVal) {
                      if (returnVal != SWT.OK) {
                        return;
                      }

                      final TextViewerWindow viewer =
                          new TextViewerWindow(
                              MessageText.getString("br.backup.progress"), null, "", true, true);

                      viewer.setEditable(false);

                      viewer.setOKEnabled(false);

                      backup_manager.restore(
                          new File(path),
                          new BackupManager.BackupListener() {
                            public boolean reportProgress(String str) {
                              return (append(str, false));
                            }

                            public void reportComplete() {
                              append("Restore Complete!", true);

                              Utils.execSWTThread(
                                  new AERunnable() {
                                    public void runSupport() {
                                      MessageBoxShell mb =
                                          new MessageBoxShell(
                                              SWT.ICON_INFORMATION | SWT.OK,
                                              MessageText.getString(
                                                  "ConfigView.section.security.restart.title"),
                                              MessageText.getString(
                                                  "ConfigView.section.security.restart.msg"));
                                      mb.setParent(parent.getShell());
                                      mb.open(
                                          new UserPrompterResultListener() {
                                            public void prompterClosed(int returnVal) {
                                              UIFunctionsSWT uiFunctions =
                                                  UIFunctionsManagerSWT.getUIFunctionsSWT();

                                              if (uiFunctions != null) {

                                                uiFunctions.dispose(true, false);
                                              }
                                            }
                                          });
                                    }
                                  });
                            }

                            public void reportError(Throwable error) {
                              append(
                                  "Restore Failed: " + Debug.getNestedExceptionMessage(error),
                                  true);
                            }

                            private boolean append(final String str, final boolean complete) {
                              if (viewer.isDisposed()) {

                                return (false);
                              }

                              Utils.execSWTThread(
                                  new AERunnable() {
                                    public void runSupport() {
                                      if (str.endsWith("...")) {

                                        viewer.append(str);

                                      } else {

                                        viewer.append(str + "\r\n");
                                      }

                                      if (complete) {

                                        viewer.setOKEnabled(true);
                                      }
                                    }
                                  });

                              return (true);
                            }
                          });

                      viewer.goModal();
                    }
                  });
            }
          }
        });

    return (cBR);
  }