Example #1
0
 /** Create the wizard. */
 public ExportPage1() {
   super("ExportPage1");
   setImageDescriptor(
       ResourceManager.getPluginImageDescriptor(
           "kr.re.kisti.amga.editor", "icons/wizard/export_wiz.png"));
   setTitle("Select Objects");
   setDescription("Select the data objects that you wish to export.");
 }
/**
 * Object explorer을 표시하기 위한 기본 상수를 정의합니다.
 *
 * @author hangum
 */
public class ObjectExploreDefine {

  public static final Image IMAGE_PRIMARY_KEY =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID,
          "resources/icons/objectExplorer/primary_key_column.png"); //$NON-NLS-1$
  public static final Image IMAGE_FOREIGN_KEY =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID,
          "resources/icons/objectExplorer/foreign_key_column.png"); //$NON-NLS-1$
  public static final Image IMAGE_MULTI_KEY =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID,
          "resources/icons/objectExplorer/multi_key_column.png"); //$NON-NLS-1$
  public static final Image IMAGE_COLUMN =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID, "resources/icons/objectExplorer/column.png"); // $NON-NLS-1$
}
  public BugIssueAction(IWorkbenchWindow window) {
    super(Messages.BugIssueAction_0);
    setId(this.getClass().getName());
    setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            BrowserActivator.ID, "resources/icons/bugAndIssue.png"));
    setToolTipText("Github Issue");

    this.window = window;
  }
class GenerateLabelProvider extends LabelProvider implements ITableLabelProvider {

  private static final Image CHECKED =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID, "resources/icons/checked.png"); // $NON-NLS-1$;
  private static final Image UNCHECKED =
      ResourceManager.getPluginImage(
          Activator.PLUGIN_ID, "resources/icons/unchecked.png"); // $NON-NLS-1$;

  @Override
  public Image getColumnImage(Object element, int columnIndex) {
    // TODO Auto-generated method stub
    if (columnIndex == 0) {
      ExtendTableColumnDAO columnDao = (ExtendTableColumnDAO) element;
      if (columnDao.isCheck()) {
        return CHECKED;
      } else {
        return UNCHECKED;
      }
    }
    return null;
  }

  @Override
  public String getColumnText(Object element, int columnIndex) {
    ExtendTableColumnDAO dao = (ExtendTableColumnDAO) element;

    switch (columnIndex) {
      case 0:
        return dao.getColumnNamebyTableAlias();
      case 1:
        return dao.getType();
      case 2:
        return dao.getKey();
      case 3:
        return dao.getSysName();
      case 4:
        return dao.getComment();
    }

    return "*** not set column value ***"; //$NON-NLS-1$
  }
}
Example #5
0
  public TrackerAction(JZoomerWindow w) {

    super(AS_RADIO_BUTTON);
    window = w;

    setChecked(false);
    setText(getMessage("action.tracker.text"));
    setToolTipText(getMessage("action.tracker.tooltip"));
    setImageDescriptor(
        ResourceManager.getImageDescriptor(TrackerAction.class, "/icons/measure.png"));
  }
  @Override
  public Image getImage(Object element) {

    if (element instanceof ManagerListDTO) {
      return getGroupImage();

    } else if (element instanceof UserDBDAO) {
      return DBIconsUtils.getDBConnectionImage((UserDBDAO) element);

    } else if (element instanceof UserDBResourceDAO) {
      UserDBResourceDAO dao = (UserDBResourceDAO) element;

      Image baseImage =
          ResourceManager.getPluginImage(
              Activator.PLUGIN_ID, "resources/icons/sql-query.png"); // $NON-NLS-1$
      if (PublicTadpoleDefine.RESOURCE_TYPE.ERD.toString().equals(dao.getResource_types())) {
        baseImage =
            ResourceManager.getPluginImage(
                Activator.PLUGIN_ID, "resources/icons/erd.png"); // $NON-NLS-1$
      }

      if (PublicTadpoleDefine.SHARED_TYPE.PRIVATE.name().equals(dao.getShared_type())) {
        try {
          baseImage =
              DBIconsUtils.getDecorateImage(
                  baseImage, "resources/icons/lock_0.28.png", ResourceManager.TOP_RIGHT);
        } catch (Exception e) {
          logger.error("image decorate error", e);
        }
      }

      return baseImage;
    }

    return super.getImage(element);
  }
 /**
  * get group image
  *
  * @return
  */
 public static Image getGroupImage() {
   return ResourceManager.getPluginImage(
       Activator.PLUGIN_ID, "resources/icons/server_database.png"); // $NON-NLS-1$
 }
  @Override
  public void createPartControl(Composite parent) {
    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 1;
    gl_parent.marginHeight = 1;
    gl_parent.horizontalSpacing = 1;
    gl_parent.marginWidth = 1;
    parent.setLayout(gl_parent);

    Composite compositeToolbar = new Composite(parent, SWT.NONE);
    compositeToolbar.setLayout(new GridLayout(1, false));
    compositeToolbar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    ToolBar toolBar = new ToolBar(compositeToolbar, SWT.FLAT | SWT.RIGHT);
    GridData gd_toolBar = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_toolBar.widthHint = 267;
    toolBar.setLayoutData(gd_toolBar);

    ToolItem tltmRefresh = new ToolItem(toolBar, SWT.NONE);
    tltmRefresh.setToolTipText("Refresh");
    tltmRefresh.setImage(
        ResourceManager.getPluginImage(
            Activator.PLUGIN_ID, "resources/icons/refresh.png")); // $NON-NLS-1$
    tltmRefresh.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            comboViewer.getCombo().clearSelection();
            textTitle.setText("");
            textDescription.setText("");
            textQuery.setText("");

            initUI();
            // reLoadResource();
          }
        });

    SashForm sashForm = new SashForm(parent, SWT.VERTICAL);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    columnFilter = new DefaultTableColumnFilter();

    SashForm sashForm_1 = new SashForm(sashForm, SWT.NONE);

    treeViewer = new TreeViewer(sashForm_1, SWT.BORDER);
    Tree treeDatabase = treeViewer.getTree();
    treeDatabase.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);

    Composite composite_1 = new Composite(sashForm_1, SWT.NONE);
    composite_1.setLayout(new GridLayout(1, false));

    Composite composite_2 = new Composite(composite_1, SWT.NONE);
    composite_2.setLayout(new GridLayout(2, false));
    GridData gd_composite_2 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_composite_2.heightHint = 28;
    composite_2.setLayoutData(gd_composite_2);

    Label lblFilter = new Label(composite_2, SWT.NONE);
    lblFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblFilter.setText("Filter");

    textFilter = new Text(composite_2, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SEARCH | SWT.CANCEL);
    textFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textFilter.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
              columnFilter.setSearchString(textFilter.getText());
              tableViewer.refresh();
            }
          }
        });

    tableViewer = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
    tableResource = tableViewer.getTable();
    tableResource.setHeaderVisible(true);
    tableResource.setLinesVisible(true);
    tableResource.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    sashForm_1.setWeights(new int[] {230, 359});
    tableViewer.addFilter(columnFilter);

    Group grpQuery = new Group(sashForm, SWT.NONE);
    grpQuery.setText("Query");
    GridLayout gl_grpQuery = new GridLayout(1, false);
    gl_grpQuery.verticalSpacing = 1;
    gl_grpQuery.horizontalSpacing = 1;
    gl_grpQuery.marginHeight = 1;
    gl_grpQuery.marginWidth = 1;
    grpQuery.setLayout(gl_grpQuery);

    Composite composite = new Composite(grpQuery, SWT.NONE);
    GridLayout gl_composite = new GridLayout(6, false);
    gl_composite.marginHeight = 2;
    gl_composite.marginWidth = 2;
    gl_composite.verticalSpacing = 2;
    composite.setLayout(gl_composite);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Label lblNewLabel = new Label(composite, SWT.NONE);
    lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblNewLabel.setText("Share");

    comboViewer = new ComboViewer(composite, SWT.NONE);
    comboShare = comboViewer.getCombo();
    comboShare.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboShare.setItems(new String[] {"PUBLIC", "PRIVATE"});

    Label lblNewLabel_1 = new Label(composite, SWT.NONE);
    lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblNewLabel_1.setText("Title");

    textTitle = new Text(composite, SWT.BORDER);
    textTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnSave = new Button(composite, SWT.NONE);
    btnSave.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO : SAVE...공유 구분및 제목 변경.
            if (tableViewer.getSelection().isEmpty()) return;

            StructuredSelection ss = (StructuredSelection) tableViewer.getSelection();
            ResourceManagerDAO dao = (ResourceManagerDAO) ss.getFirstElement();

            try {
              String share_type = comboShare.getText();
              share_type = (share_type == null || "".equals(share_type)) ? "PUBLIC" : share_type;
              dao.setShared_type(share_type);
              dao.setRes_title(textTitle.getText());
              dao.setDescription(textDescription.getText());
              TadpoleSystem_UserDBResource.updateResourceHeader(dao);
              // reLoadResource();
              addUserResouceData();
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnSave.setText("Save");

    Button btnDelete = new Button(composite, SWT.NONE);
    btnDelete.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO : DELYN SET TO 'YES'
            if (tableViewer.getSelection().isEmpty()) return;

            StructuredSelection ss = (StructuredSelection) tableViewer.getSelection();
            ResourceManagerDAO dao = (ResourceManagerDAO) ss.getFirstElement();

            // 기존에 사용하던 좌측 트리(디비목록)에 리소스를 표시하지 않을 경우에는 dao를 통일해서 하나만 쓰게 수정이
            // 필요함.
            UserDBResourceDAO userDBResource = new UserDBResourceDAO();
            userDBResource.setResource_seq((int) dao.getResource_seq());
            userDBResource.setName(dao.getRes_title());
            userDBResource.setParent(userDB);

            try {
              TadpoleSystem_UserDBResource.delete(userDBResource);
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    btnDelete.setText("Delete");

    Label lblDescription = new Label(composite, SWT.NONE);
    lblDescription.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblDescription.setText("Description");

    textDescription =
        new Text(composite, SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.CANCEL | SWT.MULTI);
    GridData gd_textDescription = new GridData(SWT.FILL, SWT.CENTER, true, false, 5, 1);
    gd_textDescription.heightHint = 44;
    textDescription.setLayoutData(gd_textDescription);

    textQuery =
        new Text(
            composite,
            SWT.BORDER
                | SWT.READ_ONLY
                | SWT.WRAP
                | SWT.H_SCROLL
                | SWT.V_SCROLL
                | SWT.CANCEL
                | SWT.MULTI);
    textQuery.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 6, 1));
    sashForm.setWeights(new int[] {179, 242});

    createTableColumn();

    initUI();
  }
Example #9
0
 private Image getCachedImage(String name) {
   return ResourceManager.getPluginImage("org.gastro.rcp.department", "images/" + name + ".png");
 }
Example #10
0
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setImage(
        ResourceManager.getPluginImage("kr.re.kisti.amga.editor", "icons/elcl16/save.png"));
    shell.setLocation(getParent().getLocation().x + 50, getParent().getLocation().y + 50);
    shell.setSize(400, 245);
    shell.setText("File(xls, txt) Save As...");
    shell.setLayout(new GridLayout(1, false));

    Group grpOutputFormat = new Group(shell, SWT.NONE);
    grpOutputFormat.setText("Output Format");
    grpOutputFormat.setLayout(new GridLayout(3, false));
    GridData gd_grpOutputFormat = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_grpOutputFormat.heightHint = 136;
    grpOutputFormat.setLayoutData(gd_grpOutputFormat);

    combo_type = new Combo(grpOutputFormat, SWT.READ_ONLY);
    combo_type.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            switch (combo_type.getSelectionIndex()) {
              case 0:
                combo_string.setEnabled(false);
                break;
              case 1:
                combo_string.setEnabled(true);
                break;
              default:
                break;
            }
          }
        });
    combo_type.setItems(new String[] {"Excel File", "Delimited Text"});
    GridData gd_combo_type = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    gd_combo_type.widthHint = 253;
    combo_type.setLayoutData(gd_combo_type);
    combo_type.select(0);

    Label lblStringQuoteCharacher = new Label(grpOutputFormat, SWT.NONE);
    lblStringQuoteCharacher.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblStringQuoteCharacher.setText("String quote characher : ");

    combo_string = new Combo(grpOutputFormat, SWT.READ_ONLY);
    combo_string.setEnabled(false);
    combo_string.setItems(new String[] {"Tab", "Space", "Comma"});
    combo_string.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    combo_string.select(0);

    Label lblFileName = new Label(grpOutputFormat, SWT.NONE);
    lblFileName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblFileName.setText("File Name : ");

    text_file = new Text(grpOutputFormat, SWT.BORDER);
    text_file.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            ValuesCheck();
          }
        });
    text_file.addVerifyListener(
        new VerifyListener() {
          public void verifyText(VerifyEvent e) {
            e.doit = e.text.matches("[\\w]*");
          }
        });
    text_file.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Label lblSavePath = new Label(grpOutputFormat, SWT.NONE);
    lblSavePath.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblSavePath.setText("Save Path : ");

    text_dir = new Text(grpOutputFormat, SWT.BORDER | SWT.READ_ONLY);
    text_dir.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            ValuesCheck();
          }
        });
    text_dir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button button_browser = new Button(grpOutputFormat, SWT.NONE);
    button_browser.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            //				DirectoryDialog directoryDialog = new DirectoryDialog(shell, SWT.SAVE);
            //				if(text_dir.getText().trim().length() != 0){
            //					directoryDialog.setFilterPath(text_dir.getText());
            //				}
            //
            //				String sPath = directoryDialog.open();
            //				if(sPath != null){
            //					text_dir.setText(sPath);
            //				}
          }
        });
    button_browser.setText("...");
    grpOutputFormat.setTabList(new Control[] {combo_type, combo_string, text_file, button_browser});

    group_btn = new Group(shell, SWT.NONE);
    group_btn.setLayout(null);
    GridData gd_group_btn = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_group_btn.heightHint = 63;
    group_btn.setLayoutData(gd_group_btn);

    Button btn_cancel = new Button(group_btn, SWT.NONE);
    btn_cancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            shell.close();
          }
        });
    btn_cancel.setBounds(299, 18, 75, 25);
    btn_cancel.setText("&Cancel");

    btn_ok = new Button(group_btn, SWT.NONE);
    btn_ok.setEnabled(false);
    btn_ok.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {

            try {
              int nCount = 0;
              String sFullPath =
                  text_dir.getText() + System.getProperty("file.separator") + text_file.getText();
              int nTotal = 0;

              switch (combo_type.getSelectionIndex()) {
                case 0:
                  CollectionView navigationView =
                      (CollectionView)
                          PlatformUI.getWorkbench()
                              .getActiveWorkbenchWindow()
                              .getActivePage()
                              .findView(CollectionView.ID);
                  String sCollection = navigationView.SelectTree();

                  // Excel
                  WritableWorkbook myWorkbook =
                      Workbook.createWorkbook(new File(sFullPath + ".xls"));
                  WritableSheet mySheet =
                      myWorkbook.createSheet(sCollection.replaceAll("/", "_"), 0);

                  String sImsi = "";
                  for (int i = 0; i < nColumns; i++) {
                    sImsi = oTotal.get(i);

                    WritableCellFormat ColumnFormat = new WritableCellFormat();
                    ColumnFormat.setAlignment(Alignment.CENTRE);
                    ColumnFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
                    ColumnFormat.setBackground(Colour.GRAY_25);
                    mySheet.setColumnView(i, (sImsi.trim().length() * 2));
                    jxl.write.Label oColumnLabel = new jxl.write.Label(i, 0, sImsi, ColumnFormat);
                    mySheet.addCell(oColumnLabel);
                  }
                  for (int i = 0; i < nColumns; i++) {
                    oTotal.remove(0);
                  }

                  nTotal = (oTotal.size() / nColumns);
                  nCount = 0;
                  for (int nRow = 1; nRow <= nTotal; nRow++) {
                    for (int nCol = 0; nCol < nColumns; nCol++) {
                      jxl.write.Label numberLabels =
                          new jxl.write.Label(nCol, nRow, oTotal.get(nCount++));
                      mySheet.addCell(numberLabels);
                    }
                  }
                  myWorkbook.write();
                  myWorkbook.close();

                  break;
                case 1:
                  // Txt
                  ArrayList<String> oTxt = new ArrayList<String>();
                  int nString = combo_string.getSelectionIndex();
                  String sDelimited = "";

                  switch (nString) {
                    case 0:
                      sDelimited = "\t";
                      break;
                    case 1:
                      sDelimited = " ";
                      break;
                    case 2:
                      sDelimited = ",";
                      break;
                    default:
                      break;
                  }

                  String sContent = "";
                  nCount = 0;
                  nTotal = (oTotal.size() / nColumns);
                  for (int i = 0; i < nTotal; i++) {
                    for (int j = 0; j < nColumns; j++) {
                      sContent = sContent + oTotal.get(nCount++) + sDelimited;
                    }
                    oTxt.add(sContent);
                    sContent = "";
                  }

                  BufferedWriter out = new BufferedWriter(new FileWriter(sFullPath + ".txt"));
                  for (int i = 0; i < oTxt.size(); i++) {
                    out.write(oTxt.get(i));
                    out.newLine();
                  }
                  out.close();

                  break;
                default:
                  break;
              }

              MessageDialog.openInformation(
                  shell,
                  "AMGA_Mangaer",
                  "Success : Files have been saved["
                      + sFullPath
                      + (combo_type.getSelectionIndex() == 0 ? ".xls" : ".txt")
                      + "]");
              shell.close();
            } catch (Exception e1) {
              MessageDialog.openError(shell, "AMGA_Mangaer", e1.getLocalizedMessage());
            }
          }
        });
    btn_ok.setBounds(218, 18, 75, 25);
    btn_ok.setText("&Ok");

    Label lblTotalDataRow = new Label(group_btn, SWT.NONE);
    lblTotalDataRow.setBounds(10, 23, 202, 15);
    lblTotalDataRow.setText("Total data row : " + ((oTotal.size() / nColumns) - 1));
    group_btn.setTabList(new Control[] {btn_ok, btn_cancel});
    shell.setTabList(new Control[] {grpOutputFormat, group_btn});
  }
  protected void makeActions(final IWorkbenchWindow window) {
    // Creates the actions and registers them.
    // Registering is needed to ensure that key bindings work.
    // The corresponding commands keybindings are defined in the plugin.xml
    // file.
    // Registering also provides automatic disposal of the actions when
    // the window is closed.

    this.window = window;

    exitAction = ActionFactory.QUIT.create(window);
    register(exitAction);
    {
      closeAction = ActionFactory.CLOSE.create(window);
      register(closeAction);
    }
    {
      closeAllAction = ActionFactory.CLOSE_ALL.create(window);
      register(closeAllAction);
    }
    {
      saveAction = ActionFactory.SAVE.create(window);
      register(saveAction);
    }
    {
      saveAsAction = ActionFactory.SAVE_AS.create(window);
      register(saveAsAction);
    }
    {
      saveAllAction = ActionFactory.SAVE_ALL.create(window);
      register(saveAllAction);
    }
    sizeAction1 =
        new Action("176x208") {
          public void run() {
            Settings.setScreenSize(176, 208);
          }
        };

    sizeAction2 =
        new Action("240x320") {
          public void run() {
            Settings.setScreenSize(240, 320);
          }
        };

    sizeAction3 =
        new Action("320x240") {
          public void run() {
            Settings.setScreenSize(320, 240);
          }
        };

    sizeAction4 =
        new Action("480x320") {
          public void run() {
            Settings.setScreenSize(480, 320);
          }
        };

    sizeAction5 =
        new Action("640x360") {
          public void run() {
            Settings.setScreenSize(640, 360);
          }
        };

    sizeAction6 =
        new Action("960x640") {
          public void run() {
            Settings.setScreenSize(960, 640);
          }
        };

    undoAction =
        new Action("&Undo") {
          public void run() {
            this.firePropertyChange("chosen", this, this);
          }
        };
    undoAction.setEnabled(false);
    undoAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/undo_edit(1).gif"));
    undoAction.setDisabledImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/undo_edit.gif"));
    undoAction.setAccelerator(SWT.CTRL | 'z');

    redoAction =
        new Action("&Redo") {
          public void run() {
            this.firePropertyChange("chosen", this, this);
          }
        };
    redoAction.setEnabled(false);
    redoAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/redo_edit(1).gif"));
    redoAction.setDisabledImageDescriptor(
        ResourceManager.getPluginImageDescriptor(
            WorkshopPlugin.getDefault(), "icons/redo_edit.gif"));
    redoAction.setAccelerator(SWT.CTRL | 'y');
    {
      newWizardDropDownAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
      register(newWizardDropDownAction);
    }

    chooseImageEditorAction =
        new Action("工具设置...") {
          public void run() {
            onChooseImageEditor();
          }
        };

    viewDirectoryAction =
        new Action("Resource Explorer") {
          public void run() {
            try {
              window.getActivePage().showView(DirectoryView.ID);
            } catch (Exception e) {
            }
          }
        };
    viewDirectoryAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/items.gif"));

    viewTileLibraryAction =
        new Action("Tile Library") {
          public void run() {
            try {
              window.getActivePage().showView(TileLibView.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    viewTileLibraryAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/tilelib.gif"));

    viewTileViewAction =
        new Action("Tile Viewer") {
          public void run() {
            try {
              window.getActivePage().showView(TileView.ID);
              //			window.getActivePage().showView("org.eclipse.swt.sleak.views.SleakView");
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    viewTileViewAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/tiles.gif"));

    optimizeColorsAction =
        new Action("Optimize PNG Colors...") {
          public void run() {
            new PNGColorOptimizer().run(window.getShell());
          }
        };

    openLogDirAction =
        new Action("打开日志目录") {
          public void run() {
            String dir = Settings.logDir;
            String cmd = "explorer.exe \"" + dir + "\"";
            try {
              Runtime.getRuntime().exec(cmd);
            } catch (Exception e) {
            }
          }
        };

    projectViewAction =
        new Action("ProjectView") {
          public void run() {
            try {
              window.getActivePage().showView(ProjectView.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    projectViewAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/project.gif"));

    frameDelayAction5 =
        new Action("20毫秒") {
          public void run() {
            Settings.animateFrameDelay = 20;
          }
        };

    frameDelayAction6 =
        new Action("10毫秒") {
          public void run() {
            Settings.animateFrameDelay = 10;
          }
        };

    frameDelayAction1 =
        new Action("40毫秒") {
          public void run() {
            Settings.animateFrameDelay = 40;
          }
        };

    frameDelayAction2 =
        new Action("60毫秒") {
          public void run() {
            Settings.animateFrameDelay = 60;
          }
        };

    frameDelayAction3 =
        new Action("80毫秒") {
          public void run() {
            Settings.animateFrameDelay = 80;
          }
        };

    frameDelayAction4 =
        new Action("100毫秒") {
          public void run() {
            Settings.animateFrameDelay = 100;
          }
        };

    limitPIPAction =
        new Action("限制PIP图片大小", IAction.AS_CHECK_BOX) {
          public void run() {
            PipImage.limitSize = !PipImage.limitSize;
          }
        };
    limitPIPAction.setChecked(PipImage.limitSize);

    allowMultiCompAction =
        new Action("允许一个PIP包含多个压缩纹理", IAction.AS_CHECK_BOX) {
          public void run() {
            PipImage.allowMultiCompressTexturesInOneFile =
                !PipImage.allowMultiCompressTexturesInOneFile;
          }
        };
    allowMultiCompAction.setChecked(PipImage.allowMultiCompressTexturesInOneFile);

    actionFontTool =
        new Action("字体工具...") {
          public void run() {
            FontViewDialog dlg = new FontViewDialog(window.getShell());
            dlg.open();
          }
        };

    openglAction =
        new Action("OpenGL模式", IAction.AS_CHECK_BOX) {
          public void run() {
            GLUtils.glEnabled = !GLUtils.glEnabled;
          }
        };
    openglAction.setImageDescriptor(
        ResourceManager.getPluginImageDescriptor(WorkshopPlugin.getDefault(), "icons/gl.gif"));
    openglAction.setToolTipText("开启/关闭OpenGL模式");
    openglAction.setChecked(GLUtils.glEnabled);

    optimizeImageAction =
        new Action("图片优化工具...") {
          public void run() {
            try {
              IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path("."));
              FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
              window.getActivePage().openEditor(input, ImageOptimizeEditor.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };

    comparePipAction =
        new Action("比较PIP图片...") {
          public void run() {
            try {
              IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path("."));
              FileStoreEditorInput input = new FileStoreEditorInput(fileStore);
              window.getActivePage().openEditor(input, ImageCompareEditor.ID);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };

    batchConvertAction =
        new Action("批量格式转换...") {
          public void run() {
            DirectoryDialog dlg = new DirectoryDialog(window.getShell());
            dlg.setMessage("请选择源目录:");
            String dir = dlg.open();
            if (dir == null) {
              return;
            }
            dlg.setMessage("请选择目标目录:");
            String targetDir = dlg.open();
            if (targetDir == null) {
              return;
            }

            BatchConvertDialog dlg2 = new BatchConvertDialog(window.getShell());
            try {
              dlg2.setDirectory(dir, targetDir);
              dlg2.open();
            } catch (Exception e1) {
              SWTUtils.showError(window.getShell(), "错误", e1);
            }
          }
        };

    testAction =
        new Action("test") {
          public void run() {
            // new TestPathDialog(null).open();
          }
        };
  }
  /**
   * 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;
  }