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

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

Introduction

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

Prototype

public int open() 

Source Link

Document

Opens this window, creating it first if it has not yet been created.

Usage

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(/*from   w  w  w .  j  av  a2  s  . co  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.core.ui.views.RezepteView.java

License:Open Source License

private void makeActions() {
    newRpAction = new Action(Messages.RezepteView_newPrescriptionAction) { //$NON-NLS-1$
        {/*from  w  w w  .  j a v  a 2s. co m*/
            setImageDescriptor(Images.IMG_NEW.getImageDescriptor());
            setToolTipText(Messages.RezepteView_newPrescriptonTooltip); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            if (act == null) {
                MessageBox mb = new MessageBox(getViewSite().getShell(), SWT.ICON_INFORMATION | SWT.OK);
                mb.setText(Messages.RezepteView_newPrescriptionError); //$NON-NLS-1$
                mb.setMessage(Messages.RezepteView_noPatientSelected); //$NON-NLS-1$
                mb.open();
                return;
            }
            Fall fall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
            if (fall == null) {
                Konsultation k = act.getLetzteKons(false);
                if (k == null) {
                    SWTHelper.alert(Messages.RezepteView_noCaseSelected, //$NON-NLS-1$
                            Messages.RezepteView_pleaseCreateOrChooseCase); //$NON-NLS-1$                     
                    return;
                }
            }
            Rezept rezept = new Rezept(act);
            tv.refresh();
            doSelectNewRezept(rezept);
            doAddLine();
        }
    };
    deleteRpAction = new Action(Messages.RezepteView_deletePrescriptionActiom) { //$NON-NLS-1$
        @Override
        public void run() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            if (MessageDialog.openConfirm(getViewSite().getShell(),
                    Messages.RezepteView_deletePrescriptionActiom, //$NON-NLS-1$
                    MessageFormat.format(Messages.RezepteView_deletePrescriptionConfirm, rp //$NON-NLS-1$
                            .getDate()))) {
                rp.delete();
                tv.refresh();
            }
        }
    };
    removeLineAction = new Action(Messages.RezepteView_deleteLineAction) { //$NON-NLS-1$
        @Override
        public void run() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            IStructuredSelection sel = (IStructuredSelection) lvRpLines.getSelection();
            Prescription p = (Prescription) sel.getFirstElement();
            if ((rp != null) && (p != null)) {
                rp.removePrescription(p);
                lvRpLines.refresh();
            }
            /*
             * RpZeile z=(RpZeile)sel.getFirstElement(); if((rp!=null) && (z!=null)){
             * rp.removeLine(z); lvRpLines.refresh(); }
             */
        }
    };
    addLineAction = new Action(Messages.RezepteView_newLineAction) { //$NON-NLS-1$
        @Override
        public void run() {
            doAddLine();
        }
    };
    printAction = new Action(Messages.RezepteView_printAction) { //$NON-NLS-1$
        @Override
        public void run() {
            try {
                RezeptBlatt rp = (RezeptBlatt) getViewSite().getPage().showView(RezeptBlatt.ID);
                Rezept actR = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
                Brief rpBrief = actR.getBrief();
                if (rpBrief == null)
                    // not yet created - just create a new Rezept
                    rp.createRezept(actR);
                else {
                    // Brief for Rezept already exists:
                    // ask if it should be recreated or just shown
                    String[] dialogButtonLabels = { Messages.RezepteView_RecreatePrescription,
                            Messages.RezepteView_ShowPrescription, Messages.RezepteView_PrescriptionCancel };
                    MessageDialog msg = new MessageDialog(null, Messages.RezepteView_CreatePrescription, //$NON-NLS-1$
                            null, Messages.RezepteView_ReallyWantToRecreatePrescription, //$NON-NLS-1$
                            MessageDialog.WARNING, dialogButtonLabels, 2);
                    int result = msg.open();
                    switch (result) {
                    case 0: // recreate rezept
                        rp.createRezept(actR);
                        break;
                    case 1: // open rezept
                        rp.loadRezeptFromDatabase(actR, rpBrief);
                        break;
                    case 2: // cancel or closebox - do nothing
                        break;
                    }
                }
            } catch (Exception ex) {
                ExHandler.handle(ex);
            }
        }
    };
    changeMedicationAction = new RestrictedAction(AccessControlDefaults.MEDICATION_MODIFY,
            Messages.RezepteView_ChangeLink) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_EDIT.getImageDescriptor());
            setToolTipText(Messages.RezepteView_ChangeTooltip); //$NON-NLS-1$
        }

        public void doRun() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            IStructuredSelection sel = (IStructuredSelection) lvRpLines.getSelection();
            Prescription pr = (Prescription) sel.getFirstElement();
            if (pr != null) {
                new MediDetailDialog(getViewSite().getShell(), pr).open();
                lvRpLines.refresh();
            }
        }
    };
    addLineAction.setImageDescriptor(Images.IMG_ADDITEM.getImageDescriptor());
    printAction.setImageDescriptor(Images.IMG_PRINTER.getImageDescriptor());
    deleteRpAction.setImageDescriptor(Images.IMG_DELETE.getImageDescriptor());
}

From source file:ch.elexis.Hub.java

License:Open Source License

/**
 * Programmende/*from   w  w w  .  jav a  2 s.c  o  m*/
 */
public static void postShutdown() {
    // heart.stop();
    // JobPool.getJobPool().dispose();
    if (Hub.actUser != null) {
        Anwender.logoff();
    }
    if (globalCfg != null) {
        // We should not flush at this point, since this might
        // overwrite other client's
        // settings
        // acl.flush();
        // globalCfg.flush();
    }

    // shutdownjobs are executed after the workbench has been shut down.
    // So those jobs must not use any of the workbench's resources.
    if ((shutdownJobs != null) && (shutdownJobs.size() > 0)) {
        Shell shell = new Shell(Display.getDefault());
        MessageDialog dlg = new MessageDialog(shell, Messages.Hub_title_configuration, Dialog.getDefaultImage(),
                Messages.Hub_message_configuration, SWT.ICON_INFORMATION, new String[] {}, 0);
        dlg.setBlockOnOpen(false);
        dlg.open();
        for (ShutdownJob job : shutdownJobs) {
            try {
                job.doit();
            } catch (Exception e) {
                log.log("Error starting job: " + e.getMessage(), Log.ERRORS);
            }
        }
        dlg.close();
    }
}

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 w  w  .  j  a va 2  s  . c om
    }
    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.elexis.views.RezepteView.java

License:Open Source License

private void makeActions() {
    newRpAction = new Action(Messages.getString("RezepteView.newPrescriptionAction")) { //$NON-NLS-1$
        {//from   w  w  w . j a v  a  2s  .  c o m
            setImageDescriptor(Images.IMG_NEW.getImageDescriptor());
            setToolTipText(Messages.getString("RezepteView.newPrescriptonTooltip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            if (act == null) {
                MessageBox mb = new MessageBox(getViewSite().getShell(), SWT.ICON_INFORMATION | SWT.OK);
                mb.setText(Messages.getString("RezepteView.newPrescriptionError")); //$NON-NLS-1$
                mb.setMessage(Messages.getString("RezepteView.noPatientSelected")); //$NON-NLS-1$
                mb.open();
                return;
            }
            Fall fall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
            if (fall == null) {
                Konsultation k = act.getLetzteKons(false);
                if (k == null) {
                    SWTHelper.alert(Messages.getString("RezepteView.noCaseSelected"), //$NON-NLS-1$
                            Messages.getString("RezepteView.pleaseCreateOrChooseCase")); //$NON-NLS-1$
                    return;
                } else {
                    fall = k.getFall();
                }
            }
            new Rezept(act);
            tv.refresh();
        }
    };
    deleteRpAction = new Action(Messages.getString("RezepteView.deletePrescriptionActiom")) { //$NON-NLS-1$
        @Override
        public void run() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            if (MessageDialog.openConfirm(getViewSite().getShell(),
                    Messages.getString("RezepteView.deletePrescriptionActiom"), //$NON-NLS-1$
                    MessageFormat.format(Messages.getString("RezepteView.deletePrescriptionConfirm"), rp //$NON-NLS-1$
                            .getDate()))) {
                rp.delete();
                tv.refresh();
            }
        }
    };
    removeLineAction = new Action(Messages.getString("RezepteView.deleteLineAction")) { //$NON-NLS-1$
        @Override
        public void run() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            IStructuredSelection sel = (IStructuredSelection) lvRpLines.getSelection();
            Prescription p = (Prescription) sel.getFirstElement();
            if ((rp != null) && (p != null)) {
                rp.removePrescription(p);
                lvRpLines.refresh();
            }
            /*
             * RpZeile z=(RpZeile)sel.getFirstElement(); if((rp!=null) && (z!=null)){
             * rp.removeLine(z); lvRpLines.refresh(); }
             */
        }
    };
    addLineAction = new Action(Messages.getString("RezepteView.newLineAction")) { //$NON-NLS-1$
        @Override
        public void run() {
            try {
                LeistungenView lv1 = (LeistungenView) getViewSite().getPage().showView(LeistungenView.ID);
                CodeSelectorHandler.getInstance().setCodeSelectorTarget(dropTarget);
                CTabItem[] tabItems = lv1.ctab.getItems();
                for (CTabItem tab : tabItems) {
                    ICodeElement ics = (ICodeElement) tab.getData();
                    if (ics instanceof Artikel) {
                        lv1.ctab.setSelection(tab);
                        break;
                    }
                }
            } catch (PartInitException ex) {
                ExHandler.handle(ex);
            }
        }
    };
    printAction = new Action(Messages.getString("RezepteView.printAction")) { //$NON-NLS-1$
        @Override
        public void run() {
            try {
                RezeptBlatt rp = (RezeptBlatt) getViewSite().getPage().showView(RezeptBlatt.ID);
                Rezept actR = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
                Brief rpBrief = actR.getBrief();
                if (rpBrief == null)
                    // not yet created - just create a new Rezept
                    rp.createRezept(actR);
                else {
                    // Brief for Rezept already exists:
                    // ask if it should be recreated or just shown
                    String[] dialogButtonLabels = { Messages.getString("RezepteView.RecreatePrescription"), //$NON-NLS-1$
                            Messages.getString("RezepteView.ShowPrescription"), //$NON-NLS-1$
                            Messages.getString("RezepteView.PrescriptionCancel") //$NON-NLS-1$
                    };
                    MessageDialog msg = new MessageDialog(null,
                            Messages.getString("RezepteView.CreatePrescription"), //$NON-NLS-1$
                            null, Messages.getString("RezepteView.ReallyWantToRecreatePrescription"), //$NON-NLS-1$
                            MessageDialog.WARNING, dialogButtonLabels, 2);
                    int result = msg.open();
                    switch (result) {
                    case 0: // recreate rezept
                        rp.createRezept(actR);
                        break;
                    case 1: // open rezept
                        rp.loadRezeptFromDatabase(actR, rpBrief);
                        break;
                    case 2: // cancel or closebox - do nothing
                        break;
                    }
                }
            } catch (Exception ex) {
                ExHandler.handle(ex);
            }
        }
    };
    changeMedicationAction = new RestrictedAction(AccessControlDefaults.MEDICATION_MODIFY,
            Messages.getString("RezepteView.ChangeLink")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_EDIT.getImageDescriptor());
            setToolTipText(Messages.getString("RezepteView.ChangeTooltip")); //$NON-NLS-1$
        }

        public void doRun() {
            Rezept rp = (Rezept) ElexisEventDispatcher.getSelected(Rezept.class);
            IStructuredSelection sel = (IStructuredSelection) lvRpLines.getSelection();
            Prescription pr = (Prescription) sel.getFirstElement();
            if (pr != null) {
                new MediDetailDialog(getViewSite().getShell(), pr).open();
                lvRpLines.refresh();
            }
        }
    };
    addLineAction.setImageDescriptor(Images.IMG_ADDITEM.getImageDescriptor());
    printAction.setImageDescriptor(Images.IMG_PRINTER.getImageDescriptor());
    deleteRpAction.setImageDescriptor(Images.IMG_DELETE.getImageDescriptor());
}

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

License:Open Source License

/** {@inheritDoc} */
@Override//from ww  w . j a 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.AbstractExpirationWithSerialNumberStrategy.java

@Override
public void showLicenseExpirationInProgressDialog() {
    String expireMessage = String.format(
            "You have %d days of %d evaluation period days left. You may continue evaluation or enter a serial number",
            getDaysLeft(), getExpirationPeriod());

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "Evaluation License", null,
            expireMessage, MessageDialog.INFORMATION,
            new String[] { "Continue Evaluation", "Enter Serial Number" }, 0);
    int result = dialog.open();
    if (result == 1) {
        showSerialNumberDialog();//from  ww w  . j av a  2 s.  c o m
    }
}

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  . j  a  va  2 s. c  o  m*/

    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:codeOrchestra.lcs.license.FastCompilerBetaExpirationStrategy.java

@Override
public boolean showLicenseExpiredDialog() {
    String expireMessage = "This copy of COLT has expired.";

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT 1.1 (beta)", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
    dialog.open();

    return false;
}

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

@SuppressWarnings("deprecation")
@Override// w  w  w  .j a va2 s . co m
public void showLicenseExpirationInProgressDialog() {
    String expireMessage = String.format("This copy of COLT will expire on %s",
            new Date(113, 5, 24).toLocaleString());

    MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), "COLT 1.1 (beta)", null,
            expireMessage, MessageDialog.INFORMATION, new String[] { "OK" }, 0);
    dialog.open();
}