List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.
Click Source Link
From source file:org.celllife.idart.gui.reportParameters.MmiaReport.java
License:Open Source License
@SuppressWarnings("unused") @Override//from w w w .j av a 2 s . c o m protected void cmdViewReportWidgetSelected() { StockCenter pharm = AdministrationManager.getStockCenter(getHSession(), cmbStockCenter.getText()); if (cmbStockCenter.getText().equals("")) { MessageBox missing = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); missing.setText("No Pharmacy Was Selected"); missing.setMessage( "No pharmacy was selected. Please select a pharmacy by looking through the list of available pharmacies."); missing.open(); } else if (pharm == null) { MessageBox missing = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); missing.setText("Pharmacy not found"); missing.setMessage("There is no pharmacy called '" + cmbStockCenter.getText() + "' in the database. Please select a pharmacy by looking through the list of available pharmacies."); missing.open(); } else if (iDARTUtil.before(calendarEnd.getCalendar().getTime(), calendarStart.getCalendar().getTime())) { showMessage(MessageDialog.ERROR, "End date before start date", "You have selected an end date that is before the start date.\nPlease select an end date after the start date."); return; } else { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); // String strTheDate = "" + cmbYear.getText() + "-" // + cmbMonth.getText() + "-01"; Date theStartDate = calendarStart.getCalendar().getTime(); Date theEndDate = calendarEnd.getCalendar().getTime(); //theStartDate = sdf.parse(strTheDate); MiaReport report = new MiaReport(getShell(), pharm, theStartDate, theEndDate); viewReport(report); } catch (Exception e) { getLog().error("Exception while running Monthly Receipts and Issues report", e); } } }
From source file:org.celllife.idart.gui.reportParameters.MmiaReportMISAU.java
License:Open Source License
@SuppressWarnings("unused") @Override//from w w w .j ava 2 s . c o m protected void cmdViewReportWidgetSelected() { StockCenter pharm = AdministrationManager.getStockCenter(getHSession(), cmbStockCenter.getText()); if (cmbStockCenter.getText().equals("")) { MessageBox missing = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); missing.setText("No Pharmacy Was Selected"); missing.setMessage( "No pharmacy was selected. Please select a pharmacy by looking through the list of available pharmacies."); missing.open(); } else if (pharm == null) { MessageBox missing = new MessageBox(getShell(), SWT.ICON_ERROR | SWT.OK); missing.setText("Pharmacy not found"); missing.setMessage("There is no pharmacy called '" + cmbStockCenter.getText() + "' in the database. Please select a pharmacy by looking through the list of available pharmacies."); missing.open(); } else if (iDARTUtil.before(calendarEnd.getCalendar().getTime(), calendarStart.getCalendar().getTime())) { showMessage(MessageDialog.ERROR, "End date before start date", "You have selected an end date that is before the start date.\nPlease select an end date after the start date."); return; } else { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); // String strTheDate = "" + cmbYear.getText() + "-" // + cmbMonth.getText() + "-01"; Date theStartDate = calendarStart.getCalendar().getTime(); Date theEndDate = calendarEnd.getCalendar().getTime(); //theStartDate = sdf.parse(strTheDate); MiaReportMISAU report = new MiaReportMISAU(getShell(), pharm, theStartDate, theEndDate); viewReport(report); } catch (Exception e) { getLog().error("Exception while running Monthly Receipts and Issues report", e); } } }
From source file:org.celllife.idart.gui.reportParameters.RegisteredIdart.java
License:Open Source License
@SuppressWarnings("unused") @Override// www. ja va2 s . co m protected void cmdViewReportWidgetSelected() { if (iDARTUtil.before(calendarEnd.getCalendar().getTime(), calendarStart.getCalendar().getTime())) { showMessage(MessageDialog.ERROR, "End date before start date", "You have selected an end date that is before the start date.\nPlease select an end date after the start date."); return; } else { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); Date theStartDate = calendarStart.getCalendar().getTime(); Date theEndDate = calendarEnd.getCalendar().getTime(); //theStartDate = sdf.parse(strTheDate); RegisteredIdart1 report = new RegisteredIdart1(getShell(), theStartDate, theEndDate); viewReport(report); } catch (Exception e) { getLog().error("Exception while running rEGISTADOS NO IDART report", e); } } }
From source file:org.celllife.idart.gui.reportParameters.SecondLineReport.java
License:Open Source License
@SuppressWarnings("unused") @Override/* ww w . j a va 2 s . co m*/ protected void cmdViewReportWidgetSelected() { if (iDARTUtil.before(calendarEnd.getCalendar().getTime(), calendarStart.getCalendar().getTime())) { showMessage(MessageDialog.ERROR, "End date before start date", "You have selected an end date that is before the start date.\nPlease select an end date after the start date."); return; } else { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); Date theStartDate = calendarStart.getCalendar().getTime(); Date theEndDate = calendarEnd.getCalendar().getTime(); //theStartDate = sdf.parse(strTheDate); SecondLine report = new SecondLine(getShell(), theStartDate, theEndDate); viewReport(report); } catch (Exception e) { getLog().error("Exception while running Second Line report", e); } } }
From source file:org.celllife.idart.gui.stockOnHand.StockOnHandGui.java
License:Open Source License
private void populateStockGUI() { if (localStockCenter == null) { getLog().info("Tried to retrieve stock list, but localPharmay is null"); return;/* w ww . j a va2 s . c o m*/ } final List<DrugDetail> dataList = new ArrayList<DrugDetail>(); final List<Drug> drugList = DrugManager.getAllDrugs(getHSession()); final String parmacy = cmbPharmacy.getText(); try { new ProgressMonitorDialog(getShell()).run(true, true, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Calculating stock values", drugList.size()); for (Drug drug : drugList) { if (monitor.isCanceled()) { throw new OperationCanceledException("Calculation cancelled"); } monitor.subTask("Calculating values for " + drug.getName()); DrugDetail dd = StockManager.getDrugDetail(getHSession(), drug, AdministrationManager.getStockCenter(getHSession(), parmacy)); dataList.add(dd); monitor.worked(1); } monitor.done(); } }); } catch (InvocationTargetException e) { showMessage(MessageDialog.ERROR, Messages.getString("common.error"), //$NON-NLS-1$ Messages.getString("stockOnHand.error")); //$NON-NLS-1$ } catch (InterruptedException e) { showMessage(MessageDialog.WARNING, Messages.getString("common.warning"), //$NON-NLS-1$ Messages.getString("stockOnHand.warning")); //$NON-NLS-1$ } tblStockTable.setInput(dataList); tblStockTable.refresh(); tblStockTable.expandAll(); }
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.CloudFoundryUiCallback.java
License:Open Source License
@Override public void handleError(final IStatus status) { if (status != null && status.getSeverity() == IStatus.ERROR) { CloudFoundryPlugin.log(status);//from w w w .ja va 2 s . c om UIJob job = new UIJob(Messages.CloudFoundryUiCallback_JOB_CF_ERROR) { public IStatus runInUIThread(IProgressMonitor monitor) { Shell shell = CloudUiUtil.getShell(); if (shell != null) { new MessageDialog(shell, Messages.CloudFoundryUiCallback_ERROR_CALLBACK_TITLE, null, status.getMessage(), MessageDialog.ERROR, new String[] { Messages.COMMONTXT_OK }, 0) .open(); } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); } }
From source file:org.csstudio.startup.application.OpenDocumentEventProcessor.java
License:Open Source License
private void openFile(Display display, final String path) { display.asyncExec(() -> {/*from ww w . j ava 2 s . co m*/ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return; updatePermissions(); int ds = path.lastIndexOf('.'); int de = path.substring(ds + 1).indexOf(' '); String pathPart = path; String ext; String data = null; if (de == -1) { ext = path.substring(ds + 1).trim(); } else { de += ds + 1; pathPart = path.substring(0, de); ext = path.substring(ds + 1, de).trim(); data = path.substring(de + 1); data = replaceAsciiCode(data); } //open file with DisplayUtil if it is a supported Display file if (DisplayUtil.getInstance().isExtensionSupported(ext)) { try { DisplayUtil.getInstance().openDisplay(pathPart, data); Shell shell = window.getShell(); if (shell != null) { if (shell.getMinimized()) shell.setMinimized(false); shell.forceActive(); } return; } catch (Exception e) { String msg = NLS.bind("The file ''{0}'' could not be opened as a display. \n " + "It will be opened by default editor", path); MessageDialog.openError(window.getShell(), "Open Display", msg); Logger.getLogger(Plugin.ID).log(Level.WARNING, msg, e); } } IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(path)); IFileInfo fetchInfo = fileStore.fetchInfo(); if (!fetchInfo.isDirectory() && fetchInfo.exists()) { IWorkbenchPage page = window.getActivePage(); if (page == null) { String msg = "No window available"; MessageDialog.open(MessageDialog.ERROR, window.getShell(), "Open File", msg, SWT.SHEET); } try { IDE.openInternalEditorOnFileStore(page, fileStore); Shell shell = window.getShell(); if (shell != null) { if (shell.getMinimized()) shell.setMinimized(false); shell.forceActive(); } } catch (PartInitException e) { String msg = NLS.bind("The file ''{0}'' could not be opened. See log for details.", fileStore.getName()); CoreException eLog = new PartInitException(e.getMessage()); Logger.getLogger(Plugin.ID).log(Level.WARNING, "Cannot open " + fileStore.getName(), eLog); MessageDialog.open(MessageDialog.ERROR, window.getShell(), "Open File", msg, SWT.SHEET); } } else { String msg = NLS.bind("The file ''{0}'' could not be opened. See log for details.", path); MessageDialog.open(MessageDialog.ERROR, window.getShell(), "Open File", msg, SWT.SHEET); } }); }
From source file:org.dawb.passerelle.actors.ui.MessageSink.java
License:Open Source License
public MessageSink(CompositeEntity container, String name) throws NameDuplicationException, IllegalActionException { super(container, name); visibleChoices.put(MessageDialog.ERROR + "", "ERROR"); visibleChoices.put(MessageDialog.WARNING + "", "WARNING"); visibleChoices.put(MessageDialog.INFORMATION + "", "INFORMATION"); messageType = new StringChoiceParameter(this, "Message Type", new IAvailableChoices() { @Override/* www . ja v a 2 s . co m*/ public Map<String, String> getVisibleChoices() { return visibleChoices; } @Override public String[] getChoices() { return visibleChoices.keySet().toArray(new String[0]); } }, SWT.SINGLE); messageType.setExpression(MessageDialog.INFORMATION + ""); registerConfigurableParameter(messageType); messageParam = new StringParameter(this, "Message"); messageParam.setExpression("${message_text}"); registerConfigurableParameter(messageParam); messageTitle = new StringParameter(this, "Message Title"); messageTitle.setExpression("Error Message"); registerConfigurableParameter(messageTitle); memoryManagementParam.setVisibility(Settable.NONE); passModeParameter.setExpression(EXPRESSION_MODE.get(1)); passModeParameter.setVisibility(Settable.NONE); shownMessagePort = PortFactory.getInstance().createOutputPort(this, "shownMessage"); }
From source file:org.dawb.passerelle.common.remote.RemoteWorkbenchImpl.java
License:Open Source License
@Override public boolean showMessage(final String title, final String message, final int type) { if (!PlatformUI.isWorkbenchRunning()) { if (type == MessageDialog.ERROR) logger.error(title + "> " + message); if (type == MessageDialog.WARNING) logger.warn(title + "> " + message); if (type == MessageDialog.INFORMATION) logger.info(title + "> " + message); return true; }/*from w w w. j a va 2 s . c o m*/ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { @Override public void run() { MessageDialog.open(type, PlatformUI.getWorkbench().getDisplay().getActiveShell(), title, message, SWT.NONE); } }); return true; }
From source file:org.destecs.ide.ui.wizards.AbstractNewFileWizard.java
License:Open Source License
private void createFile(final IFile newFileHandle, final InputStream initialContents) { IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { URI linkTargetPath = null; CreateFileOperation op = new CreateFileOperation(newFileHandle, linkTargetPath, initialContents, IDEWorkbenchMessages.WizardNewFileCreationPage_title); try { // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=219901 // directly execute the operation so that the undo state is // not preserved. Making this undoable resulted in too many // accidental file deletions. op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (final ExecutionException e) { getContainer().getShell().getDisplay().syncExec(new Runnable() { public void run() { if (e.getCause() instanceof CoreException) { ErrorDialog.openError(getContainer().getShell(), // Was // Utilities.getFocusShell() IDEWorkbenchMessages.WizardNewFileCreationPage_errorTitle, null, // no special // message ((CoreException) e.getCause()).getStatus()); } else { IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getCause()); //$NON-NLS-1$ MessageDialog.openError(getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind( IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getCause().getMessage())); }//from w w w . j av a2 s . c om } }); } } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { // return null; } catch (InvocationTargetException e) { // Execution Exceptions are handled above but we may still get // unexpected runtime errors. IDEWorkbenchPlugin.log(getClass(), "createNewFile()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFileCreationPage_internalErrorMessage, e.getTargetException().getMessage()), SWT.SHEET); // return null; } }