Search in sources :

Example 21 with Logger

use of org.eclipse.e4.core.services.log.Logger in project eclipse.platform.ui by eclipse-platform.

the class PartRenderingEngine method createGui.

@Override
public Object createGui(final MUIElement element) {
    final Object[] gui = { null };
    // wrap the handling in a SafeRunner so that exceptions do not prevent
    // the renderer from processing other elements
    SafeRunner.run(new ISafeRunnable() {

        @Override
        public void handleException(Throwable e) {
            if (e instanceof Error) {
                // errors are deadly, we shouldn't ignore these
                throw (Error) e;
            }
            // log exceptions otherwise
            if (logger != null) {
                // $NON-NLS-1$
                String message = "Exception occurred while rendering: {0}";
                logger.error(e, NLS.bind(message, element));
            }
        }

        @Override
        public void run() throws Exception {
            gui[0] = safeCreateGui(element);
        }
    });
    return gui[0];
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) TestableObject(org.eclipse.ui.testing.TestableObject) EObject(org.eclipse.emf.ecore.EObject) IOException(java.io.IOException) InjectionException(org.eclipse.e4.core.di.InjectionException) InvalidRegistryObjectException(org.eclipse.core.runtime.InvalidRegistryObjectException)

Aggregations

IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)12 IOException (java.io.IOException)9 Logger (org.eclipse.e4.core.services.log.Logger)7 EObject (org.eclipse.emf.ecore.EObject)7 ArrayList (java.util.ArrayList)6 InjectionException (org.eclipse.e4.core.di.InjectionException)5 MApplication (org.eclipse.e4.ui.model.application.MApplication)5 MWindow (org.eclipse.e4.ui.model.application.ui.basic.MWindow)5 List (java.util.List)4 IPresentationEngine (org.eclipse.e4.ui.workbench.IPresentationEngine)4 Display (org.eclipse.swt.widgets.Display)4 Shell (org.eclipse.swt.widgets.Shell)4 File (java.io.File)3 Set (java.util.Set)3 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)3 Platform (org.eclipse.core.runtime.Platform)3 ContextInjectionFactory (org.eclipse.e4.core.contexts.ContextInjectionFactory)3 IContributionFactory (org.eclipse.e4.core.services.contributions.IContributionFactory)3 E4Workbench (org.eclipse.e4.ui.internal.workbench.E4Workbench)3 MContribution (org.eclipse.e4.ui.model.application.MContribution)3