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

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

Introduction

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

Prototype

int QUESTION

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

Click Source Link

Document

Constant for the question image, or a simple dialog with the question image and Yes/No buttons (value 3).

Usage

From source file:ch.elexis.agenda.data.Termin.java

License:Open Source License

public boolean delete(boolean askForConfirmation) {
    boolean confirmed = !askForConfirmation;
    if (checkLock()) {
        return false;
    }//from   ww  w . ja v a 2  s . c  o  m
    String linkgroup = get(FLD_LINKGROUP); //$NON-NLS-1$
    boolean isLinked = linkgroup != null && !linkgroup.isEmpty();

    if (isLinked && askForConfirmation) {
        MessageDialog msd = new MessageDialog(UiDesk.getTopShell(), Messages.Termin_deleteSeries, null,
                Messages.Termin_thisAppIsPartOfSerie, MessageDialog.QUESTION,
                new String[] { Messages.Termin_yes, Messages.Termin_no }, 1);
        int retval = msd.open();
        if (retval == SWT.DEFAULT) {
            return false;
        }
        confirmed = (retval == Dialog.OK);
    }
    if (isLinked) {
        List<Termin> linked = getLinked(this);
        if (confirmed) {
            // delete whole series
            for (Termin ae : (List<Termin>) linked) {
                ae.set(new String[] { FLD_LASTEDIT, FLD_DELETED },
                        new String[] { createTimeStamp(), StringConstants.ONE });
            }
        } else {
            if (getId().equals(linkgroup)) {
                // move root information
                if (linked.size() > 1) {
                    int index = 0;
                    Termin moveto = linked.get(index);
                    while (moveto.getId().equals(linkgroup)) {
                        moveto = linked.get(++index);
                    }
                    moveto.set(Termin.FLD_PATIENT, get(Termin.FLD_PATIENT));
                    moveto.set(Termin.FLD_GRUND, get(Termin.FLD_GRUND));
                    moveto.set(Termin.FLD_CREATOR, get(Termin.FLD_CREATOR));
                    moveto.set(Termin.FLD_EXTENSION, get(Termin.FLD_EXTENSION));
                    for (Termin termin : linked) {
                        termin.set(Termin.FLD_LINKGROUP, moveto.getId());
                    }
                }
            }
            // delete this
            set(new String[] { FLD_DELETED, FLD_LASTEDIT }, StringConstants.ONE, createTimeStamp());
        }
    } else {
        // delete this
        set(new String[] { FLD_DELETED, FLD_LASTEDIT }, StringConstants.ONE, createTimeStamp());
    }
    return true;
}

From source file:ch.elexis.core.ui.stock.dialogs.ImportArticleDialog.java

License:Open Source License

private void doImport() {

    StringBuffer buf = new StringBuffer();

    // check for store availability
    final List<String> storeIds = ArticleServiceHolder.getStoreIds();
    if (storeIds.isEmpty()) {
        buf.append(//w w  w  .ja va 2  s.  c o m
                "Es ist kein Artikelservice registriert. Vergewissern Sie sich, dass zumindest ein Artikel Plugin installiert ist.");
    } else {
        // check for stock availability
        StructuredSelection iSelection = (StructuredSelection) comboStockType.getSelection();
        if (iSelection.isEmpty()) {
            buf.append("Bitte whlen Sie ein Lager aus.");
        } else {
            final Stock stock = (Stock) iSelection.getFirstElement();

            // check src file
            String path = tFilePath.getText();
            if (path != null && !path.isEmpty() && path.toLowerCase().endsWith("xls")) {

                try (FileInputStream is = new FileInputStream(tFilePath.getText())) {
                    ExcelWrapper xl = new ExcelWrapper();
                    if (xl.load(is, 0)) {
                        xl.setFieldTypes(new Class[] { Integer.class, String.class, String.class, String.class,
                                String.class, String.class, Integer.class, String.class, String.class });
                        MessageDialog dialog = new MessageDialog(getShell(), "Datenimport", null,
                                "Wie sollen die Datenbestnde importiert werden ?", MessageDialog.QUESTION, 0,
                                "Datenbestand 'exakt' importieren", "Datenbestand 'aufaddieren'");
                        int ret = dialog.open();
                        if (ret >= 0) {
                            runImport(buf, storeIds, stock, xl, ret == 0);
                        }
                        return;
                    }
                } catch (IOException e) {
                    MessageDialog.openError(getShell(), "Import error",
                            "Import fehlgeschlagen.\nDatei nicht importierbar: " + path);
                    LoggerFactory.getLogger(ImportArticleDialog.class).error("cannot import file at " + path,
                            e);
                }
            } else {
                buf.append("Die Quelldatei ist ungltig. Bitte berprfen Sie diese Datei.\n" + path);
            }
        }
    }
    if (buf.length() > 0) {
        MessageDialog.openInformation(getShell(), "Import Ergebnis", buf.toString());
    } else {
        MessageDialog.openWarning(getShell(), "Import Ergebnis",
                "Import nicht mglich.\nberprfen Sie das Log-File.");
    }
}

From source file:ch.elexis.views.KonsDetailView.java

License:Open Source License

@Override
public void createPartControl(final Composite p) {
    org.eclipse.swt.graphics.Image icon = Desk.getImage(ICON);
    if (icon != null) {
        setTitleImage(icon);//from   w ww .  j a  v a2s . com
    }
    sash = new SashForm(p, SWT.VERTICAL);

    tk = Desk.getToolkit();
    form = tk.createForm(sash);
    form.getBody().setLayout(new GridLayout(1, true));
    form.setText(NO_CONS_SELECTED);
    cEtiketten = new Composite(form.getBody(), SWT.NONE);
    cEtiketten.setLayout(new RowLayout(SWT.HORIZONTAL));
    cEtiketten.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    cDesc = new Composite(form.getBody(), SWT.NONE);
    cDesc.setLayout(new RowLayout(SWT.HORIZONTAL));
    cDesc.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
    lBeh = tk.createLabel(cDesc, NO_CONS_SELECTED);
    emFont = Desk.getFont("Helvetica", 11, SWT.BOLD); //$NON-NLS-1$
    lBeh.setFont(emFont);
    defaultBackground = p.getBackground();
    // lBeh.setBackground();
    hlMandant = tk.createHyperlink(cDesc, "--", SWT.NONE); //$NON-NLS-1$
    hlMandant.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            KontaktSelektor ksl = new KontaktSelektor(getSite().getShell(), Mandant.class,
                    Messages.getString("KonsDetailView.SelectMandatorCaption"), //$NON-NLS-1$
                    Messages.getString("KonsDetailView.SelectMandatorBody"),
                    new String[] { Mandant.FLD_SHORT_LABEL, Mandant.FLD_NAME1, Mandant.FLD_NAME2 }); //$NON-NLS-1$
            if (ksl.open() == Dialog.OK) {
                actKons.setMandant((Mandant) ksl.getSelection());
                setKons(actKons);
            }
        }

    });
    hlMandant.setBackground(p.getBackground());

    cbFall = new Combo(form.getBody(), SWT.SINGLE);
    cbFall.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            Fall[] faelle = (Fall[]) cbFall.getData();
            int i = cbFall.getSelectionIndex();
            if (i > -1 && i < faelle.length) {
                Fall nFall = faelle[i];

                Fall actFall = null;
                String fallId = "";
                if (actKons != null) {
                    actFall = actKons.getFall();
                    fallId = actFall.getId();
                }

                if (!nFall.getId().equals(fallId)) {
                    if (!nFall.isOpen()) {
                        SWTHelper.alert(Messages.getString("KonsDetailView.CaseClosedCaption"), //$NON-NLS-1$
                                Messages.getString("KonsDetailView.CaseClosedBody")); //$NON-NLS-1$
                    } else {
                        MessageDialog msd = new MessageDialog(getViewSite().getShell(),
                                Messages.getString("KonsDetailView.ChangeCaseCaption"), //$NON-NLS-1$
                                Images.IMG_LOGO48.getImage(),
                                MessageFormat.format(
                                        Messages.getString("KonsDetailView.ConfirmChangeConsToCase"),
                                        new Object[] { actFall.getLabel(), nFall.getLabel() }),
                                MessageDialog.QUESTION, new String[] { Messages.getString("KonsDetailView.Yes"), //$NON-NLS-1$
                                        Messages.getString("KonsDetailView.No") }, //$NON-NLS-1$
                                0);
                        if (msd.open() == 0) {
                            actKons.setFall(nFall);
                            setKons(actKons);
                        }
                    }
                }
            }
        }

    });
    GridData gdFall = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    cbFall.setLayoutData(gdFall);

    lVersion = tk.createLabel(form.getBody(), Messages.getString("KonsDetailView.actual")); //$NON-NLS-1$
    GridData gdVer = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    lVersion.setLayoutData(gdVer);

    text = new EnhancedTextField(form.getBody());
    hXrefs = new Hashtable<String, IKonsExtension>();
    @SuppressWarnings("unchecked")
    List<IKonsExtension> xrefs = Extensions.getClasses("ch.elexis.KonsExtension", "KonsExtension"); //$NON-NLS-1$ //$NON-NLS-2$
    for (IKonsExtension x : xrefs) {
        String provider = x.connect(text);
        hXrefs.put(provider, x);
    }
    text.setXrefHandlers(hXrefs);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL
            | GridData.GRAB_HORIZONTAL);
    text.setLayoutData(gd);
    tk.adapt(text);
    SashForm bf = new SashForm(sash, SWT.HORIZONTAL);

    Composite botleft = tk.createComposite(bf);
    botleft.setLayout(new GridLayout(1, false));
    Composite botright = tk.createComposite(bf);
    botright.setLayout(new GridLayout(1, false));

    dd = new DiagnosenDisplay(getSite().getPage(), botleft, SWT.NONE);
    dd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    vd = new VerrechnungsDisplay(getSite().getPage(), botright, SWT.NONE);
    vd.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    getSite().registerContextMenu(ID + ".VerrechnungsDisplay", vd.contextMenuManager, vd.viewer);
    getSite().setSelectionProvider(vd.viewer);

    makeActions();
    ViewMenus menu = new ViewMenus(getViewSite());
    if (Hub.acl.request(AccessControlDefaults.AC_PURGE)) {
        menu.createMenu(versionFwdAction, versionBackAction, GlobalActions.neueKonsAction,
                GlobalActions.delKonsAction, GlobalActions.redateAction, assignStickerAction, purgeAction);
    } else {
        menu.createMenu(versionFwdAction, versionBackAction, GlobalActions.neueKonsAction,
                GlobalActions.delKonsAction, GlobalActions.redateAction, assignStickerAction);
    }
    sash.setWeights(sashWeights == null ? new int[] { 80, 20 } : sashWeights);

    menu.createToolbar(GlobalActions.neueKonsAction, saveAction);
    GlobalEventDispatcher.addActivationListener(this, this);
    text.connectGlobalActions(getViewSite());
    adaptMenus();
    setKons((Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class));
}

From source file:ch.netcetera.eclipse.workspaceconfig.ui.handler.WorkspaceStartupHandler.java

License:Open Source License

/** {@inheritDoc} */
@Override/*w w  w  .ja va 2 s.  c  o m*/
public void earlyStartup() {
    final IWorkbench workbench = PlatformUI.getWorkbench();
    final String bundleId = FrameworkUtil.getBundle(getClass()).getSymbolicName();
    boolean isNewWorkspace = WorkspaceConfigurationStatusUtil.isNewWorkspace();
    boolean checkEnabled = Platform.getPreferencesService().getBoolean(bundleId,
            WorkspaceConfigurationConstants.CONFIG_STARTUP_CHECK, true, null);
    boolean urlConfigured = ConfigurationUtil.isEpfUrlConfigured();

    if (checkEnabled && isNewWorkspace && urlConfigured) {

        workbench.getDisplay().asyncExec(new Runnable() {

            @Override
            public void run() {
                IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
                if (window != null) {
                    String[] buttonLabels = new String[] {
                            WorkspaceConfigurationUIPlugin.getDefault()
                                    .getText("startup.handler.dialog.button.yes"),
                            WorkspaceConfigurationUIPlugin.getDefault()
                                    .getText("startup.handler.dialog.button.no"),
                            WorkspaceConfigurationUIPlugin.getDefault()
                                    .getText("startup.handler.dialog.button.ask.again") };
                    String message = WorkspaceConfigurationUIPlugin.getDefault()
                            .getText("startup.handler.dialog.text");
                    Image titleImage = WorkspaceConfigurationUIPlugin
                            .getImageDescriptor(PluginImages.IMG_DIALOG_TITLE).createImage();
                    String title = WorkspaceConfigurationUIPlugin.getDefault()
                            .getText("startup.handler.dialog.title");
                    MessageDialog dialog = new MessageDialog(window.getShell(), title, titleImage, message,
                            MessageDialog.QUESTION, buttonLabels, 0);
                    int result = dialog.open();

                    if (result == IMPORT_CONFIG) {
                        applySettings();
                        WorkspaceConfigurationStatusUtil.writeConfiguredFlag();
                    } else if (result == DO_NOT_IMPORT_CONFIG) {
                        WorkspaceConfigurationStatusUtil.writeNoConfigFlag();
                    }
                    // else: do nothing
                }
            }

            private void applySettings() {
                IHandlerService service = (IHandlerService) workbench.getService(IHandlerService.class);
                try {
                    service.executeCommand(ImportWorkspaceConfigurationHandler.COMMAND_ID, null);
                } catch (CommandException e) {
                    ILog log = WorkspaceConfigurationUIPlugin.getDefault().getLog();
                    log.log(new Status(IStatus.ERROR, bundleId, "applying settings failed", e));
                    displayErrorDialog();
                }
            }
        });
    }
}

From source file:codeOrchestra.lcs.license.CalendarUsageDayExpirationStrategy.java

@Override
public boolean showLicenseExpiredDialog() {
    String expireMessage = String.format(
            "%d day(s) evaluation license has expired. The programm will quit unless you enter a serial number",
            getExpirationPeriod());/*  w w w .  java2  s.com*/

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "Evaluation License", null,
            expireMessage, MessageDialog.QUESTION, new String[] { "Exit", "Enter Serial Number" }, 0);

    int result = dialog.open();
    if (result == 1) {
        return showSerialNumberDialog();
    }

    return false;
}

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private boolean isSaveModifiedEditor(String editorName) {
    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_4, null,
            Messages.ImportItemsWizard_5 + editorName + Messages.ImportItemsWizard_6, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
    dialog.open();/*  w ww.ja  v  a 2 s. co m*/
    if (dialog.getReturnCode() == 0) {
        return true;
    }
    return false;
}

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private int isOveride(String name, String obTypeName) {

    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_12, null,
            Messages.ImportItemsWizard_13 + obTypeName + Messages.ImportItemsWizard_14 + name
                    + Messages.ImportItemsWizard_15,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            0);/*from w ww.  j  av a2s  .  c om*/
    dialog.open();
    int result = dialog.getReturnCode();
    if (result == 0) {
        return IDialogConstants.YES_ID;
    }
    if (result == 1) {
        return IDialogConstants.YES_TO_ALL_ID;
    }
    if (result == 2) {
        return IDialogConstants.NO_ID;
    }
    return IDialogConstants.CANCEL_ID;

}

From source file:com.amazonaws.eclipse.ec2.ui.views.instances.DeviceDialog.java

License:Apache License

/**
 * Creates a new DeviceDialog ready to be opened.
 *///from w  w w  .j  a  v  a 2 s  .  c  om
public DeviceDialog() {
    super(new Shell(), "Select Device", null, "Select the device to attach this volume to.",
            MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0);
}

From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.IAMOperationNotAllowedErrorDialog.java

License:Open Source License

public IAMOperationNotAllowedErrorDialog(Shell parentShell) {
    super(parentShell, TITLE, AwsToolkitCore.getDefault().getImageRegistry().get(IMAGE_NAME), MESSAGE,
            MessageDialog.QUESTION,
            new String[] { "Reload", "Proceed without a profile", "Use the specified profile" },
            RETRY_IAM_OPERATION);//ww  w.  j ava  2 s .  c om
}

From source file:com.amazonaws.eclipse.explorer.s3.actions.DeleteBucketAction.java

License:Apache License

private Dialog newConfirmationDialog(String title, String message) {
    return new MessageDialog(Display.getDefault().getActiveShell(), title, null, message,
            MessageDialog.QUESTION, new String[] { "No", "Yes" }, 1);
}