Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IContextFunction.ServiceContextKey OSGi component property type #1577

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dsVersion=V1_4
eclipse.preferences.version=1
enabled=true
generateBundleActivationPolicyLazy=true
path=OSGI-INF
validationErrorLevel=error
validationErrorLevel.missingImplicitUnbindMethod=error
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.core.contexts
Bundle-Version: 1.12.600.qualifier
Bundle-Version: 1.13.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2013 IBM Corporation and others.
* Copyright (c) 2009, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -10,11 +10,15 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Hannes Wellmann - Add IContextFunction.ServiceContextKey OSGi component property type
*******************************************************************************/

package org.eclipse.e4.core.contexts;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.ComponentPropertyType;

/**
* A context function encapsulates evaluation of some code within an
Expand Down Expand Up @@ -58,9 +62,23 @@ public interface IContextFunction {
* should be registered in.
*
* @see BundleContext#getServiceReference(String)
* @see ServiceContextKey
*/
String SERVICE_CONTEXT_KEY = "service.context.key"; //$NON-NLS-1$

/**
* An OSGi service component property type used to indicate the context key this
* function should be registered in.
*
* @since 1.13
* @see #SERVICE_CONTEXT_KEY
*/
@ComponentPropertyType
@Retention(RetentionPolicy.SOURCE)
public @interface ServiceContextKey {
Class<?> value();
}

/**
* Evaluates the function based on the provided arguments and context to
* produce a consistent result.
Expand Down
Loading