1 /*******************************************************************************
2 * Copyright (c) 2015 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.internal.startup;
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.Status;
17 import org.simantics.PlatformException;
18 import org.simantics.internal.Activator;
19 import org.simantics.startup.IStartup;
22 * @author Tuukka Lehtonen
24 public class StartupExtensions {
29 public static StartupExtension[] getAllStartupExtensions() {
30 return Activator.getDefault().getStartupRegistry().getExtensions();
34 * Consults all {@link IStartup} extensions retrieved from
35 * {@link #getAllStartupExtensions()} by invoking their
36 * {@link IStartup#preStartup()} method.
38 * @throws PlatformException
40 public static void consultStartupExtensions() throws PlatformException {
41 for (StartupExtension ext : getAllStartupExtensions()) {
43 ext.newInstance().preStartup();
44 } catch (CoreException ex) {
45 Activator.getDefault().getLog().log(
46 new Status(IStatus.ERROR, Activator.PLUGIN_ID,
47 "Failed to instantiate startup extension class "
48 + ext.getClassName(), ex));