diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/dialogs/AboutDialog.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/dialogs/AboutDialog.java index 5643400c84..138ba83b01 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/dialogs/AboutDialog.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/dialogs/AboutDialog.java @@ -89,9 +89,8 @@ private Control createAboutText(Composite parent) imageLabel.setImage(Images.LOGO_128.image()); List styles = new ArrayList<>(); - aboutText = addContributorHyperlinks(aboutText, styles); + aboutText = addMarkdownLikeHyperlinks(aboutText, styles); addBoldFirstLine(aboutText, styles); - addHyperlinks(aboutText, styles); Collections.sort(styles, (o1, o2) -> Integer.compare(o1.start, o2.start)); @@ -153,34 +152,36 @@ protected void buttonPressed(int buttonId) } } - private String addContributorHyperlinks(String aboutText, List styles) + private String addMarkdownLikeHyperlinks(String aboutText, List styles) { - Pattern pattern = Pattern.compile("\\[([\\w]*)\\]"); //$NON-NLS-1$ + Pattern pattern = Pattern.compile("\\[(?[^\\]]*)\\]\\((?[^\\)]*)\\)"); //$NON-NLS-1$ Matcher matcher = pattern.matcher(aboutText); StringBuilder answer = new StringBuilder(aboutText.length()); int pointer = 0; - int found = 0; while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); + + answer.append(aboutText.substring(pointer, start)); + + String text = matcher.group("text"); //$NON-NLS-1$ + String link = matcher.group("link"); //$NON-NLS-1$ StyleRange styleRange = new StyleRange(); styleRange.underline = true; styleRange.underlineStyle = SWT.UNDERLINE_LINK; styleRange.underlineColor = Display.getDefault().getSystemColor(SWT.COLOR_DARK_BLUE); - styleRange.data = "https://github.com/" + matcher.group(1); //$NON-NLS-1$ - styleRange.start = start - (2 * found); - styleRange.length = end - start - 2; + styleRange.data = link; + styleRange.start = answer.length(); + styleRange.length = text.length(); styles.add(styleRange); - answer.append(aboutText.substring(pointer, start)); - answer.append(aboutText.substring(start + 1, end - 1)); + answer.append(text); pointer = end; - found++; } if (pointer < aboutText.length()) @@ -198,26 +199,6 @@ private void addBoldFirstLine(String aboutText, List ranges) ranges.add(styleRange); } - private void addHyperlinks(String aboutText, List ranges) - { - Pattern pattern = Pattern.compile("https?://[^ \n]*"); //$NON-NLS-1$ - Matcher matcher = pattern.matcher(aboutText); - while (matcher.find()) - { - int start = matcher.start(); - int end = matcher.end(); - - StyleRange styleRange = new StyleRange(); - styleRange.underline = true; - styleRange.underlineStyle = SWT.UNDERLINE_LINK; - styleRange.underlineColor = Display.getDefault().getSystemColor(SWT.COLOR_DARK_BLUE); - styleRange.data = matcher.group(); - styleRange.start = start; - styleRange.length = end - start; - ranges.add(styleRange); - } - } - private void openBrowser(Event event) { try diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties index 04bcc43d25..f959778445 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages.properties @@ -1,5 +1,5 @@ -AboutText = Portfolio Performance\n\nVersion {0} ({1}, {2})\n\n(c) Copyright Andreas Buchen 2012 - 2017. All rights reserved.\n\nDeveloped by [buchen] with contributions by [simpsus], [jahzoo], [gynngr],\n [nistude], [mwhesse], [derari], [necoro], [alani1], [sebasbaumh], [juelicher],\n [wsteitz], [beluk], [hjbflyer], [ZfT2], [etzelc], [flobjective], [akoch],\n [bbrach], [tobsen987], [gubwe], [cmaoling], [es86de], [DominikHolzapfel],\n [sunnylars], [jklw], [Ragas13], and [stephanmunich].\n\nThis product includes software developed by the\n Eclipse Foundation http://eclipse.org/\n Apache Software Foundation http://apache.org/\n SWT Chart Project http://www.swtchart.org/\n Tree Map Library http://code.google.com/p/treemaplib/\n jsoup Java HTML Parser http://jsoup.org\n JSON.simple https://code.google.com/p/json-simple/\n D3.js http://d3js.org\n\nIcons taken from iconmonstr http://iconmonstr.com\n\nThis product is published under the Eclipse Public License\nhttp://www.eclipse.org/legal/epl-v10.html +AboutText = Portfolio Performance\n\nVersion {0} ({1}, {2})\n\n(c) Copyright [Andreas Buchen](https://github.com/buchen) 2012 - 2017. All rights reserved.\n\nDeveloped with contributions by [simpsus](https://github.com/simpsus), [jahzoo](https://github.com/jahzoo), [gynngr](https://github.com/gynngr),\n [nistude](https://github.com/nistude), [mwhesse](https://github.com/mwhesse), [derari](https://github.com/derari), [necoro](https://github.com/necoro), [alani1](https://github.com/alani1), [sebasbaumh](https://github.com/sebasbaumh), [juelicher](https://github.com/juelicher),\n [wsteitz](https://github.com/wsteitz), [beluk](https://github.com/beluk), [hjbflyer](https://github.com/hjbflyer), [ZfT2](https://github.com/ZfT2), [etzelc](https://github.com/etzelc), [flobjective](https://github.com/flobjective), [akoch](https://github.com/akoch),\n [bbrach](https://github.com/bbrach), [tobsen987](https://github.com/tobsen987), [gubwe](https://github.com/gubwe), [cmaoling](https://github.com/cmaoling), [es86de](https://github.com/es86de), [DominikHolzapfel](https://github.com/DominikHolzapfel),\n [sunnylars](https://github.com/sunnylars), [jklw](https://github.com/jklw), [Ragas13](https://github.com/Ragas13), and [stephanmunich](https://github.com/stephanmunich).\n\n[Portfolio Performance Forum](https://forum.portfolio-performance.info) run by [@Thomas](https://forum.portfolio-performance.info/u/thomas)\n\nThis product includes software developed by the\n [Eclipse Foundation](http://eclipse.org/)\n [Apache Software Foundation](http://apache.org/)\n [SWT Chart Project](http://www.swtchart.org/)\n [Tree Map Library](http://code.google.com/p/treemaplib/)\n [jsoup Java HTML Parser](http://jsoup.org)\n [JSON.simple](https://code.google.com/p/json-simple/)\n [D3.js](http://d3js.org)\n\nIcons taken from [iconmonstr](http://iconmonstr.com)\n\nThis product is published under the [Eclipse Public License](http://www.eclipse.org/legal/epl-v10.html) AccountFilterRetiredAccounts = Hide inactive accounts diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties index 8a93cfaed9..8d006e7127 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/messages_de.properties @@ -1,5 +1,5 @@ -AboutText = Portfolio Performance\n\nVersion {0} ({1}, {2})\n\n(c) Copyright Andreas Buchen 2012 - 2017. All rights reserved.\n\nDeveloped by [buchen] with contributions by [simpsus], [jahzoo], [gynngr],\n [nistude], [mwhesse], [derari], [necoro], [alani1], [sebasbaumh], [juelicher],\n [wsteitz], [beluk], [hjbflyer], [ZfT2], [etzelc], [flobjective], [akoch],\n [bbrach], [tobsen987], [gubwe], [cmaoling], [es86de], [DominikHolzapfel],\n [sunnylars], [jklw], [Ragas13], and [stephanmunich].\n\nThis product includes software developed by the\n Eclipse Foundation http://eclipse.org/\n Apache Software Foundation http://apache.org/\n SWT Chart Project http://www.swtchart.org/\n Tree Map Library http://code.google.com/p/treemaplib/\n jsoup Java HTML Parser http://jsoup.org\n JSON.simple https://code.google.com/p/json-simple/\n D3.js http://d3js.org\n\nIcons taken from iconmonstr http://iconmonstr.com\n\nThis product is published under the Eclipse Public License\nhttp://www.eclipse.org/legal/epl-v10.html +AboutText = Portfolio Performance\n\nVersion {0} ({1}, {2})\n\n(c) Copyright [Andreas Buchen](https://github.com/buchen) 2012 - 2017. All rights reserved.\n\nDeveloped with contributions by [simpsus](https://github.com/simpsus), [jahzoo](https://github.com/jahzoo), [gynngr](https://github.com/gynngr),\n [nistude](https://github.com/nistude), [mwhesse](https://github.com/mwhesse), [derari](https://github.com/derari), [necoro](https://github.com/necoro), [alani1](https://github.com/alani1), [sebasbaumh](https://github.com/sebasbaumh), [juelicher](https://github.com/juelicher),\n [wsteitz](https://github.com/wsteitz), [beluk](https://github.com/beluk), [hjbflyer](https://github.com/hjbflyer), [ZfT2](https://github.com/ZfT2), [etzelc](https://github.com/etzelc), [flobjective](https://github.com/flobjective), [akoch](https://github.com/akoch),\n [bbrach](https://github.com/bbrach), [tobsen987](https://github.com/tobsen987), [gubwe](https://github.com/gubwe), [cmaoling](https://github.com/cmaoling), [es86de](https://github.com/es86de), [DominikHolzapfel](https://github.com/DominikHolzapfel),\n [sunnylars](https://github.com/sunnylars), [jklw](https://github.com/jklw), [Ragas13](https://github.com/Ragas13), and [stephanmunich](https://github.com/stephanmunich).\n\n[Portfolio Performance Forum](https://forum.portfolio-performance.info) run by [@Thomas](https://forum.portfolio-performance.info/u/thomas)\n\nThis product includes software developed by the\n [Eclipse Foundation](http://eclipse.org/)\n [Apache Software Foundation](http://apache.org/)\n [SWT Chart Project](http://www.swtchart.org/)\n [Tree Map Library](http://code.google.com/p/treemaplib/)\n [jsoup Java HTML Parser](http://jsoup.org)\n [JSON.simple](https://code.google.com/p/json-simple/)\n [D3.js](http://d3js.org)\n\nIcons taken from [iconmonstr](http://iconmonstr.com)\n\nThis product is published under the [Eclipse Public License](http://www.eclipse.org/legal/epl-v10.html) AccountFilterRetiredAccounts = Inaktive Konten verbergen