Example usage for org.eclipse.jface.dialogs MessageDialog openConfirm

List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog openConfirm.

Prototype

public static boolean openConfirm(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a simple confirm (OK/Cancel) dialog.

Usage

From source file:com.hangum.tadpole.manager.core.editor.auth.dialogs.DBAccessControlDialog.java

License:Open Source License

@Override
protected void okPressed() {
    if (!MessageDialog.openConfirm(getShell(), "Confirm", "Do you want to update?"))
        return;/*from w  w  w  . ja  v a 2s  . c  om*/

    DBAccessControlDAO dao = new DBAccessControlDAO();
    dao.setSeq(dbAccessDetail.getSeq());

    dao.setSelect_lock(btnSelect.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    dao.setInsert_lock(btnInsert.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    dao.setUpdate_lock(btnUpdate.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    dao.setDelete_locl(btnDelete.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());
    dao.setDdl_lock(btnDdl.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
            : PublicTadpoleDefine.YES_NO.NO.name());

    Map<String, AccessCtlObjectDAO> mapSelectAccessCtl = new HashMap<String, AccessCtlObjectDAO>();
    for (AccessCtlObjectDAO objectDao : listTableColumn) {
        mapSelectAccessCtl.put(objectDao.getObj_name(), objectDao);
    }
    dao.setMapSelectAccessCtl(mapSelectAccessCtl);

    // 
    try {
        TadpoleSystem_AccessControl.updateDBAccessControl(dao);
    } catch (Exception e) {
        logger.error("Update dbAccessContorl error", e);
        MessageDialog.openError(getShell(), "Error", "During update : " + e.getMessage());
        return;
    }

    super.okPressed();
}

From source file:com.hangum.tadpole.manager.core.editor.auth.dialogs.DBOthresConfigDialog.java

License:Open Source License

@Override
protected void okPressed() {
    if (MessageDialog.openConfirm(getShell(), "Confirm", "Do you want to save?")) {
        try {/* w  ww  . java  2 s . c  o m*/
            final UserDBDAO updateUserDB = new UserDBDAO();
            updateUserDB.setIs_visible(btnVisible.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
                    : PublicTadpoleDefine.YES_NO.NO.name());
            updateUserDB.setIs_lock(btnDbLock.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
                    : PublicTadpoleDefine.YES_NO.NO.name());
            updateUserDB.setSeq(userDB.getSeq());

            TadpoleSystem_UserDBQuery.updateDBOtherInformation(updateUserDB);
        } catch (Exception e) {
            logger.error("update faile", e);
        }
    } else {
        return;
    }

    super.okPressed();
}

From source file:com.hangum.tadpole.manager.core.editor.auth.dialogs.TableColumnFilterDialog.java

License:Open Source License

/**
 * delete filter/*from  w w  w. ja  v a 2 s  .c o  m*/
 */
private void deleteFilter() {
    IStructuredSelection iss = (IStructuredSelection) tvTableFilter.getSelection();
    if (iss.isEmpty())
        return;

    TableFilterDAO tableFilterDao = (TableFilterDAO) iss.getFirstElement();
    if (MessageDialog.openConfirm(getShell(), "Confirm", "Do you want to delete filter?")) {
        try {
            TadpoleSystem_TableColumnFilter.deleteTableColumnFilters(tableFilterDao);
            initData();
        } catch (Exception e) {
            logger.error("delete tablefilter exception", e);
        }
    }
}

From source file:com.hangum.tadpole.manager.core.editor.auth.UserListComposite.java

License:Open Source License

/**
 * delete user/*from w  w w  .ja  va2 s. c  o  m*/
 */
private void deleteUser() {
    IStructuredSelection ss = (IStructuredSelection) userListViewer.getSelection();
    if (ss != null) {
        UserGroupAUserDAO userGroupAuser = (UserGroupAUserDAO) ss.getFirstElement();
        if (userGroupAuser.getEmail().equals(SessionManager.getEMAIL())) {
            MessageDialog.openWarning(getShell(), "Warning", Messages.UserListComposite_16); //$NON-NLS-1$
        } else {
            if (MessageDialog.openConfirm(getShell(), Messages.UserListComposite_17,
                    Messages.UserListComposite_18)) {
                try {
                    TadpoleSystem_UserRole.withdrawalUserRole(SessionManager.getGroupSeq(),
                            userGroupAuser.getSeq());
                    initUI();
                } catch (Exception e) {
                    logger.error("withdrawal group user", e); //$NON-NLS-1$
                }
            }
        }
    }
}

From source file:com.hangum.tadpole.manager.core.editor.db.DBListComposite.java

License:Open Source License

/**
 * delete user/*from  www  .ja  v  a 2 s  .c  o m*/
 */
private void deleteUser() {
    IStructuredSelection ss = (IStructuredSelection) tvDBList.getSelection();
    if (ss.isEmpty())
        return;

    TadpoleUserDbRoleDAO userDBRole = (TadpoleUserDbRoleDAO) ss.getFirstElement();
    if (userDBRole.getParent().getUser_seq() == userDBRole.getUser_seq())
        return;

    if (!MessageDialog.openConfirm(null, Messages.get().Confirm, Messages.get().DBListComposite_18))
        return;

    try {
        TadpoleSystem_UserDBQuery.removeUserRoleDB(userDBRole.getSeq());
        UserDBDAO userDB = userDBRole.getParent();
        userDB.getListChildren().remove(userDBRole);

        tvDBList.refresh(userDB);

    } catch (Exception e) {
        logger.error("delete user exception", e); //$NON-NLS-1$
        Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
        ExceptionDetailsErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.get().Error, Messages.get().DBListComposite_6, errStatus);
    }
}

From source file:com.hangum.tadpole.manager.core.editor.db.dialogs.DBAccessControlDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//from   w w w . j av a 2  s  .  com
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.verticalSpacing = 5;
    gridLayout.horizontalSpacing = 5;
    gridLayout.marginHeight = 5;
    gridLayout.marginWidth = 5;

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

    Label lblDbName = new Label(compositeHead, SWT.NONE);
    lblDbName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblDbName.setText(Messages.get().DBName);

    textDBName = new Text(compositeHead, SWT.BORDER);
    textDBName.setEditable(false);
    textDBName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textDBName.setText(userDB.getDisplay_name());

    Label lblUser = new Label(compositeHead, SWT.NONE);
    lblUser.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblUser.setText(Messages.get().User);

    comboUser = new Combo(compositeHead, SWT.READ_ONLY);
    comboUser.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            initData();
        }
    });
    comboUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    List<TadpoleUserDbRoleDAO> listUser = userDB.getListChildren();
    for (int i = 0; i < listUser.size(); i++) {
        TadpoleUserDbRoleDAO tadpoleUserDbRoleDAO = listUser.get(i);
        comboUser
                .add(String.format("%s (%s)", tadpoleUserDbRoleDAO.getName(), tadpoleUserDbRoleDAO.getEmail())); //$NON-NLS-1$
        comboUser.setData("" + i, tadpoleUserDbRoleDAO); //$NON-NLS-1$
    }
    comboUser.select(0);

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

    Group grpAuthority = new Group(compositeBody, SWT.NONE);
    grpAuthority.setLayout(new GridLayout(2, false));
    grpAuthority.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    grpAuthority.setText(Messages.get().Authority);

    btnSelect = new Button(grpAuthority, SWT.CHECK);
    btnSelect.setEnabled(false);
    btnSelect.setSelection(true);
    btnSelect.setText(Messages.get().SELECT);

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

    btnSelectAdd = new Button(compositeSelectBtn, SWT.NONE);
    btnSelectAdd.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            TableColumnFilterDialog tableColumnDialog = new TableColumnFilterDialog(getShell(), dbAccessDetail);
            if (Dialog.OK == tableColumnDialog.open()) {
                listTableColumn.add(tableColumnDialog.getUpdateData());
                tvSelect.refresh();
            }
        }
    });
    btnSelectAdd.setText(Messages.get().Add);
    btnSelect.setEnabled(false);
    //      if(userDB.getDBDefine() == DBDefine.MYSQL_DEFAULT) btnSelect.setEnabled(true);

    btnSelectDelete = new Button(compositeSelectBtn, SWT.NONE);
    btnSelectDelete.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection iss = (IStructuredSelection) tvSelect.getSelection();
            if (!iss.isEmpty()) {
                if (!MessageDialog.openConfirm(getShell(), Messages.get().Confirm,
                        Messages.get().DBAccessControlDialog_9))
                    return;

                AccessCtlObjectDAO dao = (AccessCtlObjectDAO) iss.getFirstElement();

                listTableColumn.remove(dao);
                tvSelect.refresh();
            }
        }
    });
    btnSelectDelete.setText(Messages.get().Delete);
    btnSelectDelete.setEnabled(false);
    new Label(compositeSelectBtn, SWT.NONE);

    new Label(grpAuthority, SWT.NONE);

    tvSelect = new TableViewer(grpAuthority, SWT.BORDER | SWT.FULL_SELECTION);
    tvSelect.addPostSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            btnSelectDelete.setEnabled(true);
        }
    });
    tvSelect.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection iss = (IStructuredSelection) event.getSelection();
            if (!iss.isEmpty()) {
                AccessCtlObjectDAO acObject = (AccessCtlObjectDAO) iss.getFirstElement();

                TableColumnFilterDialog tableColumnDialog = new TableColumnFilterDialog(getShell(),
                        dbAccessDetail, acObject);
                if (Dialog.OK == tableColumnDialog.open()) {
                    //                  listTableColumn.add(tableColumnDialog.getUpdateData());
                    tvSelect.refresh();
                }
            }

        }
    });
    Table table = tvSelect.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tvColumnName = new TableViewerColumn(tvSelect, SWT.NONE);
    TableColumn tblclmnTable = tvColumnName.getColumn();
    tblclmnTable.setWidth(150);
    tblclmnTable.setText(Messages.get().Table);

    TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tvSelect, SWT.NONE);
    TableColumn tblclmnDoNotUse = tableViewerColumn_2.getColumn();
    tblclmnDoNotUse.setWidth(60);
    tblclmnDoNotUse.setText(Messages.get().DBAccessControlDialog_12);

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tvSelect, SWT.NONE);
    TableColumn tblclmnColumn = tableViewerColumn_1.getColumn();
    tblclmnColumn.setWidth(500);
    tblclmnColumn.setText(Messages.get().Column);

    tvSelect.setContentProvider(new ArrayContentProvider());
    tvSelect.setLabelProvider(new SelectTableFilterLabelprovider());
    tvSelect.setInput(listTableColumn);

    btnInsert = new Button(grpAuthority, SWT.CHECK);
    btnInsert.setText("INSERT"); //$NON-NLS-1$
    new Label(grpAuthority, SWT.NONE);

    btnUpdate = new Button(grpAuthority, SWT.CHECK);
    btnUpdate.setText("UPDATE"); //$NON-NLS-1$
    new Label(grpAuthority, SWT.NONE);

    btnDelete = new Button(grpAuthority, SWT.CHECK);
    btnDelete.setText("DELETE"); //$NON-NLS-1$
    new Label(grpAuthority, SWT.NONE);

    btnDdl = new Button(grpAuthority, SWT.CHECK);
    btnDdl.setText("DDL"); //$NON-NLS-1$
    new Label(grpAuthority, SWT.NONE);

    firstInit();
    initData();

    return container;
}

From source file:com.hangum.tadpole.manager.core.editor.db.dialogs.DBAccessControlDialog.java

License:Open Source License

@Override
protected void okPressed() {
    if (!MessageDialog.openConfirm(getShell(), Messages.get().Confirm, Messages.get().DBAccessControlDialog_22))
        return;//w  ww  .  j  ava2  s  .c  om

    DBAccessControlDAO dao = new DBAccessControlDAO();
    dao.setSeq(dbAccessDetail.getSeq());

    //      dao.setSelect_lock(btnSelect.getSelection()?PublicTadpoleDefine.YES_NO.NO.name():PublicTadpoleDefine.YES_NO.YES.name());
    dao.setInsert_lock(btnInsert.getSelection() ? PublicTadpoleDefine.YES_NO.NO.name()
            : PublicTadpoleDefine.YES_NO.YES.name());
    dao.setUpdate_lock(btnUpdate.getSelection() ? PublicTadpoleDefine.YES_NO.NO.name()
            : PublicTadpoleDefine.YES_NO.YES.name());
    dao.setDelete_locl(btnDelete.getSelection() ? PublicTadpoleDefine.YES_NO.NO.name()
            : PublicTadpoleDefine.YES_NO.YES.name());
    dao.setDdl_lock(btnDdl.getSelection() ? PublicTadpoleDefine.YES_NO.NO.name()
            : PublicTadpoleDefine.YES_NO.YES.name());

    Map<String, AccessCtlObjectDAO> mapSelectAccessCtl = new HashMap<String, AccessCtlObjectDAO>();
    for (AccessCtlObjectDAO objectDao : listTableColumn) {
        mapSelectAccessCtl.put(objectDao.getObj_name(), objectDao);
    }
    dao.setMapSelectAccessCtl(mapSelectAccessCtl);

    // 
    try {
        TadpoleSystem_AccessControl.updateDBAccessControl(dao);
    } catch (Exception e) {
        logger.error("Update dbAccessContorl error", e);
        MessageDialog.openError(getShell(), Messages.get().Error, Messages.get().Authority + e.getMessage());
        return;
    }

    super.okPressed();
}

From source file:com.hangum.tadpole.manager.core.editor.db.dialogs.DBOthresConfigDialog.java

License:Open Source License

@Override
protected void okPressed() {
    if (MessageDialog.openConfirm(getShell(), Messages.get().Confirm, Messages.get().DBOthresConfigDialog_5)) {
        try {/*from w ww .ja  v  a  2 s.co  m*/
            userDB.setIs_visible(btnVisible.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
                    : PublicTadpoleDefine.YES_NO.NO.name());
            userDB.setIs_lock(btnDbLock.getSelection() ? PublicTadpoleDefine.YES_NO.YES.name()
                    : PublicTadpoleDefine.YES_NO.NO.name());

            TadpoleSystem_UserDBQuery.updateDBOtherInformation(userDB);
        } catch (Exception e) {
            logger.error("update faile", e); //$NON-NLS-1$
        }

        super.okPressed();
    } else {
        return;
    }
}

From source file:com.hangum.tadpole.manager.core.editor.executedsql.SQLAuditEditor.java

License:Open Source License

/**
 * download/*  ww w  . j av  a2s . c om*/
 */
private void download() {
    if (gridHistory.getItemCount() == 0)
        return;
    if (!MessageDialog.openConfirm(getSite().getShell(), Messages.get().Confirm,
            Messages.get().ExecutedSQLEditor_28))
        return;

    List<String[]> listCsvData = new ArrayList<String[]>();

    // add header
    listCsvData.add(strArrHeader);

    String[] strArryData = new String[gridHistory.getColumnCount()];
    for (int i = 0; i < gridHistory.getItemCount(); i++) {
        strArryData = new String[gridHistory.getColumnCount()];

        GridItem gi = gridHistory.getItem(i);
        for (int intColumnCnt = 0; intColumnCnt < gridHistory.getColumnCount(); intColumnCnt++) {
            strArryData[intColumnCnt] = Utils.convHtmlToLine(gi.getText(intColumnCnt));
        }
        listCsvData.add(strArryData);
    }

    try {
        String strCVSContent = CSVFileUtils.makeData(listCsvData);
        downloadExtFile("SQLAudit.csv", strCVSContent); //$NON-NLS-1$

        MessageDialog.openInformation(getSite().getShell(), Messages.get().Confirm,
                Messages.get().ExecutedSQLEditor_31);
    } catch (Exception e) {
        logger.error("Save CSV Data", e); //$NON-NLS-1$
    }
}

From source file:com.hangum.tadpole.manager.core.editor.restfulapi.RESTFulAPIManagerEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));

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

    ToolBar toolBar = new ToolBar(compositeHead, SWT.FLAT | SWT.RIGHT);

    ToolItem tltmRefrsh = new ToolItem(toolBar, SWT.NONE);
    tltmRefrsh.setToolTipText(Messages.get().Refresh);
    tltmRefrsh.setImage(ResourceManager.getPluginImage(Activator.PLUGIN_ID, "resources/icons/refresh.png")); //$NON-NLS-1$
    tltmRefrsh.addSelectionListener(new SelectionAdapter() {
        @Override//from   w  w w .j  a  va 2  s.com
        public void widgetSelected(SelectionEvent e) {
            initUI();
        }
    });

    ToolItem tltmAPIExecute = new ToolItem(toolBar, SWT.NONE);
    tltmAPIExecute.setToolTipText(Messages.get().RESTFulAPIManagerEditor_3);
    tltmAPIExecute.setImage(ResourceManager.getPluginImage(com.hangum.tadpole.manager.core.Activator.PLUGIN_ID,
            "resources/icons/restful_api.png")); //$NON-NLS-1$
    tltmAPIExecute.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            UserAPIServiceDialog dialog = new UserAPIServiceDialog(getSite().getShell());
            dialog.open();
        }
    });

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

    tvAPIList = new TreeViewer(compositeBody, SWT.BORDER | SWT.FULL_SELECTION);
    tvAPIList.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (tvAPIList.getSelection().isEmpty())
                return;

            StructuredSelection ss = (StructuredSelection) tvAPIList.getSelection();
            RESTFulAPIDAO dao = (RESTFulAPIDAO) ss.getFirstElement();
            rmDAO = dao.getResourceManagerDao();

            if (rmDAO == null)
                return;

            try {
                userDB = TadpoleSystem_UserDBQuery.getUserDBInstance(Integer.parseInt("" + rmDAO.getDb_seq())); //$NON-NLS-1$

                SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB());
                List<String> result = sqlClient.queryForList("userDbResourceData", rmDAO); //$NON-NLS-1$

                comboShare.getCombo().select("PUBLIC".equals(rmDAO.getShared_type()) ? 0 : 1); //$NON-NLS-1$
                textTitle.setText(rmDAO.getName());
                textDescription.setText(rmDAO.getDescription());
                comboSupportAPI.setText(rmDAO.getRestapi_yesno());
                textAPIURL.setText(rmDAO.getRestapi_uri() == null ? "" : rmDAO.getRestapi_uri()); //$NON-NLS-1$
                textAPIKey.setText(rmDAO.getRestapi_key());
                textQuery.setText(""); //$NON-NLS-1$
                for (String data : result) {
                    textQuery.append(data);
                }

            } catch (Exception e) {
                logger.error("Resource detail", e); //$NON-NLS-1$
            }
        }
    });
    tvAPIList.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            if (tvAPIList.getSelection().isEmpty())
                return;

            StructuredSelection ss = (StructuredSelection) tvAPIList.getSelection();
            RESTFulAPIDAO dao = (RESTFulAPIDAO) ss.getFirstElement();
            ResourceManagerDAO rmDAO = dao.getResourceManagerDao();

            if (rmDAO == null)
                return;

            try {

                final UserDBDAO userDB = TadpoleSystem_UserDBQuery
                        .getUserDBInstance(Integer.parseInt("" + rmDAO.getDb_seq())); //$NON-NLS-1$

                // TODO :  ??? ??     DAO   ?  .DAO    ?.
                UserDBResourceDAO ad = new UserDBResourceDAO();
                ad.setResource_seq((int) rmDAO.getResource_seq());
                ad.setName(rmDAO.getName());
                ad.setParent(userDB);

                // db object ?  ? ??.
                if (PublicTadpoleDefine.RESOURCE_TYPE.ERD.toString().equals(rmDAO.getResource_types())) {
                    if (userDB != null && DBDefine.MONGODB_DEFAULT == userDB.getDBDefine()) {
                        MongoDBERDViewAction ea = new MongoDBERDViewAction();
                        ea.run(ad);
                    } else {
                        RDBERDViewAction ea = new RDBERDViewAction();
                        ea.run(ad);
                    }
                } else if (PublicTadpoleDefine.RESOURCE_TYPE.SQL.toString().equals(rmDAO.getResource_types())) {
                    QueryEditorAction qea = new QueryEditorAction();
                    qea.run(ad);
                }
            } catch (Exception e) {
                logger.error("select api", e); //$NON-NLS-1$
            }
        }
    });
    Tree tree = tvAPIList.getTree();
    tree.setLinesVisible(true);
    tree.setHeaderVisible(true);
    tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TreeViewerColumn treeViewerColumn = new TreeViewerColumn(tvAPIList, SWT.NONE);
    TreeColumn trclmnUrl = treeViewerColumn.getColumn();
    trclmnUrl.setWidth(150);
    trclmnUrl.setText(Messages.get().URL);

    TreeViewerColumn tvcName = new TreeViewerColumn(tvAPIList, SWT.NONE);
    TreeColumn trclmnDBName = tvcName.getColumn();
    trclmnDBName.setWidth(150);
    trclmnDBName.setText(Messages.get().APIName);

    TreeViewerColumn treeViewerColumn_1 = new TreeViewerColumn(tvAPIList, SWT.NONE);
    TreeColumn trclmnName = treeViewerColumn_1.getColumn();
    trclmnName.setWidth(150);
    trclmnName.setText(Messages.get().DBName);

    TreeViewerColumn treeViewerColumn_2 = new TreeViewerColumn(tvAPIList, SWT.NONE);
    TreeColumn trclmnDescription = treeViewerColumn_2.getColumn();
    trclmnDescription.setWidth(300);
    trclmnDescription.setText(Messages.get().Description);

    tvAPIList.setContentProvider(new APIListContentProvider());
    tvAPIList.setLabelProvider(new APIListLabelProvider());

    /////////////////////////////////////////////////////////////////////////////////////////////
    Group grpQuery = new Group(parent, SWT.NONE);
    grpQuery.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    grpQuery.setText(Messages.get().DetailItem);
    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 compositeDetail = new Composite(grpQuery, SWT.NONE | SWT.READ_ONLY);
    GridLayout gl_compositeDetail = new GridLayout(7, false);
    gl_compositeDetail.marginHeight = 2;
    gl_compositeDetail.marginWidth = 2;
    gl_compositeDetail.verticalSpacing = 2;
    compositeDetail.setLayout(gl_compositeDetail);
    compositeDetail.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Label lblNewLabel = new Label(compositeDetail, SWT.NONE);
    lblNewLabel.setText(Messages.get().Share);

    comboShare = new ComboViewer(compositeDetail, SWT.NONE | SWT.READ_ONLY);
    Combo cShare = comboShare.getCombo();
    cShare.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    cShare.setItems(new String[] { "PUBLIC", "PRIVATE" }); //$NON-NLS-1$ //$NON-NLS-2$

    Label lblNewLabel_1 = new Label(compositeDetail, SWT.NONE);
    lblNewLabel_1.setText(Messages.get().Title);

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

    Button btnSave = new Button(compositeDetail, SWT.NONE);
    btnSave.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (rmDAO == null)
                return;

            if (!MessageDialog.openConfirm(getSite().getShell(), Messages.get().Confirm,
                    Messages.get().RESTFulAPIManagerEditor_22))
                return;

            try {
                String share_type = comboShare.getCombo().getText();
                share_type = (share_type == null || "".equals(share_type)) ? "PUBLIC" : share_type; //$NON-NLS-1$ //$NON-NLS-2$
                rmDAO.setShared_type(share_type);
                rmDAO.setName(textTitle.getText());
                rmDAO.setDescription(textDescription.getText());
                rmDAO.setRestapi_yesno(comboSupportAPI.getText());
                rmDAO.setRestapi_uri(textAPIURL.getText());

                if (!isValid(rmDAO))
                    return;

                try {
                    TadpoleSystem_UserDBResource.userDBResourceDupUpdate(userDB, rmDAO);
                } catch (Exception ee) {
                    logger.error("Resource validate", ee); //$NON-NLS-1$
                    MessageDialog.openError(null, Messages.get().Error, ee.getMessage()); //$NON-NLS-1$
                    return;
                }

                if (comboSupportAPI.getText().equals(PublicTadpoleDefine.YES_NO.YES.name())
                        && "".equals(rmDAO.getRestapi_key())) { //$NON-NLS-1$
                    rmDAO.setRestapi_key(Utils.getUniqueID());
                }

                TadpoleSystem_UserDBResource.updateResourceHeader(rmDAO);
                tvAPIList.refresh(rmDAO, true);

                MessageDialog.openInformation(getSite().getShell(), Messages.get().Confirm,
                        Messages.get().RESTFulAPIManagerEditor_27);
            } catch (Exception e1) {
                logger.error("save resource", e1); //$NON-NLS-1$
                MessageDialog.openError(getSite().getShell(), Messages.get().Error,
                        Messages.get().RESTFulAPIManagerEditor_30 + e1.getMessage());
            }
        }

        /**
         * is valid
         * @return
         */
        private boolean isValid(ResourceManagerDAO dao) {
            int len = StringUtils.trimToEmpty(textTitle.getText()).length();
            if (len < 3) {
                MessageDialog.openWarning(null, Messages.get().Warning,
                        Messages.get().RESTFulAPIManagerEditor_31); //$NON-NLS-1$
                textTitle.setFocus();
                return false;
            }

            // sql type 
            if (dao.getResource_types().equals(RESOURCE_TYPE.SQL.name())) {
                if (PublicTadpoleDefine.YES_NO.YES.name().equals(comboSupportAPI.getText())) {
                    String strAPIURI = textAPIURL.getText().trim();

                    if (strAPIURI.equals("")) { //$NON-NLS-1$
                        MessageDialog.openWarning(getSite().getShell(), Messages.get().Warning,
                                Messages.get().RESTFulAPIManagerEditor_34);
                        textAPIURL.setFocus();
                        return false;
                    }

                    // check valid url. url pattern is must be /{parent}/{child}
                    if (!RESTfulAPIUtils.validateURL(textAPIURL.getText())) {
                        MessageDialog.openWarning(getSite().getShell(), Messages.get().Warning,
                                Messages.get().RESTFulAPIManagerEditor_36);

                        textAPIURL.setFocus();
                        return false;
                    }
                }
            }

            return true;
        }
    });
    btnSave.setText(Messages.get().Save);

    //      Button btnDelete = new Button(composite, SWT.NONE);
    //      btnDelete.addSelectionListener(new SelectionAdapter() {
    //         @Override
    //         public void widgetSelected(SelectionEvent e) {
    //            if (tableViewer.getSelection().isEmpty()) return;
    //
    //            if(!MessageDialog.openConfirm(getSite().getShell(), Messages.get().Confirm, "Do you wont to delete?")) 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);
    //               addUserResouceData(null);
    //            } catch (Exception e1) {
    //               logger.error("Resource delete " + dao.toString(), e1);
    //            }
    //         }
    //      });
    //      btnDelete.setText("Delete");

    Label lblDescription = new Label(compositeDetail, SWT.NONE);
    lblDescription.setText(Messages.get().Description);

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

    Label lblSupportApi = new Label(compositeDetail, SWT.NONE);
    lblSupportApi.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblSupportApi.setText(Messages.get().RESTFulAPIManagerEditor_39);

    comboSupportAPI = new Combo(compositeDetail, SWT.READ_ONLY);
    comboSupportAPI.add("YES"); //$NON-NLS-1$
    comboSupportAPI.add("NO"); //$NON-NLS-1$
    comboSupportAPI.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblApiURI = new Label(compositeDetail, SWT.NONE);
    lblApiURI.setText(Messages.get().APIURL);

    textAPIURL = new Text(compositeDetail, SWT.BORDER);
    textAPIURL.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    Button btnShowUrl = new Button(compositeDetail, SWT.NONE);
    btnShowUrl.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!"".equals(textAPIURL.getText())) { //$NON-NLS-1$
                String strURL = RESTfulAPIUtils.makeURL(textQuery.getText(), textAPIURL.getText());

                TadpoleSimpleMessageDialog dialog = new TadpoleSimpleMessageDialog(getSite().getShell(),
                        Messages.get().RESTFulAPIManagerEditor_44, strURL);
                dialog.open();
            }
        }
    });
    btnShowUrl.setText(Messages.get().RESTFulAPIManagerEditor_45);
    new Label(compositeDetail, SWT.NONE);
    new Label(compositeDetail, SWT.NONE);

    Label lblApiKey = new Label(compositeDetail, SWT.NONE);
    lblApiKey.setText(Messages.get().RESTFulAPIManagerEditor_46);

    textAPIKey = new Text(compositeDetail, SWT.BORDER);
    textAPIKey.setEditable(false);
    textAPIKey.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    Button btnApiExecute = new Button(compositeDetail, SWT.NONE);
    btnApiExecute.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!"".equals(textAPIURL.getText())) { //$NON-NLS-1$
                if (userDB != null & rmDAO != null) {
                    APIServiceDialog dialog = new APIServiceDialog(getSite().getShell(), userDB,
                            textQuery.getText(), rmDAO);
                    dialog.open();
                }
            }
        }
    });
    btnApiExecute.setText(Messages.get().RESTFulAPIManagerEditor_48);

    textQuery = new Text(compositeDetail,
            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, 7, 1));
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    initUI();

}