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:carisma.modeltype.bpmn2.popup.ConvertEmfAction.java

License:Open Source License

/**
 * //from  ww w  .j  ava2  s.  com
 * @param inputFile
 * @param outputFile
 */
private void startEmfTransformation(String inputFile, String outputFile) {
    File model = new File(inputFile);
    if (YaoqiangHelper.emf2yaoqiangModel(inputFile, outputFile)) {
        MessageDialog.openInformation(this.shell, "CARiSMA",
                "Successfully transformed model " + model.getName() + ".");
    } else {
        MessageDialog.openError(this.shell, "Carisma", "Error during transformation!");
    }
}

From source file:carisma.modeltype.bpmn2.popup.ConvertYaoqiangAction.java

License:Open Source License

/**
 * //from   www  . j a va2  s  . c  om
 * @param inputFile
 * @param outputFile
 */
private void startYaoqiangTransformation(final String inputFile, final String outputFile) {
    File model = new File(inputFile);
    if (YaoqiangHelper.yaoqiang2emfModel(inputFile, outputFile)) {
        MessageDialog.openInformation(this.shell, "CARiSMA",
                "Successfully transformed model " + model.getName() + ".");
    } else {
        MessageDialog.openError(this.shell, "Carisma", "Error during transformation!");
    }
}

From source file:cbc.helpers.Helper.java

License:Open Source License

public void message(String message) {
    MessageDialog.openInformation(window.getShell(), name, message);
}

From source file:cc.warlock.rcp.application.WarlockUpdates.java

License:Open Source License

public static void checkForUpdates(final Shell parent) {
    try {/*w  ww  .  ja v a  2s.  c om*/
        System.out.println("Checking for updates...");

        String repository_loc = updateProperties.getProperty(UPDATE_SITE);
        System.out.println("Using repository: " + repository_loc);

        BundleContext context = FrameworkUtil.getBundle(WarlockUpdates.class).getBundleContext();
        ServiceReference<?> reference = context.getServiceReference(IProvisioningAgent.SERVICE_NAME);
        if (reference == null) {
            System.out.println("No service reference");
            return;
        }
        IProvisioningAgent agent = (IProvisioningAgent) context.getService(reference);
        ProvisioningSession session = new ProvisioningSession(agent);
        UpdateOperation operation = new UpdateOperation(session);

        // Create uri
        URI uri = null;
        try {
            uri = new URI(repository_loc);
        } catch (URISyntaxException e) {
            System.out.println("URI invalid: " + e.getMessage());
            return;
        }

        operation.getProvisioningContext().setArtifactRepositories(new URI[] { uri });
        operation.getProvisioningContext().setMetadataRepositories(new URI[] { uri });

        //Update[] updates = operation.getPossibleUpdates();
        IProgressMonitor monitor = new NullProgressMonitor();
        IStatus status = operation.resolveModal(monitor);

        // Failed to find updates (inform user and exit)
        if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
            System.out.println("No update");
            MessageDialog.openWarning(parent, "No update",
                    "No updates for the current installation have been found");
            return /*Status.CANCEL_STATUS*/;
        }

        // found updates, ask user if to install?
        if (status.isOK() && status.getSeverity() != IStatus.ERROR) {
            ProvisioningJob job = operation.getProvisioningJob(monitor);
            if (job == null) {
                System.out.println("Error with update (running in eclipse?)");
                MessageDialog.openInformation(parent, "Resolution",
                        operation.getResolutionDetails() + "\nLikely cause is from running inside Eclipse.");
            } else {
                System.out.println("Scheduling update");
                job.schedule();
            }
        } else {
            System.out.println("Error with update");
            MessageDialog.openError(parent, "Error updating", operation.getResolutionDetails());
        }
        context.ungetService(reference);
    } catch (Exception e) {
        System.out.println("Unexpected exception in updater: " + e.getMessage());
        e.printStackTrace();
    }
}

From source file:ccw.actions.ToggleNatureAction.java

License:Open Source License

private void toggleNature(IProject project) {
    String title = "Change Clojure language support";
    String message;/*from   w  ww  .  j a  v a2s. com*/
    try {
        boolean added = doToggleNature(project);
        message = "Clojure language support successfully " + (added ? "added" : "removed") + ".";
    } catch (CoreException e) {
        message = "Error while trying to toggle clojure language support for project " + project.getName()
                + ":";
        if (e.getMessage() != null) {
            message += "\n\n" + e.getMessage();
        }
        CCWPlugin.logError(message, e);
    }
    MessageDialog.openInformation(targetPart.getSite().getShell(), title, message);
}

From source file:ccw.commands.ToggleClojureNatureCommand.java

License:Open Source License

public static void toggleNature(IProject project, boolean quiet) {
    final String title = "Change Clojure language support";
    String mess;/*from w ww.jav  a2  s .c o m*/

    try {
        boolean added = doToggleNature(project);
        mess = "Clojure language support successfully " + (added ? "added" : "removed") + " for project "
                + project.getName() + ".";
    } catch (CoreException e) {
        mess = "Error while trying to toggle clojure language support for project " + project.getName() + ":";
        if (e.getMessage() != null) {
            mess += "\n\n" + e.getMessage();
        }
        CCWPlugin.logError(mess, e);
    }
    final String message = mess;

    if (quiet) {
        CCWPlugin.log(title + " : " + message);
    } else {
        DisplayUtil.asyncExec(new Runnable() {
            @Override
            public void run() {
                MessageDialog.openInformation(Display.getCurrent().getActiveShell(), title, message);
            }
        });
    }
}

From source file:ccw.commands.ToggleNatureCommand.java

License:Open Source License

public static void toggleNature(IProject project, boolean quiet) {
    final String title = "Change Clojure language support";
    String mess;/*from   w  w  w . j a v  a2 s. c om*/

    try {
        boolean added = doToggleNature(project);
        mess = "Clojure language support successfully " + (added ? "added" : "removed") + " for project "
                + project.getName() + ".";
    } catch (CoreException e) {
        mess = "Error while trying to toggle clojure language support for project " + project.getName() + ":";
        if (e.getMessage() != null) {
            mess += "\n\n" + e.getMessage();
        }
        CCWPlugin.logError(mess, e);
    }
    final String message = mess;

    if (quiet) {
        CCWPlugin.log(title + " : " + message);
    } else {
        DisplayUtil.asyncExec(new Runnable() {
            public void run() {
                MessageDialog.openInformation(Display.getCurrent().getActiveShell(), title, message);
            }
        });
    }
}

From source file:ch.droptilllate.application.handlers.AboutHandler.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    MessageDialog.openInformation(shell, "About", "DropTillLate");
}

From source file:ch.elexis.actions.GlobalActions.java

License:Open Source License

public GlobalActions(final IWorkbenchWindow window) {
    if (Hub.mainActions != null) {
        return;/*from  ww  w  .jav  a  2  s  .  c om*/
    }
    logger = LoggerFactory.getLogger(this.getClass());
    mainWindow = window;
    help = Hub.plugin.getWorkbench().getHelpSystem();
    exitAction = ActionFactory.QUIT.create(window);
    exitAction.setText(Messages.getString("GlobalActions.MenuExit")); //$NON-NLS-1$
    newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
    newWindowAction.setText(Messages.getString("GlobalActions.NewWindow")); //$NON-NLS-1$
    copyAction = ActionFactory.COPY.create(window);
    copyAction.setText(Messages.getString("GlobalActions.Copy")); //$NON-NLS-1$
    cutAction = ActionFactory.CUT.create(window);
    cutAction.setText(Messages.getString("GlobalActions.Cut")); //$NON-NLS-1$
    pasteAction = ActionFactory.PASTE.create(window);
    pasteAction.setText(Messages.getString("GlobalActions.Paste")); //$NON-NLS-1$
    aboutAction = ActionFactory.ABOUT.create(window);
    aboutAction.setText(Messages.getString("GlobalActions.MenuAbout")); //$NON-NLS-1$
    // helpAction=ActionFactory.HELP_CONTENTS.create(window);
    // helpAction.setText(Messages.getString("GlobalActions.HelpIndex")); //$NON-NLS-1$
    prefsAction = ActionFactory.PREFERENCES.create(window);
    prefsAction.setText(Messages.getString("GlobalActions.Preferences")); //$NON-NLS-1$
    savePerspectiveAction = new Action(Messages.getString("GlobalActions.SavePerspective")) { //$NON-NLS-1$
        {
            setId("savePerspektive"); //$NON-NLS-1$
            // setActionDefinitionId(Hub.COMMAND_PREFIX+"savePerspektive"); //$NON-NLS-1$
            setToolTipText(Messages.getString("GlobalActions.SavePerspectiveToolTip")); //$NON-NLS-1$
            setImageDescriptor(Hub.getImageDescriptor("rsc/save.gif")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            mainWindow.getActivePage().savePerspective();
        }
    };

    helpAction = new Action(Messages.getString("GlobalActions.ac_handbook")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_BOOK.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.ac_openhandbook")); //$NON-NLS-1$

        }

        @Override
        public void run() {
            File book = new File(Platform.getInstallLocation().getURL().getPath() + "elexis.pdf"); //$NON-NLS-1$
            Program proggie = Program.findProgram(".pdf"); //$NON-NLS-1$
            if (proggie != null) {
                logger.info("will open handbook: " + book.toString() + " using: " + proggie);
                proggie.execute(book.toString());
            } else {
                logger.info("will launch handbook: " + book.toString());
                if (Program.launch(book.toString()) == false) {
                    try {
                        logger.info("will exec handbook: " + book.toString());
                        Runtime.getRuntime().exec(book.toString());
                    } catch (Exception e) {
                        ExHandler.handle(e);
                    }
                }
            }
        }
    };
    savePerspectiveAsAction = ActionFactory.SAVE_PERSPECTIVE.create(window);

    // ActionFactory.SAVE_PERSPECTIVE.create(window);
    resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);
    resetPerspectiveAction.setImageDescriptor(Images.IMG_REFRESH.getImageDescriptor());

    homeAction = new Action(Messages.getString("GlobalActions.Home")) { //$NON-NLS-1$
        {
            setId("home"); //$NON-NLS-1$
            setActionDefinitionId(Hub.COMMAND_PREFIX + "home"); //$NON-NLS-1$
            setImageDescriptor(Images.IMG_HOME.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.HomeToolTip")); //$NON-NLS-1$
            help.setHelp(this, "ch.elexis.globalactions.homeAction"); //$NON-NLS-1$
        }

        @Override
        public void run() {
            // String
            // perspektive=Hub.actUser.getInfoString("StartPerspektive");
            String perspektive = Hub.localCfg.get(Hub.actUser + DEFAULTPERSPECTIVECFG, null);
            if (StringTool.isNothing(perspektive)) {
                // TODO refactor
                perspektive = "ch.elexis.PatientPerspective";
            }
            try {
                IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                PlatformUI.getWorkbench().showPerspective(perspektive, win);
                // Hub.heart.resume(true);
            } catch (Exception ex) {
                ExHandler.handle(ex);
            }
        }
    };
    savePerspectiveAsDefaultAction = new Action(Messages.getString("GlobalActions.saveasstartperspective")) { //$NON-NLS-1$
        {
            setId("start"); //$NON-NLS-1$
            // setActionDefinitionId(Hub.COMMAND_PREFIX+"startPerspective");
        }

        @Override
        public void run() {
            IPerspectiveDescriptor p = mainWindow.getActivePage().getPerspective();
            Hub.localCfg.set(Hub.actUser + DEFAULTPERSPECTIVECFG, p.getId());
            // Hub.actUser.setInfoElement("StartPerspektive",p.getId());
        }

    };
    loginAction = new Action(Messages.getString("GlobalActions.Login")) { //$NON-NLS-1$
        {
            setId("login"); //$NON-NLS-1$
            setActionDefinitionId(Hub.COMMAND_PREFIX + "login"); //$NON-NLS-1$
        }

        @Override
        public void run() {
            try {
                IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                IWorkbenchWindow[] wins = PlatformUI.getWorkbench().getWorkbenchWindows();
                for (IWorkbenchWindow w : wins) {
                    if (!w.equals(win)) {
                        w.close();
                    }
                }
                ch.elexis.data.Anwender.logoff();
                adaptForUser();
                LoginDialog dlg = new LoginDialog(win.getShell());
                dlg.create();
                dlg.setTitle(Messages.getString("GlobalActions.LoginDialogTitle")); //$NON-NLS-1$
                dlg.setMessage(Messages.getString("GlobalActions.LoginDialogMessage")); //$NON-NLS-1$
                // dlg.getButton(IDialogConstants.CANCEL_ID).setText("Beenden");
                dlg.getShell().setText(Messages.getString("GlobalActions.LoginDialogShelltext")); //$NON-NLS-1$
                if (dlg.open() == Dialog.CANCEL) {
                    exitAction.run();
                }
            } catch (Exception ex) {
                ExHandler.handle(ex);
            }
            System.out.println("login"); //$NON-NLS-1$
        }
    };
    importAction = new Action(Messages.getString("GlobalActions.Import")) { //$NON-NLS-1$
        {
            setId("import"); //$NON-NLS-1$
            setActionDefinitionId(Hub.COMMAND_PREFIX + "import"); //$NON-NLS-1$
        }

        @Override
        public void run() {
            // cnv.open();
            Importer imp = new Importer(mainWindow.getShell(), "ch.elexis.FremdDatenImport"); //$NON-NLS-1$
            imp.create();
            imp.setMessage(Messages.getString("GlobalActions.ImportDlgMessage")); //$NON-NLS-1$
            imp.getShell().setText(Messages.getString("GlobalActions.ImportDlgShelltext")); //$NON-NLS-1$
            imp.setTitle(Messages.getString("GlobalActions.ImportDlgTitle")); //$NON-NLS-1$
            imp.open();
        }
    };

    connectWizardAction = new Action(Messages.getString("GlobalActions.Connection")) { //$NON-NLS-1$
        {
            setId("connectWizard"); //$NON-NLS-1$
            setActionDefinitionId(Hub.COMMAND_PREFIX + "connectWizard"); //$NON-NLS-1$
        }

        @Override
        public void run() {
            WizardDialog wd = new WizardDialog(mainWindow.getShell(), new DBConnectWizard());
            wd.open();
        }

    };

    changeMandantAction = new Action(Messages.getString("GlobalActions.Mandator")) { //$NON-NLS-1$
        {
            setId("changeMandant"); //$NON-NLS-1$
            // setActionDefinitionId(Hub.COMMAND_PREFIX+"changeMandant"); //$NON-NLS-1$
        }

        @Override
        public void run() {
            ChangeMandantDialog cmd = new ChangeMandantDialog();
            if (cmd.open() == org.eclipse.jface.dialogs.Dialog.OK) {
                Mandant n = cmd.result;
                if (n != null) {
                    Hub.setMandant(n);
                }
            }
        }
    };
    printKontaktEtikette = new Action(Messages.getString("GlobalActions.PrintContactLabel")) { //$NON-NLS-1$
        {
            setToolTipText(Messages.getString("GlobalActions.PrintContactLabelToolTip")); //$NON-NLS-1$
            setImageDescriptor(Images.IMG_ADRESSETIKETTE.getImageDescriptor());
        }

        @Override
        public void run() {
            Kontakt kontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class);
            if (kontakt == null) {
                SWTHelper.showInfo("Kein Kontakt ausgewhlt",
                        "Bitte whlen Sie vor dem Drucken einen Kontakt!");
                return;
            }
            EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), kontakt,
                    "AdressEtikette");
            dlg.setTitle(Messages.getString("GlobalActions.PrintContactLabel"));
            dlg.setMessage(Messages.getString("GlobalActions.PrintContactLabelToolTip"));
            if (isDirectPrint()) {
                dlg.setBlockOnOpen(false);
                dlg.open();
                if (dlg.doPrint()) {
                    dlg.close();
                } else {
                    SWTHelper.alert("Fehler beim Drucken",
                            "Beim Drucken ist ein Fehler aufgetreten. Bitte berprfen Sie die Einstellungen.");
                }
            } else {
                dlg.setBlockOnOpen(true);
                dlg.open();
            }
        }
    };

    printAdresse = new Action(Messages.getString("GlobalActions.PrintAddressLabel")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_ADRESSETIKETTE.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.PrintAddressLabelToolTip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Patient actPatient = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            if (actPatient == null) {
                SWTHelper.showInfo("Kein Patient ausgewhlt",
                        "Bitte whlen Sie vor dem Drucken einen Patient!");
                return;
            }

            EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), actPatient,
                    "AdressEtikette");
            dlg.setTitle(Messages.getString("GlobalActions.PrintAddressLabel"));
            dlg.setMessage(Messages.getString("GlobalActions.PrintAddressLabelToolTip"));
            if (isDirectPrint()) {
                dlg.setBlockOnOpen(false);
                dlg.open();
                if (dlg.doPrint()) {
                    dlg.close();
                } else {
                    SWTHelper.alert("Fehler beim Drucken",
                            "Beim Drucken ist ein Fehler aufgetreten. Bitte berprfen Sie die Einstellungen.");
                }
            } else {
                dlg.setBlockOnOpen(true);
                dlg.open();
            }
        }
    };

    printVersionedEtikette = new Action(Messages.getString("GlobalActions.PrintVersionedLabel")) { //$NON-NLS-1$
        {
            setToolTipText(Messages.getString("GlobalActions.PrintVersionedLabelToolTip")); //$NON-NLS-1$
            setImageDescriptor(Images.IMG_VERSIONEDETIKETTE.getImageDescriptor());
        }

        @Override
        public void run() {
            Patient actPatient = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            if (actPatient == null) {
                SWTHelper.showInfo("Kein Patient ausgewhlt",
                        "Bitte whlen Sie vor dem Drucken einen Patient!");
                return;
            }
            EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), actPatient,
                    "PatientEtiketteAuftrag");
            dlg.setTitle(Messages.getString("GlobalActions.PrintVersionedLabel"));
            dlg.setMessage(Messages.getString("GlobalActions.PrintVersionedLabelToolTip"));
            if (isDirectPrint()) {
                dlg.setBlockOnOpen(false);
                dlg.open();
                if (dlg.doPrint()) {
                    dlg.close();
                } else {
                    SWTHelper.alert("Fehler beim Drucken",
                            "Beim Drucken ist ein Fehler aufgetreten. Bitte berprfen Sie die Einstellungen.");
                }
            } else {
                dlg.setBlockOnOpen(true);
                dlg.open();
            }
        }
    };

    printEtikette = new Action(Messages.getString("GlobalActions.PrintLabel")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_PATIENTETIKETTE.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.PrintLabelToolTip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Patient actPatient = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            if (actPatient == null) {
                SWTHelper.showInfo("Kein Patient ausgewhlt",
                        "Bitte whlen Sie vor dem Drucken einen Patient!");
                return;
            }
            EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), actPatient,
                    "PatientEtikette");
            dlg.setTitle(Messages.getString("GlobalActions.PrintLabel"));
            dlg.setMessage(Messages.getString("GlobalActions.PrintLabelToolTip"));
            if (isDirectPrint()) {
                dlg.setBlockOnOpen(false);
                dlg.open();
                if (dlg.doPrint()) {
                    dlg.close();
                } else {
                    SWTHelper.alert("Fehler beim Drucken",
                            "Beim Drucken ist ein Fehler aufgetreten. Bitte berprfen Sie die Einstellungen.");
                }
            } else {
                dlg.setBlockOnOpen(true);
                dlg.open();
            }
        }
    };

    printBlatt = new Action(Messages.getString("GlobalActions.PrintEMR")) { //$NON-NLS-1$
        @Override
        public void run() {
            Patient actPatient = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            String printer = Hub.localCfg.get("Drucker/Einzelblatt/Name", null); //$NON-NLS-1$
            String tray = Hub.localCfg.get("Drucker/Einzelblatt/Schacht", null); //$NON-NLS-1$

            MessageBox mb = new MessageBox(Desk.getDisplay().getActiveShell(),
                    SWT.ICON_INFORMATION | SWT.OK | SWT.CANCEL);
            mb.setText("Papier einlegen"); //$NON-NLS-1$
            mb.setMessage("Bitte legen Sie im Einzelblatteinzug Papier ein."); //$NON-NLS-1$
            if (mb.open() == SWT.OK) {
                new TemplateDrucker("KG-Deckblatt", printer, tray).doPrint(actPatient); //$NON-NLS-1$
            }
        }
    };
    printRoeBlatt = new Action(Messages.getString("GlobalActions.PrintXRay")) { //$NON-NLS-1$
        @Override
        public void run() {
            Patient actPatient = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
            String printer = Hub.localCfg.get("Drucker/A4/Name", null); //$NON-NLS-1$
            String tray = Hub.localCfg.get("Drucker/A4/Schacht", null); //$NON-NLS-1$

            new TemplateDrucker("Roentgen-Blatt", printer, tray).doPrint(actPatient); //$NON-NLS-1$
        }
    };

    fixLayoutAction = new Action(Messages.getString("GlobalActions.LockPerspectives"), Action.AS_CHECK_BOX) { //$NON-NLS-1$
        {
            setToolTipText(Messages.getString("GlobalActions.LockPerspectivesToolTip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            // store the current value in the user's configuration
            Hub.userCfg.set(PreferenceConstants.USR_FIX_LAYOUT, fixLayoutAction.isChecked());
        }
    };
    makeBillAction = new Action(Messages.getString("GlobalActions.MakeBill")) { //$NON-NLS-1$
        @Override
        public void run() {
            Fall actFall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
            Mandant mnd = Hub.actMandant;
            if (actFall != null && mnd != null) {
                String rsId = mnd.getRechnungssteller().getId();
                Konsultation[] bhdl = actFall.getBehandlungen(false);
                ArrayList<Konsultation> lBehdl = new ArrayList<Konsultation>(bhdl.length);
                for (Konsultation b : bhdl) {
                    Rechnung rn = b.getRechnung();
                    if (rn == null) {
                        if (b.getMandant().getRechnungssteller().getId().equals(rsId)) {
                            lBehdl.add(b);
                        }
                    }
                }
                Result<Rechnung> res = Rechnung.build(lBehdl);
                if (!res.isOK()) {
                    ErrorDialog.openError(mainWindow.getShell(), Messages.getString("GlobalActions.Error"), //$NON-NLS-1$
                            Messages.getString("GlobalActions.BillErrorMessage"), //$NON-NLS-1$
                            ResultAdapter.getResultAsStatus(res));
                    // Rechnung rn=(Rechnung)res.get();
                    // rn.storno(true);
                    // rn.delete();

                }
            }
            // setFall(actFall,null);
        }
    };
    moveBehandlungAction = new Action(Messages.getString("GlobalActions.AssignCase")) { //$NON-NLS-1$
        @Override
        public void run() {
            // Object[] s=behandlViewer.getSelection();
            Konsultation k = (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
            if (k == null) {
                MessageDialog.openInformation(mainWindow.getShell(),
                        Messages.getString("GlobalActions.NoKonsSelected"), //$NON-NLS-1$
                        Messages.getString("GlobalActions.NoKonsSelectedMessage")); //$NON-NLS-1$
                return;
            }

            SelectFallDialog dlg = new SelectFallDialog(mainWindow.getShell());
            if (dlg.open() == Dialog.OK) {
                Fall f = dlg.result;
                if (f != null) {
                    k.setFall(f);
                    ElexisEventDispatcher.fireSelectionEvent(f);
                }
            }
        }
    };
    redateAction = new Action(Messages.getString("GlobalActions.Redate")) { //$NON-NLS-1$
        @Override
        public void run() {
            Konsultation k = (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
            if (k == null) {
                MessageDialog.openInformation(mainWindow.getShell(),
                        Messages.getString("GlobalActions.NoKonsSelected"), //$NON-NLS-1$
                        Messages.getString("GlobalActions.NoKonsSelectedMessage")); //$NON-NLS-1$
                return;
            }

            DateSelectorDialog dlg = new DateSelectorDialog(mainWindow.getShell());
            if (dlg.open() == Dialog.OK) {
                TimeTool date = dlg.getSelectedDate();
                k.setDatum(date.toString(TimeTool.DATE_GER), false);

                // notify listeners about change
                ElexisEventDispatcher.getInstance()
                        .fire(new ElexisEvent(k, k.getClass(), ElexisEvent.EVENT_UPDATE));

                ElexisEventDispatcher.fireSelectionEvent(k);
            }
        }
    };
    delFallAction = new Action(Messages.getString("GlobalActions.DeleteCase")) { //$NON-NLS-1$
        @Override
        public void run() {
            Fall actFall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
            if ((actFall != null) && (actFall.delete(false) == false)) {
                SWTHelper.alert(Messages.getString("GlobalActions.CouldntDeleteCaseMessage"), //$NON-NLS-1$
                        Messages.getString("GlobalActions.CouldntDeleteCaseExplanation") + //$NON-NLS-1$
                Messages.getString("GlobalActions.93")); //$NON-NLS-1$
            }
            ElexisEventDispatcher.reload(Fall.class);
        }
    };
    delKonsAction = new Action(Messages.getString("GlobalActions.DeleteKons")) { //$NON-NLS-1$
        @Override
        public void run() {
            Konsultation k = (Konsultation) ElexisEventDispatcher.getSelected(Konsultation.class);
            if ((k != null) && (k.delete(false) == false)) {
                SWTHelper.alert(Messages.getString("GlobalActions.CouldntDeleteKons"), //$NON-NLS-1$
                        Messages.getString("GlobalActions.CouldntDeleteKonsExplanation") + //$NON-NLS-1$
                Messages.getString("GlobalActions.97")); //$NON-NLS-1$
            }
            ElexisEventDispatcher.clearSelection(Konsultation.class);
            if (k != null) {
                ElexisEventDispatcher.fireSelectionEvent(k.getFall());
            }
        }
    };
    openFallaction = new Action(Messages.getString("GlobalActions.EditCase")) { //$NON-NLS-1$

        @Override
        public void run() {
            try {
                Hub.plugin.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                        .showView(FallDetailView.ID);
                // getViewSite().getPage().showView(FallDetailView.ID);
            } catch (Exception ex) {
                ExHandler.handle(ex);
            }
        }

    };
    reopenFallAction = new Action(Messages.getString("GlobalActions.ReopenCase")) { //$NON-NLS-1$
        @Override
        public void run() {
            Fall actFall = (Fall) ElexisEventDispatcher.getSelected(Fall.class);
            if (actFall != null) {
                actFall.setEndDatum(""); //$NON-NLS-1$
            }
        }
    };
    neueKonsAction = new Action(Messages.getString("GlobalActions.NewKons")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_NEW.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.NewKonsToolTip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Konsultation.neueKons(null);
        }
    };
    neuerFallAction = new Action(Messages.getString("GlobalActions.NewCase")) { //$NON-NLS-1$
        {
            setImageDescriptor(Images.IMG_NEW.getImageDescriptor());
            setToolTipText(Messages.getString("GlobalActions.NewCaseToolTip")); //$NON-NLS-1$
        }

        @Override
        public void run() {
            Patient pat = ElexisEventDispatcher.getSelectedPatient();
            if (pat != null) {
                NeuerFallDialog nfd = new NeuerFallDialog(mainWindow.getShell(), null);
                if (nfd.open() == Dialog.OK) {

                }
            }
        }
    };
    planeRechnungAction = new Action(Messages.getString("GlobalActions.plaBill")) { //$NON-NLS-1$
        public void run() {

        }
    };
}

From source file:ch.elexis.ApplicationWorkbenchAdvisor.java

License:Open Source License

@Override
public void postStartup() {
    Shell shell = getWorkbenchConfigurer().getWorkbench().getActiveWorkbenchWindow().getShell();
    Log.setAlert(shell);/*from w  w w.  ja  va  2  s  .  com*/
    String username = System.getProperty("ch.elexis.username");
    String password = System.getProperty("ch.elexis.password");
    if (username != null && password != null) {
        Log log = Log.get("LoginDialog"); //$NON-NLS-1$
        log.log("Bypassing LoginDialg username " + username + " " + password, Log.ERRORS);
        if (!Anwender.login(username, password)) {
            log.log("Authentication failed. Exiting", Log.FATALS);
        }
    } else {
        LoginDialog dlg = new LoginDialog(shell);
        dlg.create();
        dlg.getShell().setText(Messages.ApplicationWorkbenchAdvisor_7);
        dlg.setTitle(Messages.ApplicationWorkbenchAdvisor_8);
        dlg.setMessage(Messages.ApplicationWorkbenchAdvisor_9);
        dlg.open();
    }

    // check if there is a valid user
    if ((Hub.actUser == null) || !Hub.actUser.isValid()) {
        // no valid user, exit (don't consider this as an error)
        Hub.log.log("Exit because no valid user logged-in", Log.WARNINGS); //$NON-NLS-1$
        PersistentObject.disconnect();
        System.exit(0);
    }

    List<Reminder> reminderList = Reminder.findToShowOnStartup(Hub.actUser);
    if (reminderList.size() > 0) {
        StringBuilder sb = new StringBuilder();
        for (Reminder reminder : reminderList) {
            sb.append(reminder.getMessage()).append("\n\n"); //$NON-NLS-1$      
        }

        MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                ch.elexis.views.Messages.getString("ReminderView.importantRemindersOnLogin"), sb.toString());
    }

}