[EGIT PATCH 01/25] Use generics for collections in commit dialog and import page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A little cleaner and fewer warnings.

Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx>
---
 .../ui/internal/clone/GitProjectsImportPage.java   |   16 ++++++++--------
 .../egit/ui/internal/dialogs/CommitDialog.java     |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
index ece585a..5d82edc 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/clone/GitProjectsImportPage.java
@@ -508,7 +508,7 @@ public void run(IProgressMonitor monitor) {
 							UIText.WizardProjectsImportPage_SearchingMessage,
 							100);
 					selectedProjects = new ProjectRecord[0];
-					Collection files = new ArrayList();
+					Collection<File> files = new ArrayList<File>();
 					monitor.worked(10);
 					if (directory.isDirectory()) {
 
@@ -516,14 +516,14 @@ public void run(IProgressMonitor monitor) {
 								null, monitor)) {
 							return;
 						}
-						Iterator filesIterator = files.iterator();
+						Iterator<File> filesIterator = files.iterator();
 						selectedProjects = new ProjectRecord[files.size()];
 						int index = 0;
 						monitor.worked(50);
 						monitor
 								.subTask(UIText.WizardProjectsImportPage_ProcessingMessage);
 						while (filesIterator.hasNext()) {
-							File file = (File) filesIterator.next();
+							File file = filesIterator.next();
 							selectedProjects[index] = new ProjectRecord(file);
 							index++;
 						}
@@ -562,8 +562,8 @@ setMessage(UIText.WizardProjectsImportPage_projectsInWorkspace,
 	 *            The monitor to report to
 	 * @return boolean <code>true</code> if the operation was completed.
 	 */
-	private boolean collectProjectFilesFromDirectory(Collection files,
-			File directory, Set directoriesVisited, IProgressMonitor monitor) {
+	private boolean collectProjectFilesFromDirectory(Collection<File> files,
+			File directory, Set<String> directoriesVisited, IProgressMonitor monitor) {
 
 		if (monitor.isCanceled()) {
 			return false;
@@ -577,7 +577,7 @@ private boolean collectProjectFilesFromDirectory(Collection files,
 
 		// Initialize recursion guard for recursive symbolic links
 		if (directoriesVisited == null) {
-			directoriesVisited = new HashSet();
+			directoriesVisited = new HashSet<String>();
 			try {
 				directoriesVisited.add(directory.getCanonicalPath());
 			} catch (IOException exception) {
@@ -759,13 +759,13 @@ public CheckboxTreeViewer getProjectsList() {
 	 *         workspace
 	 */
 	public ProjectRecord[] getValidProjects() {
-		List validProjects = new ArrayList();
+		List<ProjectRecord> validProjects = new ArrayList<ProjectRecord>();
 		for (int i = 0; i < selectedProjects.length; i++) {
 			if (!isProjectInWorkspace(selectedProjects[i].getProjectName())) {
 				validProjects.add(selectedProjects[i]);
 			}
 		}
-		return (ProjectRecord[]) validProjects
+		return validProjects
 				.toArray(new ProjectRecord[validProjects.size()]);
 	}
 
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index b69a4ba..e6bd02d 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -366,7 +366,7 @@ public void handleEvent(Event arg0) {
 				}
 				try {
 					ArrayList<GitIndex> changedIndexes = new ArrayList<GitIndex>();
-					for (Iterator<Object> it = sel.iterator(); it.hasNext();) {
+					for (Iterator<?> it = sel.iterator(); it.hasNext();) {
 						CommitItem commitItem = (CommitItem) it.next();
 
 						IProject project = commitItem.file.getProject();
-- 
1.6.1.285.g35d8b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux