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 9d82899d7..c8541e309 100644 --- a/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.passage.loc.api/META-INF/MANIFEST.MF @@ -40,3 +40,4 @@ Require-Bundle: org.eclipse.e4.core.services;bundle-version="0.0.0", org.eclipse.passage.lic.products;bundle-version="1.0.0";visibility:=reexport, org.eclipse.passage.lic.users;bundle-version="1.0.0";visibility:=reexport, org.eclipse.passage.lic.users.model;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/floating/IssueLicensePackPage.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/floating/IssueLicensePackPage.java index 2b32dcfd5..0c58e6dcc 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/floating/IssueLicensePackPage.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/floating/IssueLicensePackPage.java @@ -12,6 +12,7 @@ *******************************************************************************/ package org.eclipse.passage.loc.dashboard.ui.wizards.floating; +import java.util.Arrays; import java.util.Optional; import java.util.function.Supplier; @@ -37,6 +38,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; public final class IssueLicensePackPage extends WizardPage { @@ -45,7 +47,7 @@ public final class IssueLicensePackPage extends WizardPage { private final Adapter update = new EContentAdapter() { @Override public void notifyChanged(Notification notification) { - setPageComplete(validatePage()); + updatePageComplete(); } }; private FloatingLicensePack license; @@ -85,21 +87,17 @@ public void createControl(Composite parent) { } private void init() { - boolean render = license == null; createLicensePack(); - if (render) { - updatePage(); - } + updatePage(); } private void createLicensePack() { if (license != null) { license.eAdapters().remove(update); - } else { - license = context.get(OperatorLicenseService.class)// - .createFloatingLicensePack(data.get(), Optional.ofNullable(license)); - license.eAdapters().add(update); } + license = context.get(OperatorLicenseService.class)// + .createFloatingLicensePack(data.get(), Optional.ofNullable(license)); + license.eAdapters().add(update); } private void updatePage() { @@ -107,16 +105,27 @@ private void updatePage() { setPageComplete(false); return; } - if (license != null) { - try { - ECPSWTViewRenderer.INSTANCE.render(base, license, properties); - base.layout(); - } catch (ECPRendererException e) { - } - } + renderEmfForms(); + updatePageComplete(); + } + + private void updatePageComplete() { setPageComplete(validatePage()); } + private void renderEmfForms() { + if (license == null) { + return; + } + try { + Arrays.asList(base.getChildren()).forEach(Control::dispose); + ECPSWTViewRenderer.INSTANCE.render(base, license, properties); + base.layout(); // guaranteed to exist and been not disposed + } catch (ECPRendererException e) { + // do nothing + } + } + protected boolean validatePage() { String errors = LicensingEcore.extractValidationError(license); setErrorMessage(errors); diff --git a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/SelectableField.java b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/SelectableField.java index 278663a7d..124b0709d 100644 --- a/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/SelectableField.java +++ b/bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/SelectableField.java @@ -40,7 +40,7 @@ protected SelectableField(Optional source, Runnable modified, LabelProvider l @Override public Optional error() { - return data().isEmpty() ? Optional.of(errorText()) : Optional.empty(); + return noData() ? Optional.of(errorText()) : Optional.empty(); } @Override @@ -75,6 +75,17 @@ private void installSelectButton(Composite parent) { select.setLayoutData(GridDataFactory.fillDefaults().create()); } + private boolean noData() { + Optional data = data(); + if (!data.isPresent()) { + return true; + } + if (data.get() instanceof Collection) { + return ((Collection) data.get()).isEmpty(); + } + return false; + } + @Override protected void enableAuxiliaryControls(boolean enable) { select.setEnabled(enable); diff --git a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java index a153d95f1..4626d6a5b 100644 --- a/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java +++ b/bundles/org.eclipse.passage.loc.licenses.core/src/org/eclipse/passage/loc/internal/licenses/core/FloatingLicensePackFromRequest.java @@ -182,7 +182,7 @@ private FeatureGrant featureGrant(LicensePlanFeatureDescriptor feature, Floating FeatureGrant grant = FloatingFactory.eINSTANCE.createFeatureGrant(); String fid = feature.getFeatureIdentifier(); grant.setFeature(fid); - grant.setCapacity(featureGrantCapacity(fid)); + grant.setCapacity(request.defaultCapacity()); grant.setIdentifier(String.format("%s#%d", request.identifier(), no)); //$NON-NLS-1$ grant.setPack(pack); grant.setValid(featureGrantPeriod(fid)); @@ -191,13 +191,6 @@ private FeatureGrant featureGrant(LicensePlanFeatureDescriptor feature, Floating return grant; } - private int featureGrantCapacity(String feature) { - return template// - .flatMap(l -> forFeature(l.getFeatures(), feature)) // - .map(FeatureGrant::getCapacity)// - .orElseGet(request::defaultCapacity); - } - private ValidityPeriod featureGrantPeriod(String feature) { return template// .flatMap(l -> forFeature(l.getFeatures(), feature)) // diff --git a/bundles/org.eclipse.passage.seal.demo/OSGI-INF/anti-human-magic.product_0.2.1.pub b/bundles/org.eclipse.passage.seal.demo/OSGI-INF/anti-human-magic.product_0.2.1.pub deleted file mode 100644 index 629a69573..000000000 --- a/bundles/org.eclipse.passage.seal.demo/OSGI-INF/anti-human-magic.product_0.2.1.pub +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: BCPG v1.65 - -mI0EXz6mRAEEAMDncQ54z+JSaAc7zjfnojFCk9/jcPcZHbIENjGeUg/3NfI3GbJv -cGi//abYchzilMJS/h+kNPmKkABZ9FDvUFjdxhmjaqL1dgR4xJmd4SlczLAtPQhM -dNukFyWHIkhFL88W5yuqUtWdCPplzmLbe2wX6wLrqgwgKqchzISCi6qhABEBAAG0 -GGFudGktaHVtYW4tbWFnaWMucHJvZHVjdIiiBBMBAgAMBQJfPqZEBQkAAAPoAAoJ -EHbBbJDZeiPsEV0D/iPfuVsuGjt2Xa1tsJ1gAI75dTwiNHlFAMPSSa0xuQInrRln -wzNY4JNYz9ZSEp1IjA6rsAYCgh/vgITKrqvp/MHPfk6ojRz0ecT/UkblZCB/S4CI -64lQrVxGYttX8foexs6VDD43RIO0jUpLTX7lXzBMBP0ETzYT+E0Q/qgW/LiDuI0E -Xz6mRAEEAMDncQ54z+JSaAc7zjfnojFCk9/jcPcZHbIENjGeUg/3NfI3GbJvcGi/ -/abYchzilMJS/h+kNPmKkABZ9FDvUFjdxhmjaqL1dgR4xJmd4SlczLAtPQhMdNuk -FyWHIkhFL88W5yuqUtWdCPplzmLbe2wX6wLrqgwgKqchzISCi6qhABEBAAGIogQY -AQIADAUCXz6mRAUJAAAD6AAKCRB2wWyQ2Xoj7D69A/9dzrh61zov6cgSLUVR4p+W -AewU3yCRYHIx158K7jG2lmoKmiLcJKjcqWmoJcuxX8lPWHqeG2wEVqnONgLi4Yq1 -/ZWrc/CqszV4258zGu8pQxZOdovbzxgPf9eTPqRtIOnrtWcwlRWKkW3K8HgMCq9X -coWMvpxXfnEvN7VrS6sePw== -=eVWh ------END PGP PUBLIC KEY BLOCK-----