| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.ide.core.ui.display; |
| |
| import org.eclipse.osbp.runtime.common.ui.IWorkbenchAvailable; |
| import org.eclipse.ui.IWorkbench; |
| import org.osgi.service.component.annotations.Component; |
| import org.osgi.service.component.annotations.Reference; |
| import org.osgi.service.component.annotations.ReferenceCardinality; |
| |
| /** |
| * A marker service which is registered as soon as the |
| * org.eclipse.e4.ui.workbench.IWorkbench is registered as an OSGi-service.<br> |
| * This prevents that services requiring this service are only started, if the |
| * swt.Display has been created. |
| */ |
| @Component(immediate = true) |
| public class WorkbenchAvailableService implements IWorkbenchAvailable { |
| |
| @SuppressWarnings("unused") |
| private IWorkbench workbench; |
| |
| @Reference(service = IWorkbench.class, cardinality=ReferenceCardinality.MANDATORY) |
| void bindWorkbench(IWorkbench workbench) { |
| this.workbench = workbench; |
| } |
| |
| void unbindWorkbench(IWorkbench workbench) { |
| this.workbench = null; |
| } |
| |
| } |