diff --git a/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF b/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF index 8e9dcf56c32..68b564266ec 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF +++ b/runtime/bundles/org.eclipse.e4.core.services/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-SymbolicName: org.eclipse.e4.core.services;singleton:=true Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-Version: 2.4.500.qualifier +Bundle-Version: 2.5.0.qualifier Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-17 Import-Package: jakarta.annotation;version="[2.0.0,3.0.0)", diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java index 0547e1cb5a3..a8e4e03cf21 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledBundles.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -27,7 +27,8 @@ import org.osgi.framework.FrameworkUtil; import org.osgi.service.component.annotations.Component; -@Component(service = { ISystemInformation.class }, property = { AboutSections.SECTION + '=' + AboutSections.SECTION_INSTALLED_BUNDLES }) +@Component(service = ISystemInformation.class) +@ISystemInformation.Section(AboutSections.SECTION_INSTALLED_BUNDLES) public class InstalledBundles implements ISystemInformation { @Override @@ -71,21 +72,14 @@ private Comparator createComparator(Map names) { } private String getStateName(int state) { - switch (state) { - case Bundle.INSTALLED: - return AboutMessages.bundleStateInstalled; - case Bundle.RESOLVED: - return AboutMessages.bundleStateResolved; - case Bundle.STARTING: - return AboutMessages.bundleStateStarting; - case Bundle.STOPPING: - return AboutMessages.bundleStateStopping; - case Bundle.UNINSTALLED: - return AboutMessages.bundleStateUninstalled; - case Bundle.ACTIVE: - return AboutMessages.bundleStateActive; - default: - return AboutMessages.bundleStateUnknown; - } + return switch (state) { + case Bundle.INSTALLED -> AboutMessages.bundleStateInstalled; + case Bundle.RESOLVED -> AboutMessages.bundleStateResolved; + case Bundle.STARTING -> AboutMessages.bundleStateStarting; + case Bundle.STOPPING -> AboutMessages.bundleStateStopping; + case Bundle.UNINSTALLED -> AboutMessages.bundleStateUninstalled; + case Bundle.ACTIVE -> AboutMessages.bundleStateActive; + default -> AboutMessages.bundleStateUnknown; + }; } } diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledFeatures.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledFeatures.java index 9b57d8251fc..c84483eee9a 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledFeatures.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/InstalledFeatures.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -29,7 +29,8 @@ import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; -@Component(service = { ISystemInformation.class }, property = { AboutSections.SECTION + '=' + AboutSections.SECTION_INSTALLED_FEATURES }) +@Component(service = ISystemInformation.class) +@ISystemInformation.Section(AboutSections.SECTION_INSTALLED_FEATURES) public class InstalledFeatures implements ISystemInformation { private final List providers = new ArrayList<>(); diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemEnvironment.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemEnvironment.java index aadab498c50..b39957583fa 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemEnvironment.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemEnvironment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -18,7 +18,8 @@ import org.eclipse.e4.core.services.about.ISystemInformation; import org.osgi.service.component.annotations.Component; -@Component(service = { ISystemInformation.class }, property = { AboutSections.SECTION + '=' + AboutSections.SECTION_SYSTEM_ENVIRONMENT }) +@Component(service = ISystemInformation.class) +@ISystemInformation.Section(AboutSections.SECTION_SYSTEM_ENVIRONMENT) public class SystemEnvironment extends PrintedMap { @Override diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemProperties.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemProperties.java index 58bdf9b6dc0..4a65c38156d 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemProperties.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/SystemProperties.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -19,7 +19,8 @@ import org.eclipse.e4.core.services.about.ISystemInformation; import org.osgi.service.component.annotations.Component; -@Component(service = { ISystemInformation.class }, property = { AboutSections.SECTION + '=' + AboutSections.SECTION_SYSTEM_PROPERTIES }) +@Component(service = ISystemInformation.class) +@ISystemInformation.Section(AboutSections.SECTION_SYSTEM_PROPERTIES) public class SystemProperties extends PrintedMap { @Override diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/UserPreferences.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/UserPreferences.java index ba8736f2a64..549af6105a3 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/UserPreferences.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/internal/services/about/UserPreferences.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -28,7 +28,8 @@ import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; -@Component(service = { ISystemInformation.class }, property = { AboutSections.SECTION + '=' + AboutSections.SECTION_USER_PREFERENCES }) +@Component(service = ISystemInformation.class) +@ISystemInformation.Section(AboutSections.SECTION_USER_PREFERENCES) public class UserPreferences implements ISystemInformation { private IPreferencesService preferencesService; diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/AboutSections.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/AboutSections.java index 50c16923124..e4a9964a0a2 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/AboutSections.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/AboutSections.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -69,7 +69,7 @@ public final class AboutSections { * @return the section filter string */ public static String createSectionFilter(String section) { - return new StringBuilder().append('(').append(SECTION).append('=').append(section).append(')').toString(); + return '(' + SECTION + '=' + section + ')'; } } diff --git a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/ISystemInformation.java b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/ISystemInformation.java index c53b201383f..44c1a61f45b 100644 --- a/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/ISystemInformation.java +++ b/runtime/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/about/ISystemInformation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 ArSysOp and others. + * Copyright (c) 2019, 2024 ArSysOp and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,6 +14,9 @@ package org.eclipse.e4.core.services.about; import java.io.PrintWriter; +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import org.osgi.service.component.annotations.ComponentPropertyType; /** * Collects the system information for the "about"-related functionality. @@ -31,4 +34,17 @@ public interface ISystemInformation { */ void append(PrintWriter writer); + /** + * An OSGi service component property type to define the information to be + * related with the specified section. + * + * @since 2.5 + * @see #SECTION + */ + @ComponentPropertyType + @Target(ElementType.TYPE) + public @interface Section { + String value(); + } + }