Author: gmascellani-guest Date: 2009-02-15 17:48:25 +0000 (Sun, 15 Feb 2009) New Revision: 1885
Modified: packages/josm/trunk/debian/patches/20_bts.dpatch packages/josm/trunk/debian/patches/40_elemstyles.dpatch Log: Hope this is the last... Modified: packages/josm/trunk/debian/patches/20_bts.dpatch =================================================================== --- packages/josm/trunk/debian/patches/20_bts.dpatch 2009-02-15 17:34:34 UTC (rev 1884) +++ packages/josm/trunk/debian/patches/20_bts.dpatch 2009-02-15 17:48:25 UTC (rev 1885) @@ -5,90 +5,393 @@ ## DP: Pattern match debian version in about dialog. @DPATCH@ -diff -urNad josm-0.0.svn1137~/src/org/openstreetmap/josm/actions/AboutAction.java josm-0.0.svn1137/src/org/openstreetmap/josm/actions/AboutAction.java ---- josm-0.0.svn1137~/src/org/openstreetmap/josm/actions/AboutAction.java 2008-12-25 12:19:43.000000000 +0100 -+++ josm-0.0.svn1137/src/org/openstreetmap/josm/actions/AboutAction.java 2008-12-25 12:20:52.000000000 +0100 -@@ -12,6 +12,7 @@ - import java.io.IOException; - import java.io.InputStream; - import java.io.InputStreamReader; -+import java.net.MalformedURLException; - import java.net.URL; - import java.util.Map.Entry; - import java.util.regex.Matcher; -@@ -46,19 +47,31 @@ +diff -urNad trunk~/src/org/openstreetmap/josm/actions/AboutAction.java trunk/src/org/openstreetmap/josm/actions/AboutAction.java +--- trunk~/src/org/openstreetmap/josm/actions/AboutAction.java 2009-01-23 22:22:10.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/actions/AboutAction.java 2009-02-15 18:45:19.000000000 +0100 +@@ -47,6 +47,7 @@ public class AboutAction extends JosmAction { - public static final String version; + private static final String version; + public static final String debianRelease; - private final static JTextArea revision; - private static String time; + private final static JTextArea revision; + private static String time; +@@ -67,6 +68,10 @@ + Matcher match = versionPattern.matcher(revision.getText()); + version = match.matches() ? match.group(1) : tr("UNKNOWN"); - static { - URL u = Main.class.getResource("/REVISION"); -- if(u == null) u = Main.class.getResource("/META-INF/MANIFEST.MF"); ++ Pattern debianReleasePattern = Pattern.compile(".*?(?:Debian-Release): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); ++ match = debianReleasePattern.matcher(revision.getText()); ++ debianRelease = match.matches() ? match.group(1) : tr("UNKNOWN"); ++ + Pattern timePattern = Pattern.compile(".*?(?:Last Changed Date|Main-Date): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); + match = timePattern.matcher(revision.getText()); + time = match.matches() ? match.group(1) : tr("UNKNOWN"); +@@ -124,6 +129,8 @@ + info.add(GBC.glue(0,10), GBC.eol()); + info.add(new JLabel(tr("Version {0}",version)), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); + info.add(GBC.glue(0,5), GBC.eol()); ++ info.add(new JLabel(tr("Debian release: {0}",debianRelease)), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); ++ info.add(GBC.glue(0,5), GBC.eol()); + info.add(new JLabel(tr("Last change at {0}",time)), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); + info.add(GBC.glue(0,5), GBC.eol()); + info.add(new JLabel(tr("Java Version {0}",System.getProperty("java.version"))), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); +@@ -131,7 +138,7 @@ + info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0)); + info.add(new UrlLabel("http://josm.openstreetmap.de"), GBC.eol().fill(GBC.HORIZONTAL)); + info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10,0,10,0)); +- info.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eol().fill(GBC.HORIZONTAL)); ++ info.add(new UrlLabel("http://bugs.debian.org"), GBC.eol().fill(GBC.HORIZONTAL)); + info.add(new JLabel(tr("News about JOSM")), GBC.std().insets(10,0,10,0)); + info.add(new UrlLabel("http://www.opengeodata.org/?cat=17"), GBC.eol().fill(GBC.HORIZONTAL)); + +diff -urNad trunk~/src/org/openstreetmap/josm/actions/AboutAction.java~ trunk/src/org/openstreetmap/josm/actions/AboutAction.java~ +--- trunk~/src/org/openstreetmap/josm/actions/AboutAction.java~ 1970-01-01 01:00:00.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/actions/AboutAction.java~ 2009-02-15 18:42:48.000000000 +0100 +@@ -0,0 +1,210 @@ ++//License: GPL. Copyright 2007 by Immanuel Scholz and others ++package org.openstreetmap.josm.actions; ++ ++import static org.openstreetmap.josm.tools.I18n.tr; ++ ++import java.awt.Dimension; ++import java.awt.Font; ++import java.awt.GridBagLayout; ++import java.awt.event.ActionEvent; ++import java.awt.event.KeyEvent; ++import java.io.BufferedReader; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.InputStreamReader; ++import java.net.MalformedURLException; ++import java.net.URL; ++import java.util.regex.Matcher; ++import java.util.regex.Pattern; ++ ++import javax.swing.BorderFactory; ++import javax.swing.JLabel; ++import javax.swing.JOptionPane; ++import javax.swing.JPanel; ++import javax.swing.JScrollPane; ++import javax.swing.JTabbedPane; ++import javax.swing.JTextArea; ++ ++import org.openstreetmap.josm.Main; ++import org.openstreetmap.josm.plugins.PluginHandler; ++import org.openstreetmap.josm.tools.GBC; ++import org.openstreetmap.josm.tools.ImageProvider; ++import org.openstreetmap.josm.tools.UrlLabel; ++import org.openstreetmap.josm.tools.Shortcut; ++ ++/** ++ * Nice about screen. I guess every application need one these days.. *sigh* ++ * ++ * The REVISION resource is read and if present, it shows the revision ++ * information of the jar-file. ++ * ++ * @author imi ++ */ ++/** ++ * @author Stephan ++ * ++ */ ++public class AboutAction extends JosmAction { ++ ++ private static final String version; ++ public static final String debianRelease; ++ ++ private final static JTextArea revision; ++ private static String time; ++ ++ static { ++ URL u = Main.class.getResource("/REVISION"); + if(u == null) { + try { -+ u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString() ++ u = new URL("jar:" + Main.class.getProtectionDomain().getCodeSource().getLocation().toString() + + "!/META-INF/MANIFEST.MF"); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } - revision = loadFile(u); - -- Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); -+ Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); - Matcher match = versionPattern.matcher(revision.getText()); - version = match.matches() ? match.group(1) : tr("UNKNOWN"); - ++ revision = loadFile(u); ++ ++ Pattern versionPattern = Pattern.compile(".*?(?:Revision|Main-Version): ([0-9]*(?: SVN)?).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); ++ Matcher match = versionPattern.matcher(revision.getText()); ++ version = match.matches() ? match.group(1) : tr("UNKNOWN"); ++ + Pattern debianReleasePattern = Pattern.compile(".*?(?:Debian-Release): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); + match = debianReleasePattern.matcher(revision.getText()); + debianRelease = match.matches() ? match.group(1) : tr("UNKNOWN"); + - Pattern timePattern = Pattern.compile(".*?(?:Last Changed Date|Main-Date): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); - match = timePattern.matcher(revision.getText()); - time = match.matches() ? match.group(1) : tr("UNKNOWN"); -@@ -80,13 +93,14 @@ ++ Pattern timePattern = Pattern.compile(".*?(?:Last Changed Date|Main-Date): ([^\n]*).*", Pattern.CASE_INSENSITIVE|Pattern.DOTALL); ++ match = timePattern.matcher(revision.getText()); ++ time = match.matches() ? match.group(1) : tr("UNKNOWN"); ++ } ++ ++ /** ++ * Return string describing version. ++ * Note that the strinc contains the version number plus an optional suffix of " SVN" to indicate an unofficial development build. ++ * @return version string ++ */ ++ static public String getVersionString() { ++ return version; ++ } ++ ++ static public String getTextBlock() { ++ return revision.getText(); ++ } ++ ++ /** ++ * Return the number part of the version string. ++ * @return integer part of version number or Integer.MAX_VALUE if not available ++ */ ++ public static int getVersionNumber() { ++ int myVersion=Integer.MAX_VALUE; ++ try { ++ myVersion = Integer.parseInt(version.split(" ")[0]); ++ } catch (NumberFormatException e) { ++ e.printStackTrace(); ++ } ++ return myVersion; ++ } ++ ++ /** ++ * check whether the version is a development build out of SVN. ++ * @return true if it is a SVN unofficial build ++ */ ++ public static boolean isDevelopmentVersion() { ++ return version.endsWith(" SVN") || version.equals(tr("UNKNOWN")); ++ } ++ ++ public AboutAction() { ++ super(tr("About"), "about", tr("Display the about screen."), Shortcut.registerShortcut("system:about", tr("About"), KeyEvent.VK_F1, Shortcut.GROUP_DIRECT, Shortcut.SHIFT_DEFAULT), true); ++ } ++ ++ public void actionPerformed(ActionEvent e) { ++ JTabbedPane about = new JTabbedPane(); ++ ++ JTextArea readme = loadFile(Main.class.getResource("/README")); ++ JTextArea contribution = loadFile(Main.class.getResource("/CONTRIBUTION")); ++ ++ JPanel info = new JPanel(new GridBagLayout()); ++ JLabel caption = new JLabel("JOSM - " + tr("Java OpenStreetMap Editor")); ++ caption.setFont(new Font("Helvetica", Font.BOLD, 20)); ++ info.add(caption, GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); ++ info.add(GBC.glue(0,10), GBC.eol()); ++ info.add(new JLabel(tr("Version {0}",version)), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); ++ info.add(GBC.glue(0,5), GBC.eol()); ++ info.add(new JLabel(tr("Last change at {0}",time)), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); ++ info.add(GBC.glue(0,5), GBC.eol()); ++ info.add(new JLabel(tr("Java Version {0}",System.getProperty("java.version"))), GBC.eol().fill(GBC.HORIZONTAL).insets(10,0,0,0)); ++ info.add(GBC.glue(0,10), GBC.eol()); ++ info.add(new JLabel(tr("Homepage")), GBC.std().insets(10,0,10,0)); ++ info.add(new UrlLabel("http://josm.openstreetmap.de"), GBC.eol().fill(GBC.HORIZONTAL)); ++ info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(10,0,10,0)); ++ info.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eol().fill(GBC.HORIZONTAL)); ++ info.add(new JLabel(tr("News about JOSM")), GBC.std().insets(10,0,10,0)); ++ info.add(new UrlLabel("http://www.opengeodata.org/?cat=17"), GBC.eol().fill(GBC.HORIZONTAL)); ++ ++ about.addTab(tr("Info"), info); ++ about.addTab(tr("Readme"), createScrollPane(readme)); ++ about.addTab(tr("Revision"), createScrollPane(revision)); ++ about.addTab(tr("Contribution"), createScrollPane(contribution)); ++ about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel())); ++ ++ about.setPreferredSize(new Dimension(500,300)); ++ ++ JOptionPane.showMessageDialog(Main.parent, about, tr("About JOSM..."), ++ JOptionPane.INFORMATION_MESSAGE, ImageProvider.get("logo")); ++ } ++ ++ private JScrollPane createScrollPane(JTextArea area) { ++ area.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); ++ area.setOpaque(false); ++ JScrollPane sp = new JScrollPane(area); ++ sp.setBorder(null); ++ sp.setOpaque(false); ++ return sp; ++ } ++ ++ /** ++ * Retrieve the latest JOSM version from the JOSM homepage. ++ * @return An string with the latest version or "UNKNOWN" in case ++ * of problems (e.g. no internet connection). ++ */ ++ public static String checkLatestVersion() { ++ String latest; ++ try { ++ InputStream s = new URL("http://josm.openstreetmap.de/current").openStream(); ++ latest = new BufferedReader(new InputStreamReader(s)).readLine(); ++ s.close(); ++ } catch (IOException x) { ++ x.printStackTrace(); ++ return tr("UNKNOWN"); ++ } ++ return latest; ++ } ++ ++ /** ++ * Load the specified resource into an TextArea and return it. ++ * @param resource The resource url to load ++ * @return An read-only text area with the content of "resource" ++ */ ++ private static JTextArea loadFile(URL resource) { ++ JTextArea area = new JTextArea(tr("File could not be found.")); ++ area.setEditable(false); ++ Font font = Font.getFont("monospaced"); ++ if (font != null) ++ area.setFont(font); ++ if (resource == null) ++ return area; ++ BufferedReader in; ++ try { ++ in = new BufferedReader(new InputStreamReader(resource.openStream())); ++ StringBuilder sb = new StringBuilder(); ++ for (String line = in.readLine(); line != null; line = in.readLine()) { ++ sb.append(line); ++ sb.append('\n'); ++ } ++ area.setText(sb.toString()); ++ area.setCaretPosition(0); ++ } catch (IOException e) { ++ e.printStackTrace(); ++ } ++ return area; ++ } ++} +diff -urNad trunk~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java +--- trunk~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java 2009-01-23 22:22:10.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java 2009-02-15 18:39:14.000000000 +0100 +@@ -58,8 +58,8 @@ - JPanel info = new JPanel(new GridBagLayout()); - info.add(new JLabel(tr("Java OpenStreetMap Editor Version {0}",version)), GBC.eol().fill(GBC.HORIZONTAL)); -+ info.add(new JLabel(tr("Debian release: {0}",debianRelease)), GBC.eol().fill(GBC.HORIZONTAL)); - info.add(new JLabel(tr("last change at {0}",time)), GBC.eol().fill(GBC.HORIZONTAL)); - info.add(new JLabel(tr("Java Version {0}",System.getProperty("java.version"))), GBC.eol().fill(GBC.HORIZONTAL)); - info.add(GBC.glue(0,10), GBC.eol()); - info.add(new JLabel(tr("Homepage")), GBC.std().insets(0,0,10,0)); - info.add(new UrlLabel("http://josm.openstreetmap.de"), GBC.eol().fill(GBC.HORIZONTAL)); - info.add(new JLabel(tr("Bug Reports")), GBC.std().insets(0,0,10,0)); -- info.add(new UrlLabel("http://josm.openstreetmap.de/newticket"), GBC.eol().fill(GBC.HORIZONTAL)); -+ info.add(new UrlLabel("http://bugs.debian.org"), GBC.eol().fill(GBC.HORIZONTAL)); - info.add(new JLabel(tr("News about JOSM")), GBC.std().insets(0,0,10,0)); - info.add(new UrlLabel("http://www.opengeodata.org/?cat=17"), GBC.eol().fill(GBC.HORIZONTAL)); + Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; + int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occurred.\n\n" + +- "This is always a coding error. If you are running the latest\n" + +- "version of JOSM, please consider being kind and file a bug report."), ++ "Please consider being kind and file a bug report.\n" + ++ "See http://bugs.debian.org for a guide how to do this."), + tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, + null, options, options[0]); + if (answer == 1) { +@@ -73,10 +73,10 @@ + text += "\n" + stack.getBuffer().toString(); -diff -urNad josm-0.0.svn1137~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java josm-0.0.svn1137/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java ---- josm-0.0.svn1137~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java 2008-12-25 12:19:43.000000000 +0100 -+++ josm-0.0.svn1137/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java 2008-12-25 12:20:36.000000000 +0100 -@@ -91,8 +91,8 @@ - - Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; - int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occurred.\n\n" + -- "This is always a coding error. If you are running the latest\n" + -- "version of JOSM, please consider being kind and file a bug report."), + JPanel p = new JPanel(new GridBagLayout()); +- p.add(new JLabel("<html>" + tr("Please report a ticket at {0}","http://josm.openstreetmap.de/newticket") + +- "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") + ++ p.add(new JLabel("<html>" + tr("Please report a bug against josm.") + ++ "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") + + "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") + +- "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol()); ++ "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol()); + try { + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), new ClipboardOwner(){ + public void lostOwnership(Clipboard clipboard, Transferable contents) {} +diff -urNad trunk~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java~ trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java~ +--- trunk~/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java~ 1970-01-01 01:00:00.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java~ 2009-02-15 18:38:59.000000000 +0100 +@@ -0,0 +1,104 @@ ++// License: GPL. Copyright 2007 by Immanuel Scholz and others ++package org.openstreetmap.josm.tools; ++ ++import static org.openstreetmap.josm.tools.I18n.tr; ++ ++import java.awt.GridBagLayout; ++import java.awt.Toolkit; ++import java.awt.datatransfer.Clipboard; ++import java.awt.datatransfer.ClipboardOwner; ++import java.awt.datatransfer.StringSelection; ++import java.awt.datatransfer.Transferable; ++import java.io.BufferedReader; ++import java.io.File; ++import java.io.InputStreamReader; ++import java.io.PrintWriter; ++import java.io.StringWriter; ++import java.net.URL; ++import java.text.DateFormat; ++import java.text.SimpleDateFormat; ++import java.util.Arrays; ++import java.util.Date; ++import java.util.LinkedList; ++ ++import javax.swing.JLabel; ++import javax.swing.JOptionPane; ++import javax.swing.JPanel; ++import javax.swing.JScrollPane; ++import javax.swing.JTextArea; ++ ++import org.openstreetmap.josm.Main; ++import org.openstreetmap.josm.actions.AboutAction; ++import org.openstreetmap.josm.plugins.PluginHandler; ++ ++/** ++ * An exception handler that asks the user to send a bug report. ++ * ++ * @author imi ++ */ ++public final class BugReportExceptionHandler implements Thread.UncaughtExceptionHandler { ++ ++ public void uncaughtException(Thread t, Throwable e) { ++ handleException(e); ++ } ++ public static void handleException(Throwable e) { ++ e.printStackTrace(); ++ if (Main.parent != null) { ++ if (e instanceof OutOfMemoryError) { ++ // do not translate the string, as translation may raise an exception ++ JOptionPane.showMessageDialog(Main.parent, "JOSM is out of memory. " + ++ "Strange things may happen.\nPlease restart JOSM with the -Xmx###M option,\n" + ++ "where ### is the the number of MB assigned to JOSM (e.g. 256).\n" + ++ "Currently, " + Runtime.getRuntime().maxMemory()/1024/1024 + " MB are available to JOSM."); ++ return; ++ } ++ ++ if(PluginHandler.checkException(e)) ++ return; ++ ++ Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; ++ int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occurred.\n\n" + + "Please consider being kind and file a bug report.\n" + + "See http://bugs.debian.org for a guide how to do this."), - tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, - null, options, options[0]); - if (answer == 1) { -@@ -124,9 +124,9 @@ - sb.append("\n"+stack.getBuffer().toString()); - - JPanel p = new JPanel(new GridBagLayout()); -- p.add(new JLabel(tr("<html>Please report a ticket at {0}<br>" + -+ p.add(new JLabel(tr("<html>Please report a bug against josm.<br>" + - "Include your steps to get to the error (as detailed as possible)!<br>" + -- "Be sure to include the following information:</html>", "http://josm.openstreetmap.de/newticket")), GBC.eol()); -+ "Be sure to include the following information:</html>")), GBC.eol()); - try { - Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(sb.toString()), new ClipboardOwner(){ - public void lostOwnership(Clipboard clipboard, Transferable contents) {} ++ tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, ++ null, options, options[0]); ++ if (answer == 1) { ++ try { ++ StringWriter stack = new StringWriter(); ++ e.printStackTrace(new PrintWriter(stack)); ++ ++ String text = AboutAction.getTextBlock(); ++ text += "Java version: " + System.getProperty("java.version")+"\n"; ++ text += PluginHandler.getBugReportText(); ++ text += "\n" + stack.getBuffer().toString(); ++ ++ JPanel p = new JPanel(new GridBagLayout()); ++ p.add(new JLabel("<html>" + tr("Please report a ticket at {0}","http://josm.openstreetmap.de/newticket") + ++ "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") + ++ "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") + ++ "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol()); ++ p.add(new JLabel("<html>" + tr("Please report a bug against josm.") + ++ "<br>" + tr("Include your steps to get to the error (as detailed as possible)!") + ++ "<br>" + tr("Try updating to the newest version of JOSM and all plugins before reporting a bug.") + ++ "<br>" + tr("Be sure to include the following information:") + "</html>"), GBC.eol()); ++ try { ++ Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(text), new ClipboardOwner(){ ++ public void lostOwnership(Clipboard clipboard, Transferable contents) {} ++ }); ++ p.add(new JLabel(tr("(The text has already been copied to your clipboard.)")), GBC.eop()); ++ } ++ catch (RuntimeException x) {} ++ ++ JTextArea info = new JTextArea(text, 20, 60); ++ info.setCaretPosition(0); ++ info.setEditable(false); ++ p.add(new JScrollPane(info), GBC.eop()); ++ ++ JOptionPane.showMessageDialog(Main.parent, p); ++ } catch (Exception e1) { ++ e1.printStackTrace(); ++ } ++ } ++ } ++ } ++} Modified: packages/josm/trunk/debian/patches/40_elemstyles.dpatch =================================================================== --- packages/josm/trunk/debian/patches/40_elemstyles.dpatch 2009-02-15 17:34:34 UTC (rev 1884) +++ packages/josm/trunk/debian/patches/40_elemstyles.dpatch 2009-02-15 17:48:25 UTC (rev 1885) @@ -6,19 +6,111 @@ ## DP: Point josm to the correct directory so that the icons are found. @DPATCH@ -diff -urNad josm-0.0.svn1137~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java josm-0.0.svn1137/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java ---- josm-0.0.svn1137~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java 2008-12-23 14:32:23.000000000 +0100 -+++ josm-0.0.svn1137/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java 2008-12-23 14:33:09.000000000 +0100 -@@ -49,7 +49,11 @@ +diff -urNad trunk~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java +--- trunk~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java 2009-01-11 12:00:48.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java 2009-02-15 18:47:34.000000000 +0100 +@@ -51,7 +51,11 @@ + String[] a = null; - public static void readFromPreferences() { - /* don't prefix icon path, as it should be generic */ -- String internalicon = "resource://images/styles/standard/;resource://images/styles/"; -+ //String internalicon = "resource://images/styles/standard/;resource://images/styles/"; + /* don't prefix icon path, as it should be generic */ +- String internalicon = "resource://images/styles/standard/;resource://images/styles/"; ++ //String internalicon = "resource://images/styles/standard/;resource://images/styles/"; + String internalicon = "/usr/share/icons/openstreetmap/classic.small;"; + internalicon += "/usr/share/icons/openstreetmap/square.small;"; + internalicon += "/usr/share/icons/openstreetmap/classic.big;"; + internalicon += "/usr/share/icons/openstreetmap/square.big"; - String internalfile = "standard=resource://styles/standard/elemstyles.xml"; + String internalfile = "resource://styles/standard/elemstyles.xml"; - iconDirs = Main.pref.get("mappaint.iconpaths"); + iconDirs = Main.pref.get("mappaint.icon.sources"); +diff -urNad trunk~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java~ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java~ +--- trunk~/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java~ 1970-01-01 01:00:00.000000000 +0100 ++++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java~ 2009-02-15 18:46:08.000000000 +0100 +@@ -0,0 +1,88 @@ ++package org.openstreetmap.josm.gui.mappaint; ++ ++import java.util.LinkedList; ++import java.util.List; ++ ++import javax.swing.ImageIcon; ++ ++import org.openstreetmap.josm.Main; ++import org.openstreetmap.josm.gui.mappaint.ElemStyles; ++import org.openstreetmap.josm.io.MirroredInputStream; ++import org.openstreetmap.josm.tools.ImageProvider; ++import org.xml.sax.InputSource; ++import org.xml.sax.XMLReader; ++import org.xml.sax.helpers.XMLReaderFactory; ++ ++public class MapPaintStyles { ++ ++ private static ElemStyles styles = new ElemStyles(); ++ private static String iconDirs; ++ ++ public static ElemStyles getStyles() ++ { ++ return styles; ++ } ++ ++ public static ImageIcon getIcon(String name, String styleName) ++ { ++ List<String> dirs = new LinkedList<String>(); ++ for(String fileset : iconDirs.split(";")) ++ { ++ String[] a; ++ if(fileset.indexOf("=") >= 0) ++ a = fileset.split("=", 2); ++ else ++ a = new String[] {"", fileset}; ++ ++ /* non-prefixed path is generic path, always take it */ ++ if(a[0].length() == 0 || styleName.equals(a[0])) ++ dirs.add(a[1]); ++ } ++ ImageIcon i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, name); ++ if(i == null) ++ { ++ System.out.println("Mappaint-Style \""+styleName+"\" icon \"" + name + "\" not found."); ++ i = ImageProvider.getIfAvailable(dirs, "mappaint."+styleName, null, "misc/no_icon.png"); ++ } ++ return i; ++ } ++ ++ public static void readFromPreferences() { ++ String[] a = null; ++ ++ /* don't prefix icon path, as it should be generic */ ++ String internalicon = "resource://images/styles/standard/;resource://images/styles/"; ++ String internalfile = "resource://styles/standard/elemstyles.xml"; ++ ++ iconDirs = Main.pref.get("mappaint.icon.sources"); ++ if(Main.pref.getBoolean("mappaint.icon.enable-defaults", true)) ++ iconDirs = iconDirs == null || iconDirs.length() == 0 ? internalicon : iconDirs + ";" + internalicon; ++ ++ String file = Main.pref.get("mappaint.style.sources"); ++ if(Main.pref.getBoolean("mappaint.style.enable-defaults", true)) ++ file = (file == null || file.length() == 0) ? internalfile : internalfile + ";" + file; ++ ++ for(String fileset : file.split(";")) ++ { ++ try ++ { ++ if(fileset.indexOf("=") >= 0) ++ a = fileset.split("=", 2); ++ else ++ a = new String[] {null, fileset}; ++ XMLReader xmlReader = XMLReaderFactory.createXMLReader(); ++ ElemStyleHandler handler = new ElemStyleHandler(a[0]); ++ xmlReader.setContentHandler(handler); ++ xmlReader.setErrorHandler(handler); ++ xmlReader.parse(new InputSource(new MirroredInputStream(a[1]))); ++ } ++ catch (Exception e) ++ { ++ System.out.println("Mappaint-Style \"" + a[0] + "\" file \"" + a[1] + "\""); ++ System.out.println("Mappaint-Style problems: " + e); ++ } ++ } ++ iconDirs = null; ++ } ++ ++} _______________________________________________ Pkg-grass-devel mailing list Pkg-grass-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/pkg-grass-devel