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

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

Introduction

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

Prototype

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

Source Link

Document

Convenience method to open a standard information dialog.

Usage

From source file:at.rc.tacos.client.editors.CompetenceEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("COMPETENCE_UPDATE".equals(evt.getPropertyName())
            || "COMPETENCE_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        Competence updateCompetence = null;
        // get the new value
        if (evt.getNewValue() instanceof Competence)
            updateCompetence = (Competence) evt.getNewValue();

        // assert we have a value
        if (updateCompetence == null)
            return;

        // is this competence is the current one -> update it
        if (competence.equals(updateCompetence)
                || competence.getCompetenceName().equals(updateCompetence.getCompetenceName())) {
            // save the updated competence
            setInput(new CompetenceEditorInput(updateCompetence, false));
            setPartName(updateCompetence.getCompetenceName());
            competence = updateCompetence;
            isNew = false;//from   ww w.j  av a 2  s .  c om
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("COMPETENCE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed competence
        Competence removedCompetence = (Competence) evt.getOldValue();
        // current open
        if (competence.equals(removedCompetence)) {
            MessageDialog.openInformation(getSite().getShell(), "Kompetenz wurde gelscht",
                    "Die Kompetenz, welche Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.DiseaseEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("DISEASE_UPDATE".equals(evt.getPropertyName())
            || "DISEASE_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        Disease updateDisease = null;/*from  w  ww.ja v a 2  s .  c o  m*/
        // get the new value
        if (evt.getNewValue() instanceof Disease)
            updateDisease = (Disease) evt.getNewValue();

        // assert we have a value
        if (updateDisease == null)
            return;

        // is this job the current -> update it
        if (disease.equals(updateDisease) || disease.getDiseaseName().equals(updateDisease.getDiseaseName())) {
            // save the updated disease
            setInput(new DiseaseEditorInput(updateDisease, false));
            setPartName(updateDisease.getDiseaseName());
            disease = updateDisease;
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("DISEASE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed job
        Disease removedDisease = (Disease) evt.getOldValue();
        // current open
        if (disease.equals(removedDisease)) {
            MessageDialog.openInformation(getSite().getShell(), "Erkrankung wurde gelscht",
                    "Die Erkrankung, welches Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.JobEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("JOB_UPDATE".equals(evt.getPropertyName()) || "JOB_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        Job updateJob = null;/*  w w w .j  a va 2 s.c  o m*/
        // get the new value
        if (evt.getNewValue() instanceof Job)
            updateJob = (Job) evt.getNewValue();

        // assert we have a value
        if (updateJob == null)
            return;

        // is this job the current -> update it
        if (job.equals(updateJob) || job.getJobName().equals(updateJob.getJobName())) {
            // save the updated job
            setInput(new JobEditorInput(updateJob, false));
            setPartName(updateJob.getJobName());
            job = updateJob;
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("JOB_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed job
        Job removedJob = (Job) evt.getOldValue();
        // current open
        if (job.equals(removedJob)) {
            MessageDialog.openInformation(getSite().getShell(), "Verwendung wurde gelscht",
                    "Die Verwendung, welches Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.LocationEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("LOCATION_UPDATE".equals(evt.getPropertyName())
            || "LOCATION_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        Location updateLocation = null;
        // get the new value
        if (evt.getNewValue() instanceof Location)
            updateLocation = (Location) evt.getNewValue();

        // assert we have a value
        if (updateLocation == null)
            return;

        // is this location is the current -> update it
        if (location.equals(updateLocation)
                || location.getLocationName().equals(updateLocation.getLocationName())) {
            // save the updated location
            setInput(new LocationEditorInput(updateLocation, false));
            setPartName(location.getLocationName());
            location = updateLocation;/*from   w ww.j av a  2 s  .  c  o  m*/
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("LOCATION_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed location
        Location removedLocation = (Location) evt.getOldValue();
        // current open?
        if (location.equals(removedLocation)) {
            MessageDialog.openInformation(getSite().getShell(), "Ortsstelle wurde gelscht",
                    "Die Ortsstelle, welches Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
    if ("PHONE_ADD".equalsIgnoreCase(evt.getPropertyName())
            || "PHONE_UPDATE".equalsIgnoreCase(evt.getPropertyName())
            || "PHONE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // just refresh the viewer to update the combo
        phoneViewer.refresh(true);
    }
}

From source file:at.rc.tacos.client.editors.MobilePhoneEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("PHONE_UPDATE".equals(evt.getPropertyName()) || "PHONE_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        MobilePhoneDetail updatePhone = null;
        // get the new value
        if (evt.getNewValue() instanceof MobilePhoneDetail)
            updatePhone = (MobilePhoneDetail) evt.getNewValue();

        // assert we have a value
        if (updatePhone == null)
            return;

        // is this mobile phone is the current one -> update it
        if (detail.equals(updatePhone) || (detail.getMobilePhoneName().equals(updatePhone.getMobilePhoneName())
                && detail.getMobilePhoneNumber().equals(updatePhone.getMobilePhoneNumber()))) {
            // save the updated phone
            setInput(new MobilePhoneEditorInput(updatePhone, false));
            setPartName(updatePhone.getMobilePhoneName() + " " + detail.getMobilePhoneNumber());
            detail = updatePhone;/*from w w  w .jav  a 2s. com*/
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("PHONE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed phone
        MobilePhoneDetail removedPhone = (MobilePhoneDetail) evt.getOldValue();
        // current edited?
        if (detail.equals(removedPhone)) {
            MessageDialog.openInformation(getSite().getShell(), "Mobiletelefon wurde gelscht",
                    "Das Mobiltelefon, welches Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.ServiceTypeEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("SERVICETYPE_UPDATE".equals(evt.getPropertyName())
            || "SERVICETYPE_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        ServiceType updateService = null;
        // get the new value
        if (evt.getNewValue() instanceof ServiceType)
            updateService = (ServiceType) evt.getNewValue();

        // assert we have a value
        if (updateService == null)
            return;

        // is this service type is the current -> update it
        if (serviceType.equals(updateService)
                || serviceType.getServiceName().equals(updateService.getServiceName())) {
            // save the updated service type
            setInput(new ServiceTypeEditorInput(updateService, false));
            setPartName(updateService.getServiceName());
            serviceType = updateService;
            isNew = false;/* w  w w  .ja  v  a2s. c o m*/
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("SERVICETYPE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed service type
        ServiceType removedService = (ServiceType) evt.getOldValue();
        // check the type
        if (serviceType.equals(removedService)) {
            MessageDialog.openInformation(getSite().getShell(), "Dienstverhltnis wurde gelscht",
                    "Das Dienstverhltnis, welches Sie gerade editieren, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.SickPersonEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("SICKPERSON_UPDATE".equals(evt.getPropertyName())
            || "SICKPERSON_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        SickPerson updatePerson = null;// w  ww. j  a v  a 2s.c om
        // get the new value
        if (evt.getNewValue() instanceof SickPerson)
            updatePerson = (SickPerson) evt.getNewValue();

        // assert we have a value
        if (updatePerson == null)
            return;

        // if this sick person is the current -> update it
        if (person.equals(updatePerson) || updatePerson.getLastName().equalsIgnoreCase(person.getLastName())) {
            // save the updated sick person
            setInput(new SickPersonEditorInput(updatePerson, false));
            setPartName(person.getLastName());
            person = updatePerson;
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("SICKPERSON_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // get the removed sick person
        SickPerson removedPerson = (SickPerson) evt.getOldValue();
        // current open?
        if (person.equals(removedPerson)) {
            MessageDialog.openInformation(getSite().getShell(), "Patient wurde gelscht",
                    "Der Patient, welchen sie gerade bearbeiten, wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
}

From source file:at.rc.tacos.client.editors.VehicleDetailEditor.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("VEHICLE_UPDATE".equals(evt.getPropertyName())
            || "VEHICLE_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        VehicleDetail updateVehicle = null;
        // get the new value
        if (evt.getNewValue() instanceof VehicleDetail)
            updateVehicle = (VehicleDetail) evt.getNewValue();

        // assert we have a value
        if (updateVehicle == null)
            return;

        // is this vehicle is the current one -> update it
        if (detail.equals(updateVehicle)
                || (detail.getVehicleName().equalsIgnoreCase(updateVehicle.getVehicleName())
                        && detail.getVehicleType().equalsIgnoreCase(updateVehicle.getVehicleType()))) {
            // save the updated competence
            setInput(new VehicleDetailEditorInput(updateVehicle, false));
            setPartName(updateVehicle.getVehicleType() + " " + updateVehicle.getVehicleName());
            detail = updateVehicle;//from   ww w  . java2s  .c o  m
            isNew = false;
            // update the editor
            loadData();
            // show the result
            isDirty = false;
            infoLabel.setText("nderungen gespeichert");
            infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("info.ok"));
            Display.getCurrent().beep();
        }
    }
    if ("VEHICLE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        // the removed vehicle
        VehicleDetail removedVehicle = (VehicleDetail) evt.getOldValue();
        // the current edited
        if (detail.equals(removedVehicle)) {
            MessageDialog.openInformation(getSite().getShell(), "Fahrzeug wurde gelscht",
                    "Das Fahrzeug welches Sie gerade editieren wurde gelscht");
            EditorCloseAction closeAction = new EditorCloseAction(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow());
            closeAction.run();
        }
    }
    // keep on track on location changes
    if ("LOCATION_ADD".equalsIgnoreCase(evt.getPropertyName())
            || "LOCATION_REMOVE".equalsIgnoreCase(evt.getPropertyName())
            || "LOCATION_UPDATE".equalsIgnoreCase(evt.getPropertyName())) {
        // just refresh the combo so that the new data is loaded
        basicLocationViewer.refresh(true);
        currentLocationViewer.refresh(true);
    }
    // keep on track on phone changes
    if ("PHONE_ADD".equalsIgnoreCase(evt.getPropertyName())
            || "PHONE_UPDATE".equalsIgnoreCase(evt.getPropertyName())
            || "PHONE_REMOVE".equalsIgnoreCase(evt.getPropertyName())) {
        phoneViewer.refresh(true);
    }
}

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

License:Open Source License

/**
 * Loops over the vehicles and updates the most important transport status
 * based on the assigned transports of the vehicle.<br>
 * This method is triggered each time a transport is updated.
 *//*from  www. j  a  va  2  s .  co  m*/
@Override
public void propertyChange(PropertyChangeEvent evt) {
    // to get the color status for the nef vehicle (--> add action)
    if ("TRANSPORT_ADD".equalsIgnoreCase(evt.getPropertyName())) {
        TransportManager transportManager = ModelFactory.getInstance().getTransportManager();
        // the added transport
        Transport transport = (Transport) evt.getNewValue();
        if (transport == null)
            return;

        // check if the transport has a vehicle
        VehicleDetail vehicle = transport.getVehicleDetail();
        if (vehicle == null)
            return;

        int index = objectList.indexOf(vehicle);
        VehicleDetail detail = objectList.get(index);
        if (detail == null)
            return;

        // get the list of transports and update the status color
        List<Transport> transportList = transportManager
                .getUnderwayTransportsByVehicle(detail.getVehicleName());
        checkVehicleColorState(transportList, detail);
    }
    if ("TRANSPORT_UPDATE".equalsIgnoreCase(evt.getPropertyName())) {
        // the transport manager
        TransportManager transportManager = ModelFactory.getInstance().getTransportManager();

        // assert valid transport
        Transport transport = (Transport) evt.getNewValue();
        if (transport == null)
            return;

        // to update the vehicle color status in case of detaching a vehicle
        // from a transport
        if (transport.getNotes() != null) {
            if (transport.getProgramStatus() == PROGRAM_STATUS_OUTSTANDING
                    && transport.getNotes().contains("Fahrzeugabzug")) {
                List<VehicleDetail> vehicleList = new ArrayList<VehicleDetail>();
                vehicleList = this.getReadyVehicleList();
                for (VehicleDetail detachedVehicle : vehicleList) {
                    // get the list of transports
                    List<Transport> vehicleDetachedTransportList = transportManager
                            .getUnderwayTransportsByVehicle(detachedVehicle.getVehicleName());
                    // simplest calculation comes first ;)
                    // green (30) is for a 'underway'(program status)
                    // vehicle not possible
                    if (vehicleDetachedTransportList.isEmpty()) {
                        detachedVehicle.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_GREEN);
                        NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detachedVehicle);
                        continue;
                    }
                    // status list
                    ArrayList<Integer> list = new ArrayList<Integer>();
                    // get the most important status of each transport
                    for (Transport trList : vehicleDetachedTransportList) {
                        int mostImportantStatus = trList.getMostImportantStatusMessageOfOneTransport();
                        list.add(mostImportantStatus);
                    }

                    // get most important status of one vehicle (from the
                    // list)
                    // for a 'red' status
                    if (list.contains(TRANSPORT_STATUS_START_WITH_PATIENT)
                            || list.contains(TRANSPORT_STATUS_OUT_OF_OPERATION_AREA)) {
                        detachedVehicle.setTransportStatus(VehicleDetail.TRANSPROT_STATUS_RED); // 10
                        NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detachedVehicle);
                        continue;
                    }
                    // for a 'yellow' status
                    detachedVehicle.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_YELLOW); // 20
                    NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detachedVehicle);
                    continue;
                }
            }
        }

        // assert valid
        VehicleDetail vehicle;
        if (transport.getVehicleDetail() == null) {
            // check the old vehicle of the transport
            if (evt.getOldValue() == null)
                return;
            vehicle = (VehicleDetail) evt.getOldValue();
        } else {
            vehicle = transport.getVehicleDetail();
        }

        int index = objectList.indexOf(vehicle);
        VehicleDetail detail = objectList.get(index);

        // get the list of transports and update the color
        List<Transport> transportList = transportManager
                .getUnderwayTransportsByVehicle(detail.getVehicleName());
        checkVehicleColorState(transportList, detail);
    }

    if ("ROSTERENTRY_UPDATE".equalsIgnoreCase(evt.getPropertyName())) {
        // the updated entry
        RosterEntry entry = (RosterEntry) evt.getNewValue();
        if (entry == null)
            return;

        // get the staff
        StaffMember member = entry.getStaffMember();
        if (member == null)
            return;

        // check if we have a vehicle for this member
        VehicleDetail detail = getVehicleOfStaff(member.getStaffMemberId());
        if (detail == null)
            return;

        // we need only to check staff members who signed out
        if (entry.getRealEndOfWork() == 0)
            return;

        // don't detach the staff member from the car if there is another
        // checked in entry
        RosterEntryManager rosterManager = ModelFactory.getInstance().getRosterEntryManager();
        RosterEntry checkedInEntry = rosterManager.getCheckedInRosterEntryByStaffId(member.getStaffMemberId());
        if (checkedInEntry != null) {
            // check if there is another signed in entry
            if (checkedInEntry.getRealEndOfWork() == 0) {
                return;
            }
        }

        // detach the staff member from the car
        // driver
        if (member.equals(detail.getDriver())) {
            detail.setDriver(null);
        }
        // paramedic
        if (member.equals(detail.getFirstParamedic())) {
            detail.setFirstParamedic(null);
        }
        // paramedic
        if (member.equals(detail.getSecondParamedic())) {
            detail.setSecondParamedic(null);
        }

        // adjust the status
        detail.setReadyForAction(false);
        detail.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_NA);
        NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detail);

        // show a message box
        MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Information",
                "Der Mitarbeiter " + member.getFirstName() + " " + member.getLastName()
                        + " hat sich abgemeldet.\n" + "Er wurde vom Fahrzeug " + detail.getVehicleName()
                        + " abgezogen");
    }
}

From source file:at.rc.tacos.client.splashHandlers.InteractiveSplashHandler.java

License:Open Source License

/**
 * Method to handle the ok button//w  ww.j  av  a2  s. c o  m
 */
private void handleButtonOKWidgetSelected() {
    // get the login values
    final String username = fTextUsername.getText();
    final String password = fTextPassword.getText();
    // try to login
    try {
        // create a new login object
        Login login = new Login(username, password, false);
        // send the login request
        NetWrapper.getDefault().sendLoginMessage(login);
        // hide the controls, show the progress
        toggelCheckProgress(true);
    } catch (IllegalArgumentException iae) {
        Display.getCurrent().beep();
        // show the warning message
        MessageDialog.openInformation(getSplash(), "Anmeldung",
                "Sie mssen einen Benutzernamen und ein Passwort eingeben um sich anzumelden");
    }
}