Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 560060 - [Passage] provide "issued licenses" report
- repackage existing yars export (customer base) wizard - pull common parts out for further ues in 'issued licenses' report wizard - start implementing 'issued licenses' report export wizard Signed-off-by: elena.parovyshnaya <elena.parovyshnaya@gmail.com>
- Loading branch information
1 parent
61bed4c
commit 4f50506
Showing
32 changed files
with
1,006 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...rc/org/eclipse/passage/loc/internal/licenses/ui/handlers/IssuedLicensesReportHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************* | ||
* 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.loc.internal.licenses.ui.handlers; | ||
|
||
import java.util.Optional; | ||
|
||
import org.eclipse.e4.core.contexts.IEclipseContext; | ||
import org.eclipse.e4.core.di.annotations.Execute; | ||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.osgi.util.NLS; | ||
import org.eclipse.passage.loc.internal.licenses.ui.i18n.LicensesUiMessages; | ||
import org.eclipse.passage.loc.report.internal.core.license.LicenseReportExportService; | ||
import org.eclipse.passage.loc.report.internal.core.license.LicenseStorage; | ||
import org.eclipse.passage.loc.report.internal.ui.jface.license.ExposedIssuedLicensesReportWizard; | ||
import org.eclipse.swt.widgets.Shell; | ||
|
||
public class IssuedLicensesReportHandler { | ||
|
||
@Execute | ||
public void execute(IEclipseContext context) { | ||
Optional<LicenseStorage> storage = service(LicenseStorage.class, context); | ||
if (!storage.isPresent()) { | ||
return; | ||
} | ||
Optional<LicenseReportExportService> export = service(LicenseReportExportService.class, context); | ||
if (!export.isPresent()) { | ||
return; | ||
} | ||
|
||
new ExposedIssuedLicensesReportWizard(// | ||
storage.get(), // | ||
export.get()// | ||
).accept(context.get(Shell.class)); | ||
|
||
} | ||
|
||
private <S> Optional<S> service(Class<S> service, IEclipseContext context) { | ||
Optional<S> implementation = Optional.ofNullable(context.get(service)); | ||
if (!implementation.isPresent()) { | ||
MessageDialog.openError(// | ||
context.get(Shell.class), // | ||
LicensesUiMessages.IssuedLicensesReportHandler_unavailableTitle, // | ||
NLS.bind(LicensesUiMessages.IssuedLicensesReportHandler_unavailableMessage, service.getName())// | ||
); | ||
} | ||
return implementation; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...rc/org/eclipse/passage/loc/report/internal/ui/i18n/ExportLicenseReportWizardMessages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/******************************************************************************* | ||
* 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.loc.report.internal.ui.i18n; | ||
|
||
import org.eclipse.osgi.util.NLS; | ||
|
||
public class ExportLicenseReportWizardMessages extends NLS { | ||
|
||
private static final String BUNDLE_NAME = "org.eclipse.passage.loc.report.internal.ui.i18n.ExportLicenseReportWizardMessages"; //$NON-NLS-1$ | ||
|
||
public static String ErrorPage_description; | ||
public static String ErrorPage_title; | ||
public static String ExportCustomersWizard_errorTitle; | ||
public static String PreviewPage_description; | ||
|
||
public static String PreviewPage_period; | ||
public static String PreviewPage_title; | ||
public static String ScopePage_columnProduct; | ||
public static String ScopePage_columnSelect; | ||
public static String ScopePage_selctNone; | ||
public static String ScopePage_selectAll; | ||
public static String ScopePage_title; | ||
public static String ScopePage_description; | ||
|
||
public static String ConfigPage_title; | ||
public static String ConfigPage_description; | ||
public static String ConfigPage_dateFrom_title; | ||
public static String ConfigPage_dateTo_title; | ||
public static String ConfigPage_dates_description; | ||
|
||
public static String VisibleProgress_task; | ||
|
||
static { | ||
// initialize resource bundle | ||
NLS.initializeMessages(BUNDLE_NAME, ExportLicenseReportWizardMessages.class); | ||
} | ||
|
||
private ExportLicenseReportWizardMessages() { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../eclipse/passage/loc/report/internal/ui/i18n/ExportLicenseReportWizardMessages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
############################################################################### | ||
# 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 | ||
# http://www.eclipse.org/legal/epl-2.0. | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# ArSysOp - initial API and implementation | ||
############################################################################### | ||
ErrorPage_description=We cannot proceed with the export: unavoidable error happened | ||
ErrorPage_title=Error | ||
|
||
ExportCustomersWizard_errorTitle=Error during export | ||
|
||
PreviewPage_description=Here are the final list of license plans selected \ | ||
and the final location of the resulting report | ||
PreviewPage_title=License Plans, selected for analysis | ||
|
||
ScopePage_columnProduct=License Plan | ||
ScopePage_columnSelect=Select | ||
ScopePage_description=Here is the list of available License Plans. \ | ||
Select those, which you'd like to include into issues licenses report. | ||
ScopePage_selctNone=Select &None | ||
ScopePage_selectAll=Select &All | ||
ScopePage_title=Choose license plan for report | ||
|
||
ConfigPage_title = Report configuration settings | ||
ConfigPage_description = Alter supported report configuration parameters | ||
|
||
VisibleProgress_task=Export issued licenses report for {0} selected license plans |
45 changes: 45 additions & 0 deletions
45
...c.report.ui/src/org/eclipse/passage/loc/report/internal/ui/i18n/ExportWizardMessages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************* | ||
* 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.loc.report.internal.ui.i18n; | ||
|
||
import org.eclipse.osgi.util.NLS; | ||
|
||
public class ExportWizardMessages extends NLS { | ||
|
||
private static final String BUNDLE_NAME = "org.eclipse.passage.loc.report.internal.ui.i18n.ExportWizardMessages"; //$NON-NLS-1$ | ||
|
||
public static String ErrorPage_description; | ||
public static String ErrorPage_title; | ||
public static String ExportCustomersWizard_errorTitle; | ||
public static String PreviewPage_description; | ||
public static String PreviewPage_title; | ||
public static String ScopePage_columnProduct; | ||
public static String ScopePage_columnSelect; | ||
public static String ScopePage_description; | ||
public static String ScopePage_selctNone; | ||
public static String ScopePage_selectAll; | ||
public static String ScopePage_title; | ||
public static String TargetPage_browse; | ||
public static String TargetPage_description; | ||
public static String TargetPage_open; | ||
public static String TargetPage_title; | ||
public static String VisibleProgress_task; | ||
|
||
static { | ||
// initialize resource bundle | ||
NLS.initializeMessages(BUNDLE_NAME, ExportWizardMessages.class); | ||
} | ||
|
||
private ExportWizardMessages() { | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...rt.ui/src/org/eclipse/passage/loc/report/internal/ui/i18n/ExportWizardMessages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
############################################################################### | ||
# 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 | ||
# http://www.eclipse.org/legal/epl-2.0. | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# ArSysOp - initial API and implementation | ||
############################################################################### | ||
|
||
TargetPage_browse=Browse... | ||
TargetPage_description=Select target directory to store exported CSV file | ||
TargetPage_open=Open the resulting file when export is over | ||
TargetPage_title=Exported files location |
66 changes: 66 additions & 0 deletions
66
...report.ui/src/org/eclipse/passage/loc/report/internal/ui/jface/ExportWizardDecisions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* 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.loc.report.internal.ui.jface; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* <p> | ||
* Base class collecting all the data gathered by an export wizard. Can tell if | ||
* the current state of the data is sufficient ({@code complete}) for export or | ||
* not. | ||
* </p> | ||
* <p> | ||
* Each export wizard is must get from a user the following information: | ||
* </p> | ||
* <ul> | ||
* <li>path to a directory where exported file is going to appear, and</li> | ||
* <li>if a user desires to open exported report right after the export is | ||
* done</li> | ||
* </ul> | ||
* <p> | ||
* To gather more data, extend the class, supply the data and the validation | ||
* part for it. | ||
* </p> | ||
* | ||
* @author user | ||
* | ||
*/ | ||
public abstract class ExportWizardDecisions { | ||
|
||
private final Supplier<Path> target; | ||
private final Supplier<Boolean> open; | ||
|
||
protected ExportWizardDecisions(Supplier<Path> target, Supplier<Boolean> open) { | ||
this.target = target; | ||
this.open = open; | ||
} | ||
|
||
public final Path target() { | ||
return target.get(); | ||
} | ||
|
||
public final boolean open() { | ||
return open.get(); | ||
} | ||
|
||
public final boolean complete() { | ||
Path path = target(); | ||
return Files.exists(path) && Files.isDirectory(path) && dataComplete(); | ||
} | ||
|
||
protected abstract boolean dataComplete(); | ||
|
||
} |
Oops, something went wrong.