Bug 501224 - Cleanup warnings in o.e.releng.tools
* Generification.
* SubProgressMonitor -> SubMonitor
* Remove useless non-javadoc comments
Change-Id: Ibb852b69993137490f23604ba7a01e99f48cfaa5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/bundles/org.eclipse.releng.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.releng.tools/.settings/org.eclipse.jdt.core.prefs
index fbd753d..1798177 100644
--- a/bundles/org.eclipse.releng.tools/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.releng.tools/.settings/org.eclipse.jdt.core.prefs
@@ -2,10 +2,14 @@
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
@@ -49,12 +53,14 @@
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
@@ -78,12 +84,13 @@
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/internal/tools/pomversion/PomVersionErrorReporter.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/internal/tools/pomversion/PomVersionErrorReporter.java
index 4e9b0cf..7874aa4 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/internal/tools/pomversion/PomVersionErrorReporter.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/internal/tools/pomversion/PomVersionErrorReporter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+ * Copyright (c) 2013, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -140,7 +140,7 @@
*/
class PomVersionHandler extends DefaultHandler {
private Version version;
- private Stack elements = new Stack();
+ private Stack<String> elements = new Stack<String>();
private boolean checkVersion = false;
private boolean isFeatureProject = false;
private Locator locator;
@@ -350,7 +350,7 @@
// Get the manifest version
Version bundleVersion = Version.emptyVersion;
try {
- Map headers = new HashMap();
+ Map<String, String> headers = new HashMap<String, String>();
ManifestElement.parseBundleManifest(manifest.getContents(), headers);
String ver = (String)headers.get(Constants.BUNDLE_VERSION);
if(ver == null) {
@@ -426,7 +426,7 @@
*/
void reportMarker(String message, int lineNumber, int charStart, int charEnd, String correctedVersion, IFile pom, String severity) {
try {
- HashMap attributes = new HashMap();
+ HashMap<String, Object> attributes = new HashMap<String, Object>();
attributes.put(IMarker.MESSAGE, message);
if (severity.equals(IPomVersionConstants.VALUE_WARNING)){
attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING));
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/AdvancedFixCopyrightAction.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/AdvancedFixCopyrightAction.java
index e6602cf..ac88dc7 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/AdvancedFixCopyrightAction.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/AdvancedFixCopyrightAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2014 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -36,7 +36,7 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelection;
@@ -113,7 +113,7 @@
}
private String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
- private Map log = new HashMap();
+ private Map<String, List<String>> log = new HashMap<String, List<String>>();
private MessageConsole console;
// The current selection
@@ -127,10 +127,10 @@
* @return the selected resources
*/
protected IResource[] getSelectedResources() {
- ArrayList resources = null;
+ ArrayList<IResource> resources = null;
if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = selection.iterator();
+ resources = new ArrayList<IResource>();
+ Iterator<?> elements = selection.iterator();
while (elements.hasNext()) {
addResource(elements.next(), resources);
}
@@ -143,9 +143,9 @@
return new IResource[0];
}
- private void addResource(Object element, ArrayList resources) {
+ private void addResource(Object element, ArrayList<IResource> resources) {
if (element instanceof IResource) {
- resources.add(element);
+ resources.add((IResource) element);
} else if (element instanceof IWorkingSet) {
IWorkingSet ws = (IWorkingSet) element;
IAdaptable[] elements= ws.getElements();
@@ -153,7 +153,7 @@
addResource(elements[i], resources);
} else if (element instanceof IAdaptable) {
IAdaptable a = (IAdaptable) element;
- addResource((IResource)a.getAdapter(IResource.class), resources);
+ addResource(a.getAdapter(IResource.class), resources);
}
}
@@ -167,7 +167,7 @@
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
- log = new HashMap();
+ log = new HashMap<String, List<String>>();
console = new FixConsole();
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] {console});
try {
@@ -188,7 +188,7 @@
stream.println(NLS.bind(
Messages.getString("AdvancedFixCopyrightAction.3"), Integer.toString(results.length))); //$NON-NLS-1$
- monitor.subTask(Messages.getString("AdvancedFixCopyrightAction.22")); //'initializing' msg.
+ monitor.subTask(Messages.getString("AdvancedFixCopyrightAction.22")); //'initializing' msg. //$NON-NLS-1$
int totalFileCount = countFiles(results); //this generates ~5% overhead.
monitor.beginTask(Messages.getString("AdvancedFixCopyrightAction.4"), totalFileCount); //$NON-NLS-1$
@@ -198,9 +198,9 @@
throw new CoreException(new Status(IStatus.ERROR, RelEngPlugin.ID, 0, Messages.getString("AdvancedFixCopyrightAction.5"), null)); //$NON-NLS-1$
}
} else {
- adapter.initialize(new SubProgressMonitor(monitor, 100));
+ adapter.initialize(SubMonitor.convert(monitor, 100));
}
- List exceptions = new ArrayList();
+ List<CoreException> exceptions = new ArrayList<CoreException>();
for (int i = 0; i < results.length; i++) {
IResource resource = results[i];
stream.println(NLS.bind(
@@ -221,12 +221,12 @@
if (!exceptions.isEmpty()) {
stream.println(Messages.getString("AdvancedFixCopyrightAction.9")); //$NON-NLS-1$
if (exceptions.size() == 1) {
- throw (CoreException)exceptions.get(0);
+ throw exceptions.get(0);
} else {
- List status = new ArrayList();
- for (Iterator iterator = exceptions.iterator(); iterator
+ List<Status> status = new ArrayList<Status>();
+ for (Iterator<CoreException> iterator = exceptions.iterator(); iterator
.hasNext();) {
- CoreException ce = (CoreException) iterator.next();
+ CoreException ce = iterator.next();
status.add(new Status(
ce.getStatus().getSeverity(),
ce.getStatus().getPlugin(),
@@ -235,7 +235,7 @@
ce));
}
throw new CoreException(new MultiStatus(RelEngPlugin.ID,
- 0, (IStatus[]) status.toArray(new IStatus[status.size()]),
+ 0, status.toArray(new IStatus[status.size()]),
Messages.getString("AdvancedFixCopyrightAction.10"), //$NON-NLS-1$
null));
}
@@ -286,7 +286,7 @@
if(providerType == null) {
return null;
}
- IRepositoryProviderCopyrightAdapterFactory factory = (IRepositoryProviderCopyrightAdapterFactory)providerType.getAdapter(IRepositoryProviderCopyrightAdapterFactory.class);
+ IRepositoryProviderCopyrightAdapterFactory factory = providerType.getAdapter(IRepositoryProviderCopyrightAdapterFactory.class);
if (factory == null) {
factory = (IRepositoryProviderCopyrightAdapterFactory)Platform.getAdapterManager().loadAdapter(providerType, IRepositoryProviderCopyrightAdapterFactory.class.getName());
if (factory == null) {
@@ -306,17 +306,17 @@
File aFile = new File(Platform.getLocation().toFile(),
"copyrightLog.txt"); //$NON-NLS-1$
aStream = new FileOutputStream(aFile);
- Set aSet = log.entrySet();
- Iterator errorIterator = aSet.iterator();
+ Set<Map.Entry<String, List<String>>> aSet = log.entrySet();
+ Iterator<Map.Entry<String, List<String>>> errorIterator = aSet.iterator();
while (errorIterator.hasNext()) {
- Map.Entry anEntry = (Map.Entry) errorIterator.next();
- String errorDescription = (String) anEntry.getKey();
+ Map.Entry<String, List<String>> anEntry = errorIterator.next();
+ String errorDescription = anEntry.getKey();
aStream.write(errorDescription.getBytes());
aStream.write(newLine.getBytes());
- List fileList = (List) anEntry.getValue();
- Iterator listIterator = fileList.iterator();
+ List<String> fileList = anEntry.getValue();
+ Iterator<String> listIterator = fileList.iterator();
while (listIterator.hasNext()) {
- String fileName = (String) listIterator.next();
+ String fileName = listIterator.next();
aStream.write(" ".getBytes()); //$NON-NLS-1$
aStream.write(fileName.getBytes());
aStream.write(newLine.getBytes());
@@ -332,14 +332,14 @@
private void displayLogs(MessageConsoleStream stream) {
- Set aSet = log.entrySet();
- Iterator errorIterator = aSet.iterator();
+ Set<Map.Entry<String, List<String>>> aSet = log.entrySet();
+ Iterator<Map.Entry<String, List<String>>> errorIterator = aSet.iterator();
while (errorIterator.hasNext()) {
- Map.Entry anEntry = (Map.Entry) errorIterator.next();
- String errorDescription = (String) anEntry.getKey();
+ Map.Entry<String, List<String>> anEntry = errorIterator.next();
+ String errorDescription = anEntry.getKey();
stream.println(errorDescription);
- List fileList = (List) anEntry.getValue();
- Iterator listIterator = fileList.iterator();
+ List<String> fileList = anEntry.getValue();
+ Iterator<String> listIterator = fileList.iterator();
while (listIterator.hasNext()) {
String fileName = (String) listIterator.next();
stream.println(" " + fileName); //$NON-NLS-1$
@@ -437,7 +437,7 @@
// in the comment to the last modification time provided by adapter
if (lastMod < currentYear) {
try {
- lastMod = adapter.getLastModifiedYear(file, new SubProgressMonitor(monitor, 1));
+ lastMod = adapter.getLastModifiedYear(file, SubMonitor.convert(monitor, 1));
} catch (CoreException e) {
// Let's log the exception and continue
RelEngPlugin
@@ -546,9 +546,9 @@
private void warn(IFile file, BlockComment firstBlockComment,
String errorDescription) {
- List aList = (List) log.get(errorDescription);
+ List<String> aList = log.get(errorDescription);
if (aList == null) {
- aList = new ArrayList();
+ aList = new ArrayList<String>();
log.put(errorDescription, aList);
}
aList.add(file.getFullPath().toString());
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BlockComment.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BlockComment.java
index ada8b5c..8a7feb1 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BlockComment.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BlockComment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@
private String contents;
private static String newLine = System.getProperty("line.separator"); //$NON-NLS-1$
private String copyrightHolder;
- private List nonIBMContributors = new ArrayList();
+ private List<String> nonIBMContributors = new ArrayList<String>();
private String commentEnd;
@@ -103,7 +103,7 @@
/**
*
*/
- public List nonIBMContributors() {
+ public List<String> nonIBMContributors() {
String lowerCaseContents = contents.toLowerCase();
int start = lowerCaseContents.indexOf("contributors");
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BuildNotesPage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BuildNotesPage.java
index 1e0b261..3edf815 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BuildNotesPage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/BuildNotesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,9 +19,23 @@
import java.util.Iterator;
import java.util.Map;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -33,27 +47,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.internal.texteditor.SWTUtil;
import org.eclipse.ui.model.WorkbenchContentProvider;
@@ -82,7 +77,7 @@
private Text reportText;
- private Map bugSummaryMap;
+ private Map<Integer, String> bugSummaryMap;
private boolean validPath;
@@ -328,17 +323,17 @@
insertBuffer.append(" <p>Problem reports updated</p>\n");
insertBuffer.append(" <p>\n");
- Iterator i = bugSummaryMap.entrySet().iterator();
+ Iterator<Map.Entry<Integer, String>> i = bugSummaryMap.entrySet().iterator();
while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
- Integer bug = (Integer) entry.getKey();
- String summary = (String) entry.getValue();
+ Map.Entry<Integer, String> entry = i.next();
+ Integer bug = entry.getKey();
+ String summary = entry.getValue();
insertBuffer
.append("<a href=\"https://bugs.eclipse.org/bugs/show_bug.cgi?id=");
insertBuffer.append(bug);
insertBuffer.append("\">Bug ");
insertBuffer.append(bug);
- insertBuffer.append("</a>. ");
+ insertBuffer.append("</a. ");
insertBuffer.append(summary + "<br>\n");
}
insertBuffer.append(" </p>");
@@ -465,12 +460,12 @@
} else {
buffer
.append("The map file has been updated for the following Bug changes:\n");
- Iterator i = bugSummaryMap.entrySet().iterator();
+ Iterator<Map.Entry<Integer, String>> i = bugSummaryMap.entrySet().iterator();
while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
- Integer bug = (Integer) entry.getKey();
- String summary = (String) entry.getValue();
+ Map.Entry<Integer, String> entry = i.next();
+ Integer bug = entry.getKey();
+ String summary = entry.getValue();
buffer.append("+ Bug " + bug + ". " + summary + "\n");
}
}
@@ -483,7 +478,7 @@
return buffer.toString();
}
- public void setMap(Map map) {
+ public void setMap(Map<Integer, String> map) {
this.bugSummaryMap = map;
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapter.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapter.java
index 9b6e5bd..0789cb3 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapter.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
@@ -38,7 +38,7 @@
if (cvsFile != null && cvsFile.isManaged()) {
// get the log entry for the revision loaded in the workspace
ILogEntry entry = ((ICVSRemoteFile)cvsFile)
- .getLogEntry(new SubProgressMonitor(monitor, 100));
+ .getLogEntry(SubMonitor.convert(monitor, 100));
String logComment = entry.getComment();
if (filterString != null && logComment.toLowerCase().indexOf(filterString) != -1) {
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapterFactory.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapterFactory.java
index d0f695b..b5c576f 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapterFactory.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSCopyrightAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,12 +17,13 @@
public class CVSCopyrightAdapterFactory implements IAdapterFactory,
IRepositoryProviderCopyrightAdapterFactory {
- private static final Class[] ADAPTER_LIST = new Class[] { IRepositoryProviderCopyrightAdapterFactory.class };
+ private static final Class<?>[] ADAPTER_LIST = new Class[] { IRepositoryProviderCopyrightAdapterFactory.class };
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (IRepositoryProviderCopyrightAdapterFactory.class
.equals(adapterType)) {
- return getCVSCopyrightAdapter(adaptableObject);
+ return (T) getCVSCopyrightAdapter(adaptableObject);
}
return null;
}
@@ -33,7 +34,7 @@
return this;
}
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSTagHelper.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSTagHelper.java
index ced41ff..b4bc75d 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSTagHelper.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/CVSTagHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,16 +12,13 @@
import java.util.ArrayList;
-import org.eclipse.releng.tools.preferences.MapProjectPreferencePage;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.releng.tools.preferences.MapProjectPreferencePage;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
/**
* This is a helper class used for obtaining CVSTags and checking for projects that have no corresponding
@@ -29,11 +26,11 @@
*/
public class CVSTagHelper {
- private ArrayList defaultTags;
+ private ArrayList<IResource> defaultTags;
//Returns an array of CVSTags for which no map entry could be found
public CVSTag[] findMissingMapEntries(IResource[] resources) {
- defaultTags = new ArrayList();
+ defaultTags = new ArrayList<IResource>();
CVSTag[] tags = new CVSTag[resources.length];
for (int i = 0; i < resources.length; i++) {
tags[i] = getTag(resources[i]);
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/FixPageParticipant.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/FixPageParticipant.java
index 9aec84a..80e2826 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/FixPageParticipant.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/FixPageParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBH SYSTEMS GmbH.
+ * Copyright (c) 2014, 2016 IBH SYSTEMS GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
public class FixPageParticipant implements IConsolePageParticipant {
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/GetBugsOperation.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/GetBugsOperation.java
index a5fce52..a2c25c2 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/GetBugsOperation.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/GetBugsOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -84,16 +84,13 @@
// task 1 -- get bug number from comments
syncInfos = syncInfoSet.getSyncInfos();
- Set bugTree = getBugNumbersFromComments(syncInfos,
- new SubProgressMonitor(monitor, 85,
- SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
+ Set<Integer> bugTree = getBugNumbersFromComments(syncInfos,
+ new SubProgressMonitor(monitor, 85, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
// task 2 -- create map of bugs and summaries
- Integer[] bugs = (Integer[]) bugTree
- .toArray(new Integer[0]);
- final TreeMap map = (TreeMap) getBugzillaSummaries(bugs,
- new SubProgressMonitor(monitor, 15,
- SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
+ Integer[] bugs = bugTree.toArray(new Integer[0]);
+ final Map<Integer, String> map = getBugzillaSummaries(bugs,
+ new SubProgressMonitor(monitor, 15, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
page.getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
page.setMap(map);
@@ -109,10 +106,10 @@
}
}
- protected Set getBugNumbersFromComments(SyncInfo[] syncInfos,
+ protected Set<Integer> getBugNumbersFromComments(SyncInfo[] syncInfos,
IProgressMonitor monitor) {
monitor.beginTask("Scanning comments for bug numbers", syncInfos.length);
- TreeSet set = new TreeSet();
+ TreeSet<Integer> set = new TreeSet<Integer>();
for (int i = 0; i < syncInfos.length; i++) {
SyncInfo info = syncInfos[i];
getBugNumbersForSyncInfo(info, monitor, set);
@@ -123,7 +120,7 @@
}
private void getBugNumbersForSyncInfo(SyncInfo info,
- IProgressMonitor monitor, Set set) {
+ IProgressMonitor monitor, Set<Integer> set) {
try {
CVSTag remoteTag = null;
CVSTag localTag = null;
@@ -198,7 +195,7 @@
return new CVSTag();
}
- protected void findBugNumber(String comment, Set set) {
+ protected void findBugNumber(String comment, Set<Integer> set) {
if (comment == null) {
return;
}
@@ -213,14 +210,14 @@
* Method uses set of bug numbers to query bugzilla and get summary of each
* bug
*/
- protected Map getBugzillaSummaries(Integer[] bugs, IProgressMonitor monitor) {
+ protected Map<Integer, String> getBugzillaSummaries(Integer[] bugs, IProgressMonitor monitor) {
monitor.beginTask(
Messages.getString("GetBugsOperation.1"), bugs.length + 1); //$NON-NLS-1$
HttpURLConnection hURL;
DataInputStream in;
URLConnection url;
StringBuffer buffer;
- TreeMap map = new TreeMap();
+ TreeMap<Integer, String> map = new TreeMap<Integer, String>();
for (int i = 0; i < bugs.length; i++) {
try {
url = (new URL(BUG_DATABASE_PREFIX + bugs[i]
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/IBMCopyrightComment.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/IBMCopyrightComment.java
index 6f10ad7..290ccea 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/IBMCopyrightComment.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/IBMCopyrightComment.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,11 +22,11 @@
private static final int DEFAULT_CREATION_YEAR = 2005;
- private List contributors;
+ private List<String> contributors;
private int yearRangeStart, yearRangeEnd;
private String originalText;
- private IBMCopyrightComment(int commentStyle, int creationYear, int revisionYear, List contributors, int yearRangeStart, int yearRangeEnd, String originalText) {
+ private IBMCopyrightComment(int commentStyle, int creationYear, int revisionYear, List<String> contributors, int yearRangeStart, int yearRangeEnd, String originalText) {
super(commentStyle, creationYear == -1 ? DEFAULT_CREATION_YEAR : creationYear, revisionYear);
this.contributors = contributors;
this.yearRangeStart = yearRangeStart;
@@ -92,7 +92,7 @@
String contribComment = body.substring(contrib);
StringTokenizer tokens = new StringTokenizer(contribComment, "\r\n"); //$NON-NLS-1$
tokens.nextToken();
- ArrayList contributors = new ArrayList();
+ ArrayList<String> contributors = new ArrayList<String>();
String linePrefix = getLinePrefix(commentStyle);
while(tokens.hasMoreTokens()) {
String contributor = tokens.nextToken();
@@ -173,9 +173,9 @@
if (contributors == null || contributors.size() <= 0)
println(writer, linePrefix + " IBM Corporation - initial API and implementation"); //$NON-NLS-1$
else {
- Iterator i = contributors.iterator();
+ Iterator<String> i = contributors.iterator();
while (i.hasNext()) {
- String contributor = (String) i.next();
+ String contributor = i.next();
if (contributor.length() > 0) {
if (Character.isWhitespace(contributor.charAt(0))) {
println(writer, linePrefix + contributor);
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/LoadMap.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/LoadMap.java
index eb47d16..3e23c83 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/LoadMap.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/LoadMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,23 +18,19 @@
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.IAction;
import org.eclipse.team.core.ProjectSetCapability;
import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.team.internal.ui.UIProjectSetSerializationContext;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.action.IAction;
-
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -74,13 +70,13 @@
* @throws CoreException
*/
protected String[] getReferenceStrings(IResource[] mapFiles) throws CoreException {
- List allStrings = new ArrayList();
+ List<String> allStrings = new ArrayList<String>();
for (int i = 0; i < mapFiles.length; i++) {
IResource resource = mapFiles[i];
String[] referenceStrings = readReferenceStrings((IFile)resource);
allStrings.addAll(Arrays.asList(referenceStrings));
}
- return (String[]) allStrings.toArray(new String[allStrings.size()]);
+ return allStrings.toArray(new String[allStrings.size()]);
}
/**
@@ -94,7 +90,7 @@
try {
try {
String line = reader.readLine();
- List references = new ArrayList();
+ List<String> references = new ArrayList<String>();
while (line != null) {
String referenceString = new MapEntry(line).getReferenceString();
if (referenceString != null) {
@@ -102,7 +98,7 @@
}
line = reader.readLine();
}
- return (String[]) references.toArray(new String[references.size()]);
+ return references.toArray(new String[references.size()]);
} finally {
reader.close();
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapEntry.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapEntry.java
index b8aaddb..b1c863e 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapEntry.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,11 +10,17 @@
*******************************************************************************/
package org.eclipse.releng.tools;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
@@ -33,7 +39,7 @@
private boolean valid = false;
private String type = EMPTY_STRING;
private String id = EMPTY_STRING;
- private OrderedMap arguments = new OrderedMap();
+ private OrderedMap<String, String> arguments = new OrderedMap<String, String>();
private boolean legacy = false;
private String version;
@@ -137,8 +143,8 @@
* Build a table from the given array. In the new format,the array contains
* key=value elements. Otherwise we fill in the key based on the old format.
*/
- private OrderedMap populate(String[] entries) {
- OrderedMap result = new OrderedMap();
+ private OrderedMap<String, String> populate(String[] entries) {
+ OrderedMap<String, String> result = new OrderedMap<String, String>();
for (int i=0; i<entries.length; i++) {
String entry = entries[i];
int index = entry.indexOf('=');
@@ -157,9 +163,9 @@
return result;
}
- private OrderedMap legacyPopulate(String[] entries) {
+ private OrderedMap<String, String> legacyPopulate(String[] entries) {
legacy = true;
- OrderedMap result = new OrderedMap();
+ OrderedMap<String, String> result = new OrderedMap<String, String>();
// must have at least tag and connect string
if (entries.length >= 2) {
// Version
@@ -188,7 +194,7 @@
public static String[] getArrayFromStringWithBlank(String list, String separator) {
if (list == null || list.trim().length() == 0)
return new String[0];
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
boolean previousWasSeparator = true;
for (StringTokenizer tokens = new StringTokenizer(list, separator, true); tokens.hasMoreTokens();) {
String token = tokens.nextToken().trim();
@@ -201,7 +207,7 @@
previousWasSeparator = false;
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public String getTagName() {
@@ -283,9 +289,9 @@
}
result.append('=');
result.append("CVS");
- for (Iterator iter = arguments.keys().iterator(); iter.hasNext(); ) {
- String key = (String) iter.next();
- String value = (String) arguments.get(key);
+ for (Iterator<String> iter = arguments.keys().iterator(); iter.hasNext(); ) {
+ String key = iter.next();
+ String value = arguments.get(key);
if (value != null && value.length() > 0)
result.append(',' + key + '=' + value);
}
@@ -332,9 +338,6 @@
return "Entry: " + getMapString();
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object obj) {
if (obj instanceof MapEntry) {
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFile.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFile.java
index 34aada2..9edc318 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFile.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,16 +19,15 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
public class MapFile {
@@ -54,7 +53,7 @@
protected void loadEntries() throws CoreException {
InputStream inputStream = null;
- List list = new ArrayList();
+ List<MapEntry> list = new ArrayList<MapEntry>();
try {
inputStream = file.getContents();
@@ -107,7 +106,7 @@
}
public IProject[] getAccessibleProjects() {
- Set list = new HashSet();
+ Set<IProject> list = new HashSet<IProject>();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
if(entries == null || entries.length ==0) return null;
for (int i = 0; i < projects.length; i++) {
@@ -120,7 +119,7 @@
}
}
}
- return (IProject[])list.toArray(new IProject[list.size()]);
+ return list.toArray(new IProject[list.size()]);
}
public String getName() {
@@ -136,7 +135,7 @@
* @since 3.7
*/
public static MapFile[] findAllMapFiles(IResource resource) throws CoreException {
- final ArrayList mapFiles = new ArrayList();
+ final ArrayList<MapFile> mapFiles = new ArrayList<MapFile>();
IResourceProxyVisitor visitor= new IResourceProxyVisitor() {
public boolean visit(IResourceProxy resourceProxy) throws CoreException {
if (!resourceProxy.isAccessible())
@@ -155,7 +154,7 @@
resource.accept(visitor,IResource.NONE);
- return (MapFile[]) mapFiles.toArray(new MapFile[mapFiles.size()]);
+ return mapFiles.toArray(new MapFile[mapFiles.size()]);
}
public static boolean isMapFile(IFile aFile){
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFileCompareEditorInput.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFileCompareEditorInput.java
index 8824909..dc9b421 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFileCompareEditorInput.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapFileCompareEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -56,9 +56,6 @@
mapProject = null;
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
CompareConfiguration config = getCompareConfiguration();
@@ -76,9 +73,6 @@
setDocuments(docs);
buildTree();
}
- /* (non-Javadoc)
- * @see org.eclipse.compare.CompareEditorInput#createDiffViewer(org.eclipse.swt.widgets.Composite)
- */
@Override
public Viewer createDiffViewer(Composite parent) {
viewer = super.createDiffViewer(parent);
@@ -132,14 +126,14 @@
private MapFile[] getChangedMapFiles() {
if (selectedProjects == null || selectedProjects.length == 0)
return null;
- List projectList = new ArrayList();
+ List<IProject> projectList = new ArrayList<IProject>();
CVSTag[] tags = mapProject.getTagsFor(selectedProjects );
for(int i = 0; i < selectedProjects.length; i++){
if(!tags[i].getName().equals(tag)){
projectList.add(selectedProjects[i]);
}
}
- IProject [] projects = (IProject[])projectList.toArray(new IProject[projectList.size()]);
+ IProject [] projects = projectList.toArray(new IProject[projectList.size()]);
return mapProject.getMapFilesFor(projects);
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProject.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProject.java
index 9bf6d2a..aee30ed 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProject.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,15 +17,6 @@
import java.util.List;
import java.util.Set;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -36,6 +27,13 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation;
public class MapProject implements IResourceChangeListener {
@@ -111,14 +109,14 @@
}
public MapFile[] getValidMapFiles(){
- List list = new ArrayList();
+ List<MapFile> list = new ArrayList<MapFile>();
for (int i = 0; i <mapFiles.length; i++){
IProject[] projects = mapFiles[i].getAccessibleProjects();
if( projects!= null && projects.length > 0){
list.add(mapFiles[i]);
}
}
- return (MapFile[])list.toArray(new MapFile[list.size()]);
+ return list.toArray(new MapFile[list.size()]);
}
/**
@@ -148,12 +146,12 @@
}
public MapFile[] getMapFilesFor(IProject[] projects){
- Set alist = new HashSet();
+ Set<MapFile> alist = new HashSet<MapFile>();
for(int i = 0; i<projects.length; i++){
MapFile aMapFile = getMapFile(projects[i]);
alist.add(aMapFile);
}
- return (MapFile[])alist.toArray(new MapFile[alist.size()]);
+ return alist.toArray(new MapFile[alist.size()]);
}
/**
@@ -241,8 +239,8 @@
return new MapFile(file);
}
private void addMapFile(MapFile aFile){
- Set set = new HashSet(Arrays.asList(mapFiles));
+ Set<MapFile> set = new HashSet<MapFile>(Arrays.asList(mapFiles));
set.add(aFile);
- mapFiles = (MapFile[])set.toArray(new MapFile[set.size()]);
+ mapFiles = set.toArray(new MapFile[set.size()]);
}
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProjectSelectionPage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProjectSelectionPage.java
index 1b33214..11edd54 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProjectSelectionPage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/MapProjectSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,21 +15,8 @@
import java.util.Iterator;
import java.util.Set;
-import org.eclipse.team.core.RepositoryProvider;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.List;
-
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.core.resources.IProject;
-
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -42,7 +29,15 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardPage;
-
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.List;
+import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
@@ -63,10 +58,7 @@
super(pageName, title, image);
this.settings = settings;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
+
public void createControl(Composite parent) {
Composite topContainer = new Composite(parent, SWT.NONE);
topContainer.setLayout(new GridLayout());
@@ -97,8 +89,8 @@
ListViewer result = new ListViewer(tree);
result.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
- Set projects=(Set)inputElement;
- return ((IProject[]) projects.toArray(new IProject[projects.size()]));
+ Set<IProject> projects=(Set<IProject>)inputElement;
+ return projects.toArray(new IProject[projects.size()]);
}
public void dispose() {
}
@@ -115,20 +107,20 @@
return result;
}
- private static Set getMapFileProjects() {
- Set projects = new HashSet();
+ private static Set<IProject> getMapFileProjects() {
+ Set<IProject> projects = new HashSet<IProject>();
MapFile[] mapFiles;
try {
mapFiles = MapFile.findAllMapFiles(RelEngPlugin.getWorkspace().getRoot());
} catch (CoreException ex) {
- return Collections.EMPTY_SET;
+ return Collections.emptySet();
}
for (int i = 0; i < mapFiles.length; i++)
projects.add(mapFiles[i].getFile().getProject());
- for (Iterator iterator= projects.iterator(); iterator.hasNext();) {
+ for (Iterator<IProject> iterator= projects.iterator(); iterator.hasNext();) {
MapProject mapProject= null;
try {
- mapProject= new MapProject((IProject)iterator.next());
+ mapProject= new MapProject(iterator.next());
if (mapProject.getValidMapFiles().length == 0)
iterator.remove();
} catch (CoreException e) {
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/OrderedMap.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/OrderedMap.java
index 16d19f7..91f7a0a 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/OrderedMap.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/OrderedMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,24 +21,24 @@
* Don't implement the Map interface because we don't want people calling #entrySet
* because order is important.
*/
-public class OrderedMap {
+public class OrderedMap<K, V> {
- private List keys = new ArrayList();
- private List values = new ArrayList();
+ private List<K> keys = new ArrayList<K>();
+ private List<V> values = new ArrayList<V>();
/* (non-Javadoc)
* @see java.util.Map#clear()
*/
public void clear() {
- keys = new ArrayList();
- values = new ArrayList();
+ keys = new ArrayList<K>();
+ values = new ArrayList<V>();
}
/* (non-Javadoc)
* @see java.util.Map#containsKey(java.lang.Object)
*/
- public boolean containsKey(Object key) {
- for (Iterator iter = keys.iterator(); iter.hasNext();) {
+ public boolean containsKey(K key) {
+ for (Iterator<K> iter = keys.iterator(); iter.hasNext();) {
if (key.equals(iter.next()))
return true;
}
@@ -48,8 +48,8 @@
/* (non-Javadoc)
* @see java.util.Map#containsValue(java.lang.Object)
*/
- public boolean containsValue(Object value) {
- for (Iterator iter = values.iterator(); iter.hasNext();) {
+ public boolean containsValue(V value) {
+ for (Iterator<V> iter = values.iterator(); iter.hasNext();) {
if (value.equals(iter.next()))
return true;
}
@@ -59,7 +59,7 @@
/* (non-Javadoc)
* @see java.util.Map#get(java.lang.Object)
*/
- public Object get(Object key) {
+ public V get(K key) {
int index = indexOf(key);
return index == -1 ? null : values.get(index);
}
@@ -84,14 +84,14 @@
/* (non-Javadoc)
* @see java.util.Map#put(java.lang.Object, java.lang.Object)
*/
- public Object put(Object key, Object value) {
+ public V put(K key, V value) {
int index = indexOf(key);
if (index == -1) {
keys.add(key);
values.add(value);
return null;
}
- Object oldValue = values.get(index);
+ V oldValue = values.get(index);
values.set(index, value);
return oldValue;
}
@@ -99,17 +99,17 @@
/* (non-Javadoc)
* @see java.util.Map#putAll(java.util.Map)
*/
- public void putAll(Map other) {
- for (Iterator iter = other.entrySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
- put(key, other.get(key));
+ public void putAll(Map<K, V> other) {
+ for (Iterator<Map.Entry<K, V>> iter = other.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry<K, V> entry = iter.next();
+ put(entry.getKey(), entry.getValue());
}
}
/* (non-Javadoc)
* @see java.util.Map#remove(java.lang.Object)
*/
- public Object remove(Object key) {
+ public V remove(K key) {
int index = indexOf(key);
if (index == -1)
return null;
@@ -127,11 +127,11 @@
/* (non-Javadoc)
* @see java.util.Map#values()
*/
- public Collection values() {
+ public Collection<V> values() {
return values;
}
- public Collection keys() {
+ public Collection<K> keys() {
return keys;
}
@@ -142,9 +142,9 @@
public String toString() {
StringBuffer result = new StringBuffer();
result.append("{"); //$NON-NLS-1$
- for (Iterator iter = keys().iterator(); iter.hasNext(); ) {
- Object key = iter.next();
- Object value = get(key);
+ for (Iterator<K> iter = keys().iterator(); iter.hasNext(); ) {
+ K key = iter.next();
+ V value = get(key);
result.append(key);
result.append('=');
result.append(value);
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectComparePage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectComparePage.java
index faf277c..4c7ec0d 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectComparePage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectComparePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,25 @@
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+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.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
@@ -23,33 +42,8 @@
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ParticipantPageSaveablePart;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-
import org.eclipse.ui.part.PageBook;
-import org.eclipse.compare.CompareConfiguration;
-
/**
*This class extends <code>WizardPage<code>. It utilizes a <code>PageBook<code> to show user
@@ -214,9 +208,6 @@
return part;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
@Override
public void dispose() {
super.dispose();
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectSelectionPage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectSelectionPage.java
index df50f07..a4d7315 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectSelectionPage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectSelectionPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,20 +14,8 @@
import java.util.Arrays;
import java.util.Iterator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-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.Label;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -38,7 +26,16 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
-
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+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.Label;
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
@@ -192,24 +189,24 @@
* Returns all the checked items if they are IProject
*/
public IProject[] getCheckedProjects(){
- ArrayList projectsToRelease = new ArrayList();
+ ArrayList<IProject> projectsToRelease = new ArrayList<IProject>();
Object[] obj = viewer.getCheckedElements();
if (obj == null)return null;
for(int i = 0; i < obj.length; i++){
if (obj[i] instanceof IProject)
- projectsToRelease.add(obj[i]);
+ projectsToRelease.add((IProject) obj[i]);
}
- return (IProject[])projectsToRelease.toArray(new IProject[projectsToRelease.size()]);
+ return projectsToRelease.toArray(new IProject[projectsToRelease.size()]);
}
private void readProjectSettings(){
if( settings == null) return;
if(settings.getArray(SELECTED_ITEMS_KEY) != null){
- ArrayList nameList = new ArrayList(Arrays.asList(settings.getArray(SELECTED_ITEMS_KEY)));
+ ArrayList<String> nameList = new ArrayList<String>(Arrays.asList(settings.getArray(SELECTED_ITEMS_KEY)));
if(nameList != null){
- Iterator iter = nameList.iterator();
+ Iterator<String> iter = nameList.iterator();
while(iter.hasNext()){
- String name = (String)iter.next();
+ String name = iter.next();
IProject project = getProjectWithName(name);
if(project != null){
viewer.setChecked(project,true);
@@ -236,13 +233,13 @@
*/
public void saveSettings(){
Object[] obj = viewer.getCheckedElements();
- ArrayList names = new ArrayList();
+ ArrayList<String> names = new ArrayList<String>();
for (int i = 0; i < obj.length; i++){
if(obj[i] instanceof IProject){
names.add(((IProject)obj[i]).getName());
}
}
- settings.put(SELECTED_ITEMS_KEY, (String[])names.toArray(new String[names.size()]));
+ settings.put(SELECTED_ITEMS_KEY, names.toArray(new String[names.size()]));
settings.put(COMPARE_BUTTON_KEY, compareButtonChecked);
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectValidationDialog.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectValidationDialog.java
index 8d2691b..6658f32 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectValidationDialog.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ProjectValidationDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,6 +10,12 @@
*******************************************************************************/
package org.eclipse.releng.tools;
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -21,17 +27,6 @@
import org.eclipse.team.ui.synchronize.ParticipantPageDialog;
import org.eclipse.team.ui.synchronize.ParticipantPageSaveablePart;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-
-import org.eclipse.compare.CompareConfiguration;
-
/**
*It extends <code>Dialog<code>. This dialog will show up if <code>isValidateButtonSelected()<code>
@@ -73,7 +68,7 @@
cc.setRightEditable(false);
ParticipantPageSaveablePart part = new ParticipantPageSaveablePart(shell, cc, configuration, participant);
try {
- ProjectValidationDialog dialog = new ProjectValidationDialog(shell, part, participant); //$NON-NLS-1$
+ ProjectValidationDialog dialog = new ProjectValidationDialog(shell, part, participant);
dialog.open();
} finally {
part.dispose();
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReleaseWizard.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReleaseWizard.java
index 5d1f683..30620b9 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReleaseWizard.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReleaseWizard.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -302,7 +302,7 @@
operation.moveTag();
}
monitor.beginTask(Messages.getString("ReleaseWizard.21"), 100); //$NON-NLS-1$
- operation.run(new SubProgressMonitor(monitor, 90));
+ operation.run(SubMonitor.convert(monitor, 90));
if (operation.isMapFileUpdated()) {
try {
if(tagPage.isValidateButtonSelected()){
@@ -313,7 +313,7 @@
((WizardDialog)parentDialog).showPage(validatePage);
}
});
- validateRelease(new SubProgressMonitor(monitor, 10));
+ validateRelease(SubMonitor.convert(monitor, 10));
} catch (TeamException e) {
throw new InvocationTargetException(e);
}
@@ -367,11 +367,6 @@
this.parentDialog = p;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
@Override
public IWizardPage getNextPage(IWizardPage page) {
if (page == mapSelectionPage) {
@@ -421,11 +416,11 @@
if (resources.length < 1) {
preSelectedProjects = null;
} else {
- Set list = new HashSet();
+ Set<IProject> list = new HashSet<IProject>();
for (int i = 0; i < resources.length; i++) {
list.add(resources[i].getProject());
}
- preSelectedProjects = (IProject[]) list.toArray(new IProject[list.size()]);
+ preSelectedProjects = list.toArray(new IProject[list.size()]);
}
}
@@ -504,9 +499,6 @@
return preSelectedProjects;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#canFinish()
- */
@Override
public boolean canFinish() {
// There must be projects selected
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/RemoveAllConsolesAction.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/RemoveAllConsolesAction.java
index 24204c4..ef3251b 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/RemoveAllConsolesAction.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/RemoveAllConsolesAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 IBH SYSTEMS GmbH.
+ * Copyright (c) 2014, 2016 IBH SYSTEMS GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@
@Override
public void run() {
- List consolesList = new ArrayList();
+ List<IConsole> consolesList = new ArrayList<IConsole>();
for (IConsole console : ConsolePlugin.getDefault().getConsoleManager()
.getConsoles()) {
@@ -40,7 +40,7 @@
IConsole[] consoles = new IConsole[consolesList.size()];
for (int i = 0; i < consoles.length; i++) {
- consoles[i] = (IConsole) consolesList.get(i);
+ consoles[i] = consolesList.get(i);
}
ConsolePlugin.getDefault().getConsoleManager().removeConsoles(consoles);
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReplaceLocalFromMap.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReplaceLocalFromMap.java
index 8d9322b..28eeccf 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReplaceLocalFromMap.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/ReplaceLocalFromMap.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,12 @@
import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.releng.tools.preferences.MapProjectPreferencePage;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -22,15 +28,6 @@
import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-
/**
* This action replaces one or more projects in the local workspace
@@ -48,9 +45,6 @@
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
- */
@Override
protected boolean isEnabledForNonExistantResources() {
return true;
@@ -100,9 +94,6 @@
return CompareLocalToMap.hasProjectFromMapFile();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction#performReplace(org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
protected void performReplace(IResource[] resources, IProgressMonitor monitor) throws TeamException, InvocationTargetException, InterruptedException {
monitor.beginTask(null, 100 * resources.length);
try {
@@ -110,16 +101,13 @@
return;
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
- new ReplaceOperation(getTargetPart(), new IResource[] { resource }, tags[i], true).run(new SubProgressMonitor(monitor, 100));
+ new ReplaceOperation(getTargetPart(), new IResource[] { resource }, tags[i], true).run(SubMonitor.convert(monitor, 100));
}
} finally {
monitor.done();
}
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
- */
@Override
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
//Start the MapProjectSelectionWizard
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/SourceFile.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/SourceFile.java
index 26deca6..bf3c7fb 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/SourceFile.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/SourceFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,7 +40,7 @@
public abstract class SourceFile {
IFile file;
- List comments = new ArrayList();
+ List<BlockComment> comments = new ArrayList<BlockComment>();
StringWriter contents = new StringWriter();
private ITextFileBufferManager textFileBufferManager;
private String lineDelimiter;
@@ -246,9 +246,9 @@
* @return BlockComment
*/
public BlockComment getFirstCopyrightComment() {
- Iterator anIterator = comments.iterator();
+ Iterator<BlockComment> anIterator = comments.iterator();
while (anIterator.hasNext()) {
- BlockComment aComment = (BlockComment) anIterator.next();
+ BlockComment aComment = anIterator.next();
if (aComment.isCopyright()) {
return aComment;
}
@@ -297,9 +297,9 @@
*/
public boolean hasMultipleCopyrights() {
int count = 0;
- Iterator anIterator = comments.iterator();
+ Iterator<BlockComment> anIterator = comments.iterator();
while (anIterator.hasNext()) {
- BlockComment aComment = (BlockComment) anIterator.next();
+ BlockComment aComment = anIterator.next();
if (aComment.isCopyright()) {
count++;
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagAndReleaseOperation.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagAndReleaseOperation.java
index b0a9c7a..35056eb 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagAndReleaseOperation.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagAndReleaseOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,10 +12,15 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
import org.eclipse.ui.IWorkbenchPart;
@@ -41,9 +46,6 @@
this.mapProject = mapProject;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.TagOperation#tag(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public IStatus tag(
CVSTeamProvider provider,
@@ -54,20 +56,17 @@
// Tag the resource
progress.beginTask("Releasing project " + provider.getProject().getName(), 100);
- IStatus status = super.tag(provider, resources, recurse, new SubProgressMonitor(progress, 95));
+ IStatus status = super.tag(provider, resources, recurse, SubMonitor.convert(progress, 95));
if (status.getSeverity() == IStatus.ERROR) return status;
progress.done();
return status;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
@Override
public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
monitor.beginTask("Tagging with " + getTag().getName(), 100);
- super.execute(new SubProgressMonitor(monitor, 95));
+ super.execute(SubMonitor.convert(monitor, 95));
monitor.subTask("Updating and committing map files");
// Always update the map file even if tagging failed
@@ -84,9 +83,6 @@
monitor.done();
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getSchedulingRule(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
- */
@Override
protected ISchedulingRule getSchedulingRule(CVSTeamProvider provider) {
// We need a rule on both the provider and the releng map project
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagMap.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagMap.java
index 25cb848..07afd6e 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagMap.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagMap.java
@@ -17,6 +17,9 @@
import java.util.Map;
import java.util.StringTokenizer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -26,24 +29,16 @@
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.actions.TagInRepositoryAction;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-
/**
* Tags the versions in a map file with another tag
*/
public class TagMap extends TagInRepositoryAction {
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getSelectedCVSResources()
- */
@Override
protected ICVSRemoteResource[] getSelectedRemoteResources() {
IResource[] resources = getSelectedResources();
- List identifiers = new ArrayList();
+ List<String> identifiers = new ArrayList<String>();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
try {
@@ -53,13 +48,13 @@
RelEngPlugin.log(e);
}
}
- return getCVSResourcesFor((String[]) identifiers.toArray(new String[identifiers.size()]));
+ return getCVSResourcesFor(identifiers.toArray(new String[identifiers.size()]));
}
private ICVSRemoteResource[] getCVSResourcesFor(String[] referenceStrings) {
- Map previouslySelectedRepositories = new HashMap();
+ Map<ICVSRepositoryLocation, ICVSRepositoryLocation> previouslySelectedRepositories = new HashMap<ICVSRepositoryLocation, ICVSRepositoryLocation>();
int size = referenceStrings.length;
- List result = new ArrayList(size);
+ List<ICVSRemoteResource> result = new ArrayList<ICVSRemoteResource>(size);
for (int i = 0; i < size; i++) {
StringTokenizer tokenizer = new StringTokenizer(referenceStrings[i], ","); //$NON-NLS-1$
String version = tokenizer.nextToken();
@@ -88,7 +83,7 @@
RelEngPlugin.log(e);
}
}
- return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
+ return result.toArray(new ICVSRemoteResource[result.size()]);
}
private ICVSRepositoryLocation getLocationFromString(String repo) throws CVSException {
@@ -112,7 +107,7 @@
private ICVSRepositoryLocation getWritableRepositoryLocation(ICVSRepositoryLocation storedLocation) {
// Find out which repo locations are appropriate
ICVSRepositoryLocation[] locations = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownRepositoryLocations();
- List compatibleLocations = new ArrayList();
+ List<ICVSRepositoryLocation> compatibleLocations = new ArrayList<ICVSRepositoryLocation>();
for (int i = 0; i < locations.length; i++) {
ICVSRepositoryLocation location = locations[i];
// Only locations with the same host and root are eligible
@@ -121,15 +116,12 @@
compatibleLocations.add(location);
}
RepositorySelectionDialog dialog = new RepositorySelectionDialog(getShell());
- dialog.setLocations((ICVSRepositoryLocation[])compatibleLocations.toArray(new ICVSRepositoryLocation[compatibleLocations.size()]));
+ dialog.setLocations(compatibleLocations.toArray(new ICVSRepositoryLocation[compatibleLocations.size()]));
dialog.open();
ICVSRepositoryLocation location = dialog.getLocation();
return location;
}
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
@Override
public boolean isEnabled() {
IResource[] resources = getSelectedResources();
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagPage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagPage.java
index 2df7e66..03f4bc8 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagPage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/TagPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,10 @@
import java.util.Calendar;
import java.util.List;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -30,12 +32,7 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
/**
@@ -76,9 +73,7 @@
super(pageName, title, image);
this.settings = settings;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
+
public void createControl(Composite parent) {
Font font = parent.getFont();
Composite composite = new Composite(parent, SWT.NONE);
@@ -299,9 +294,6 @@
return tag;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
@@ -319,14 +311,14 @@
}
private String[] addToTagList(String[] history, String newEntry) {
- ArrayList l = new ArrayList(Arrays.asList(history));
+ ArrayList<String> l = new ArrayList<String>(Arrays.asList(history));
addToTagList(l, newEntry);
String[] r = new String[l.size()];
l.toArray(r);
return r;
}
- private void addToTagList(List history, String newEntry) {
+ private void addToTagList(List<String> history, String newEntry) {
history.remove(newEntry);
history.add(0,newEntry);
// since only one new item was added, we can be over the limit
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/git/GitCopyrightAdapterFactory.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/git/GitCopyrightAdapterFactory.java
index d8d0b76..08df8aa 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/git/GitCopyrightAdapterFactory.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/git/GitCopyrightAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 AGETO Service GmbH and others.
+ * Copyright (c) 2010, 2016 AGETO Service GmbH and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
@@ -21,12 +21,13 @@
public class GitCopyrightAdapterFactory implements IAdapterFactory,
IRepositoryProviderCopyrightAdapterFactory {
- private static final Class[] ADAPTER_LIST = new Class[] { IRepositoryProviderCopyrightAdapterFactory.class };
+ private static final Class<?>[] ADAPTER_LIST = new Class[] { IRepositoryProviderCopyrightAdapterFactory.class };
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (IRepositoryProviderCopyrightAdapterFactory.class
.equals(adapterType)) {
- return getGitCopyrightAdapter(adaptableObject);
+ return (T) getGitCopyrightAdapter(adaptableObject);
}
return null;
}
@@ -37,7 +38,7 @@
return this;
}
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return ADAPTER_LIST;
}
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/MapProjectPreferencePage.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/MapProjectPreferencePage.java
index cdc401c..f535dc3 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/MapProjectPreferencePage.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/MapProjectPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -121,7 +121,7 @@
data.grabExcessVerticalSpace = true;
projectList.setLayoutData(data);
- Set projects = new HashSet();
+ Set<IProject> projects = new HashSet<IProject>();
MapFile[] mapFiles;
try {
mapFiles = MapFile.findAllMapFiles(RelEngPlugin.getWorkspace().getRoot());
@@ -130,7 +130,7 @@
}
for (int i = 0; i < mapFiles.length; i++)
projects.add(mapFiles[i].getFile().getProject());
- workspaceMapProjects = ((IProject[]) projects.toArray(new IProject[projects.size()]));
+ workspaceMapProjects = projects.toArray(new IProject[projects.size()]);
String[] projectNames = new String[workspaceMapProjects.length];
for (int i = 0; i < workspaceMapProjects.length; i++) {
diff --git a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomErrorLevelBlock.java b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomErrorLevelBlock.java
index 0dd2769..a4e2c20 100644
--- a/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomErrorLevelBlock.java
+++ b/bundles/org.eclipse.releng.tools/src/org/eclipse/releng/tools/preferences/PomErrorLevelBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+ * Copyright (c) 2013, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -299,7 +299,7 @@
private void save() {
if(fDirty) {
try {
- ArrayList changes = new ArrayList();
+ ArrayList<Key> changes = new ArrayList<Key>();
collectChanges(fLookupOrder[0], changes);
if(changes.size() > 0) {
fManager.applyChanges();
@@ -376,7 +376,7 @@
* Collects the keys that have changed on the page into the specified list
* @param changes the {@link List} to collect changed keys into
*/
- private void collectChanges(IScopeContext context, List changes) {
+ private void collectChanges(IScopeContext context, List<Key> changes) {
Key key = null;
String origval = null,
newval = null;