Package org.openstreetmap.josm.gui

Examples of org.openstreetmap.josm.gui.ExtendedDialog


        }

        // Ask for overwrite in case of GpxLayer: GpxLayers usually are imports
        // and modifying is an error most of the time.
        if(f != null && layer instanceof GpxLayer) {
            ExtendedDialog dialog = new ExtendedDialog(
                    Main.parent,
                    tr("Overwrite"),
                    new String[] {tr("Overwrite"), tr("Cancel")}
            );
            dialog.setButtonIcons(new String[] {"save_as.png", "cancel.png"});
            dialog.setContent(tr("File {0} exists. Overwrite?", f.getName()));
            dialog.showDialog();
            int ret = dialog.getValue();
            if (ret != 1) {
                f = null;
            }
        }
        return f == null ? layer.createAndOpenSaveFileChooser() : f;
View Full Code Here


                Shortcut.registerShortcut("tools:combineway", tr("Tool: {0}", tr("Combine Way")), KeyEvent.VK_C, Shortcut.DIRECT), true);
        putValue("help", ht("/Action/CombineWay"));
    }

    protected static boolean confirmChangeDirectionOfWays() {
        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Change directions?"),
                new String[] {tr("Reverse and Combine"), tr("Cancel")});
        ed.setButtonIcons(new String[] {"wayflip.png", "cancel.png"});
        ed.setContent(tr("The ways can not be combined in their current directions.  "
                + "Do you want to reverse some of them?"));
        ed.toggleEnable("combineway-reverse");
        ed.showDialog();
        return ed.getValue() == 1;
    }
View Full Code Here

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    // Then ask for submitting a bug report, for exceptions thrown from a plugin too, unless updated to a new version
                    if (pluginDownloadTask == null) {
                        ExtendedDialog ed = new ExtendedDialog(Main.parent, tr("Unexpected Exception"), new String[] {tr("Do nothing"), tr("Report Bug")});
                        ed.setIcon(JOptionPane.ERROR_MESSAGE);
                        JPanel pnl = new JPanel(new GridBagLayout());
                        pnl.add(new JLabel(
                                "<html>" + tr("An unexpected exception occurred.<br>" +
                                              "This is always a coding error. If you are running the latest<br>" +
                                              "version of JOSM, please consider being kind and file a bug report."
                                              )
                                         + "</html>"), GBC.eol());
                        JCheckBox cbSuppress = null;
                        if (exceptionCounter > 1) {
                            cbSuppress = new JCheckBox(tr("Suppress further error dialogs for this session."));
                            pnl.add(cbSuppress, GBC.eol());
                        }
                        ed.setContent(pnl);
                        ed.showDialog();
                        if (cbSuppress != null && cbSuppress.isSelected()) {
                            suppressExceptionDialogs = true;
                        }
                        if (ed.getValue() != 2) return;
                        askForBugReport(e);
                    } else {
                        // Ask for restart to install new plugin
                        PluginPreference.notifyDownloadResults(Main.parent, pluginDownloadTask);
                    }
View Full Code Here

    @Override
    protected void finish() {}

    protected void download(PluginInformation pi, File file) throws PluginDownloadException{
        if (pi.mainversion > Version.getInstance().getVersion()) {
            ExtendedDialog dialog = new ExtendedDialog(
                    progressMonitor.getWindowParent(),
                    tr("Skip download"),
                    new String[] {
                        tr("Download Plugin"),
                        tr("Skip Download") }
            );
            dialog.setContent(tr("JOSM version {0} required for plugin {1}.", pi.mainversion, pi.name));
            dialog.setButtonIcons(new String[] { "download.png", "cancel.png" });
            dialog.showDialog();
            int answer = dialog.getValue();
            if (answer != 1)
                throw new PluginDownloadException(tr("Download skipped"));
        }
        try {
            if (pi.downloadlink == null) {
View Full Code Here

        ta.setWrapStyleWord(true);
        ta.setLineWrap(true);
        ta.setEditable(false);
        JScrollPane sp = new JScrollPane(ta);

        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Status Report"),
                new String[] {tr("Copy to clipboard and close"), tr("Report bug"), tr("Close") });
        ed.setButtonIcons(new String[] {"copy.png", "bug.png", "cancel.png" });
        ed.setContent(sp, false);
        ed.setMinimumSize(new Dimension(380, 200));
        ed.setPreferredSize(new Dimension(700, Main.parent.getHeight()-50));

        switch (ed.showDialog().getValue()) {
            case 1: Utils.copyToClipboard(text.toString()); break;
            case 2: OpenBrowser.displayUrl(BugReportExceptionHandler.getBugReportUrl(
                        Utils.strip(reportHeader)).toExternalForm()) ; break;
        }
    }
View Full Code Here

        p.add(new JLabel(tr("Keywords")), GBC.eol());
        JosmTextField keywords = new JosmTextField();
        keywords.setText((String) gpxData.attr.get(META_KEYWORDS));
        p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL));

        ExtendedDialog ed = new ExtendedDialog(Main.parent,
                tr("Export options"),
                new String[] { tr("Export and Save"), tr("Cancel") });
        ed.setButtonIcons(new String[] { "exportgpx.png", "cancel.png" });
        ed.setContent(p);
        ed.showDialog();

        if (ed.getValue() != 1) {
            setCanceled(true);
            return;
        }
        setCanceled(false);
View Full Code Here

    public void removeCurrentPhotoFromDisk() {
        ImageEntry toDelete = null;
        if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
            toDelete = data.get(currentPhoto);

            int result = new ExtendedDialog(
                    Main.parent,
                    tr("Delete image file from disk"),
                    new String[] {tr("Cancel"), tr("Delete")})
            .setButtonIcons(new String[] {"cancel.png", "dialogs/delete.png"})
            .setContent(new JLabel(tr("<html><h3>Delete the file {0} from disk?<p>The image file will be permanently lost!</h3></html>"
View Full Code Here

            sldSeconds.addChangeListener(new SliderListener());

            // There is no way to cancel this dialog, all changes get applied
            // immediately. Therefore "Close" is marked with an "OK" icon.
            // Settings are only saved temporarily to the layer.
            new ExtendedDialog(Main.parent,
                    tr("Adjust timezone and offset"),
                    new String[] { tr("Close")}).
                    setContent(p).setButtonIcons(new String[] {"ok.png"}).showDialog();
        }
View Full Code Here

        outerPanel = new JPanel();
        outerPanel.setLayout(new BorderLayout());
        outerPanel.add(statusBar, BorderLayout.PAGE_END);

        syncDialog = new ExtendedDialog(
                Main.parent,
                tr("Correlate images with GPX track"),
                new String[] { tr("Correlate"), tr("Cancel") },
                false
        );
        syncDialog.setContent(panelTf, false);
        syncDialog.setButtonIcons(new String[] { "ok.png", "cancel.png" });
        syncDialog.setupDialog();
        outerPanel.add(syncDialog.getContentPane(), BorderLayout.PAGE_START);
        syncDialog.setContentPane(outerPanel);
        syncDialog.pack();
        syncDialog.addWindowListener(new WindowAdapter() {
            static final int CANCEL = -1;
            static final int DONE = 0;
            static final int AGAIN = 1;
            static final int NOTHING = 2;
            private int checkAndSave() {
                if (syncDialog.isVisible())
                    // nothing happened: JOSM was minimized or similar
                    return NOTHING;
                int answer = syncDialog.getValue();
                if(answer != 1)
                    return CANCEL;

                // Parse values again, to display an error if the format is not recognized
                try {
                    timezone = parseTimezone(tfTimezone.getText().trim());
                } catch (ParseException e) {
                    JOptionPane.showMessageDialog(Main.parent, e.getMessage(),
                            tr("Invalid timezone"), JOptionPane.ERROR_MESSAGE);
                    return AGAIN;
                }

                try {
                    delta = parseOffset(tfOffset.getText().trim());
                } catch (ParseException e) {
                    JOptionPane.showMessageDialog(Main.parent, e.getMessage(),
                            tr("Invalid offset"), JOptionPane.ERROR_MESSAGE);
                    return AGAIN;
                }

                if (lastNumMatched == 0 && new ExtendedDialog(
                            Main.parent,
                            tr("Correlate images with GPX track"),
                            new String[] { tr("OK"), tr("Try Again") }).
                            setContent(tr("No images could be matched!")).
                            setButtonIcons(new String[] { "ok.png", "dialogs/refresh.png"}).
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.ExtendedDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.