From ceb062f8568392a4fc410c9a5bf5faa2fcc5d9fa Mon Sep 17 00:00:00 2001 From: Brian de Alwis Date: Sat, 7 May 2016 22:51:40 -0400 Subject: Bug 491556 - [Welcome] Provide theme-specific mechanism to influence path resolution resolveVariable() previously returned null when resolving a product: file that didn't exist, and the original value on an IOException. Change-Id: Ic0039970a1c05fe22803c3c020f26319fa52e104 --- .../intro/universal/UniversalIntroConfigurer.java | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java index 06bfddc28..52b2f05a2 100644 --- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java +++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java @@ -181,33 +181,33 @@ public class UniversalIntroConfigurer extends IntroConfigurer implements if (value == null) { return null; } - if (value.startsWith("intro:")) { //$NON-NLS-1$ - bundle = UniversalIntroPlugin.getDefault().getBundle(); - return resolveFile(bundle, value.substring(6)); - } else if (value.startsWith("product:")) { //$NON-NLS-1$ - return resolveFile(bundle, value.substring(8)); + try { + if (value.startsWith("intro:")) { //$NON-NLS-1$ + bundle = UniversalIntroPlugin.getDefault().getBundle(); + return resolveFile(bundle, value.substring(6)); + } else if (value.startsWith("product:")) { //$NON-NLS-1$ + return resolveFile(bundle, value.substring(8)); + } + } catch (IOException e) { + // just use the value as-is } return value; } - private String resolveFile(Bundle bundle, String path) { + private String resolveFile(Bundle bundle, String path) throws IOException { String prefixedPath = getThemePrefixedPath(path); - try { - URL url = null; - if (prefixedPath != null) { - url = bundle.getEntry(prefixedPath); - } - if (url == null) { - url = bundle.getEntry(path); - } - if (url != null) { - URL localURL = FileLocator.toFileURL(url); - return localURL.toString(); - } - } catch (IOException e) { + URL url = null; + if (prefixedPath != null) { + url = bundle.getEntry(prefixedPath); + } + if (url == null) { + url = bundle.getEntry(path); } - // just use the value as-is - return path; + if (url != null) { + URL localURL = FileLocator.toFileURL(url); + return localURL.toString(); + } + return null; } /** -- cgit v1.2.3