Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-08-04 05:44:27 -0400
committerMichael Keppler2019-08-15 09:10:46 -0400
commit63093b15aeb7417a0a0aed15676da116bd682c35 (patch)
treef0f6fb3366d5aad7e8fe1cf0540da43d88f361d8
parent49134410668238184bbdfc5c5b732c18894a9f49 (diff)
downloadegit-63093b15aeb7417a0a0aed15676da116bd682c35.tar.gz
egit-63093b15aeb7417a0a0aed15676da116bd682c35.tar.xz
egit-63093b15aeb7417a0a0aed15676da116bd682c35.zip
Handle Java templates initialization error silently
If the additional variable for the Java templates cannot be registered, only log this error to the platform log, but do not show an error dialog. Depending on the (currently unknown) root cause of the error, this might happen on every start of eclipse, and users will be annoyed by an error message that is shown on every eclipse start. Bug: 549206 Change-Id: Ife0bf013c9f5666218447426f03002b87687f83c Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
-rwxr-xr-xorg.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
index b04824be2..6e60a803c 100755
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
@@ -377,17 +377,24 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- final ContextTypeRegistry codeTemplateContextRegistry = JavaPlugin
- .getDefault().getCodeTemplateContextRegistry();
- final Iterator<?> ctIter = codeTemplateContextRegistry
- .contextTypes();
-
- while (ctIter.hasNext()) {
- final TemplateContextType contextType = (TemplateContextType) ctIter
- .next();
- contextType.addResolver(new GitTemplateVariableResolver(
- "git_config", //$NON-NLS-1$
- UIText.GitTemplateVariableResolver_GitConfigDescription));
+ try {
+ final ContextTypeRegistry codeTemplateContextRegistry = JavaPlugin
+ .getDefault().getCodeTemplateContextRegistry();
+ final Iterator<?> ctIter = codeTemplateContextRegistry
+ .contextTypes();
+
+ while (ctIter.hasNext()) {
+ final TemplateContextType contextType = (TemplateContextType) ctIter
+ .next();
+ contextType.addResolver(new GitTemplateVariableResolver(
+ "git_config", //$NON-NLS-1$
+ UIText.GitTemplateVariableResolver_GitConfigDescription));
+ }
+ } catch (Throwable e) {
+ // while catching Throwable is an anti-pattern, we may
+ // experience NoClassDefFoundErrors here
+ logError("Cannot register git support for Java templates", //$NON-NLS-1$
+ e);
}
return Status.OK_STATUS;
}

Back to the top