diff --git a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/internal/equinox/LicensedRunnable.java b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/internal/equinox/LicensedRunnable.java index 647c6a6a4..a5d8b6e6f 100644 --- a/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/internal/equinox/LicensedRunnable.java +++ b/bundles/org.eclipse.passage.lic.equinox/src/org/eclipse/passage/lic/internal/equinox/LicensedRunnable.java @@ -13,6 +13,7 @@ package org.eclipse.passage.lic.internal.equinox; import java.util.Optional; +import java.util.function.Consumer; import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; import org.eclipse.passage.lic.internal.api.access.GrantLockAttempt; @@ -21,10 +22,18 @@ public abstract class LicensedRunnable implements Runnable { private final String feature; private final Runnable action; + private final Consumer> fallback; - public LicensedRunnable(String feature, Runnable action) { + public LicensedRunnable(String feature, Runnable action, + Consumer> fallback) { this.feature = feature; this.action = action; + this.fallback = fallback; + } + + public LicensedRunnable(String feature, Runnable action) { + this(feature, action, response -> { + }); } @Override @@ -34,6 +43,8 @@ public final void run() { response = Optional.of(acquireLicense(feature)); if (grantAcquired(response)) { action.run(); + } else { + fallback.accept(response.get()); } } finally { response.flatMap(ServiceInvocationResult::data)// @@ -57,6 +68,10 @@ public Default(String feature, Runnable action) { super(feature, action); } + public Default(String feature, Runnable action, Consumer> fallback) { + super(feature, action, fallback); + } + @Override protected ServiceInvocationResult acquireLicense(String feature) { return new EquinoxPassage().acquireLicense(feature); diff --git a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/actions/LicensedRunnableUi.java b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/actions/LicensedRunnableUi.java index 66039dce1..0e0d4c825 100644 --- a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/actions/LicensedRunnableUi.java +++ b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/actions/LicensedRunnableUi.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.passage.lic.internal.jface.actions; +import java.util.function.Consumer; import java.util.function.Supplier; import org.eclipse.passage.lic.internal.api.ServiceInvocationResult; @@ -25,11 +26,17 @@ public final class LicensedRunnableUi extends LicensedRunnable { private final Supplier shell; - public LicensedRunnableUi(Supplier shell, String feature, Runnable action) { - super(feature, action); + public LicensedRunnableUi(Supplier shell, String feature, Runnable action, + Consumer> fallback) { + super(feature, action, fallback); this.shell = shell; } + public LicensedRunnableUi(Supplier shell, String feature, Runnable action) { + this(shell, feature, action, response -> { + }); + } + public LicensedRunnableUi(String feature, Runnable action) { this(Display.getDefault()::getActiveShell, feature, action); } diff --git a/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF index 003e0b055..219960e29 100644 --- a/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF @@ -41,3 +41,7 @@ Require-Bundle: org.eclipse.e4.core.services;bundle-version="0.0.0", org.eclipse.passage.lic.users.model;bundle-version="0.0.0", org.eclipse.passage.lic.licenses.model;bundle-version="0.0.0" Bundle-ActivationPolicy: lazy +Provide-Capability: licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issue.personal";version="2.0.0";name="Issue Personal License";level="warn";provider="Eclipse Passage", + licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issue.floating";version="2.0.0";name="Issue Floating License";level="warn";provider="Eclipse Passage", + licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issue.personal.full";version="2.0.0";name="Issue full functioning Personal License";level="error";provider="Eclipse Passage", + licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issue.floating.full";version="2.0.0";name="Issue full functioning Floating License";level="error";provider="Eclipse Passage" diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java index a431f8dd7..ef2068f86 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueFloatingLicenseHandler.java @@ -35,7 +35,7 @@ @SuppressWarnings("restriction") public class DashboardIssueFloatingLicenseHandler { - private final String feature = "org.eclipse.passage.loc.operator.issuefloating"; //$NON-NLS-1$ + private final String feature = "org.eclipse.passage.loc.operator.issue.floating"; //$NON-NLS-1$ @Execute public void execute(IEclipseContext context, diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java index 75a7736ec..0f4f6904f 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/handlers/DashboardIssueLicenseHandler.java @@ -34,7 +34,7 @@ @SuppressWarnings("restriction") public class DashboardIssueLicenseHandler { - private final String feature = "org.eclipse.passage.loc.operator.issuepersonal"; //$NON-NLS-1$ + private final String feature = "org.eclipse.passage.loc.operator.issue.personal"; //$NON-NLS-1$ @Execute public void execute(IEclipseContext context, diff --git a/bundles/org.eclipse.passage.loc.operator/META-INF/MANIFEST.MF b/bundles/org.eclipse.passage.loc.operator/META-INF/MANIFEST.MF index 25f7c1d98..d2613afba 100644 --- a/bundles/org.eclipse.passage.loc.operator/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.operator/META-INF/MANIFEST.MF @@ -11,6 +11,4 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="0.0.0", org.eclipse.passage.loc.workbench;bundle-version="0.0.0", org.eclipse.passage.lic.e4.ui;bundle-version="0.0.0" Eclipse-BundleShape: dir -Provide-Capability: licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.product";name="Eclipse Passage Operator";version="2.0.0";provider="Eclispe Passage";level="warn", - licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issuepersonal";version="2.0.0";name="Issue Personal License";level="error";provider="Eclipse Passage", - licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.issuefloating";version="2.0.0";name="Issue Floating License";level="warn";provider="Eclipse Passage" +Provide-Capability: licensing.feature;licensing.feature="org.eclipse.passage.loc.operator.product";name="Eclipse Passage Operator";version="2.0.0";provider="Eclispe Passage";level="warn"