-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some shared component want to discover the available workspace and do so by searching for Workspace in the service registry. This adds a service factory that supply the PDE Bnd Workspace in case it is requested by a component.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...rg.eclipse.pde.core/src/org/eclipse/pde/internal/core/bnd/BndWorkspaceServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Christoph Läubrich and others. | ||
* | ||
* 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: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.pde.internal.core.bnd; | ||
|
||
import org.eclipse.core.runtime.ILog; | ||
import org.osgi.framework.Bundle; | ||
import org.osgi.framework.ServiceFactory; | ||
import org.osgi.framework.ServiceRegistration; | ||
|
||
import aQute.bnd.build.Workspace; | ||
|
||
public class BndWorkspaceServiceFactory implements ServiceFactory<Workspace> { | ||
|
||
@Override | ||
public Workspace getService(Bundle bundle, ServiceRegistration<Workspace> registration) { | ||
try { | ||
return BndProjectManager.getWorkspace(); | ||
} catch (Exception e) { | ||
ILog.get().error("Creating Bnd Workspace Service failed!", e); //$NON-NLS-1$ | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
public void ungetService(Bundle bundle, ServiceRegistration<Workspace> registration, Workspace service) { | ||
} | ||
|
||
} |