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.casmall.dts.ui.master.CarEditComposite.java

License:Open Source License

private boolean validate() {
    if ("".equals(txtCarNum.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ", "  .");
        txtCarNum.setFocus();/*w w w.  jav a 2s  .  c  o m*/
        return false;
    }

    if (btnCheck.getSelection() && "".equals(txtCarMgtCd.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ",
                "  .\n\n ,     .");
        txtCarMgtCd.setFocus();
        return false;
    }
    TsCarMstDTO p = new TsCarMstDTO();
    if (dto != null)
        p.setCar_cd(dto.getCar_cd());
    if (!"".equals(txtCarMgtCd.getText().trim())) {
        //   
        p.setCar_mgt_cd(txtCarMgtCd.getText().trim());
        if (mgr.existTsCarMstMgtCd(p)) {
            MessageDialog.openWarning(getShell(), "  ",
                    " .   .");
            txtCarMgtCd.setFocus();
            return false;
        }
    }
    //    :   confirm!
    p.setCar_num(txtCarNum.getText().trim());
    ArrayList<TsCarMstDTO> list = mgr.selectTsCarMst(p);
    boolean e = false;
    if (dto == null) {
        if (list.size() > 0)
            e = true;
    } else {
        for (TsCarMstDTO d : list) {
            if (!dto.getCar_cd().equals(d.getCar_cd())) {
                e = true;
                break;
            }
        }
    }
    if (e) {
        return MessageDialog.openConfirm(getShell(), "  ",
                "  .\n\n ?");
    }
    return true;
}

From source file:com.casmall.dts.ui.master.CarEditComposite.java

License:Open Source License

private void btnDeleteMouseDown(MouseEvent evt) {
    try {//from ww  w .j  a  v a  2 s . com
        if (dto == null) {
            this.btnClearMouseDown(null);
            return;
        }
        if (MessageDialog.openConfirm(getShell(), "", " ?")) {
            dto = (TsCarMstDTO) ObjectUtil.getUpdateObject(dto);
            mgr.deleteTsCarMst(dto);
            callback.callback(CallbackIF.CMD_LIST, null);
            btnClearMouseDown(null);
            MessageDialog.openInformation(getShell(), "", " .");
        }
    } catch (Exception e) {
        MessageDialog.openError(getShell(), " Error", e.getMessage());
        log.error(e.getMessage());
    }
}

From source file:com.casmall.dts.ui.master.CstEditComposite.java

License:Open Source License

private void btnSaveMouseDown(SelectionEvent evt) {
    if (!validate())
        return;//from w ww  .ja  v a 2  s. co m

    if (MessageDialog.openConfirm(getShell(), "", "?")) {
        try {
            //  
            TsCstMstDTO pdto = (TsCstMstDTO) ObjectUtil.getDefaultObject(TsCstMstDTO.class.getName());
            pdto.setCst_nm(txtCstNm.getText().trim());
            pdto.setCst_mgt_cd(txtCstMgtCd.getText().trim());
            pdto.setNt(txtNt.getText().trim());
            pdto.setRpr_nm(txtRprNm.getText().trim());
            pdto.setTel(txtTel.getText().trim());

            if (btnCheck.getSelection())
                pdto.setMgt_yn(DTSConstants.FLAG_Y);
            else
                pdto.setMgt_yn(DTSConstants.FLAG_N);

            //  
            if (dto == null) {
                pdto.setCst_cd(mgr.selectTsCstMstKey());
                mgr.insertTsCstMst(pdto);
            } else {
                //  
                pdto.setCst_cd(dto.getCst_cd());
                pdto.setRgn_dt(null);
                pdto.setRgn_id(null);
                mgr.updateTsCstMst(pdto);
            }

            callback.callback(CallbackIF.CMD_LIST, null);
            MessageDialog.openInformation(getShell(), "", " .");
            btnClearMouseDown(null);
        } catch (Exception e) {
            MessageDialog.openError(getShell(), " Error", e.getMessage());
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }
}

From source file:com.casmall.dts.ui.master.CstEditComposite.java

License:Open Source License

private boolean validate() {
    if ("".equals(txtCstNm.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ", "  .");
        txtCstNm.setFocus();//from w  w w .ja  va 2  s. com
        return false;
    }

    if (btnCheck.getSelection() && "".equals(txtCstMgtCd.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ",
                "  .\n\n ,     .");
        txtCstMgtCd.setFocus();
        return false;
    }
    TsCstMstDTO p = new TsCstMstDTO();
    if (dto != null)
        p.setCst_cd(dto.getCst_cd());
    if (!"".equals(txtCstMgtCd.getText().trim())) {
        //   
        p.setCst_mgt_cd(txtCstMgtCd.getText().trim());
        if (mgr.existTsCstMstMgtCd(p)) {
            MessageDialog.openWarning(getShell(), "  ",
                    " .   .");
            txtCstMgtCd.setFocus();
            return false;
        }
    }
    //    :   confirm!
    p.setCst_nm(txtCstNm.getText().trim());
    ArrayList<TsCstMstDTO> list = mgr.selectTsCstMst(p);
    boolean e = false;
    if (dto == null) {
        if (list.size() > 0)
            e = true;
    } else {
        for (TsCstMstDTO d : list) {
            if (!dto.getCst_cd().equals(d.getCst_cd())) {
                e = true;
                break;
            }
        }
    }
    if (e) {
        return MessageDialog.openConfirm(getShell(), "  ",
                "  .\n\n ?");
    }
    return true;
}

From source file:com.casmall.dts.ui.master.CstEditComposite.java

License:Open Source License

private void btnDeleteMouseDown(MouseEvent evt) {
    try {//from  w w w .j a  va2  s .c  o  m
        if (dto == null) {
            this.btnClearMouseDown(null);
            return;
        }
        if (MessageDialog.openConfirm(getShell(), "", " ?")) {
            dto = (TsCstMstDTO) ObjectUtil.getUpdateObject(dto);
            mgr.deleteTsCstMst(dto);
            callback.callback(CallbackIF.CMD_LIST, null);
            btnClearMouseDown(null);
            MessageDialog.openInformation(getShell(), "", " .");
        }
    } catch (Exception e) {
        MessageDialog.openError(getShell(), " Error", e.getMessage());
        log.error(e.getMessage());
    }
}

From source file:com.casmall.dts.ui.master.PrdtEditComposite.java

License:Open Source License

private void btnSaveMouseDown(SelectionEvent evt) {
    if (!validate())
        return;/*from  w  ww  .j  a  va  2  s  . co m*/

    if (MessageDialog.openConfirm(getShell(), "", "?")) {
        try {
            //  
            TsPrdtMstDTO pdto = (TsPrdtMstDTO) ObjectUtil.getDefaultObject(TsPrdtMstDTO.class.getName());
            pdto.setPrdt_nm(txtPrdtNm.getText().trim());
            pdto.setPrdt_mgt_cd(txtPrdtMgtCd.getText().trim());
            if ("".equals(txtUnitPrice.getControl().getText())) {
                pdto.setUnt_prc(0);
            } else {
                pdto.setUnt_prc(Integer.parseInt(txtUnitPrice.getControl().getText().replaceAll(",", "")));
            }
            pdto.setNt(txtNt.getText().trim());
            if (btnCheck.getSelection())
                pdto.setMgt_yn(DTSConstants.FLAG_Y);
            else
                pdto.setMgt_yn(DTSConstants.FLAG_N);

            //  
            if (dto == null) {
                pdto.setPrdt_cd(mgr.selectTsPrdtMstKey());
                mgr.insertTsPrdtMst(pdto);
            } else {
                //  
                pdto.setPrdt_cd(dto.getPrdt_cd());
                pdto.setRgn_dt(null);
                pdto.setRgn_id(null);
                mgr.updateTsPrdtMst(pdto);
            }

            callback.callback(CallbackIF.CMD_LIST, null);
            MessageDialog.openInformation(getShell(), "", " .");
            btnClearMouseDown(null);
        } catch (Exception e) {
            MessageDialog.openError(getShell(), " Error", e.getMessage());
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }
}

From source file:com.casmall.dts.ui.master.PrdtEditComposite.java

License:Open Source License

private boolean validate() {
    if ("".equals(txtPrdtNm.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ", "  .");
        txtPrdtNm.setFocus();/*from   w w  w .j a v  a2s.c o  m*/
        return false;
    }

    if (btnCheck.getSelection() && "".equals(txtPrdtMgtCd.getText().trim())) {
        MessageDialog.openWarning(getShell(), "  ",
                "  .\n\n ,     .");
        txtPrdtMgtCd.setFocus();
        return false;
    }
    TsPrdtMstDTO p = new TsPrdtMstDTO();
    if (dto != null)
        p.setPrdt_cd(dto.getPrdt_cd());
    if (!"".equals(txtPrdtMgtCd.getText().trim())) {
        //   
        p.setPrdt_mgt_cd(txtPrdtMgtCd.getText().trim());
        if (mgr.existTsPrdtMstMgtCd(p)) {
            MessageDialog.openWarning(getShell(), "  ",
                    " .   .");
            txtPrdtMgtCd.setFocus();
            return false;
        }
    }
    //    :   confirm!
    p.setPrdt_nm(txtPrdtNm.getText().trim());
    ArrayList<TsPrdtMstDTO> list = mgr.selectTsPrdtMst(p);
    boolean e = false;
    if (dto == null) {
        if (list.size() > 0)
            e = true;
    } else {
        for (TsPrdtMstDTO d : list) {
            if (!dto.getPrdt_cd().equals(d.getPrdt_cd())) {
                e = true;
                break;
            }
        }
    }
    if (e) {
        return MessageDialog.openConfirm(getShell(), "  ",
                "  .\n\n ?");
    }
    return true;
}

From source file:com.casmall.dts.ui.master.PrdtEditComposite.java

License:Open Source License

private void btnDeleteMouseDown(MouseEvent evt) {
    try {//  www  .  j a  va  2 s . c  o m
        if (dto == null) {
            this.btnClearMouseDown(null);
            return;
        }
        if (MessageDialog.openConfirm(getShell(), "", " ?")) {
            dto = (TsPrdtMstDTO) ObjectUtil.getUpdateObject(dto);
            mgr.deleteTsPrdtMst(dto);
            callback.callback(CallbackIF.CMD_LIST, null);
            btnClearMouseDown(null);
            MessageDialog.openInformation(getShell(), "", " .");
        }
    } catch (Exception e) {
        MessageDialog.openError(getShell(), " Error", e.getMessage());
        log.error(e.getMessage());
    }
}

From source file:com.casmall.dts.ui.usr.UsrInfEditComposite.java

License:Open Source License

private void btnSaveMouseDown(SelectionEvent evt) {
    if (DTSConstants.CD_USR_GRD_USER.equals(usr.getAth_grd()) && dto.getUsr_seq() != usr.getUsr_seq()) {
        MessageDialog.openError(getShell(), "  ",
                "  . \n\n    .");
        return;/* ww  w  .jav a2s.c o m*/
    }
    if (!validate())
        return;

    if (MessageDialog.openConfirm(getShell(), "", "?")) {
        try {
            //  
            CmUsrInfDTO pdto = (CmUsrInfDTO) ObjectUtil.getDefaultObject(CmUsrInfDTO.class.getName());
            pdto.setLgn_id(txtLgnId.getText().trim());
            pdto.setLgn_pw(txtLgnPw.getText().trim());
            pdto.setUsr_nm(txtUsrNm.getText().trim());
            pdto.setAth_grd(cboAthGrd.getText().trim());
            int auth = 0;
            for (int i = 0; i < btnAuth.length; i++) {
                if (btnAuth[i].getSelection())
                    auth |= (Integer) btnAuth[i].getData();
            }
            pdto.setAth_cd(auth);
            pdto.setNt(txtNt.getText().trim());
            pdto.setTel(txtTel.getText().trim());

            //  
            if (dto == null) {
                pdto.setUsr_seq(Integer.parseInt(mgr.selectCmUsrInfKey()));
                mgr.insertCmUsrInf(pdto);
            } else {
                //  
                pdto.setUsr_seq(dto.getUsr_seq());
                pdto.setRgn_dt(null);
                pdto.setRgn_id(null);
                mgr.updateCmUsrInf(pdto);
            }
            if (pdto.getLgn_id().equals(SessionManager.getInstance().getUsr().getLgn_id())) {
                SessionManager.getInstance().getUsr().setAth_cd(pdto.getAth_cd());
                SessionManager.getInstance().getUsr().setAth_grd(pdto.getAth_grd());
            }
            callback.callback(CallbackIF.CMD_LIST, null);
            MessageDialog.openInformation(getShell(), "", " .");
            btnClearMouseDown(null);
        } catch (Exception e) {
            MessageDialog.openError(getShell(), " Error", e.getMessage());
            e.printStackTrace();
            log.error(e.getMessage());
        }
    }
}

From source file:com.casmall.dts.ui.usr.UsrInfEditComposite.java

License:Open Source License

private void btnDeleteMouseDown(MouseEvent evt) {
    try {/*from w ww. j  a  v a  2  s.  com*/
        if (DTSConstants.CD_USR_GRD_USER.equals(usr.getAth_grd())) {
            MessageDialog.openError(getShell(), "  ",
                    "  . \n\n    .");
            return;
        }
        if (dto == null) {
            this.btnClearMouseDown(null);
            return;
        }
        if (MessageDialog.openConfirm(getShell(), "", " ?")) {
            dto = (CmUsrInfDTO) ObjectUtil.getUpdateObject(dto);
            mgr.deleteCmUsrInf(dto);
            callback.callback(CallbackIF.CMD_LIST, null);
            btnClearMouseDown(null);
            MessageDialog.openInformation(getShell(), "", " .");
        }
    } catch (Exception e) {
        MessageDialog.openError(getShell(), " Error", e.getMessage());
        log.error(e.getMessage());
    }
}