Skip to content

Commit

Permalink
[#1298] Extend IssueFloatingWizard interface
Browse files Browse the repository at this point in the history
  • Loading branch information
eparovyshnaya committed Feb 26, 2024
1 parent 88f37da commit c518268
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 43 deletions.
Expand Up @@ -17,9 +17,7 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
Expand All @@ -30,11 +28,8 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin;

import org.eclipse.passage.lic.licenses.model.api.CompanyRef;

import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

/**
Expand Down
Expand Up @@ -17,9 +17,7 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
Expand All @@ -31,11 +29,8 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin;

import org.eclipse.passage.lic.licenses.model.api.FeatureRef;

import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory;
import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

Expand Down
Expand Up @@ -17,13 +17,10 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.model.api.PersonalLicenseRequisites;

import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

/**
Expand Down
Expand Up @@ -17,7 +17,6 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
Expand All @@ -30,11 +29,8 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin;

import org.eclipse.passage.lic.licenses.model.api.SignatureAttribute;

import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

/**
Expand Down Expand Up @@ -128,6 +124,10 @@ public String getText(Object object) {
getString("_UI_SignatureAttribute_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}


/**
* @generated NOT
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, EcoreEditPlugin.INSTANCE.getImage("full/obj16/EObject")); //$NON-NLS-1$
Expand Down
Expand Up @@ -17,11 +17,8 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.ecore.EStructuralFeature;

import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
Expand All @@ -30,11 +27,8 @@
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin;

import org.eclipse.passage.lic.licenses.model.api.Signature;

import org.eclipse.passage.lic.licenses.model.meta.LicensesFactory;
import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

Expand Down
Expand Up @@ -17,9 +17,7 @@

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
Expand All @@ -30,11 +28,8 @@
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;

import org.eclipse.passage.lic.licenses.edit.LicensesEditPlugin;

import org.eclipse.passage.lic.licenses.model.api.UserRef;

import org.eclipse.passage.lic.licenses.model.meta.LicensesPackage;

/**
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 ArSysOp
* Copyright (c) 2020, 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.dashboard.ui.handlers;

Expand All @@ -32,7 +33,7 @@
import org.eclipse.passage.loc.internal.api.OperatorLicenseService;
import org.eclipse.swt.widgets.Shell;

public class DashboardIssueFloatingLicenseHandler {
public final class DashboardIssueFloatingLicenseHandler {

private final String feature = "org.eclipse.passage.loc.operator.issue.floating"; //$NON-NLS-1$

Expand All @@ -55,7 +56,6 @@ private void open(IEclipseContext context, Wizard wizard) {
WizardDialog dialog = new WizardDialog(context.get(Shell.class), wizard);
dialog.create();
Shell shell = dialog.getShell();
// TODO: floating license pack icon
shell.setImage(LicensingImages.getImage(LicensesPackage.eINSTANCE.getPersonalLicensePack().getName()));
shell.setSize(Math.max(800, shell.getSize().x), 700);
dialog.open();
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
* Copyright (c) 2020, 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,9 +9,12 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further evolution
*******************************************************************************/
package org.eclipse.passage.loc.dashboard.ui.wizards.floating;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.eclipse.passage.lic.licenses.LicensePlanDescriptor;
Expand All @@ -21,28 +24,44 @@
public final class FloatingDataPack {

private final Optional<LicensePlanDescriptor> plan;
private final Optional<UserDescriptor> user; // FIXME: can there be several of'em?
private final List<UserDescriptor> users;
private final Optional<ProductVersionDescriptor> product;

public FloatingDataPack(//
Optional<LicensePlanDescriptor> plan, //
List<UserDescriptor> users, //
Optional<ProductVersionDescriptor> product) {
this.plan = plan;
this.users = users;
this.product = product;
}

public FloatingDataPack(//
Optional<LicensePlanDescriptor> plan, //
Optional<UserDescriptor> user, //
Optional<ProductVersionDescriptor> product) {
this.plan = plan;
this.user = user;
this.users = users(user);
this.product = product;
}

private List<UserDescriptor> users(Optional<UserDescriptor> user) {
if (user.isEmpty()) {
return Collections.emptyList();
}
return Collections.singletonList(user.get());
}

public FloatingDataPack() {
this(Optional.empty(), Optional.empty(), Optional.empty());
this(Optional.empty(), Collections.emptyList(), Optional.empty());
}

Optional<LicensePlanDescriptor> plan() {
return plan;
}

Optional<UserDescriptor> user() {
return user;
List<UserDescriptor> users() {
return users;
}

Optional<ProductVersionDescriptor> product() {
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 ArSysOp
* Copyright (c) 2019, 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.dashboard.ui.wizards.floating;

Expand Down Expand Up @@ -45,7 +46,7 @@ public final class IssueLicenseRequestPage implements Supplier<IWizardPage> {
context);
PageFields units = page.withBlock();
plan = units.withLicensePlan(initial.plan());
users = units.withUsers();
users = units.withUsers(initial.users());
product = units.withProductVersion(initial.product());
period = units.withPeriod();
capacity = units.withDefaultCapacity();
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 ArSysOp
* Copyright (c) 2020, 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -9,13 +9,13 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.dashboard.ui.wizards.license;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
Expand Down Expand Up @@ -51,8 +51,8 @@ public Supplier<Optional<UserDescriptor>> withUser(Optional<UserDescriptor> user
return with(new UserField(user, this::modified, labels, context));
}

public Supplier<Optional<Collection<UserDescriptor>>> withUsers() {
return with(new UsersField(Collections.emptyList(), this::modified, labels, context));
public Supplier<Optional<Collection<UserDescriptor>>> withUsers(List<UserDescriptor> users) {
return with(new UsersField(users, this::modified, labels, context));
}

public Supplier<Optional<ProductVersionDescriptor>> withProductVersion(Optional<ProductVersionDescriptor> product) {
Expand Down

0 comments on commit c518268

Please sign in to comment.