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

Bug 561555 use BundleRequirements in FullFeather project template #212

Merged
merged 1 commit into from
May 17, 2020
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
Expand Up @@ -22,9 +22,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.passage.lic.internal.api.restrictions.RestrictionLevel;
import org.eclipse.passage.lic.internal.base.requirements.BaseFeature;
import org.eclipse.passage.lic.internal.base.requirements.BaseRequirement;
import org.eclipse.passage.lic.internal.equinox.requirements.RequirementsToBundle;
import org.eclipse.pde.core.plugin.IMatchRules;
import org.eclipse.pde.core.plugin.IPluginBase;
Expand Down Expand Up @@ -123,19 +120,10 @@ protected void createLicensingCapability(String identifier) {
((IBundlePluginModelBase) shared).getBundleModel().getBundle()//
.setHeader(Constants.PROVIDE_CAPABILITY, //
new RequirementsToBundle()//
.printed(Arrays.asList(defaultRequirement(identifier))));
.printed(requirements(identifier)));
}

private Requirement defaultRequirement(String identifier) {
return new BaseRequirement(//
new BaseFeature(//
identifier, //
"1.0.0", //$NON-NLS-1$
identifier, //
"Eclipse Passage Template"), //$NON-NLS-1$
new RestrictionLevel.Warning(), //
this);
}
protected abstract List<Requirement> requirements(String product);

protected void createApplicationExtension(String identifier, String classValue) throws CoreException {
IPluginBase plugin = model.getPluginBase();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.ldc.internal.pde.ui.templates;

import java.util.function.Supplier;

import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.passage.lic.internal.api.restrictions.RestrictionLevel;
import org.eclipse.passage.lic.internal.base.requirements.BaseFeature;
import org.eclipse.passage.lic.internal.base.requirements.BaseRequirement;

@SuppressWarnings("restriction")
final class DefaultProductRequirement implements Supplier<Requirement> {
private final String product;

DefaultProductRequirement(String product) {
this.product = product;
}

@Override
public Requirement get() {
return new BaseRequirement(//
new BaseFeature(//
product, //
"1.0.0", //$NON-NLS-1$
product, //
"Eclipse Passage Template"), //$NON-NLS-1$
new RestrictionLevel.Warning(), //
this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@
*******************************************************************************/
package org.eclipse.passage.ldc.internal.pde.ui.templates;

import java.util.Arrays;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.passage.ldc.internal.pde.ui.templates.i18n.PdeUiTemplatesMessages;
import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.ui.IFieldData;

@SuppressWarnings("restriction")
public class LicensedE3ProductTemplateSection extends BaseLicensedTemplateSection {

private static final String LICENSED_E3_PRODUCT = "LicensedE3Product"; //$NON-NLS-1$
Expand Down Expand Up @@ -83,6 +88,11 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException {
createProcessorExtension(VALUE_PROCESSOR_LICENSING_ID, VALUE_PROCESSOR_LICENSING_CLASS);
}

@Override
protected List<Requirement> requirements(String product) {
return Arrays.asList(new DefaultProductRequirement(product).get());
}

private void createPerspectiveExtension() throws CoreException {
IPluginBase plugin = model.getPluginBase();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@
*******************************************************************************/
package org.eclipse.passage.ldc.internal.pde.ui.templates;

import java.util.Arrays;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.passage.ldc.internal.pde.ui.templates.fullfeather.AntimagicShieldFeatureLicRequirement;
import org.eclipse.passage.ldc.internal.pde.ui.templates.i18n.PdeUiTemplatesMessages;
import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.ui.IFieldData;

@SuppressWarnings("restriction")
public final class LicensedE4FullFeatherProductTemplateSection extends BaseLicensedTemplateSection {

public LicensedE4FullFeatherProductTemplateSection() {
Expand Down Expand Up @@ -68,6 +74,13 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException {
createProductExtension();
}

@Override
protected List<Requirement> requirements(String product) {
return Arrays.asList(//
new DefaultProductRequirement(product).get(), //
new AntimagicShieldFeatureLicRequirement().get());
}

@Override
public IPluginReference[] getDependencies(String schemaVersion) {
return getDependencies(getRCP4Dependencies());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@
*******************************************************************************/
package org.eclipse.passage.ldc.internal.pde.ui.templates;

import java.util.Arrays;
import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.passage.ldc.internal.pde.ui.templates.i18n.PdeUiTemplatesMessages;
import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.core.plugin.IPluginReference;
import org.eclipse.pde.ui.IFieldData;

@SuppressWarnings("restriction")
@Deprecated
public class LicensedE4ProductTemplateSection extends BaseLicensedTemplateSection {

Expand Down Expand Up @@ -78,6 +83,11 @@ protected void updateModel(IProgressMonitor monitor) throws CoreException {
createProductExtension();
}

@Override
protected List<Requirement> requirements(String product) {
return Arrays.asList(new DefaultProductRequirement(product).get());
}

private void createProductExtension() throws CoreException {
IPluginBase plugin = model.getPluginBase();
IPluginExtension extension = createExtension("org.eclipse.core.runtime.products", true); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.passage.ldc.internal.pde.ui.templates.fullfeather;

import java.util.function.Supplier;

import org.eclipse.passage.lic.internal.api.requirements.Requirement;
import org.eclipse.passage.lic.internal.api.restrictions.RestrictionLevel;
import org.eclipse.passage.lic.internal.base.requirements.BaseFeature;
import org.eclipse.passage.lic.internal.base.requirements.BaseRequirement;

@SuppressWarnings("restriction")
public final class AntimagicShieldFeatureLicRequirement implements Supplier<Requirement> {

@Override
public Requirement get() {
return new BaseRequirement(//
new BaseFeature(//
"antimagic-shield", //$NON-NLS-1$
"2.72", //$NON-NLS-1$
"Antimagic protection", //$NON-NLS-1$
"Passage E4FF Template"), //$NON-NLS-1$
new RestrictionLevel.Warning(), //
this //
);
}

}