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

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

Introduction

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

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:org.bbaw.pdr.ae.view.main.views.Treeview.java

License:Open Source License

@Override
public final void update(final Observable o, final Object arg) {
    IStatus sAspect = new Status(IStatus.INFO, Activator.PLUGIN_ID, "TreeView update: " + arg); //$NON-NLS-1$
    _iLogger.log(sAspect);/*from   ww w  .j a  v  a  2 s. c  o m*/

    //        System.out.println("treeviewer notified"); //$NON-NLS-1$

    if (arg.equals("newAspect")) //$NON-NLS-1$ //$NON-NLS-2$
    {
        if (_facade.getCurrentAspect() != null) {
            if (_facade.getCurrentPerson() != null) {
                if (_advanced) {
                    _addSimilarAspectButton.setEnabled(true);
                }
            }
            // _treeViewer.refresh();
        }
    } else if (arg.equals("newTreeObjects")) //$NON-NLS-1$
    {
        showCurrentPdrObject();
    } else if (arg.equals("noSelectedPerson")) //$NON-NLS-1$
    {

        _currentObjectText.setText(""); //$NON-NLS-1$

    } else if (arg.equals("newResultingPersons")) //$NON-NLS-1$
    {
        createTreeViewer(_tabFolderLeft, "Personen"); //$NON-NLS-1$

    } else if (arg.equals("newPersonTreeRequiered")) //$NON-NLS-1$
    {
        //          createTreeViewer(_tabFolderLeft, "allPersons"); //$NON-NLS-1$
        Object[] elements = _allPersonsTreeViewer.getExpandedElements();
        _allPersonsTreeViewer.setInput(_facade.getAllPersons());
        for (Object obj : elements) {
            _allPersonsTreeViewer.setExpandedState(obj, true);
        }
        showCurrentPdrObject();

    } else if (arg.equals("newAdvancedQuery")) //$NON-NLS-1$
    {
        searchAndBuildTree(_facade.getAdvancedQuery());

    } else if (arg.equals("newNewPerson")) //$NON-NLS-1$
    {
        Object[] elements = _allPersonsTreeViewer.getExpandedElements();
        _allPersonsTreeViewer.refresh();
        for (Object obj : elements) {
            _allPersonsTreeViewer.setExpandedState(obj, true);
        }
        showCurrentPdrObject();

    } else if (arg.equals("newNewReference")) //$NON-NLS-1$
    {
        Object[] elements = _allReferencesTreeViewer.getExpandedElements();
        _allReferencesTreeViewer.setInput(_facade.getAllReferences());
        for (Object obj : elements) {
            _allReferencesTreeViewer.setExpandedState(obj, true);
        }
        showCurrentPdrObject();

    } else if (arg.equals("refreshAll")) //$NON-NLS-1$
    {
        //
        _allReferencesTreeViewer.refresh();
        _allPersonsTreeViewer.refresh();
        disposeTabItems();
        buildTabFolderLeft();
        if (_advanced) {
            _addSimilarAspectButton.setEnabled(false);
        }

        showCurrentPdrObject();

    } else if (arg.equals("allPersons")) //$NON-NLS-1$
    {
        _allPersonsTreeViewer.setInput(_facade.getAllPersons());
        showCurrentPdrObject();
    } else if (arg.equals("allReferences")) //$NON-NLS-1$
    {
        _allReferencesTreeViewer.setInput(_facade.getAllReferences());
        showCurrentPdrObject();
    } else if (arg.equals("newPersonFacetProposals")) //$NON-NLS-1$
    {
        if (_facade.getFacetProposals() != null && !_facade.getFacetProposals().isEmpty()) {
            _comboSemanticViewer.setInput(_facade.getFacetProposals());
        } else {
            _comboSemanticViewer.setInput(null);
            MessageDialog messageDialog = new MessageDialog(_parentShell,
                    NLMessages.getString("View_message_person_facet_empty"), null,
                    NLMessages.getString("View_message_person_facet_customize"), MessageDialog.INFORMATION,
                    new String[] { NLMessages.getString("View_message_customize_person_facet_proposals"),
                            NLMessages.getString("Handler_cancel") },
                    0);
            int returnCode = messageDialog.open();
            if (returnCode == 0) {
                openPreferencePage("org.bbaw.pdr.ae.view.main.preferences.pages.FacetedSearch");
                if (_facade.getFacetProposals() != null && !_facade.getFacetProposals().isEmpty()) {
                    _comboSemanticViewer.setInput(_facade.getFacetProposals());
                }
            }
        }
        _comboSemanticViewer.refresh();
    } else if (arg.equals("newAspectFacetProposals")) //$NON-NLS-1$
    {
        if (_facade.getAspectFacetProposals() != null && !_facade.getAspectFacetProposals().isEmpty()) {
            _comboSemanticViewer.setInput(_facade.getAspectFacetProposals());
        } else {
            _comboSemanticViewer.setInput(null);
            MessageDialog messageDialog = new MessageDialog(_parentShell,
                    NLMessages.getString("View_message_aspect_facet_empty"), null,
                    NLMessages.getString("View_message_aspect_facet_customize"), MessageDialog.INFORMATION,
                    new String[] { NLMessages.getString("View_message_customize_aspect_facet_proposals"),
                            NLMessages.getString("Handler_cancel") },
                    0);
            int returnCode = messageDialog.open();
            if (returnCode == 0) {
                openPreferencePage("org.bbaw.pdr.ae.view.main.preferences.pages.FacetedAspectSearch");
                if (_facade.getAspectFacetProposals() != null && !_facade.getAspectFacetProposals().isEmpty()) {
                    _comboSemanticViewer.setInput(_facade.getAspectFacetProposals());
                }
            }

        }
        _comboSemanticViewer.refresh();
    }
}

From source file:org.bonitasoft.studio.designer.ui.contribution.OpenUIDesignerCoolBarItem.java

License:Open Source License

protected void openInformationDialogOnUiDesigner() {
    if (!getEclipsePreferences().getBoolean(HIDE_UIDESIGNER_INFO_DIALOG, false)) {
        MessageDialogWithPrompt.open(MessageDialog.INFORMATION, getShell(),
                Messages.openUiDesignerInformationWindowTitle, Messages.openUiDesignerInformationMessage,
                Messages.openUiDesignerInformationToggleMessage, false, getPreferenceStore(),
                HIDE_UIDESIGNER_INFO_DIALOG, SWT.NONE);
    }//ww w  .ja va 2s .  c  om
}

From source file:org.celllife.idart.gui.clinic.AddClinic.java

License:Open Source License

@Override
protected void cmdSaveWidgetSelected() {

    if (fieldsOk()) {
        Transaction tx = null;/*w  w w.  j  a  v a2  s  .com*/

        try {
            tx = getHSession().beginTransaction();

            NationalClinics nclinic = AdministrationManager.getNationalClinic(getHSession(),
                    cmbProvince.getText().trim(), cmbDistrict.getText().trim(), cmbSubDistrict.getText().trim(),
                    cmbFacility.getText().trim());

            if (localClinic == null && isAddnotUpdate) {
                localClinic = new Clinic();

                List<User> users = AdministrationManager.getUsers(getHSession());
                for (User usr : users) {
                    if (usr.getClinics() == null) {
                        usr.setClinics(new HashSet<Clinic>());
                    }

                    usr.getClinics().add(localClinic);
                }
            }

            localClinic.setNotes(txtClinicNotes.getText().trim());
            localClinic.setClinicName(txtClinic.getText().trim());
            localClinic.setTelephone(txtTelephone.getText().trim());
            localClinic.setClinicDetails(nclinic);

            AdministrationManager.saveClinic(getHSession(), localClinic);
            getHSession().flush();
            tx.commit();

            showMessage(MessageDialog.INFORMATION, "Database Updated",
                    "The Clinic '" + localClinic.getClinicName() + "' has been saved.");

        } catch (HibernateException he) {
            showMessage(MessageDialog.ERROR, "Problems Saving to the Database",
                    "There was a problem saving the Clinic's information to the database. Please try again.");
            if (tx != null) {
                tx.rollback();
            }
            getLog().error(he);
        }
        cmdCancelWidgetSelected();
    }

}

From source file:org.celllife.idart.gui.doctor.AddDoctor.java

License:Open Source License

@Override
protected void cmdSaveWidgetSelected() {

    if (fieldsOk()) {

        Transaction tx = null;/*from ww w  .  j a v  a 2  s .c  o m*/
        String action = ""; //$NON-NLS-1$

        try {
            tx = getHSession().beginTransaction();
            // this is a new doctor
            if (localDoctor == null && isAddnotUpdate) {

                localDoctor = new Doctor(txtDoctorSurname.getText(), txtDoctorFirstname.getText(),
                        txtTelephone.getText(), txtCellphoneNo.getText(), txtEmail.getText(), 'T',
                        rdBtnActive.getSelection() ? true : false, 0);
                action = Messages.getString("adddoctor.action"); //$NON-NLS-1$
                AdministrationManager.saveDoctor(getHSession(), localDoctor);

            }

            // else, we're updating an existing doctor
            else if (localDoctor != null && !isAddnotUpdate) {
                localDoctor.setLastname(txtDoctorSurname.getText());
                localDoctor.setFirstname(txtDoctorFirstname.getText());
                localDoctor.setTelephoneno(txtTelephone.getText());
                localDoctor.setMobileno(txtCellphoneNo.getText());
                localDoctor.setEmailAddress(txtEmail.getText());
                localDoctor.setActive(rdBtnActive.getSelection() ? true : false);
                action = Messages.getString("adddoctor.updated"); //$NON-NLS-1$
            }

            getHSession().flush();
            tx.commit();
            String message = MessageFormat.format(Messages.getString("adddoctor.message"), //$NON-NLS-1$
                    localDoctor.getFullname(), action);
            showMessage(MessageDialog.INFORMATION, Messages.getString("adddoctor.messageupdate"), message);//$NON-NLS-1$ 
            fireChangeEvent(localDoctor);
            cmdCancelWidgetSelected();
        } catch (HibernateException he) {
            getLog().error(Messages.getString("adddoctor.errordb"), he); //$NON-NLS-1$
            showMessage(MessageDialog.ERROR, Messages.getString("adddoctor.errordb"), //$NON-NLS-1$ 
                    Messages.getString("adddoctor.errordb.saving"));//$NON-NLS-1$
            if (tx != null) {
                tx.rollback();
            }
        }

    }

}

From source file:org.celllife.idart.gui.parameter.UpdateParameter.java

License:Open Source License

@Override
protected void cmdSaveWidgetSelected() {

    if (fieldsOk()) {

        Transaction tx = null;//from  ww w.  j a  v a2 s. co m
        String action = ""; //$NON-NLS-1$

        try {
            tx = getHSession().beginTransaction();

            Integer amcData = Integer.parseInt(txtValue.getText());
            if (amcData.intValue() <= 0 || amcData.intValue() >= 29) {
                JOptionPane.showMessageDialog(null, "Please select a number between 1 and 28");
                return;
            }

            localParameter.setParameterValue(txtValue.getText());

            getHSession().flush();
            tx.commit();
            String message = MessageFormat.format(Messages.getString("adddoctor.message"), //$NON-NLS-1$
                    localParameter.getParameterValue(), action);
            showMessage(MessageDialog.INFORMATION, Messages.getString("adddoctor.messageupdate"), message);//$NON-NLS-1$ 
            fireChangeEvent(localParameter);
            cmdCancelWidgetSelected();
        } catch (HibernateException he) {
            getLog().error(Messages.getString("adddoctor.errordb"), he); //$NON-NLS-1$
            showMessage(MessageDialog.ERROR, Messages.getString("adddoctor.errordb"), //$NON-NLS-1$ 
                    Messages.getString("adddoctor.errordb.saving"));//$NON-NLS-1$
            if (tx != null) {
                tx.rollback();
            }
        }

    }

}

From source file:org.celllife.idart.gui.reportParameters.CohortDrugCollections.java

License:Open Source License

@Override
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;/*from  w  w  w  .  j  a  v a 2 s .  c o m*/
    }

    SafeSaveDialog dialog = new SafeSaveDialog(getShell(), FileType.EXCEL);
    String path = "";
    dialog.setFileName("Cohort_Drug_Collections_report");
    path = dialog.open();

    if (path != null) {
        ExcelReportObject reportObject = getColumnsFromTables(path);
        EntitySet patients = getPatientSet(reportObject);
        if (patients.size() <= 0) {
            showMessage(MessageDialog.INFORMATION, "No patients", "No patients have a '"
                    + Episode.REASON_NEW_PATIENT + "' episode starting between the selected dates");
            return;
        }
        viewReport(new ExcelReportJob(reportObject, new RowPerPatientExcelExporter(patients)));
        showMessage(MessageDialog.INFORMATION, "Report complete",
                "Report generation complete.\n\n" + reportObject.getPath());
    }
}

From source file:org.celllife.idart.gui.reportParameters.DrugsDispensed.java

License:Open Source License

@Override
protected void cmdViewReportWidgetSelected() {

    if (cmbPharmacy.getText().equals("")) {
        showMessage(MessageDialog.ERROR, "No Pharmacy Was Selected",
                "No pharmacy was selected. Please select a pharmacy by looking through the list of available pharmacies.");
        return;//from www. j  av a2  s. co m
    }

    StockCenter pharm = AdministrationManager.getStockCenter(getHSession(), cmbPharmacy.getText());

    if (pharm == null) {
        showMessage(MessageDialog.ERROR, "Pharmacy not found", "There is no pharmacy called '"
                + cmbPharmacy.getText()
                + "' in the database. Please select a pharmacy by looking through the list of available pharmacies.");
        return;
    }

    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;
    }

    SafeSaveDialog dialog = new SafeSaveDialog(getShell(), FileType.EXCEL);
    String path = "";
    dialog.setFileName("Drugs_Dispensed_Report");
    path = dialog.open();

    if (path != null) {
        ExcelReportObject reportObject = getColumnsFromTables(path);
        viewReport(new ExcelReportJob(reportObject, new RowPerPackageExcelExporter()));
        showMessage(MessageDialog.INFORMATION, "Report complete",
                "Report generation complete.\n\n" + reportObject.getPath());
    }
}

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/*from  ww w  .j  av a2s  . c om*/
        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;
    }//w w w.ja  v  a 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.dawb.passerelle.editors.UserModifyComposite.java

License:Open Source License

protected void doConfirm() {
    tableViewer.applyEditorValue();//w  w  w .  jav  a2s  .co m
    tableViewer.cancelEditing();
    if (queue == null || values == null) {
        MessageDialog.open(MessageDialog.INFORMATION, Display.getCurrent().getActiveShell(), "Cannot confirm",
                "The workflow is not waiting for you to confirm these values.\n\nThere is currently nothing to confirm.",
                SWT.NONE);
        return;
    }
    if (queue.isEmpty())
        queue.add(values);
}