|
5 | 5 | import org.eclipse.core.commands.ExecutionException;
|
6 | 6 | import org.eclipse.core.runtime.IStatus;
|
7 | 7 | import org.eclipse.core.runtime.Status;
|
| 8 | +import org.osgi.framework.FrameworkUtil; |
8 | 9 |
|
9 | 10 | import io.sloeber.ui.Activator;
|
10 | 11 | import io.sloeber.ui.Messages;
|
11 | 12 |
|
12 | 13 | public class LinkCommandHandler extends AbstractHandler {
|
13 | 14 |
|
14 |
| - @Override |
15 |
| - public Object execute(ExecutionEvent event) throws ExecutionException { |
16 |
| - try { |
17 |
| - String url = event.getParameter("io.sloeber.core.link.parameter");//$NON-NLS-1$ |
18 |
| - org.eclipse.swt.program.Program.launch(url); |
19 |
| - } catch (IllegalArgumentException e) { |
20 |
| - Activator.log(new Status(IStatus.ERROR, Activator.getId(), Messages.json_browser_fail, e)); |
| 15 | + @Override |
| 16 | + public Object execute(ExecutionEvent event) throws ExecutionException { |
| 17 | + try { |
| 18 | + org.osgi.framework.Version version = FrameworkUtil.getBundle(getClass()).getVersion(); |
| 19 | + String url = event.getParameter("io.sloeber.core.link.parameter");//$NON-NLS-1$ |
| 20 | + |
| 21 | + url = url.replace("${MAJOR_VERSION}", String.valueOf(version.getMajor())); //$NON-NLS-1$ |
| 22 | + url = url.replace("${MINOR_VERSION}", String.valueOf(version.getMinor())); //$NON-NLS-1$ |
| 23 | + url = url.replace("${MICRO_VERSION}", String.valueOf(version.getMinor())); //$NON-NLS-1$ |
| 24 | + url = url.replace("${QUALIFIER_VERSION}", String.valueOf(version.getMinor())); //$NON-NLS-1$ |
| 25 | + org.eclipse.swt.program.Program.launch(url); |
| 26 | + } catch (IllegalArgumentException e) { |
| 27 | + Activator.log(new Status(IStatus.ERROR, Activator.getId(), Messages.json_browser_fail, e)); |
| 28 | + } |
| 29 | + return null; |
21 | 30 | }
|
22 |
| - return null; |
23 |
| - } |
24 | 31 |
|
25 | 32 | }
|
0 commit comments