diff --git a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/FromLocalFileSystem.java b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/FromLocalFileSystem.java index 080e54460..a5835e180 100644 --- a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/FromLocalFileSystem.java +++ b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/FromLocalFileSystem.java @@ -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; @@ -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> 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)); } @@ -46,13 +47,6 @@ private void browseAndLoad(Consumer> 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 browse() { DirectoryDialog dialog = new DirectoryDialog(path.getShell(), SWT.OPEN | SWT.SHEET); dialog.setText(ImportLicenseDialogMessages.ImportLicenseDialog_browse_dialog_title); diff --git a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/ImportLicenseDialog.java b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/ImportLicenseDialog.java index d22e07cc3..d8fc5d3da 100644 --- a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/ImportLicenseDialog.java +++ b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/dialogs/licensing/ImportLicenseDialog.java @@ -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; @@ -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) { diff --git a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/i18n/ImportLicenseDialogMessages.properties b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/i18n/ImportLicenseDialogMessages.properties index 8274fe0b5..89773b0f9 100644 --- a/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/i18n/ImportLicenseDialogMessages.properties +++ b/bundles/org.eclipse.passage.lic.jface/src/org/eclipse/passage/lic/internal/jface/i18n/ImportLicenseDialogMessages.properties @@ -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