Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1191] "Import Licenses" wizard should support import from archive #1287

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.eclipse.passage.lic.internal.jface.i18n.ImportLicenseDialogMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
Expand All @@ -32,12 +31,14 @@ public final class FromLocalFileSystem implements LicenseFilesControl {
private Text path;

@Override
/**
* parent is expected to have GridLayout(3, false)
*/
public void install(Composite parent, Consumer<List<Path>> onLicenses) {
Composite composite = row(parent, 3);
new Label(composite, SWT.NONE).setText(ImportLicenseDialogMessages.ImportLicenseDialog_path_label);
path = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
new Label(parent, SWT.NONE).setText(ImportLicenseDialogMessages.ImportLicenseDialog_path_label);
path = new Text(parent, SWT.BORDER | SWT.READ_ONLY);
path.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Button browse = new Button(composite, SWT.PUSH);
Button browse = new Button(parent, SWT.PUSH);
browse.setText(ImportLicenseDialogMessages.ImportLicenseDialog_browse);
browse.addListener(SWT.Selection, e -> browseAndLoad(onLicenses));
}
Expand All @@ -46,13 +47,6 @@ private void browseAndLoad(Consumer<List<Path>> onLicenses) {
onLicenses.accept(browse());
}

private Composite row(Composite parent, int columns) {
Composite row = new Composite(parent, SWT.NONE);
row.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
row.setLayout(new GridLayout(columns, false));
return row;
}

private List<Path> browse() {
DirectoryDialog dialog = new DirectoryDialog(path.getShell(), SWT.OPEN | SWT.SHEET);
dialog.setText(ImportLicenseDialogMessages.ImportLicenseDialog_browse_dialog_title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import org.eclipse.passage.lic.internal.equinox.access.RegisteredLibraries;
import org.eclipse.passage.lic.internal.jface.i18n.ImportLicenseDialogMessages;
import org.eclipse.passage.lic.jface.resource.LicensingImages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

Expand Down Expand Up @@ -77,7 +80,14 @@ protected void initMessage() {
}

private void buildSelector(Composite parent) {
source.install(parent, this::loadAndUpdate);
source.install(row(parent, 3), this::loadAndUpdate);
}

private Composite row(Composite parent, int columns) {
Composite row = new Composite(parent, SWT.NONE);
row.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
row.setLayout(new GridLayout(columns, false));
return row;
}

private void buildViewer(Composite parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ ImportLicenseDialog_import_title=&Import
ImportLicenseDialog_import_tooltip=Copy found license files to dedicated directories
ImportLicenseDialog_io_error=License import failed due to I/O error: %s
ImportLicenseDialog_lic_read_failed=Failed to read the license from the pointed folder
ImportLicenseDialog_path_label=From folder with license(s):
ImportLicenseDialog_prelude=Point a folder with license files to see what's inside them
ImportLicenseDialog_path_label=From &Folder:
ImportLicenseDialog_prelude=Find licenses
ImportLicenseDialog_title=Import Licenses
Loading