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

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

Introduction

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

Prototype

public static void openError(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard error dialog.

Usage

From source file:at.bitandart.zoubek.mervin.review.wizards.ReviewSelectionPage.java

License:Open Source License

@SuppressWarnings("restriction")
private void loadChanges(final String uri) {
    try {/*from  w  ww  . ja  v  a  2 s. c  o m*/
        ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(getShell());
        progressMonitorDialog.run(true, true, new ReviewListUpdater(uri));
    } catch (InvocationTargetException | InterruptedException e) {
        logger.error(e);
        uiSync.syncExec(new Runnable() {

            @Override
            public void run() {
                MessageDialog.openError(getShell(), "Review list retrieval error",
                        "Could not load all review for this repository. "
                                + "Make sure the repository remote \"origin\" points at the correct "
                                + "accessible remote gerrit repository. "
                                + "See the error log for more details.");
            }
        });
    }

}

From source file:at.medevit.elexis.ehc.ui.example.wizard.ImportPatientWizard.java

License:Open Source License

@Override
public void setDocument(InputStream document) {
    try {//from   www  .j  a  va2s.  c o  m
        document.reset();
        ClinicalDocument clinicalDocument = ServiceComponent.getService().loadDocument(document);
        ehcDocument = ServiceComponent.getService().getAsCdaChDocument(clinicalDocument);
        if (mainPage != null) {
            mainPage.setDocument(ehcDocument);
        }
    } catch (IOException e) {
        logger.error("Could not open document", e);
        MessageDialog.openError(getShell(), "Fehler", "Konnte das Dokument nicht ffnen.");
    }
}

From source file:at.medevit.elexis.ehc.ui.views.EHealthConnectorView.java

License:Open Source License

/**
 * display the given CDA report/*from w w w. j  a  va  2 s .  c  om*/
 * 
 * @param path
 *            of the CDA report file
 */
public void displayReport(String path) {
    InputStream inputStream;
    try {
        // try file first, next try resolving via url
        try {
            inputStream = new FileInputStream(path);
            displayReport(inputStream, path);
        } catch (FileNotFoundException fne) {
            inputStream = new URL(path).openStream();
            displayReport(inputStream, "");
        }

    } catch (IOException e) {
        log.warn("Could not resolve CDA report on path [" + path + "]", e);
        MessageDialog.openError(UiDesk.getTopShell(), Messages.Dlg_ResolveError,
                Messages.Dlg_ResolveErrorMsg + "[" + path + "]");
    }
}

From source file:at.medevit.elexis.emediplan.ui.handler.CreateAndOpenHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Patient patient = ElexisEventDispatcher.getSelectedPatient();
    if (patient == null) {
        return null;
    }/*from  ww w. ja  va2 s  .c o m*/
    Mandant mandant = ElexisEventDispatcher.getSelectedMandator();
    if (mandant == null) {
        return null;
    }

    String medicationType = event.getParameter("ch.elexis.core.ui.medication.commandParameter.medication"); //$NON-NLS-1$
    // if not set use all
    if (medicationType == null || medicationType.isEmpty()) {
        medicationType = "all";
    }

    List<Prescription> prescriptions = getPrescriptions(patient, medicationType, event);
    if (prescriptions != null && !prescriptions.isEmpty()) {
        prescriptions = sortPrescriptions(prescriptions, event);

        BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
        ServiceReference<EMediplanService> eMediplanServiceRef = bundleContext
                .getServiceReference(EMediplanService.class);
        if (eMediplanServiceRef != null) {
            EMediplanService eMediplanService = bundleContext.getService(eMediplanServiceRef);
            ByteArrayOutputStream pdfOutput = new ByteArrayOutputStream();
            eMediplanService.exportEMediplanPdf(mandant, patient, prescriptions, pdfOutput);
            // save as Brief
            SaveEMediplanUtil.saveEMediplan(patient, mandant, pdfOutput.toByteArray());
            // open with system viewer
            try {
                Program.launch(SaveEMediplanUtil.writeTempPdf(pdfOutput));
            } catch (IOException e) {
                MessageDialog.openError(Display.getDefault().getActiveShell(), "Fehler",
                        "Das Rezept konnte nicht angezeigt werden.");
            }
            bundleContext.ungetService(eMediplanServiceRef);
        } else {
            LoggerFactory.getLogger(getClass()).error("No EMediplanService available");
            MessageDialog.openError(HandlerUtil.getActiveShell(event), "Fehler",
                    "Kein eMediplan Service gefunden.");
        }
    }
    return null;
}

From source file:at.rc.tacos.client.Application.java

License:Open Source License

/**
 * Start the application and create the main workbench
 * //from   w ww  .ja v  a2s. c  o m
 * @param context
 *            the context used to init the application
 * @return the exit code of the application
 */
public Object start(IApplicationContext context) {
    // the net source
    NetSource source = NetSource.getInstance();
    ServerInfo primaryServer = source.getServerInfoById(IServerInfo.PRIMARY_SERVER);
    ServerInfo failoverServer = source.getServerInfoById(IServerInfo.FAILOVER_SERVER);

    // FIXME This is just a test for svn merge

    // startup the workbench
    Display display = PlatformUI.createDisplay();
    // connect to the server
    if (source.openConnection(primaryServer) == null) {
        display.beep();
        // show an error message
        if (!MessageDialog.openQuestion(display.getActiveShell(), "Verbindungsfehler",
                "Verbindung zum primren Server nicht mglich.\n"
                        + "Soll eine Verbindung zum Backup Server hergestellt werden?")) {
            return IApplication.EXIT_OK;
        } else {
            // get the network status
            if (source.openConnection(failoverServer) == null) {
                display.beep();
                // show an error message
                MessageDialog.openError(display.getActiveShell(), "Verbindungsfehler",
                        "Verbindung zum primren und zum Backup Server nicht mglich.\n"
                                + "Applikation wird beendet");
                return IApplication.EXIT_OK;
            }
        }
    }
    // startup the network
    NetWrapper.getDefault().init();
    Activator.getDefault().init();
    // try to load workbench
    try {
        ApplicationWorkbenchAdvisor adv = new ApplicationWorkbenchAdvisor();
        // create the workbench
        int returnCode = PlatformUI.createAndRunWorkbench(display, adv);
        if (returnCode == PlatformUI.RETURN_RESTART)
            return IApplication.EXIT_RESTART;
        return IApplication.EXIT_OK;
    } finally {
        display.dispose();
    }
}

From source file:at.rc.tacos.client.controller.VehicleSetReadyAction.java

License:Open Source License

/**
 * Checks the vehicle and runs the action
 */// w w w  .ja va2  s .  co m
@Override
public void run() {
    // first check if we have at least a driver
    if (detail.getDriver() == null) {
        MessageDialog.openError(window.getShell(), "Fehler beim setzen des Status 'Einsatzbereit'",
                "Dem Fahrzeug " + detail.getVehicleName()
                        + " kann nicht der Status 'Einsatzbereit' gegeben werden.\n"
                        + "Bitte weisen Sie dem Fahrzeug zuerst einen Fahrer zu.");
        return;
    }
    // reset the status
    detail.setOutOfOrder(false);
    detail.setReadyForAction(true);
    if (detail.getTransportStatus() == VehicleDetail.TRANSPORT_STATUS_NA)
        detail.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_GREEN);
    NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detail);
}

From source file:at.rc.tacos.client.controller.VehicleTableSetReadyAction.java

License:Open Source License

/**
 * Checks the vehicle and runs the action
 */// w  w w  .j  a  v  a2  s.c o  m
@Override
public void run() {
    // the selection
    ISelection selection = viewer.getSelection();
    // get the selected entry
    VehicleDetail detail = (VehicleDetail) ((IStructuredSelection) selection).getFirstElement();

    // first check if we have at least a driver
    if (detail.getDriver() == null) {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                "Fehler beim setzen des Status 'Einsatzbereit'",
                "Dem Fahrzeug " + detail.getVehicleName()
                        + " kann nicht der Status 'Einsatzbereit' gegeben werden.\n"
                        + "Bitte weisen Sie dem Fahrzeug zuerst einen Fahrer zu.");
        return;
    }

    // reset the status
    detail.setOutOfOrder(false);
    detail.setReadyForAction(true);
    if (detail.getTransportStatus() == VehicleDetail.TRANSPORT_STATUS_NA)
        detail.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_GREEN);
    NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detail);
}

From source file:at.rc.tacos.client.listeners.SessionListener.java

License:Open Source License

@Override
public void transferFailed(final AbstractMessageInfo info) {
    // the message to display
    final StringBuffer msg = new StringBuffer();
    msg.append("Die folgende Nachricht konnte nicht an den Server bertragen werden. (Zeitberschreitung).\n");
    msg.append(info.getContentType() + " -> " + info.getQueryString());

    // show a message
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            // show the message to the user
            MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Netzwerkfehler",
                    msg.toString());/*from w  ww.  j  ava  2s .c  o  m*/
            // retry
            boolean retryConfirmed = MessageDialog.openConfirm(
                    PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Senden wiederholen",
                    "Wollen sie die Nachricht noch einmal senden?");
            if (!retryConfirmed)
                return;
            NetWrapper.getDefault().sheduleAndSend(info);
        }
    });
}

From source file:at.rc.tacos.client.listeners.SessionListener.java

License:Open Source License

@Override
public void systemMessage(final AbstractMessage message) {
    final SystemMessage sysMessage = (SystemMessage) message;

    // show a message
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
                    "Schwerwiegender Fehler", sysMessage.getMessage());
        }//from w w  w . jav  a  2  s . co m
    });

    // the log message
    Status status;

    if (sysMessage.getType() == SystemMessage.TYPE_INFO)
        status = new Status(IStatus.INFO, Activator.PLUGIN_ID, sysMessage.getMessage());
    else if (sysMessage.getType() == SystemMessage.TYPE_ERROR)
        status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, sysMessage.getMessage());
    // log as an error message
    else
        status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, sysMessage.getMessage());
    // log the message
    Activator.getDefault().getLog().log(status);
}

From source file:at.rc.tacos.client.modelManager.LockManager.java

License:Open Source License

/**
 * Sends the lock object to the server and waits for the response
 *///from   w ww . ja va 2 s  . co m
public static String sendLock(String contentId, String lockedId) {
    // get the authenticated user
    String user = SessionManager.getInstance().getLoginInformation().getUsername();

    // create a new lock object
    final Lock lock = new Lock(contentId, user, lockedId, false);

    // the start time of the lock request
    final Calendar startTime = Calendar.getInstance();

    // create a new thread to wait for the lock
    Job lockJob = new Job("berprfe den Status des Objektes") {

        public IStatus run(IProgressMonitor monitor) {
            try {
                // Send the request
                monitor.setTaskName("Sende Anfrage an den Server");
                NetWrapper.getDefault().sendAddMessage(Lock.ID, lock);
                lastSendLock = lock;
                lockStatus = LOCK_WAIT;
                // wait for the response
                while (lockStatus == LOCK_WAIT) {
                    if (monitor.isCanceled())
                        return Status.CANCEL_STATUS;
                    monitor.setTaskName("Warte auf Antwort des Servers");
                    Thread.sleep(10);

                    // the response from the server must be within 2 seconds
                    Calendar now = Calendar.getInstance();
                    now.add(Calendar.SECOND, -2);
                    if (now.after(startTime))
                        return Status.CANCEL_STATUS;
                }
                return Status.OK_STATUS;
            } catch (Exception e) {
                return Status.CANCEL_STATUS;
            } finally {
                monitor.done();
            }
        }
    };
    lockJob.addJobChangeListener(new JobChangeAdapter() {

        @Override
        public void done(IJobChangeEvent event) {
            // check the return code
            if (event.getResult() == Status.CANCEL_STATUS) {
                lockStatus = LOCK_ERROR;
            }
        }
    });
    lockJob.setPriority(UIJob.SHORT);
    lockJob.setUser(true);
    lockJob.schedule();

    // wait until the job has finished
    try {
        lockJob.join();
    } catch (InterruptedException ie) {
        lockStatus = LOCK_ERROR;
    }

    // check the result of the job
    if (lockStatus == LOCK_OK) {
        return null;
    } else if (lockStatus == LOCK_DENIED) {
        return lastSendLock.getLockedBy();
    } else {
        // show a warning to the user
        MessageDialog.openError(Display.getCurrent().getActiveShell(), "Sperren des Objektes fehlgeschlagen",
                "Der Status des Eintrages kann nicht berprft werden\nEin editieren wird nicht empfohlen");
        // return a std message
        return "<undefiniert>";
    }
}