aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Guzman2013-12-13 14:58:34 -0500
committerSami Wagiaalla2013-12-16 11:45:06 -0500
commit92c2859666526a941b25bc9afe3edf689029c777 (patch)
tree49c3346dbb3677b9f4f9a197f18f0e598cd97990
parente852a19df128448ff002d13c66d2ce5acdfee496 (diff)
downloadorg.eclipse.linuxtools-92c2859666526a941b25bc9afe3edf689029c777.zip
org.eclipse.linuxtools-92c2859666526a941b25bc9afe3edf689029c777.tar.gz
org.eclipse.linuxtools-92c2859666526a941b25bc9afe3edf689029c777.tar.xz
RPM: createrepo tooltips and multiple imports
Added tooltips in the second createrepo project wizard page to help the user what the required fields are. Allowed multiple RPM imports in the Repository page. There is a current bug where FileDialog will only return the first RPM's directory and assume that all the other selected RPMs come from there (reproduce using "Search"). Change-Id: Ic15f5c9d28e70601133225d3a27bda5fd2e87f6e Signed-off-by: Neil Guzman <nguzman@redhat.com> Reviewed-on: https://git.eclipse.org/r/19815 Reviewed-by: Sami Wagiaalla <swagiaal@redhat.com> IP-Clean: Sami Wagiaalla <swagiaal@redhat.com> Tested-by: Sami Wagiaalla <swagiaal@redhat.com>
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java6
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java18
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties3
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java14
-rw-r--r--rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java4
5 files changed, 35 insertions, 10 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
index 1d13bd0..5dacf44 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/Messages.java
@@ -54,6 +54,12 @@ public final class Messages {
public static String CreaterepoNewWizardPageTwo_errorName;
/****/
public static String CreaterepoNewWizardPageTwo_errorURL;
+ /****/
+ public static String CreaterepoNewWizardPageTwo_tooltipID;
+ /****/
+ public static String CreaterepoNewWizardPageTwo_tooltipName;
+ /****/
+ public static String CreaterepoNewWizardPageTwo_tooltipURL;
// CreaterepoProject
/****/
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
index 4b45cbe..f3e61f4 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/form/ImportRPMsPage.java
@@ -281,15 +281,21 @@ public class ImportRPMsPage extends FormPage implements IResourceChangeListener
public void widgetSelected(SelectionEvent e) {
IWorkbench workbench = PlatformUI.getWorkbench();
Shell shell = workbench.getModalDialogShellProvider().getShell();
- FileDialog fileDialog = new FileDialog(shell, SWT.SINGLE);
+ FileDialog fileDialog = new FileDialog(shell, SWT.MULTI);
fileDialog.setFilterExtensions(EXTENSION_FILTERS);
if (fileDialog.open() != null) {
- File externalFile = new File(fileDialog.getFilterPath(), fileDialog.getFileName());
- try {
- project.importRPM(externalFile);
+ String[] files = fileDialog.getFileNames();
+ if (files.length > 0) {
+ String directoryPath = fileDialog.getFilterPath();
+ for (String file : files) {
+ File externalFile = new File(directoryPath, file);
+ try {
+ project.importRPM(externalFile);
+ } catch (CoreException e1) {
+ Activator.logError(Messages.ImportButtonListener_error, e1);
+ }
+ }
refreshTree();
- } catch (CoreException e1) {
- Activator.logError(Messages.ImportButtonListener_error, e1);
}
}
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
index c1da0f6..d2c7b1e 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/messages.properties
@@ -32,6 +32,9 @@ CreaterepoNewWizardPageTwo_errorID=The repository ID is invalid. Make sure it is
CreaterepoNewWizardPageTwo_errorName=The name of the repository is invalid. Make sure it is not empty
CreaterepoNewWizardPageTwo_errorURL=The base URL is invalid. Make sure it has a valid protocol (http://, \
ftp://, file://)
+CreaterepoNewWizardPageTwo_tooltipID=A one word string that uniquely identifies the yum repository
+CreaterepoNewWizardPageTwo_tooltipName=A human-readable description of the repository
+CreaterepoNewWizardPageTwo_tooltipURL=A URL to the repodata directory of the repository to be created
# CreaterepoProject
CreaterepoProject_executeCreaterepo=Executing createrepo...
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java
index a26c191..d2c72e9 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/internal/rpm/createrepo/wizard/CreaterepoNewWizardPageTwo.java
@@ -84,11 +84,14 @@ public class CreaterepoNewWizardPageTwo extends WizardPage {
setPageComplete(isValid());
}
};
- repositoryIDTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelID);
+ repositoryIDTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelID,
+ Messages.CreaterepoNewWizardPageTwo_tooltipID);
repositoryIDTxt.addModifyListener(modifyListner);
- repositoryNameTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelName);
+ repositoryNameTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelName,
+ Messages.CreaterepoNewWizardPageTwo_tooltipName);
repositoryNameTxt.addModifyListener(modifyListner);
- repositoryBaseURLTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelURL);
+ repositoryBaseURLTxt = createTextFieldWithLabel(information, Messages.CreaterepoNewWizardPageTwo_labelURL,
+ Messages.CreaterepoNewWizardPageTwo_tooltipURL);
repositoryBaseURLTxt.addModifyListener(modifyListner);
setControl(container);
}
@@ -100,7 +103,7 @@ public class CreaterepoNewWizardPageTwo extends WizardPage {
* @param labelName The name on the label.
* @return The newly created text field.
*/
- protected Text createTextFieldWithLabel(Composite parent, String labelName) {
+ protected Text createTextFieldWithLabel(Composite parent, String labelName, String tooltip) {
GridData layoutData = new GridData();
// create the label
Label respositoryBaseURLLbl = new Label(parent, SWT.NONE);
@@ -108,6 +111,7 @@ public class CreaterepoNewWizardPageTwo extends WizardPage {
layoutData = new GridData();
layoutData.horizontalAlignment = GridData.BEGINNING;
layoutData.verticalAlignment = GridData.CENTER;
+ respositoryBaseURLLbl.setToolTipText(tooltip);
// create the text field
Text textField = new Text(parent, SWT.BORDER | SWT.SINGLE);
layoutData = new GridData();
@@ -115,6 +119,7 @@ public class CreaterepoNewWizardPageTwo extends WizardPage {
layoutData.horizontalAlignment = GridData.FILL;
layoutData.verticalAlignment = GridData.CENTER;
textField.setLayoutData(layoutData);
+ textField.setToolTipText(tooltip);
return textField;
}
@@ -197,4 +202,5 @@ public class CreaterepoNewWizardPageTwo extends WizardPage {
}
return repositoryBaseURLTxt.getText().trim();
}
+
}
diff --git a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
index 64d312a..3fc85c4 100644
--- a/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
+++ b/rpm/org.eclipse.linuxtools.rpm.createrepo/src/org/eclipse/linuxtools/rpm/createrepo/CreaterepoProject.java
@@ -115,6 +115,10 @@ public class CreaterepoProject {
* @throws CoreException Thrown when failure to create a workspace file.
*/
public void importRPM(File externalFile) throws CoreException {
+ // must first check if external file exists
+ if (!externalFile.exists()) {
+ return;
+ }
// must put imported RPMs into the content folder; create if missing
if (!getContentFolder().exists()) {
createContentFolder();