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.dawb.passerelle.ui.editors.UserPlotRemotePart.java

License:Open Source License

protected void doConfirm() {
    userPlotBean = createUserPlotBean();
    if (queue == null || userPlotBean == 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);//ww w.jav a2  s  . c o m
        return;
    }
    if (queue.isEmpty())
        queue.add(userPlotBean);
}

From source file:org.dawnsci.plotting.tools.diffraction.DiffractionTool.java

License:Open Source License

private void createActions() {

    final Action exportMeta = new Action("Export metadata to file",
            Activator.getImageDescriptor("icons/mask-export-wiz.png")) {
        public void run() {
            try {
                IWizard wiz = EclipseUtils.openWizard(PersistenceExportWizard.ID, false);
                WizardDialog wd = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
                wd.setTitle(wiz.getWindowTitle());
                wd.open();/*from w w w . java  2 s  . c o m*/
            } catch (Exception e) {
                logger.error("Problem opening export!", e);
            }
        }
    };

    final Action importMeta = new Action("Import metadata from file",
            Activator.getImageDescriptor("icons/mask-import-wiz.png")) {
        public void run() {
            try {
                IWizard wiz = EclipseUtils.openWizard(PersistenceImportWizard.ID, false);
                WizardDialog wd = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
                wd.setTitle(wiz.getWindowTitle());
                wd.open();
            } catch (Exception e) {
                logger.error("Problem opening import!", e);
            }
        }
    };

    final Action showDefault = new Action("Show the original/default value column",
            Activator.getImageDescriptor("icons/plot-tool-diffraction-default.gif")) {
        public void run() {
            defaultColumn.getColumn().setWidth(isChecked() ? 80 : 0);
            defaultColumn.getColumn().setResizable(!isChecked());
        }
    };
    showDefault.setChecked(false);

    final Action reset = new Action("Reset selected field", Activator.getImageDescriptor("icons/reset.gif")) {
        @Override
        public void run() {
            final TreeNode node = (TreeNode) ((StructuredSelection) viewer.getSelection()).getFirstElement();
            if (node instanceof NumericNode) {
                ((NumericNode<?>) node).reset();
                viewer.refresh(node);
            }
        }
    };
    final Action resetAll = new Action("Reset all fields",
            Activator.getImageDescriptor("icons/reset_red.png")) {
        @Override
        public void run() {

            boolean ok = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm Reset All",
                    "Are you sure that you would like to reset all values?");
            if (!ok)
                return;
            filteredTree.clearText();
            if (service.getLockedDiffractionMetaData() != null) {
                model.reset();
                viewer.refresh();
                resetExpansion();
            } else {
                model.reset();
                createDiffractionModel(true);
                viewer.refresh();
            }
        }
    };

    final Action copy = new Action("Copy value", Activator.getImageDescriptor("icons/copy.gif")) {
        @Override
        public void run() {
            copiedNode = (TreeNode) ((StructuredSelection) viewer.getSelection()).getFirstElement();
        }
    };

    final Action paste = new Action("Paste value", Activator.getImageDescriptor("icons/paste.gif")) {
        @SuppressWarnings("unchecked")
        @Override
        public void run() {
            if (copiedNode != null) {
                Object object = ((StructuredSelection) viewer.getSelection()).getFirstElement();
                if (object instanceof NumericNode) {
                    NumericNode<Quantity> nn = (NumericNode<Quantity>) object;
                    if (!nn.isEditable()) {
                        MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Cannot paste",
                                "The item '" + nn.getLabel()
                                        + "' is not writable.\n\nPlease choose a different value to paste to.");
                        return;
                    }

                    try {
                        nn.mergeValue(copiedNode);
                    } catch (Throwable e) {
                        try {
                            if (EclipseUtils.getActivePage()
                                    .findView("org.eclipse.pde.runtime.LogView") == null) {
                                EclipseUtils.getActivePage().showView("org.eclipse.pde.runtime.LogView");
                            }
                        } catch (PartInitException pe) {
                            // Ignored.
                        }
                        IStatus status = new Status(IStatus.INFO, Activator.PLUGIN_ID,
                                "Cannot past into '" + nn.getLabel() + "'", e);
                        Activator.getPluginLog().log(status);
                    }
                    viewer.refresh(object);
                }
            }
        }
    };

    final Action centre = new Action("One-click beam centre", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            logger.debug("1-click clicked");

            IPlottingSystem plotter = getPlottingSystem();
            if (plotter == null) {
                logger.debug("No plotting system found");
                return;
            }

            try {
                clearRegions(plotter);
                if (tmpRegion != null) {
                    plotter.removeRegion(tmpRegion);
                }
                tmpRegion = plotter.createRegion(RegionUtils.getUniqueName("BeamCentrePicker", plotter),
                        IRegion.RegionType.POINT);
                tmpRegion.setUserRegion(false);
                tmpRegion.setVisible(false);
                refine.setEnabled(true);
            } catch (Exception e) {
                logger.error("Cannot add beam centre", e);
            }

        }
    };
    centre.setImageDescriptor(Activator.getImageDescriptor("icons/centre.png"));

    final Action fitRing = new Action("Fit ring", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            logger.debug("Fit ring clicked");

            IPlottingSystem plotter = getPlottingSystem();
            if (plotter == null) {
                logger.debug("No plotting system found");
                return;
            }

            try {
                clearRegions(plotter);
                if (tmpRegion != null) {
                    plotter.removeRegion(tmpRegion);
                }
                tmpRegion = plotter.createRegion(RegionUtils.getUniqueName("RingPicker", plotter),
                        IRegion.RegionType.ELLIPSEFIT);
                tmpRegion.setShowLabel(false);
                tmpRegion.setUserRegion(false);
                tmpRegion.addROIListener(roiListener);
                findOuter.setEnabled(true);
                refine.setEnabled(true);
            } catch (Exception e) {
                logger.error("Cannot add ring", e);
            }
        }
    };
    fitRing.setImageDescriptor(Activator.getImageDescriptor("icons/eclipsecirclepoints.png"));
    fitRing.setToolTipText("Select 3 or 4 points on ring to fit a circle or 5 points or more for an ellipse");

    refine = new Action("Refine beam centre", IAction.AS_PUSH_BUTTON) {

        class Compare implements Comparator<IPeak> {

            @Override
            public int compare(IPeak o1, IPeak o2) {
                if (o1.getPosition() > o2.getPosition()) {
                    return 1;
                }
                if (o1.getPosition() < o2.getPosition()) {
                    return -1;
                }
                return 0;
            }

        }

        @SuppressWarnings("unchecked")
        private List<IPeak> loadPeaks() {
            IToolPage radialTool = getToolSystem()
                    .getToolPage("org.dawb.workbench.plotting.tools.radialProfileTool");
            IToolPage fittingTool = ((IToolPageSystem) radialTool.getToolPlottingSystem())
                    .getToolPage("org.dawb.workbench.plotting.tools.fittingTool");
            if (fittingTool != null) {
                List<IPeak> fittedPeaks = (List<IPeak>) fittingTool.getAdapter(IPeak.class);

                if (fittedPeaks != null) {
                    Collections.sort(fittedPeaks, new Compare());

                    ArrayList<IPeak> peaks = new ArrayList<IPeak>(fittedPeaks.size());
                    if (peaks != null && peaks.size() > 0)
                        peaks.clear();
                    for (IPeak peak : fittedPeaks) {
                        peaks.add(peak);
                    }
                    return peaks;
                }
            }

            return null;
        }

        @Override
        public void run() {
            final IPlottingSystem plotter = getPlottingSystem();
            final IImageTrace t = getImageTrace();
            if (tmpRegion.getRegionType() == RegionType.ELLIPSEFIT
                    || tmpRegion.getRegionType() == RegionType.CIRCLEFIT) {
                final Display display = control.getDisplay();
                if (t != null) {
                    Job job = new Job("Circle fit refinement") {
                        @Override
                        protected IStatus run(final IProgressMonitor monitor) {
                            IROI roi = runEllipseFit(monitor, display, plotter, t, tmpRegion.getROI(), true,
                                    RADIAL_DELTA);
                            if (roi == null)
                                return Status.CANCEL_STATUS;

                            return drawRing(monitor, display, plotter, roi, true);
                        }
                    };
                    job.setPriority(Job.SHORT);
                    //                  job.setUser(true);
                    job.schedule();

                }
                return;
            }
            try {

                Collection<IRegion> regions = plotter.getRegions(RegionType.SECTOR);
                if (regions.size() == 0) {
                    throw new IllegalStateException();
                }
                SectorROI sroi = (SectorROI) regions.iterator().next().getROI();
                Dataset dataset = (Dataset) t.getData();
                Dataset mask = (Dataset) t.getMask();
                final BeamCenterRefinement beamOffset = new BeamCenterRefinement(dataset, mask, sroi);
                List<IPeak> peaks = loadPeaks();
                if (peaks == null)
                    throw new Exception("Cannot find peaks!");
                beamOffset.setInitPeaks(peaks);

                beamOffset.optimize(getDiffractionMetaData().getDetector2DProperties().getBeamCentreCoords());
            } catch (Throwable ne) {

                /**
                 * Long discussion with Iralki on this. The algorithm must be set up in a particular way to 
                 * run at the moment. 
                 */
                ConfigurableMessageDialog dialog = new ConfigurableMessageDialog(
                        Display.getDefault().getActiveShell(), "Experimental Refinement Algorithm Incomplete",
                        null,
                        "Could not read peak positions to start refinement.\nThis tool is still under development. To perform the refinement, use the following procedure:\n\n"
                                + "1. Open the 'Diffraction' tool in a dedicated view (action on the right of the toolbar).\n"
                                + "2. Open the 'Radial Profile' tool (from the plot containing the image).\n"
                                + "3. Select a sector which bisects the rings wanted.\n"
                                + "4. In the 'Radial Profile' tool press 'Lock to Metadata' button.\n"
                                + "5. Select 'q' from the 'Select x axis values' list in the 'Radial Profile' toolbar.\n"
                                + "6. In the 'Radial Profile' tool select peak fitting.\n"
                                + "7. Set up a peak fit on all the rings which the radial profile found.\n"
                                + "8. Now run the refine action in the diffraction tool again.\n\n"
                                + "Please note that the algorithm may not converge. A job is run for the refinement which may be stopped.\n"
                                + "Please contact your support representative for more training/help with refinement.\n\n"
                                + "(NOTE: This dialog can be kept open as a guide while doing the proceedure.)",
                        MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.setShellStyle(SWT.SHELL_TRIM | SWT.MODELESS);
                dialog.open();
            }
        }
    };
    refine.setImageDescriptor(Activator.getImageDescriptor("icons/refine.png"));
    refine.setEnabled(false);

    findOuter = new Action("Find outer rings", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            logger.debug("Find outer rings clicked");

            if (tmpRegion.getRegionType() == RegionType.ELLIPSEFIT
                    || tmpRegion.getRegionType() == RegionType.CIRCLEFIT) {
                final IPlottingSystem plotter = getPlottingSystem();
                final IImageTrace t = getImageTrace();
                final Display display = control.getDisplay();
                if (t != null) {
                    Job job = new Job("Ellipse rings finding") {
                        @Override
                        protected IStatus run(final IProgressMonitor monitor) {
                            IROI roi = tmpRegion.getROI();
                            boolean circle = roi instanceof CircularROI;
                            roi = runEllipseFit(monitor, display, plotter, t, roi, circle, RADIAL_DELTA);
                            if (roi == null)
                                return Status.CANCEL_STATUS;

                            IStatus stat = drawRing(monitor, display, plotter, roi, circle);
                            if (stat.isOK()) {
                                stat = runFindOuterRings(monitor, display, plotter, t, roi);
                            }
                            return stat;
                        }
                    };
                    job.setPriority(Job.SHORT);
                    //                  job.setUser(true);
                    job.schedule();
                }
                return;
            } else {
                ConfigurableMessageDialog dialog = new ConfigurableMessageDialog(
                        Display.getDefault().getActiveShell(), "Rings locator - no initial ring", null,
                        "Please define an initial ring", MessageDialog.INFORMATION,
                        new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.setShellStyle(SWT.SHELL_TRIM | SWT.MODELESS);
                dialog.open();

            }
        }
    };
    findOuter.setImageDescriptor(Activator.getImageDescriptor("icons/findmorerings.png"));
    findOuter.setToolTipText("Find outer rings");
    findOuter.setEnabled(false);

    calibrate = new Action("Calibrate against standard", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            CalibrationStandards standards = CalibrationFactory.getCalibrationStandards();
            String name = standards.getSelectedCalibrant();
            if (name != null) {
                logger.debug("Calibrating against {}", name);
                final List<HKL> spacings = standards.getCalibrationPeakMap(name).getHKLs();

                final IPlottingSystem plotter = getPlottingSystem();
                final IImageTrace t = getImageTrace();
                final Display display = control.getDisplay();
                if (t != null) {
                    Job job = new Job("Calibrating detector") {
                        @Override
                        protected IStatus run(final IProgressMonitor monitor) {
                            return runCalibrateDetector(monitor, display, plotter, spacings);
                        }
                    };
                    job.setPriority(Job.SHORT);
                    //                  job.setUser(true);
                    job.schedule();

                }
                return;
            } else {
                ConfigurableMessageDialog dialog = new ConfigurableMessageDialog(
                        Display.getDefault().getActiveShell(), "Calibrator - no standard selected", null,
                        "Please define calibrant", MessageDialog.INFORMATION,
                        new String[] { IDialogConstants.OK_LABEL }, 0);
                dialog.setShellStyle(SWT.SHELL_TRIM | SWT.MODELESS);
                dialog.open();

            }
        }
    };
    calibrate.setImageDescriptor(Activator.getImageDescriptor("icons/findmorerings.png"));
    calibrate.setToolTipText(
            "Calibrate detector using rings - this is an experimental feature and does not work robustly");
    calibrate.setEnabled(false);

    if (lock == null)
        lock = new Action(
                "Lock the diffraction data and apply it to newly opened files.\nThis will also leave the rings on the image when the tool is deactivated.",
                IAction.AS_CHECK_BOX) {
            @Override
            public void run() {
                if (isChecked()) {
                    IDiffractionMetadata data = activeDiffractionTool.getDiffractionMetaData().clone();
                    service.setLockedDiffractionMetaData(data);
                } else {
                    // Also clears cached data because we may have
                    // changed the meta data.
                    service.setLockedDiffractionMetaData(null);
                }
                activeDiffractionTool.createDiffractionModel(true);
            }
        };
    lock.setImageDescriptor(Activator.getImageDescriptor("icons/lock.png"));

    this.calPref = new Action("Configure Calibrants...") {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    DiffractionPreferencePage.ID, null, null);
            if (pref != null)
                pref.open();
        }
    };

    Action configDetectors = new Action("Configure Detectors...") {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    DiffractionDetectorPreferencePage.ID, null, null);
            if (pref != null)
                pref.open();
        }
    };

    Action configDefaultMeta = new Action("Configure Default Metadata...") {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    DiffractionDefaultsPreferencePage.ID, null, null);
            if (pref != null)
                pref.open();
        }
    };

    this.calibrantActions = new MenuAction("Calibrants");
    calibrantActions.setImageDescriptor(Activator.getImageDescriptor("/icons/calibrant_rings.png"));
    this.calibrantGroup = new CheckableActionGroup();
    updateCalibrationActions(CalibrationFactory.getCalibrationStandards());

    MenuAction dropdown = new MenuAction("Resolution rings");
    dropdown.setImageDescriptor(Activator.getImageDescriptor("/icons/resolution_rings.png"));

    if (!hide) {
        augmenter = new DiffractionImageAugmenter(getPlottingSystem());
        augmenter.addActions(dropdown);
    }

    IToolBarManager toolMan = getSite().getActionBars().getToolBarManager();
    final MenuManager menuMan = new MenuManager();

    // false by default
    if (!hide) {
        toolMan.add(importMeta);
        toolMan.add(exportMeta);
        toolMan.add(new Separator());
        toolMan.add(lock);
        toolMan.add(new Separator());
        toolMan.add(dropdown);
        toolMan.add(calibrantActions);
        toolMan.add(new Separator());
        toolMan.add(centre);
        toolMan.add(fitRing);
        toolMan.add(refine);
        toolMan.add(findOuter);
        toolMan.add(calibrate);
        toolMan.add(new Separator());
        toolMan.add(reset);
        toolMan.add(resetAll);
        toolMan.add(new Separator());
        toolMan.add(showDefault);
        toolMan.add(new Separator());
    }

    menuMan.add(dropdown);
    menuMan.add(centre);
    menuMan.add(fitRing);
    menuMan.add(refine);
    menuMan.add(findOuter);
    menuMan.add(calibrate);
    menuMan.add(new Separator());
    menuMan.add(reset);
    menuMan.add(resetAll);
    menuMan.add(new Separator());
    menuMan.add(copy);
    menuMan.add(paste);
    menuMan.add(new Separator());
    menuMan.add(showDefault);
    menuMan.add(new Separator());
    menuMan.add(calPref);

    final Menu menu = menuMan.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);

    if (!hide) {
        getSite().getActionBars().getMenuManager().add(new Separator());
        getSite().getActionBars().getMenuManager().add(calPref);
        getSite().getActionBars().getMenuManager().add(configDetectors);
        getSite().getActionBars().getMenuManager().add(configDefaultMeta);
        getSite().getActionBars().getMenuManager().add(new Separator());
    }
}

From source file:org.deved.antlride.viz.railroad.RailRoadGraphViewer.java

License:Open Source License

private void exportToHtml() {
    try {//from  w ww .ja  va2  s .c  o m
        final RailRoadExportDialog options = new RailRoadExportDialog(getControl().getShell());
        if (options.open() == Dialog.OK) {
            ProgressMonitorDialog progress = new ProgressMonitorDialog(getControl().getShell());
            progress.run(false, false, new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException {
                    try {
                        new RailRoadGenerator().export(monitor, grammar, options);
                        MessageDialog.open(MessageDialog.INFORMATION, getControl().getShell(),
                                "Railroad exporter", grammar.getElementName() + " successfully exported.",
                                MessageDialog.OK);
                    } catch (IOException ex) {
                        throw new InvocationTargetException(ex);
                    }
                }
            });
        }
    } catch (InvocationTargetException e) {
        ErrorDialog.openError(getControl().getShell(), "Railroad exporter", null, new Status(IStatus.ERROR,
                AntlrViz.PLUGIN_ID, grammar.getElementName() + " can't be exported", e.getTargetException()));
        AntlrViz.error(e.getTargetException());
    } catch (InterruptedException e) {
        AntlrViz.error(e);
    }
}

From source file:org.easotope.client.core.ModalMessageWithViewChange.java

License:Open Source License

private synchronized void raiseInfoPrivate(final Shell shell, final EPartService partService,
        final MPerspective perspective, final MPart part, final String message) {
    list.add(list.size(), new ModalParameters(shell, partService, perspective, part, MessageDialog.INFORMATION,
            Messages.modalMessage_genericInfoTitle, message));

    if (list.size() == 1) {
        raise();//from   ww  w.j  av  a2 s  .  co  m
    }
}

From source file:org.easotope.client.DownloadVersionInfo.java

License:Open Source License

public void run() {
    int tempInt;/*from w  ww  . j  a v  a2 s.c o  m*/

    try {
        String url = MessageFormat.format(Messages.downloadVersionInfo_bestClientForServerUrl,
                String.valueOf(serverVersion));
        tempInt = downloadVersion(url);
    } catch (Exception e) {
        return;
    }

    final int bestClientForServer = tempInt;

    if (bestClientForServer != SystemProperty.getVersion()) {
        Log.getInstance().log(Level.DEBUG, DownloadVersionInfo.class,
                "Best client version for this server is " + bestClientForServer);

        try {
            sleep(5000);
        } catch (InterruptedException e) {
            // ignore
        }

        display.asyncExec(new Runnable() {
            @Override
            public void run() {
                try {
                    String message = MessageFormat.format(Messages.downloadVersionInfo_newVersion,
                            String.valueOf(bestClientForServer));
                    MessageDialog dialog = new MessageDialog(null, Messages.downloadVersionInfo_newVersionTitle,
                            null, message, MessageDialog.INFORMATION,
                            new String[] { Messages.downloadVersionInfo_downloadNewVersion,
                                    IDialogConstants.OK_LABEL },
                            0);
                    int button = dialog.open();

                    if (button == 0) {
                        Program.launch(MessageFormat.format(Messages.downloadVersionInfo_versionUrl,
                                String.valueOf(bestClientForServer)));
                    }

                } catch (Exception e) {
                    Log.getInstance().log(Level.INFO, this, "unexpected exception", e);
                    PotentialGraphicsMethodsShared.reportErrorToUser(display, e);
                }
            }
        });

        return;
    }

    Log.getInstance().log(Level.DEBUG, DownloadVersionInfo.class, "This is the best client for this server");

    try {
        tempInt = downloadVersion(Messages.downloadVersionInfo_bestServerUrl);
    } catch (Exception e) {
        return;
    }

    final int bestServer = tempInt;

    if (bestServer > SystemProperty.getVersion()) {
        Log.getInstance().log(Level.DEBUG, DownloadVersionInfo.class, "Best server version is " + bestServer);

        int previousBestServer = LoginInfoCache.getInstance().getPreferences().getPreviousBestServer();

        if (bestServer != previousBestServer) {
            try {
                sleep(5000);
            } catch (InterruptedException e) {
                // ignore
            }

            if (usingServer) {
                display.asyncExec(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String message = MessageFormat.format(Messages.downloadVersionInfo_newServer,
                                    String.valueOf(bestServer));
                            MessageDialog dialog = new MessageDialog(null,
                                    Messages.downloadVersionInfo_newVersionTitle, null, message,
                                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
                            dialog.open();

                        } catch (Exception e) {
                            Log.getInstance().log(Level.INFO, this, "unexpected exception", e);
                            PotentialGraphicsMethodsShared.reportErrorToUser(display, e);
                        }
                    }
                });
            } else {
                display.asyncExec(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String message = MessageFormat.format(Messages.downloadVersionInfo_newVersion,
                                    String.valueOf(bestServer));
                            MessageDialog dialog = new MessageDialog(null,
                                    Messages.downloadVersionInfo_newVersionTitle, null, message,
                                    MessageDialog.INFORMATION,
                                    new String[] { Messages.downloadVersionInfo_downloadNewVersion,
                                            IDialogConstants.OK_LABEL },
                                    0);
                            int button = dialog.open();

                            if (button == 0) {
                                Program.launch(MessageFormat.format(Messages.downloadVersionInfo_versionUrl,
                                        String.valueOf(bestServer)));
                            }

                        } catch (Exception e) {
                            Log.getInstance().log(Level.INFO, this, "unexpected exception", e);
                            PotentialGraphicsMethodsShared.reportErrorToUser(display, e);
                        }
                    }
                });
            }

            LoginInfoCache.getInstance().savePreviousBestServer(bestServer);
        }

        return;
    }

    Log.getInstance().log(Level.DEBUG, DownloadVersionInfo.class, "This is the best server");
}

From source file:org.easotope.client.handler.ReportBug.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    //MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.reportBug_explainTitle, Messages.reportBug_explainMessage, SWT.SHEET);

    if (!Email.launch(Messages.reportBug_address, Messages.reportBug_subject, Messages.reportBug_body)) {
        MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.reportBug_noEmailTitle,
                Messages.reportBug_noEmailMessage, SWT.SHEET);
    }/*from  w w  w .  j  a v  a  2 s. c o  m*/
}

From source file:org.easotope.client.handler.ShowBugzilla.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    if (!Browse.launch(Messages.showBugzilla_url)) {
        MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.showBugzilla_noBrowserTitle,
                Messages.showBugzilla_noBrowserMessage, SWT.SHEET);
    }/*from   w w w.jav  a  2s.c  o  m*/
}

From source file:org.easotope.client.handler.ShowHomePage.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    if (!Browse.launch(Messages.showHomePage_url)) {
        MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.showHomePage_noBrowserTitle,
                Messages.showHomePage_noBrowserMessage, SWT.SHEET);
    }//from w ww  .  j  av  a  2  s  . co  m
}

From source file:org.easotope.client.handler.ShowReference.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    Clipboard clipboard = new Clipboard(shell.getDisplay());
    clipboard.setContents(new Object[] { Messages.reference }, new Transfer[] { TextTransfer.getInstance() });
    clipboard.dispose();/*  www .  j a v  a  2s. c o m*/

    String message = Messages.showReference_message + "\n\n" + Messages.reference;
    MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.showReference_title, message, SWT.SHEET);
}

From source file:org.easotope.client.handler.ShowSourceCode.java

License:Open Source License

@Execute
public void execute(Shell shell) {
    if (!Browse.launch(Messages.showSourceCode_url)) {
        MessageDialog.open(MessageDialog.INFORMATION, shell, Messages.showSourceCode_noBrowserTitle,
                Messages.showSourceCode_noBrowserMessage, SWT.SHEET);
    }//from   w  w  w  .  j a v a  2 s  .c o m
}