List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:com.b3dgs.lionengine.editor.dialog.exit.ExitHandler.java
License:Open Source License
/** * Execute the handler.//from w w w .j a v a2 s .c o m * * @param workbench The workbench reference. * @param shell The shell reference. */ @Execute public void execute(IWorkbench workbench, Shell shell) { if (MessageDialog.openConfirm(shell, Messages.Title, Messages.Text)) { final ProjectPart part = UtilPart.getPart(ProjectPart.ID, ProjectPart.class); part.close(); workbench.close(); } }
From source file:com.b3dgs.lionengine.editor.ExitHandler.java
License:Open Source License
/** * Execute the handler./*from w w w. ja v a2 s .c om*/ * * @param workbench The workbench reference. * @param shell The shell reference. */ @Execute public void execute(IWorkbench workbench, Shell shell) { if (MessageDialog.openConfirm(shell, Messages.ExitHandler_Title, Messages.ExitHandler_Text)) { workbench.close(); } }
From source file:com.bluexml.side.Requirements.modeler.actions.BackupSpecification.java
License:Open Source License
public void run(IAction action) { if (_selection instanceof IStructuredSelection) { IStructuredSelection iss = (IStructuredSelection) _selection; if (iss.getFirstElement() instanceof IFile) { IFile requirements_model = (IFile) iss.getFirstElement(); Set<IEditorPart> editorsToClose = new HashSet<IEditorPart>(); IWorkbench workbench = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage(); for (IEditorReference ref : activePage.getEditorReferences()) { IEditorPart part = ref.getEditor(false); if (part instanceof com.bluexml.side.requirements.presentation.RequirementsEditor) { com.bluexml.side.requirements.presentation.RequirementsEditor editor = (com.bluexml.side.requirements.presentation.RequirementsEditor) part; for (Resource r : editor.getEditingDomain().getResourceSet().getResources()) { if (r.equals(requirements_model)) editorsToClose.add(editor); }// ww w.j ava 2 s . c o m } else if (part instanceof com.bluexml.side.Requirements.modeler.editor.RequirementsEditor) { com.bluexml.side.Requirements.modeler.editor.RequirementsEditor editor = (com.bluexml.side.Requirements.modeler.editor.RequirementsEditor) part; for (Resource r : editor.getEditingDomain().getResourceSet().getResources()) { IPath ePath = new Path(r.getURI().devicePath().toString()); ePath = ePath.removeFirstSegments(1); ePath = ePath.makeAbsolute(); IPath mPath = requirements_model.getFullPath(); String filename = mPath.lastSegment() + "di"; mPath = mPath.removeLastSegments(1); mPath = mPath.append(filename); if (ePath.equals(mPath)) editorsToClose.add(editor); } } } boolean cont = false; if (editorsToClose.size() > 0) { if (MessageDialog.openConfirm(null, "Close all editors", "Before backuping your model, you must close all editors. Do you agree ?")) { for (IEditorPart part : editorsToClose) activePage.closeEditor(part, true); cont = true; } } else cont = true; if (cont) { try { requirements_model.refreshLocal(IResource.DEPTH_ONE, null); IFile backupModel = getBackupModel(requirements_model); Resource res = getResource(requirements_model); RequirementsDefinition reqDefs = getDefinition(res); if (reqDefs != null) { String version = reqDefs.getVersion(); System.out.println("Old version : " + version); if (version == null || version.length() == 0) version = "1.0"; else { //increment version StringTokenizer st = new StringTokenizer(version, "."); if (st.countTokens() == 2) { String major = st.nextToken(); String minor = st.nextToken(); version = major.concat("." + String.valueOf(Integer.valueOf(minor) + 1)); } else version = "1.0"; } System.out.println("New version : " + version); reqDefs.setVersion(version); reqDefs.setDate(new Date()); //and save the model saveDefinition(reqDefs, requirements_model); requirements_model.refreshLocal(0, null); //Backup of the model String nameFile = requirements_model.getName() .substring(0, requirements_model.getName().lastIndexOf(".")) .concat("." + version).concat(".requirements"); IPath target = backupModel.getFullPath(); target = target.removeLastSegments(1); target = target.append(".backup." + nameFile); IResource container = backupModel.getParent(); if (!container.exists() && container instanceof IFolder) prepareFolder((IFolder) container); requirements_model.copy(target, true, null); //compute risk computeRisk(requirements_model, version); requirements_model.refreshLocal(0, null); } } catch (CoreException e) { e.printStackTrace(); } } } } }
From source file:com.buglabs.dragonfly.ui.wizards.bugProject.OSGiServiceBindingPage.java
License:Open Source License
/** * Warn the user that current selections will be cleared * //from w w w . ja v a 2 s . c om * @param shell * @return */ private boolean reloadListDialog(Shell shell) { // if we switch to another bug, our settings will be lost! if (pinfo.getOSGiServices() == null || pinfo.getOSGiServices().size() < 1) return true; return MessageDialog.openConfirm(shell, RELOAD_LIST_WARN_TITLE, RELOAD_LIST_WARN_MESSAGE); }
From source file:com.ca.casd.lisa.plugins.odataassistant.views.AddUpdateTransactionDialog.java
License:Open Source License
@Override public boolean close() { if (bSaved)/*from w ww . j a v a 2 s . c om*/ return super.close(); if (MessageDialog.openConfirm(parentShell, "ODME Assistant", "The information are not saved, do you like to continue?")) return super.close(); return false; }
From source file:com.ca.casd.lisa.plugins.odataassistant.views.OdataAssistant.java
License:Open Source License
private boolean generateVS() { System.out.println(this.getClass().getSimpleName() + " @generateVS() method called"); try {// w w w.ja v a 2 s. c o m if (false == checkValidInputObject()) return false; String msgString = ""; VSMObject vsmobj = new VSMObject(txtVSMName.getText().trim()); vsmobj.setDataStoreURL(""); vsmobj.setDataStoreType("H2"); vsmobj.setDatabaseUser("test"); vsmobj.setDatabasePassword("test"); vsmobj.setHttpBaseURL(getCurrentBaseUrl()); vsmobj.setHttpPort(txtPort.getText().trim()); vsmobj.setVSMPath(txtVSMPath.getText().trim()); vsmobj.setEDMFile(entityDataModelFile); vsmobj.setOdataVersion(getOdataVersion()); //VSI should be always in the folder {{LISA_PROJ_ROOT}}/VServices/Images/ String vsiFile = "{{LISA_PROJ_ROOT}}/VServices/Images/" + vsmobj.getVSMName() + ".vsi"; vsmobj.setVSIFile(vsiFile); if (enableGenerateTransactions()) { ArrayList<VSITransactionObject> transactions = getTransactionListInTable(); vsmobj.addTranscations(transactions); } String vsmFile = vsmobj.getVSMPath() + File.separator + vsmobj.getVSMName() + ".vsm"; File file = new File(vsmFile); if (file.exists()) { boolean bSave = MessageDialog.openConfirm(composite.getShell(), viewTitle, "The VSM file exists already, do you like to overwrite " + vsmFile); if (bSave == false) { txtVSMName.setFocus(); return false; } } showProgressStatus(true, LABEL_STATUS_INFORMATION, "Generating VSM Project, please wait..."); setWaitingCursor(true); LisaMarObject marObject = LisaMarUtil.generateLisaProject(vsmobj, metadata, sampleData, true); String marFile = marObject.getLisafile(); Map<String, Object> marErrors = marObject.getErrors(); Map<String, Object> marWarnings = marObject.getWarnings(); setWaitingCursor(false); if (marFile.isEmpty()) { msgString = "Failed to create VS, please check the log file for the details\n" + Log.getLogPathFileName(); showProgressStatus(true, LABEL_STATUS_ERROR, msgString); return false; } String status = LABEL_STATUS_INFORMATION; msgString = "The VS Model has been saved as " + marFile; if (marErrors != null && marErrors.size() > 0) { status = LABEL_STATUS_ERROR; msgString += ". Please check the log file for the error details\n"; } else if (marWarnings != null && marWarnings.size() > 0) { status = LABEL_STATUS_WARNING; msgString += ". Please check the log file for the error or warning details\n"; } else { status = LABEL_STATUS_INFORMATION; msgString += ". Please check the log file for the details\n"; } msgString += Log.getLogPathFileName(); showProgressStatus(true, status, msgString); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Log.write().error(e.getMessage()); } return true; }
From source file:com.ca.casd.lisa.plugins.odataassistant.views.OdataAssistant.java
License:Open Source License
private boolean showConfirmationMessage(String message) { return MessageDialog.openConfirm(composite.getShell(), viewTitle, message); }
From source file:com.casmall.dts.manage.ui.auth.AuthMgtEditComposite.java
License:Open Source License
private void btnSaveMouseDown(SelectionEvent evt) { if (!validate()) return;//from w w w. j a v a 2 s . com if (MessageDialog.openConfirm(getShell(), "", " ?")) { try { // TsAuthMgtDTO pdto = (TsAuthMgtDTO) ObjectUtil.getDefaultObject(TsAuthMgtDTO.class.getName()); pdto.setAuth_key(txtAuthKey.getText()); pdto.setAuth_num(txtAuthNum.getText()); pdto.setCst_nm(txtCustNm.getText()); pdto.setCst_tel(txtCustTel.getText()); pdto.setNt(txtNt.getText().trim()); // if (dto == null) { pdto.setAuth_seq(mgr.selectTsAuthMgtKey()); mgr.insertTsAuthMgt(pdto); } else { // pdto.setAuth_seq(dto.getAuth_seq()); pdto.setRgn_dt(null); pdto.setRgn_id(null); mgr.updateTsAuthMgt(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.manage.ui.auth.AuthMgtEditComposite.java
License:Open Source License
private void btnDeleteMouseDown(MouseEvent evt) { try {//from w ww .j ava 2 s . c o m if (dto == null) { this.btnClearMouseDown(null); return; } if (MessageDialog.openConfirm(getShell(), "", " ?")) { dto = (TsAuthMgtDTO) ObjectUtil.getUpdateObject(dto); mgr.deleteTsAuthMgt(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.CarEditComposite.java
License:Open Source License
private void btnSaveMouseDown(SelectionEvent evt) { if (!validate()) return;// ww w . j a v a 2s . c o m if (MessageDialog.openConfirm(getShell(), "", "?")) { try { // TsCarMstDTO pdto = (TsCarMstDTO) ObjectUtil.getDefaultObject(TsCarMstDTO.class.getName()); pdto.setCar_num(txtCarNum.getText().trim()); pdto.setCar_mgt_cd(txtCarMgtCd.getText().trim()); 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.setCar_cd(mgr.selectTsCarMstKey()); mgr.insertTsCarMst(pdto); } else { // pdto.setCar_cd(dto.getCar_cd()); pdto.setRgn_dt(null); pdto.setRgn_id(null); mgr.updateTsCarMst(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()); } } }