Search in sources :

Example 26 with DatabaseModelBean

use of net.heartsome.cat.common.bean.DatabaseModelBean in project translationstudio8 by heartsome.

the class NewProjectTmPage method addToCurrDbList.

/**
	 * 将选中的内容添加到列表中
	 * @param selection
	 *            ;
	 */
private void addToCurrDbList(List<DatabaseModelBean> hasSelection) {
    StringBuffer existDbNames = new StringBuffer();
    for (int i = 0; i < hasSelection.size(); i++) {
        DatabaseModelBean dbModel = hasSelection.get(i);
        checkDbHashMatch(dbModel, "M");
        if (!checkDbIsExist(curDbList, dbModel)) {
            if (curDbList.size() == 0) {
                // 第一个添加的库为默认库
                dbModel.setDefault(true);
            }
            curDbList.add(dbModel);
            this.tableViewer.refresh();
        } else {
            existDbNames.append(dbModel.getDbName());
            existDbNames.append("\n");
        }
    }
    if (existDbNames.length() != 0) {
        MessageDialog.openInformation(getShell(), Messages.getString("newproject.NewProjectTmPage.msgTitle"), Messages.getString("newproject.NewProjectTmPage.msg2") + existDbNames.toString());
    }
}
Also used : DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean)

Example 27 with DatabaseModelBean

use of net.heartsome.cat.common.bean.DatabaseModelBean in project translationstudio8 by heartsome.

the class DatabaseConfiger method getServersConfigByType.

/**
	 * 获取指定类型数据库的所有服务器配置信息
	 * @param type
	 *            数据库类型
	 * @return ;
	 */
public List<DatabaseModelBean> getServersConfigByType(String type) {
    List<DatabaseModelBean> list = new ArrayList<DatabaseModelBean>();
    try {
        vu.getVTDNav().push();
        ap.selectXPath("/servers/server[@type='" + type + "']");
        while (ap.evalXPath() != -1) {
            DatabaseModelBean dbm = new DatabaseModelBean();
            dbm.setId(vu.getCurrentElementAttribut("id", ""));
            dbm.setItlDBLocation(vu.getChildContent("location"));
            dbm.setInstance(vu.getChildContent("instance"));
            dbm.setHost(vu.getChildContent("host"));
            dbm.setPort(vu.getChildContent("port"));
            dbm.setUserName(vu.getChildContent("user"));
            dbm.setPassword(DESImpl.decrypt(vu.getChildContent("password")));
            dbm.setDbType(type);
            list.add(dbm);
        }
        ap.resetXPath();
        vu.getVTDNav().pop();
    } catch (XPathParseException e) {
        logger.error("", e);
    } catch (XPathEvalException e) {
        logger.error("", e);
    } catch (NavException e) {
        logger.error("", e);
    }
    return list;
}
Also used : XPathParseException(com.ximpleware.XPathParseException) DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) ArrayList(java.util.ArrayList) XPathEvalException(com.ximpleware.XPathEvalException) NavException(com.ximpleware.NavException)

Example 28 with DatabaseModelBean

use of net.heartsome.cat.common.bean.DatabaseModelBean in project translationstudio8 by heartsome.

the class ProjectSettingTMPage method setProjectInfoBean.

@Override
public void setProjectInfoBean(ProjectInfoBean projInfoBean) {
    super.projectInfoBean = projInfoBean;
    this.curDbList = projInfoBean.getTmDb();
    for (DatabaseModelBean bean : this.curDbList) {
        checkDbHashMatch(bean);
    }
}
Also used : DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean)

Example 29 with DatabaseModelBean

use of net.heartsome.cat.common.bean.DatabaseModelBean in project translationstudio8 by heartsome.

the class ProjectSettingTMPage method getAvailableDatabase.

public List<DatabaseModelBean> getAvailableDatabase() {
    Set<String> availableDatabase = getSysAvailableDatabase();
    List<DatabaseModelBean> rs = new ArrayList<DatabaseModelBean>();
    for (DatabaseModelBean dmb : this.curDbList) {
        if (availableDatabase.contains(dmb.getDbType())) {
            rs.add(dmb);
        }
    }
    return rs;
}
Also used : DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) ArrayList(java.util.ArrayList)

Example 30 with DatabaseModelBean

use of net.heartsome.cat.common.bean.DatabaseModelBean in project translationstudio8 by heartsome.

the class ProjectSettingTMPage method getUnAvailableDatabase.

public List<DatabaseModelBean> getUnAvailableDatabase() {
    Set<String> availableDatabase = getSysAvailableDatabase();
    List<DatabaseModelBean> rs = new ArrayList<DatabaseModelBean>();
    for (DatabaseModelBean dmb : this.curDbList) {
        if (!availableDatabase.contains(dmb.getDbType())) {
            rs.add(dmb);
        }
    }
    return rs;
}
Also used : DatabaseModelBean(net.heartsome.cat.common.bean.DatabaseModelBean) ArrayList(java.util.ArrayList)

Aggregations

DatabaseModelBean (net.heartsome.cat.common.bean.DatabaseModelBean)71 ArrayList (java.util.ArrayList)27 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)16 SQLException (java.sql.SQLException)15 SelectionEvent (org.eclipse.swt.events.SelectionEvent)14 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 MenuItem (org.eclipse.swt.widgets.MenuItem)12 List (java.util.List)11 Point (org.eclipse.swt.graphics.Point)11 File (java.io.File)10 GridData (org.eclipse.swt.layout.GridData)10 GridLayout (org.eclipse.swt.layout.GridLayout)10 Button (org.eclipse.swt.widgets.Button)10 Composite (org.eclipse.swt.widgets.Composite)10 Label (org.eclipse.swt.widgets.Label)10 Menu (org.eclipse.swt.widgets.Menu)10 Iterator (java.util.Iterator)8 Map (java.util.Map)8 MetaData (net.heartsome.cat.common.bean.MetaData)8 HSDropDownButton (net.heartsome.cat.common.ui.HSDropDownButton)8