From 2634832eab69c0dd4dd64f0ebdc3e59320840ec3 Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Fri, 9 Apr 2021 18:11:45 +0300 Subject: [PATCH 1/2] Bug 572735 - [Passage] PDE templates utilize more info for requirement Use Bundle-Name and Bundle-Version Signed-off-by: Alexander Fedorov --- .../BaseLicensedTemplateSection.java | 8 +++++++ .../templates/DefaultProductRequirement.java | 21 ++++++++++++------- .../LicensedE3ProductTemplateSection.java | 2 +- ...edE4FullFeatherProductTemplateSection.java | 4 ++-- .../LicensedE4ProductTemplateSection.java | 4 ++-- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java index 61ed1455a..126a97313 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/BaseLicensedTemplateSection.java @@ -192,4 +192,12 @@ protected List getRCP4Dependencies() { "org.apache.logging.log4j"); //$NON-NLS-1$ } + protected Requirement createProductRequirement(String product) { + return new DefaultProductRequirement(() -> product, // + () -> getManifestHeader("Bundle-Name"), // //$NON-NLS-1$ + () -> getManifestHeader("Bundle-Version"), // //$NON-NLS-1$ + () -> getManifestHeader("Bundle-Vendor")// //$NON-NLS-1$ + ).get(); + } + } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/DefaultProductRequirement.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/DefaultProductRequirement.java index 8e48e34a5..29d6f8f46 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/DefaultProductRequirement.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/DefaultProductRequirement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -22,22 +22,27 @@ @SuppressWarnings("restriction") final class DefaultProductRequirement implements Supplier { - private final String product; - private final String version; + private final Supplier product; + private final Supplier version; + private final Supplier name; + private final Supplier provider; - DefaultProductRequirement(String product, String version) { + DefaultProductRequirement(Supplier product, Supplier name, Supplier version, + Supplier provider) { this.product = product; this.version = version; + this.name = name; + this.provider = provider; } @Override public Requirement get() { return new BaseRequirement(// new BaseFeature(// - product, // - version, // - product, // - "Eclipse Passage Template"), //$NON-NLS-1$ + product.get(), // + version.get(), // + name.get(), // + provider.get()), // new RestrictionLevel.Warning(), // this); } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE3ProductTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE3ProductTemplateSection.java index 02ab7bbab..a2074baf4 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE3ProductTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE3ProductTemplateSection.java @@ -90,7 +90,7 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException { @Override protected List requirements(String product) { - return Arrays.asList(new DefaultProductRequirement(product, getManifestHeader("Bundle-Version")).get()); //$NON-NLS-1$ + return Arrays.asList(createProductRequirement(product)); } private void createPerspectiveExtension() throws CoreException { diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java index 715d29143..74e9e9be6 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4FullFeatherProductTemplateSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 ArSysOp + * Copyright (c) 2020, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -78,7 +78,7 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException { @Override protected List requirements(String product) { return Arrays.asList(// - new DefaultProductRequirement(product, getManifestHeader("Bundle-Version")).get(), //$NON-NLS-1$ + createProductRequirement(product), // new AntimagicShieldFeatureLicRequirement().get()); } diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4ProductTemplateSection.java b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4ProductTemplateSection.java index c8796bd0a..f54bd388e 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4ProductTemplateSection.java +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/LicensedE4ProductTemplateSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 ArSysOp + * Copyright (c) 2019, 2021 ArSysOp * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -85,7 +85,7 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException { @Override protected List requirements(String product) { - return Arrays.asList(new DefaultProductRequirement(product, getManifestHeader("Bundle-Version")).get()); //$NON-NLS-1$ + return Arrays.asList(createProductRequirement(product)); } private void createProductExtension() throws CoreException { From 65444c5512b04ce8490cdffea59a940ddf2ec1bf Mon Sep 17 00:00:00 2001 From: Alexander Fedorov Date: Fri, 9 Apr 2021 18:16:34 +0300 Subject: [PATCH 2/2] Bug 572735 - [Passage] PDE templates utilize more info for requirement extract more packages Signed-off-by: Alexander Fedorov --- .../META-INF/MANIFEST.MF | 3 +++ bundles/org.eclipse.passage.ldc.pde.ui.templates/plugin.xml | 6 +++--- .../pde/ui/templates/BaseLicensedTemplateSection.java | 2 +- .../passage/ldc/internal/pde/ui/templates/HelpContexts.java | 3 ++- .../templates/{ => e3}/LicensedE3ProductContentWizard.java | 4 ++-- .../{ => e3}/LicensedE3ProductTemplateSection.java | 6 ++++-- .../templates/{ => e4}/LicensedE4ProductContentWizard.java | 4 ++-- .../{ => e4}/LicensedE4ProductTemplateSection.java | 4 +++- .../LicensedE4FullFeatherProductContentWizard.java | 4 ++-- .../LicensedE4FullFeatherProductTemplateSection.java | 5 +++-- 10 files changed, 25 insertions(+), 16 deletions(-) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => e3}/LicensedE3ProductContentWizard.java (89%) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => e3}/LicensedE3ProductTemplateSection.java (95%) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => e4}/LicensedE4ProductContentWizard.java (89%) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => e4}/LicensedE4ProductTemplateSection.java (95%) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => fullfeather}/LicensedE4FullFeatherProductContentWizard.java (88%) rename bundles/org.eclipse.passage.ldc.pde.ui.templates/src/org/eclipse/passage/ldc/internal/pde/ui/templates/{ => fullfeather}/LicensedE4FullFeatherProductTemplateSection.java (96%) diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF index d1288409c..8b8832267 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/META-INF/MANIFEST.MF @@ -5,6 +5,9 @@ Bundle-SymbolicName: org.eclipse.passage.ldc.pde.ui.templates;singleton:=true Bundle-Version: 0.6.0.qualifier Bundle-Vendor: %Bundle-Vendor Export-Package: org.eclipse.passage.ldc.internal.pde.ui.templates;x-internal:=true, + org.eclipse.passage.ldc.internal.pde.ui.templates.e3;x-internal:=true, + org.eclipse.passage.ldc.internal.pde.ui.templates.e4;x-internal:=true, + org.eclipse.passage.ldc.internal.pde.ui.templates.fullfeather;x-internal:=true, org.eclipse.passage.ldc.internal.pde.ui.templates.i18n;x-internal:=true Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", org.eclipse.core.resources;bundle-version="0.0.0", diff --git a/bundles/org.eclipse.passage.ldc.pde.ui.templates/plugin.xml b/bundles/org.eclipse.passage.ldc.pde.ui.templates/plugin.xml index f8aaa1726..106b61c39 100644 --- a/bundles/org.eclipse.passage.ldc.pde.ui.templates/plugin.xml +++ b/bundles/org.eclipse.passage.ldc.pde.ui.templates/plugin.xml @@ -16,7 +16,7 @@