-
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.
Bug 571526 open license folder after issuing
Add 'open folder' to the final notification dialog Signed-off-by: eparovyshnaya <[email protected]>
- Loading branch information
1 parent
d61d18a
commit 4dea1c2
Showing
3 changed files
with
76 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
72 changes: 72 additions & 0 deletions
72
...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,72 @@ | ||
/******************************************************************************* | ||
* 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.awt.Desktop; | ||
import java.io.IOException; | ||
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.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) { | ||
try { | ||
Desktop.getDesktop().open(residence.toFile()); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
} |
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