-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #727 from eclipse-passage/571526
Bug 571526 open license folder after issuing
- Loading branch information
Showing
3 changed files
with
71 additions
and
23 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
67 changes: 67 additions & 0 deletions
67
...hboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/LicenseIssuedNotification.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,67 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021 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.dashboard.ui.wizards; | ||
|
||
import java.nio.file.Path; | ||
|
||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.passage.loc.internal.api.IssuedFloatingLicense; | ||
import org.eclipse.passage.loc.internal.api.IssuedLicense; | ||
import org.eclipse.passage.loc.internal.dashboard.ui.i18n.IssueLicensePageMessages; | ||
import org.eclipse.passage.loc.internal.licenses.ui.i18n.LicensesUiMessages; | ||
import org.eclipse.swt.program.Program; | ||
import org.eclipse.swt.widgets.Shell; | ||
|
||
public final class LicenseIssuedNotification { | ||
|
||
private final Shell shell; | ||
|
||
public LicenseIssuedNotification(Shell shell) { | ||
this.shell = shell; | ||
} | ||
|
||
public void showPersonal(IssuedLicense license) { | ||
show(// | ||
IssueLicensePageMessages.IssueLicenseWizard_ok_licensed_title, // | ||
String.format(LicensesUiMessages.LicenseExportHandler_success_description, // | ||
license.encrypted().toAbsolutePath().toString(), // | ||
license.decrypted().toAbsolutePath().toString()), // | ||
license.encrypted().getParent()); | ||
} | ||
|
||
public void showFloating(IssuedFloatingLicense license) { | ||
show(// | ||
IssueLicensePageMessages.IssueFloatingLicenseWizard_success, // | ||
String.format(IssueLicensePageMessages.IssueFloatingLicenseWizard_success_description, | ||
license.residence().toAbsolutePath()), // | ||
license.residence()); | ||
} | ||
|
||
private void show(String title, String description, Path residence) { | ||
MessageDialog dialog = new MessageDialog(// | ||
shell, // | ||
title, // | ||
null, // | ||
description, // | ||
MessageDialog.INFORMATION, // | ||
new String[] { // | ||
"OK", //$NON-NLS-1$ | ||
"Open &Folder" //$NON-NLS-1$ | ||
}, 0); | ||
int result = dialog.open(); | ||
if (result == 1) { | ||
Program.launch(residence.toAbsolutePath().toString()); | ||
} | ||
} | ||
|
||
} |
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