Generify o.e.dltk.ui.
Obvious toArray cases.
Change-Id: Ia746b7744f0e8bb98d55ae2c08ee5bbf38b93418
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
index 9e3d796..451be0f 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/RefactoringAvailabilityTester.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring;
@@ -53,22 +52,21 @@
}
public static IModelElement[] getScriptElements(final Object[] elements) {
- List result = new ArrayList();
+ List<IModelElement> result = new ArrayList<IModelElement>();
for (int index = 0; index < elements.length; index++) {
if (elements[index] instanceof IModelElement)
- result.add(elements[index]);
+ result.add((IModelElement) elements[index]);
}
- return (IModelElement[]) result
- .toArray(new IModelElement[result.size()]);
+ return result.toArray(new IModelElement[result.size()]);
}
public static IResource[] getResources(final Object[] elements) {
- List result = new ArrayList();
+ List<IResource> result = new ArrayList<IResource>();
for (int index = 0; index < elements.length; index++) {
if (elements[index] instanceof IResource)
- result.add(elements[index]);
+ result.add((IResource) elements[index]);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public static boolean isRenameElementAvailable(IModelElement element)
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
index 5d5c30d..d50c8cb 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/changes/AddToBuildpathChange.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.changes;
@@ -92,10 +91,11 @@
private IBuildpathEntry[] getNewBuildpathEntries() throws ModelException {
IBuildpathEntry[] entries = getScriptProject().getRawBuildpath();
- List cp = new ArrayList(entries.length + 1);
+ List<IBuildpathEntry> cp = new ArrayList<IBuildpathEntry>(
+ entries.length + 1);
cp.addAll(Arrays.asList(entries));
cp.add(fEntryToAdd);
- return (IBuildpathEntry[]) cp.toArray(new IBuildpathEntry[cp.size()]);
+ return cp.toArray(new IBuildpathEntry[cp.size()]);
}
private static IBuildpathEntry createNewBuildpathEntry(int kind, IPath path) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
index 1e68d5c..9871f48 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/participants/RefactoringProcessors.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.participants;
@@ -18,13 +17,13 @@
public class RefactoringProcessors {
public static String[] getNatures(IProject[] projects) throws CoreException {
- Set result= new HashSet();
+ Set<String> result = new HashSet<String>();
for (int i= 0; i < projects.length; i++) {
String[] pns= projects[i].getDescription().getNatureIds();
for (int p = 0; p < pns.length; p++) {
result.add(pns[p]);
}
}
- return (String[])result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
index 6bc59e1..f0371e5 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenameScriptFolderProcessor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.rename;
@@ -127,7 +126,7 @@
}
protected IFile[] getChangedFiles() throws CoreException {
- Set combined= new HashSet();
+ Set<IFile> combined = new HashSet<IFile>();
combined.addAll(Arrays.asList(ResourceUtil.getFiles(fChangeManager.getAllSourceModules())));
if (fRenameSubpackages) {
IScriptFolder[] allPackages= ModelElementUtil.getPackageAndSubpackages(fPackage);
@@ -142,7 +141,7 @@
}
// if (fQualifiedNameSearchResult != null)
// combined.addAll(Arrays.asList(fQualifiedNameSearchResult.getAllFiles()));
- return (IFile[]) combined.toArray(new IFile[combined.size()]);
+ return combined.toArray(new IFile[combined.size()]);
}
//---- ITextUpdating -------------------------------------------------
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
index 4a334f4..a1d38a4 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/rename/RenamingNameSuggestor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.rename;
@@ -445,7 +444,7 @@
*
*/
private String[] getSuffixes(String typeName) {
- List suffixes= new ArrayList();
+ List<String> suffixes = new ArrayList<String>();
DLTKWordIterator iterator= new DLTKWordIterator();
iterator.setText(typeName);
int lastmatch= 0;
@@ -454,7 +453,7 @@
suffixes.add(typeName.substring(lastmatch, match));
lastmatch= match;
}
- return (String[]) suffixes.toArray(new String[0]);
+ return suffixes.toArray(new String[0]);
}
private String concat(String[] suffixesNewEqual) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
index 485f9cd..9c0f793 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/CopyModifications.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -137,7 +136,7 @@
}
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
- List result= new ArrayList();
+ List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
for (int i= 0; i < fCopies.size(); i++) {
result.addAll(Arrays.asList(ParticipantManager.loadCopyParticipants(status,
owner, fCopies.get(i),
@@ -146,7 +145,7 @@
natures, shared)));
}
result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
- return (RefactoringParticipant[]) result.toArray(new RefactoringParticipant[result.size()]);
+ return result.toArray(new RefactoringParticipant[result.size()]);
}
private void add(Object element, RefactoringArguments args, IParticipantDescriptorFilter filter) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteChangeCreator.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteChangeCreator.java
index 8975426..bdd79eb 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteChangeCreator.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteChangeCreator.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -98,7 +97,9 @@
/*
* List<IModelElement> modelElements
*/
- private static Change createDeleteChange(ISourceModule cu, List modelElements, TextChangeManager manager) throws CoreException {
+ private static Change createDeleteChange(ISourceModule cu,
+ List<IModelElement> modelElements, TextChangeManager manager)
+ throws CoreException {
// SourceModule cuNode= RefactoringASTParser.parseWithASTProvider(cu, false, null);
// SourceModuleRewrite rewriter= new SourceModuleRewrite(cu, cuNode);
Assert.isNotNull(cu);
@@ -112,7 +113,8 @@
manager.manage(cu, textFileChange);
- IModelElement[] elements= (IModelElement[]) modelElements.toArray(new IModelElement[modelElements.size()]);
+ IModelElement[] elements = modelElements
+ .toArray(new IModelElement[modelElements.size()]);
for (int cnt = 0, max = elements.length; cnt < max; cnt++) {
ISourceRange sourceRange = null;
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
index 8ee8b3d..d8609e5 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/DeleteModifications.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -148,7 +147,7 @@
public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
RefactoringProcessor owner, String[] natures,
SharableParticipants shared) {
- List result = new ArrayList();
+ List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
for (Iterator iter = fDelete.iterator(); iter.hasNext();) {
result.addAll(Arrays.asList(ParticipantManager
.loadDeleteParticipants(status, owner, iter.next(),
@@ -156,8 +155,7 @@
}
result.addAll(Arrays.asList(getResourceModifications().getParticipants(
status, owner, natures, shared)));
- return (RefactoringParticipant[]) result
- .toArray(new RefactoringParticipant[result.size()]);
+ return result.toArray(new RefactoringParticipant[result.size()]);
}
/**
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
index 749ef84..fbd9c72 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/MoveModifications.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -148,7 +147,7 @@
}
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
- List result= new ArrayList();
+ List<RefactoringParticipant> result = new ArrayList<RefactoringParticipant>();
for (int i= 0; i < fMoves.size(); i++) {
result.addAll(Arrays.asList(ParticipantManager.loadMoveParticipants(status,
owner, fMoves.get(i),
@@ -157,7 +156,7 @@
natures, shared)));
}
result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
- return (RefactoringParticipant[]) result.toArray(new RefactoringParticipant[result.size()]);
+ return result.toArray(new RefactoringParticipant[result.size()]);
}
private void add(Object element, RefactoringArguments args, IParticipantDescriptorFilter filter) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
index b309281..0dea67e 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/OverwriteHelper.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -18,10 +17,10 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.internal.corext.refactoring.RefactoringCoreMessages;
import org.eclipse.dltk.internal.corext.refactoring.util.ResourceUtil;
@@ -105,57 +104,63 @@
}
private void confirmProjectFragmentOverwritting(IConfirmQuery overwriteQuery) {
- List toNotOverwrite= new ArrayList(1);
+ List<IProjectFragment> toNotOverwrite = new ArrayList<IProjectFragment>(
+ 1);
for (int i= 0; i < fRoots.length; i++) {
IProjectFragment root= fRoots[i];
if (canOverwrite(root) && ! skip(root.getElementName(), overwriteQuery))
toNotOverwrite.add(root);
}
- IProjectFragment[] roots= (IProjectFragment[]) toNotOverwrite.toArray(new IProjectFragment[toNotOverwrite.size()]);
+ IProjectFragment[] roots = toNotOverwrite
+ .toArray(new IProjectFragment[toNotOverwrite.size()]);
fRoots= ArrayTypeConverter.toProjectFragmentArray(ReorgUtils.setMinus(fRoots, roots));
}
private void confirmCuOverwritting(IConfirmQuery overwriteQuery) {
- List cusToNotOverwrite= new ArrayList(1);
+ List<ISourceModule> cusToNotOverwrite = new ArrayList<ISourceModule>(1);
for (int i= 0; i < fCus.length; i++) {
ISourceModule cu= fCus[i];
if (canOverwrite(cu) && ! overwrite(cu, overwriteQuery))
cusToNotOverwrite.add(cu);
}
- ISourceModule[] cus= (ISourceModule[]) cusToNotOverwrite.toArray(new ISourceModule[cusToNotOverwrite.size()]);
+ ISourceModule[] cus = cusToNotOverwrite
+ .toArray(new ISourceModule[cusToNotOverwrite.size()]);
fCus= ArrayTypeConverter.toCuArray(ReorgUtils.setMinus(fCus, cus));
}
private void confirmFolderOverwritting(IConfirmQuery overwriteQuery) {
- List foldersToNotOverwrite= new ArrayList(1);
+ List<IFolder> foldersToNotOverwrite = new ArrayList<IFolder>(1);
for (int i= 0; i < fFolders.length; i++) {
IFolder folder= fFolders[i];
if (canOverwrite(folder) && ! skip(folder.getName(), overwriteQuery))
foldersToNotOverwrite.add(folder);
}
- IFolder[] folders= (IFolder[]) foldersToNotOverwrite.toArray(new IFolder[foldersToNotOverwrite.size()]);
+ IFolder[] folders = foldersToNotOverwrite
+ .toArray(new IFolder[foldersToNotOverwrite.size()]);
fFolders= ArrayTypeConverter.toFolderArray(ReorgUtils.setMinus(fFolders, folders));
}
private void confirmFileOverwritting(IConfirmQuery overwriteQuery) {
- List filesToNotOverwrite= new ArrayList(1);
+ List<IFile> filesToNotOverwrite = new ArrayList<IFile>(1);
for (int i= 0; i < fFiles.length; i++) {
IFile file= fFiles[i];
if (canOverwrite(file) && ! overwrite(file, overwriteQuery))
filesToNotOverwrite.add(file);
}
- IFile[] files= (IFile[]) filesToNotOverwrite.toArray(new IFile[filesToNotOverwrite.size()]);
+ IFile[] files = filesToNotOverwrite
+ .toArray(new IFile[filesToNotOverwrite.size()]);
fFiles= ArrayTypeConverter.toFileArray(ReorgUtils.setMinus(fFiles, files));
}
private void confirmPackageOverwritting(IConfirmQuery overwriteQuery){
- List toNotOverwrite= new ArrayList(1);
+ List<IScriptFolder> toNotOverwrite = new ArrayList<IScriptFolder>(1);
for (int i= 0; i < fScriptFolders.length; i++) {
IScriptFolder pack= fScriptFolders[i];
if (canOverwrite(pack) && ! overwrite(pack, overwriteQuery))
toNotOverwrite.add(pack);
}
- IScriptFolder[] packages= (IScriptFolder[]) toNotOverwrite.toArray(new IScriptFolder[toNotOverwrite.size()]);
+ IScriptFolder[] packages = toNotOverwrite
+ .toArray(new IScriptFolder[toNotOverwrite.size()]);
fScriptFolders= ArrayTypeConverter.toPackageArray(ReorgUtils.setMinus(fScriptFolders, packages));
}
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java
index a02c054..44ed685 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ParentChecker.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
@@ -117,7 +117,7 @@
}
private void removeResourcesDescendantsOfScriptElements() {
- List subResources= new ArrayList(3);
+ List<IResource> subResources = new ArrayList<IResource>(3);
for (int i= 0; i < fResources.length; i++) {
IResource subResource= fResources[i];
for (int j= 0; j < fScriptElements.length; j++) {
@@ -126,11 +126,12 @@
subResources.add(subResource);
}
}
- removeFromSetToDelete((IResource[]) subResources.toArray(new IResource[subResources.size()]));
+ removeFromSetToDelete(
+ subResources.toArray(new IResource[subResources.size()]));
}
private void removeScriptElementsDescendantsOfScriptElements() {
- List subElements= new ArrayList(3);
+ List<IModelElement> subElements = new ArrayList<IModelElement>(3);
for (int i= 0; i < fScriptElements.length; i++) {
IModelElement subElement= fScriptElements[i];
for (int j= 0; j < fScriptElements.length; j++) {
@@ -139,11 +140,12 @@
subElements.add(subElement);
}
}
- removeFromSetToDelete((IModelElement[]) subElements.toArray(new IModelElement[subElements.size()]));
+ removeFromSetToDelete(
+ subElements.toArray(new IModelElement[subElements.size()]));
}
private void removeResourcesDescendantsOfResources() {
- List subResources= new ArrayList(3);
+ List<IResource> subResources = new ArrayList<IResource>(3);
for (int i= 0; i < fResources.length; i++) {
IResource subResource= fResources[i];
for (int j= 0; j < fResources.length; j++) {
@@ -152,7 +154,8 @@
subResources.add(subResource);
}
}
- removeFromSetToDelete((IResource[]) subResources.toArray(new IResource[subResources.size()]));
+ removeFromSetToDelete(
+ subResources.toArray(new IResource[subResources.size()]));
}
public static boolean isDescendantOf(IResource subResource, IModelElement superElement) {
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
index fc1fe90..ae48571 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ReorgUtils.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -213,13 +212,13 @@
}
public static IResource[] getResources(List elements) {
- List resources = new ArrayList(elements.size());
+ List<IResource> resources = new ArrayList<IResource>(elements.size());
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IResource)
- resources.add(element);
+ resources.add((IResource) element);
}
- return (IResource[]) resources.toArray(new IResource[resources.size()]);
+ return resources.toArray(new IResource[resources.size()]);
}
public static IResource getResource(IModelElement element) {
@@ -230,36 +229,38 @@
}
public static IResource[] getResources(IModelElement[] elements) {
- List resultArray = new ArrayList();
+ List<IResource> resultArray = new ArrayList<IResource>();
for (int i = 0; i < elements.length; i++) {
IResource res = ReorgUtils.getResource(elements[i]);
if (res != null) {
resultArray.add(res);
}
}
- return (IResource[]) resultArray.toArray(new IResource[resultArray
+ return resultArray.toArray(new IResource[resultArray
.size()]);
}
public static IResource[] getNotLinked(IResource[] resources) {
- Collection result = new ArrayList(resources.length);
+ Collection<IResource> result = new ArrayList<IResource>(
+ resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource != null && !result.contains(resource)
&& !resource.isLinked())
result.add(resource);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public static IResource[] getNotNulls(IResource[] resources) {
- Collection result = new ArrayList(resources.length);
+ Collection<IResource> result = new ArrayList<IResource>(
+ resources.length);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
if (resource != null && !result.contains(resource))
result.add(resource);
}
- return (IResource[]) result.toArray(new IResource[result.size()]);
+ return result.toArray(new IResource[result.size()]);
}
public static Map groupBySourceModule(List modelElements) {
@@ -299,33 +300,38 @@
public static IModelElement[] setMinus(IModelElement[] setToRemoveFrom,
IModelElement[] elementsToRemove) {
- Set setMinus = new HashSet(setToRemoveFrom.length
+ Set<IModelElement> setMinus = new HashSet<IModelElement>(
+ setToRemoveFrom.length
- setToRemoveFrom.length);
setMinus.addAll(Arrays.asList(setToRemoveFrom));
setMinus.removeAll(Arrays.asList(elementsToRemove));
- return (IModelElement[]) setMinus.toArray(new IModelElement[setMinus
+ return setMinus.toArray(new IModelElement[setMinus
.size()]);
}
public static IModelElement[] union(IModelElement[] set1,
IModelElement[] set2) {
- List union = new ArrayList(set1.length + set2.length);// use lists to
+ List<IModelElement> union = new ArrayList<IModelElement>(
+ set1.length + set2.length);// use lists to
// avoid
// sequence
// problems
addAll(set1, union);
addAll(set2, union);
- return (IModelElement[]) union.toArray(new IModelElement[union.size()]);
+ return union.toArray(new IModelElement[union.size()]);
}
public static IResource[] union(IResource[] set1, IResource[] set2) {
- List union = new ArrayList(set1.length + set2.length);// use lists to
+ List<IResource> union = new ArrayList<IResource>(
+ set1.length + set2.length);// use
+ // lists
+ // to
// avoid
// sequence
// problems
addAll(ReorgUtils.getNotNulls(set1), union);
addAll(ReorgUtils.getNotNulls(set2), union);
- return (IResource[]) union.toArray(new IResource[union.size()]);
+ return union.toArray(new IResource[union.size()]);
}
private static void addAll(Object[] array, List list) {
@@ -337,21 +343,23 @@
public static IResource[] setMinus(IResource[] setToRemoveFrom,
IResource[] elementsToRemove) {
- Set setMinus = new HashSet(setToRemoveFrom.length
+ Set<IResource> setMinus = new HashSet<IResource>(
+ setToRemoveFrom.length
- setToRemoveFrom.length);
setMinus.addAll(Arrays.asList(setToRemoveFrom));
setMinus.removeAll(Arrays.asList(elementsToRemove));
- return (IResource[]) setMinus.toArray(new IResource[setMinus.size()]);
+ return setMinus.toArray(new IResource[setMinus.size()]);
}
public static IModelElement[] getModelElements(List elements) {
- List resources = new ArrayList(elements.size());
+ List<IModelElement> resources = new ArrayList<IModelElement>(
+ elements.size());
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IModelElement)
- resources.add(element);
+ resources.add((IModelElement) element);
}
- return (IModelElement[]) resources.toArray(new IModelElement[resources
+ return resources.toArray(new IModelElement[resources
.size()]);
}
@@ -364,14 +372,14 @@
}
public static IWorkingSet[] getWorkingSets(List elements) {
- List result = new ArrayList(1);
+ List<IWorkingSet> result = new ArrayList<IWorkingSet>(1);
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object element = iter.next();
if (element instanceof IWorkingSet) {
- result.add(element);
+ result.add((IWorkingSet) element);
}
}
- return (IWorkingSet[]) result.toArray(new IWorkingSet[result.size()]);
+ return result.toArray(new IWorkingSet[result.size()]);
}
public static void splitIntoModelElementsAndResources(Object[] elements,
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
index b126cdf..ed9a8b6 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/refactoring/reorg/ScriptDeleteProcessor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.refactoring.reorg;
@@ -137,10 +136,10 @@
private String[] getAffectedProjectNatures() throws CoreException {
String[] jNatures= ScriptProcessors.computeAffectedNaturs(fScriptElements);
String[] rNatures= ResourceProcessors.computeAffectedNatures(fResources);
- Set result= new HashSet();
+ Set<String> result = new HashSet<String>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
- return (String[])result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public void setDeleteSubPackages(boolean selection) {
@@ -338,7 +337,7 @@
*/
private void addSubPackages() throws ModelException {
- final Set modelElements= new HashSet();
+ final Set<IModelElement> modelElements = new HashSet<IModelElement>();
for (int i= 0; i < fScriptElements.length; i++) {
if (fScriptElements[i] instanceof IScriptFolder) {
modelElements.addAll(Arrays.asList(ModelElementUtil.getPackageAndSubpackages((IScriptFolder) fScriptElements[i])));
@@ -347,7 +346,8 @@
}
}
- fScriptElements= (IModelElement[]) modelElements.toArray(new IModelElement[modelElements.size()]);
+ fScriptElements = modelElements
+ .toArray(new IModelElement[modelElements.size()]);
}
/**
@@ -380,7 +380,7 @@
}
// new package list in the right sequence
- final List/* <IScriptFolder */allFragmentsToDelete= new ArrayList();
+ final List<IScriptFolder> allFragmentsToDelete = new ArrayList<IScriptFolder>();
for (Iterator outerIter= initialPackagesToDelete.iterator(); outerIter.hasNext();) {
final IScriptFolder currentScriptFolder= (IScriptFolder) outerIter.next();
@@ -403,7 +403,7 @@
}
// Remove resources in deleted packages; and the packages as well
- final List/* <IModelElement> */modelElements= new ArrayList();
+ final List<IModelElement> modelElements = new ArrayList<IModelElement>();
for (int i= 0; i < fScriptElements.length; i++) {
if (!(fScriptElements[i] instanceof IScriptFolder)) {
// remove children of deleted packages
@@ -416,7 +416,7 @@
modelElements.addAll(allFragmentsToDelete);
// Remove resources in deleted folders
- final List/* <IResource> */resources= new ArrayList();
+ final List<IResource> resources = new ArrayList<IResource>();
for (int i= 0; i < fResources.length; i++) {
IResource parent= fResources[i];
if (parent.getType() == IResource.FILE)
@@ -425,8 +425,9 @@
resources.add(fResources[i]);
}
- fScriptElements= (IModelElement[]) modelElements.toArray(new IModelElement[modelElements.size()]);
- fResources= (IResource[]) resources.toArray(new IResource[resources.size()]);
+ fScriptElements = modelElements
+ .toArray(new IModelElement[modelElements.size()]);
+ fResources = resources.toArray(new IResource[resources.size()]);
}
/**
@@ -483,7 +484,7 @@
}
private void removeUnconfirmedReferencedArchiveFiles(IConfirmQuery query) throws ModelException, OperationCanceledException {
- List filesToSkip= new ArrayList(0);
+ List<IFile> filesToSkip = new ArrayList<IFile>(0);
for (int i= 0; i < fResources.length; i++) {
IResource resource= fResources[i];
if (! (resource instanceof IFile))
@@ -499,13 +500,14 @@
referencingProjects.add(root.getScriptProject());
referencingProjects.addAll(Arrays.asList(ModelElementUtil.getReferencingProjects(root)));
if (skipDeletingReferencedRoot(query, root, referencingProjects))
- filesToSkip.add(resource);
+ filesToSkip.add((IFile) resource);
}
- removeFromSetToDelete((IFile[]) filesToSkip.toArray(new IFile[filesToSkip.size()]));
+ removeFromSetToDelete(
+ filesToSkip.toArray(new IFile[filesToSkip.size()]));
}
private void removeUnconfirmedReferencedProjectFragments(IConfirmQuery query) throws ModelException, OperationCanceledException {
- List rootsToSkip= new ArrayList(0);
+ List<IModelElement> rootsToSkip = new ArrayList<IModelElement>(0);
for (int i= 0; i < fScriptElements.length; i++) {
IModelElement element= fScriptElements[i];
if (! (element instanceof IProjectFragment))
@@ -515,7 +517,8 @@
if (skipDeletingReferencedRoot(query, root, referencingProjects))
rootsToSkip.add(root);
}
- removeFromSetToDelete((IModelElement[]) rootsToSkip.toArray(new IModelElement[rootsToSkip.size()]));
+ removeFromSetToDelete(
+ rootsToSkip.toArray(new IModelElement[rootsToSkip.size()]));
}
private static boolean skipDeletingReferencedRoot(IConfirmQuery query, IProjectFragment root, List referencingProjects) throws OperationCanceledException {
@@ -528,7 +531,7 @@
private void removeUnconfirmedFoldersThatContainSourceFolders() throws CoreException {
String queryTitle= RefactoringCoreMessages.DeleteRefactoring_4;
IConfirmQuery query= fDeleteQueries.createYesYesToAllNoNoToAllQuery(queryTitle, true, IReorgQueries.CONFIRM_DELETE_FOLDERS_CONTAINING_SOURCE_FOLDERS);
- List foldersToSkip= new ArrayList(0);
+ List<IResource> foldersToSkip = new ArrayList<IResource>(0);
for (int i= 0; i < fResources.length; i++) {
IResource resource= fResources[i];
if (resource instanceof IFolder){
@@ -540,7 +543,8 @@
}
}
}
- removeFromSetToDelete((IResource[]) foldersToSkip.toArray(new IResource[foldersToSkip.size()]));
+ removeFromSetToDelete(
+ foldersToSkip.toArray(new IResource[foldersToSkip.size()]));
}
private static boolean containsSourceFolder(IFolder folder) throws CoreException {
@@ -621,13 +625,13 @@
//----------- empty source modules related method
private void addEmptySourceModulesToDelete() throws ModelException {
- Set modulesToEmpty = getCusToEmpty();
- addToSetToDelete((ISourceModule[]) modulesToEmpty
+ Set<ISourceModule> modulesToEmpty = getCusToEmpty();
+ addToSetToDelete(modulesToEmpty
.toArray(new ISourceModule[modulesToEmpty.size()]));
}
- private Set getCusToEmpty() throws ModelException {
- Set result = new HashSet();
+ private Set<ISourceModule> getCusToEmpty() throws ModelException {
+ Set<ISourceModule> result = new HashSet<ISourceModule>();
for (int i = 0; i < fScriptElements.length; i++) {
IModelElement element = fScriptElements[i];
ISourceModule module = ReorgUtils.getSourceModule(element);
diff --git a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
index ff962f4..2108f83 100644
--- a/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
+++ b/core/plugins/org.eclipse.dltk.ui/core refactoring/org/eclipse/dltk/internal/corext/util/OpenMethodHistory.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.util;
@@ -287,7 +286,7 @@
public synchronized MethodNameMatch[] getFilteredTypeInfos(
MethodInfoFilter filter) {
Collection values = getValues();
- List result = new ArrayList();
+ List<MethodNameMatch> result = new ArrayList<MethodNameMatch>();
for (Iterator iter = values.iterator(); iter.hasNext();) {
MethodNameMatch method = (MethodNameMatch) iter.next();
if ((filter == null || filter.matchesHistoryElement(method))
@@ -295,8 +294,7 @@
result.add(method);
}
Collections.reverse(result);
- return (MethodNameMatch[]) result.toArray(new MethodNameMatch[result
- .size()]);
+ return result.toArray(new MethodNameMatch[result.size()]);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
index 2f7d5e4..900fd08 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/buildpath/BuildpathModifier.java
@@ -207,9 +207,10 @@
if (DLTKLanguageManager.hasScriptNature(project.getProject())) {
// IPath outputLocation= project.getOutputLocation();
// IPath projPath= project.getProject().getFullPath();
- List existingEntries = getExistingEntries(project);
+ List<BPListElement> existingEntries = getExistingEntries(
+ project);
- List newEntries = new ArrayList();
+ List<BPListElement> newEntries = new ArrayList<BPListElement>();
for (int i = 0; i < elements.size(); i++) {
Object element = elements.get(i);
BPListElement entry;
@@ -224,9 +225,9 @@
Set modifiedSourceEntries = new HashSet();
BuildPathBasePage.fixNestingConflicts(
- (BPListElement[]) newEntries
+ newEntries
.toArray(new BPListElement[newEntries.size()]),
- (BPListElement[]) existingEntries
+ existingEntries
.toArray(new BPListElement[existingEntries
.size()]), modifiedSourceEntries);
@@ -238,7 +239,7 @@
List result = new ArrayList();
for (int i = 0; i < newEntries.size(); i++) {
- IBuildpathEntry entry = ((BPListElement) newEntries.get(i))
+ IBuildpathEntry entry = newEntries.get(i)
.getBuildpathEntry();
IModelElement root;
if (entry.getPath().equals(project.getPath()))
@@ -1381,7 +1382,8 @@
IPath[] exlusions = (IPath[]) element
.getAttribute(BPListElement.EXCLUSION);
if (exlusions != null) {
- List exlusionList = new ArrayList(exlusions.length);
+ List<IPath> exlusionList = new ArrayList<IPath>(
+ exlusions.length);
for (int i = 0; i < exlusions.length; i++) {
if (!exlusions[i].equals(path)) {
exlusionList.add(exlusions[i]);
@@ -1396,7 +1398,8 @@
IPath[] inclusion = (IPath[]) element
.getAttribute(BPListElement.INCLUSION);
if (inclusion != null) {
- List inclusionList = new ArrayList(inclusion.length);
+ List<IPath> inclusionList = new ArrayList<IPath>(
+ inclusion.length);
for (int i = 0; i < inclusion.length; i++) {
if (!inclusion[i].equals(path)) {
inclusionList.add(inclusion[i]);
@@ -1720,9 +1723,10 @@
monitor.beginTask(
NewWizardMessages.BuildpathModifier_Monitor_ResetFilters, 3);
- List exclusionList = getFoldersOnBP(element.getPath(), project,
+ List<IPath> exclusionList = getFoldersOnBP(element.getPath(),
+ project,
new SubProgressMonitor(monitor, 2));
- IPath[] exclusions = (IPath[]) exclusionList
+ IPath[] exclusions = exclusionList
.toArray(new IPath[exclusionList.size()]);
entry.setAttribute(BPListElement.INCLUSION, new IPath[0]);
@@ -2045,11 +2049,11 @@
* and which are on the build path
* @throws ModelException
*/
- private List getFoldersOnBP(IPath path, IScriptProject project,
+ private List<IPath> getFoldersOnBP(IPath path, IScriptProject project,
IProgressMonitor monitor) throws ModelException {
if (monitor == null)
monitor = new NullProgressMonitor();
- List srcFolders = new ArrayList();
+ List<IPath> srcFolders = new ArrayList<IPath>();
IBuildpathEntry[] cpEntries = project.getRawBuildpath();
for (int i = 0; i < cpEntries.length; i++) {
IPath cpPath = cpEntries[i].getPath();
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
index adddd1d..1926bee 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/callhierarchy/CallHierarchy.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
* (report 36180: Callers/Callees view)
*******************************************************************************/
package org.eclipse.dltk.internal.corext.callhierarchy;
@@ -191,7 +190,7 @@
* @return list
*/
private static StringMatcher[] parseList(String listString) {
- List list = new ArrayList(10);
+ List<StringMatcher> list = new ArrayList<StringMatcher>(10);
StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
@@ -199,7 +198,7 @@
list.add(new StringMatcher(textFilter, false, false));
}
- return (StringMatcher[]) list.toArray(new StringMatcher[list.size()]);
+ return list.toArray(new StringMatcher[list.size()]);
}
public static boolean arePossibleInputElements(List elements) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
index 3df99e5..a406105 100644
--- a/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
+++ b/core/plugins/org.eclipse.dltk.ui/src corext/org/eclipse/dltk/internal/corext/util/Resources.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.corext.util;
@@ -100,18 +99,19 @@
* @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
*/
public static IStatus makeCommittable(IResource[] resources, Object context) {
- List readOnlyFiles= new ArrayList();
+ List<IFile> readOnlyFiles = new ArrayList<IFile>();
for (int i= 0; i < resources.length; i++) {
IResource resource= resources[i];
if (resource.getType() == IResource.FILE && isReadOnly(resource))
- readOnlyFiles.add(resource);
+ readOnlyFiles.add((IFile) resource);
}
if (readOnlyFiles.size() == 0)
return new Status(IStatus.OK, DLTKUIPlugin.PLUGIN_ID, IStatus.OK, "", null); //$NON-NLS-1$
Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
IStatus status= ResourcesPlugin.getWorkspace().validateEdit(
- (IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context);
+ readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]),
+ context);
if (!status.isOK())
return status;
@@ -188,13 +188,13 @@
* @return the local locations
*/
public static String[] getLocationOSStrings(IResource[] resources) {
- List result= new ArrayList(resources.length);
+ List<String> result = new ArrayList<String>(resources.length);
for (int i= 0; i < resources.length; i++) {
IPath location= resources[i].getLocation();
if (location != null)
result.add(location.toOSString());
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
/**
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
index 5f05206..9586d92 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/actions/QuickMenuAction.java
@@ -257,7 +257,7 @@
private Point[] getIncludedPositions(Rectangle[] rectangles,
Rectangle widgetBounds) {
- List result = new ArrayList();
+ List<Point> result = new ArrayList<Point>();
for (int i = 0; i < rectangles.length; i++) {
Rectangle rectangle = rectangles[i];
Rectangle intersect = widgetBounds.intersection(rectangle);
@@ -266,7 +266,7 @@
+ intersect.height));
}
}
- return (Point[]) result.toArray(new Point[result.size()]);
+ return result.toArray(new Point[result.size()]);
}
private Point findBestLocation(Point[] points, Point relativeCursor) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
index fb1ff77..02e64fa 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/browsing/LogicalPackage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.browsing;
@@ -14,8 +13,8 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
/**
* Contains a list of package fragments with the same name
@@ -23,12 +22,12 @@
*/
public class LogicalPackage extends PlatformObject {
- private Set fPackages;
+ private Set<IScriptFolder> fPackages;
private String fName;
private IScriptProject fScriptProject;
public LogicalPackage(IScriptFolder fragment){
- fPackages= new HashSet();
+ fPackages = new HashSet<IScriptFolder>();
fScriptProject= fragment.getScriptProject();
add(fragment);
fName= fragment.getElementName();
@@ -39,7 +38,7 @@
}
public IScriptFolder[] getFragments(){
- return (IScriptFolder[]) fPackages.toArray(new IScriptFolder[fPackages.size()]);
+ return fPackages.toArray(new IScriptFolder[fPackages.size()]);
}
public void add(IScriptFolder fragment){
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
index 5f41298..2603cc7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/OpenCallHierarchyAction.java
@@ -148,7 +148,8 @@
IModelElement[] elements = resolveModelElements();
if (elements == null)
return;
- List candidates= new ArrayList(elements.length);
+ List<IModelElement> candidates = new ArrayList<IModelElement>(
+ elements.length);
for (int i= 0; i < elements.length; i++) {
IModelElement[] resolvedElements= CallHierarchyUI.getCandidates(elements[i]);
if (resolvedElements != null)
@@ -160,7 +161,7 @@
candidates.add(enclosingMethod);
}
}
- run((IModelElement[])candidates.toArray(new IModelElement[candidates.size()]));
+ run(candidates.toArray(new IModelElement[candidates.size()]));
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), getErrorDialogTitle(), ActionMessages.SelectionConverter_codeResolve_failed);
} catch (InterruptedException e) {
@@ -213,10 +214,10 @@
if (!ActionUtil.isProcessable(getShell(), element))
return;
- List result= new ArrayList(1);
+ List<IModelElement> result = new ArrayList<IModelElement>(1);
IStatus status= compileCandidates(result, element);
if (status.isOK()) {
- run((IModelElement[]) result.toArray(new IModelElement[result.size()]));
+ run(result.toArray(new IModelElement[result.size()]));
} else {
openErrorDialog(status);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java
index a4d6d14..b05cd3c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchScopeActionGroup.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
@@ -112,7 +112,7 @@
if (workingSetNames == null) {
return null;
}
- Set workingSets= new HashSet(2);
+ Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
for (int j= 0; j < workingSetNames.length; j++) {
IWorkingSet workingSet= getWorkingSetManager().getWorkingSet(workingSetNames[j]);
if (workingSet != null) {
@@ -120,7 +120,7 @@
}
}
- return (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]);
+ return workingSets.toArray(new IWorkingSet[workingSets.size()]);
}
/**
@@ -194,7 +194,8 @@
}
private Action[] getActions() {
- List actions = new ArrayList(SearchUtil.LRU_WORKINGSET_LIST_SIZE + 4);
+ List<Action> actions = new ArrayList<Action>(
+ SearchUtil.LRU_WORKINGSET_LIST_SIZE + 4);
addAction(actions, fSearchScopeWorkspaceAction);
addAction(actions, fSearchScopeProjectAction);
addAction(actions, fSearchScopeHierarchyAction);
@@ -213,7 +214,7 @@
actions.add(workingSetAction);
}
- Action[] result = (Action[]) actions.toArray(new Action[actions.size()]);
+ Action[] result = actions.toArray(new Action[actions.size()]);
ensureExactlyOneCheckedAction(result);
return result;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java
index 6f62c09..94d860b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/callhierarchy/SearchUtil.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
@@ -82,7 +82,7 @@
for (int i= SearchUtil.LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
String[] lruWorkingSetNames= SearchUtil.fgSettingsStore.getArray(SearchUtil.STORE_LRU_WORKING_SET_NAMES + i);
if (lruWorkingSetNames != null) {
- Set workingSets= new HashSet(2);
+ Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
for (int j= 0; j < lruWorkingSetNames.length; j++) {
IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
if (workingSet != null) {
@@ -91,7 +91,8 @@
}
foundLRU= true;
if (!workingSets.isEmpty())
- SearchUtil.fgLRUWorkingSets.add((IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]));
+ SearchUtil.fgLRUWorkingSets.add(workingSets
+ .toArray(new IWorkingSet[workingSets.size()]));
}
}
if (!foundLRU)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
index 384dbbc..adc9b66 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dialogs/MethodInfoViewer.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.dialogs;
@@ -99,19 +98,19 @@
private Set fHistory;
private MethodInfoFilter fFilter;
- private List fResult;
+ private List<MethodNameMatch> fResult;
private MethodFilter fMethodFilter;
public SearchRequestor(MethodInfoFilter filter,
MethodFilter MethodFilter) {
super();
- fResult = new ArrayList(2048);
+ fResult = new ArrayList<MethodNameMatch>(2048);
fFilter = filter;
fMethodFilter = MethodFilter;
}
public MethodNameMatch[] getResult() {
- return (MethodNameMatch[]) fResult
+ return fResult
.toArray(new MethodNameMatch[fResult.size()]);
}
@@ -240,17 +239,17 @@
private String[] fVMNames;
public MethodInfoLabelProvider() {
- List locations = new ArrayList();
- List labels = new ArrayList();
+ List<String> locations = new ArrayList<String>();
+ List<String> labels = new ArrayList<String>();
IInterpreterInstallType[] installs = ScriptRuntime
.getInterpreterInstallTypes(fToolkit.getCoreToolkit()
.getNatureId());
for (int i = 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
- fInstallLocations = (String[]) locations
+ fInstallLocations = locations
.toArray(new String[locations.size()]);
- fVMNames = (String[]) labels.toArray(new String[labels.size()]);
+ fVMNames = labels.toArray(new String[labels.size()]);
}
@@ -799,7 +798,7 @@
protected MethodNameMatch[] getSearchResult(Set filteredHistory,
ProgressMonitor monitor) throws CoreException {
- List result = new ArrayList(2048);
+ List<MethodNameMatch> result = new ArrayList<MethodNameMatch>(2048);
for (int i = 0; i < fLastResult.length; i++) {
MethodNameMatch type = fLastResult[i];
if (filteredHistory.contains(type))
@@ -808,7 +807,7 @@
result.add(type);
}
// we have to sort if the filter is a camel case filter.
- MethodNameMatch[] types = (MethodNameMatch[]) result
+ MethodNameMatch[] types = result
.toArray(new MethodNameMatch[result.size()]);
if (fFilter.isCamelCasePattern()) {
Arrays.sort(types, new MethodInfoComparator(fLabelProvider,
@@ -1117,15 +1116,15 @@
public MethodNameMatch[] getSelection() {
TableItem[] items = fTable.getSelection();
- List result = new ArrayList(items.length);
+ List<MethodNameMatch> result = new ArrayList<MethodNameMatch>(
+ items.length);
for (int i = 0; i < items.length; i++) {
Object data = items[i].getData();
if (data instanceof MethodNameMatch) {
- result.add(data);
+ result.add((MethodNameMatch) data);
}
}
- return (MethodNameMatch[]) result.toArray(new MethodNameMatch[result
- .size()]);
+ return result.toArray(new MethodNameMatch[result.size()]);
}
public void stop() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
index 3e9d5ea..da134af 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/dnd/ResourceTransferDragAdapter.java
@@ -66,7 +66,7 @@
}
public void dragSetData(DragSourceEvent event) {
- List resources= convertSelection();
+ List<IResource> resources = convertSelection();
event.data= resources.toArray(new IResource[resources.size()]);
}
@@ -79,12 +79,12 @@
}
}
- private List convertSelection() {
+ private List<IResource> convertSelection() {
ISelection s= fProvider.getSelection();
if (!(s instanceof IStructuredSelection))
return EMPTY_LIST;
IStructuredSelection selection= (IStructuredSelection)s;
- List result= new ArrayList(selection.size());
+ List<IResource> result = new ArrayList<IResource>(selection.size());
for (Iterator iter= selection.iterator(); iter.hasNext();) {
Object element= iter.next();
IResource resource= null;
@@ -106,9 +106,9 @@
IModelStatusConstants.INTERNAL_ERROR,
DLTKUIMessages.ResourceTransferDragAdapter_cannot_delete_resource,
null);
- List resources= convertSelection();
- for (Iterator iter= resources.iterator(); iter.hasNext();) {
- IResource resource= (IResource) iter.next();
+ List<IResource> resources = convertSelection();
+ for (Iterator<IResource> iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = iter.next();
try {
resource.delete(true, null);
} catch (CoreException e) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
index 1ed746e..d1b3bea 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/BasicSourceModuleEditorActionContributor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor;
@@ -19,7 +18,6 @@
import org.eclipse.dltk.ui.actions.DLTKActionConstants;
import org.eclipse.dltk.ui.text.completion.CompletionProposalCategory;
import org.eclipse.dltk.ui.text.completion.CompletionProposalComputerRegistry;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -111,16 +109,20 @@
caMenu.add(fRetargetContentAssist);
Collection descriptors= CompletionProposalComputerRegistry.getDefault().getProposalCategories();
- List specificAssistActions= new ArrayList(descriptors.size());
+ List<SpecificContentAssistAction> specificAssistActions = new ArrayList<SpecificContentAssistAction>(
+ descriptors.size());
for (Iterator it= descriptors.iterator(); it.hasNext();) {
final CompletionProposalCategory cat= (CompletionProposalCategory) it.next();
if (cat.hasComputers()) {
- IAction caAction= new SpecificContentAssistAction(cat);
+ SpecificContentAssistAction caAction = new SpecificContentAssistAction(
+ cat);
caMenu.add(caAction);
specificAssistActions.add(caAction);
}
}
- fSpecificAssistActions= (SpecificContentAssistAction[]) specificAssistActions.toArray(new SpecificContentAssistAction[specificAssistActions.size()]);
+ fSpecificAssistActions = specificAssistActions.toArray(
+ new SpecificContentAssistAction[specificAssistActions
+ .size()]);
if (fSpecificAssistActions.length > 0) {
fContentAssistMenuListener= new MenuListener(caMenu);
caMenu.addMenuListener(fContentAssistMenuListener);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
index 5e383ce..6eff6c7 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/editor/selectionaction/GoToNextPreviousMemberAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.editor.selectionaction;
@@ -150,7 +149,7 @@
}
private static Integer[] createOffsetArray(IType[] types) throws ModelException {
- List result= new ArrayList();
+ List<Integer> result = new ArrayList<Integer>();
for (int i= 0; i < types.length; i++) {
IType iType= types[i];
addOffset(result, iType.getNameRange().getOffset());
@@ -159,7 +158,7 @@
addMemberOffsetList(result, iType.getFields());
//addMemberOffsetList(result, iType.getInitializers());
}
- return (Integer[]) result.toArray(new Integer[result.size()]);
+ return result.toArray(new Integer[result.size()]);
}
private static void addMemberOffsetList(List result, IMember[] members) throws ModelException {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
index 7c88e54..943feaa 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/filters/CustomFiltersDialog.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.filters;
@@ -316,10 +315,10 @@
*/
public String[] getEnabledFilterIds() {
Object[] result= getResult();
- Set enabledIds= new HashSet(result.length);
+ Set<String> enabledIds = new HashSet<String>(result.length);
for (int i= 0; i < result.length; i++)
enabledIds.add(((FilterDescriptor)result[i]).getId());
- return (String[]) enabledIds.toArray(new String[enabledIds.size()]);
+ return enabledIds.toArray(new String[enabledIds.size()]);
}
/**
@@ -339,21 +338,22 @@
private FilterDescriptor[] getEnabledFilterDescriptors() {
FilterDescriptor[] filterDescs= fBuiltInFilters;
- List result= new ArrayList(filterDescs.length);
- List enabledFilterIds= Arrays.asList(fEnabledFilterIds);
+ List<FilterDescriptor> result = new ArrayList<FilterDescriptor>(
+ filterDescs.length);
+ List<String> enabledFilterIds = Arrays.asList(fEnabledFilterIds);
for (int i= 0; i < filterDescs.length; i++) {
String id= filterDescs[i].getId();
if (enabledFilterIds.contains(id))
result.add(filterDescs[i]);
}
- return (FilterDescriptor[])result.toArray(new FilterDescriptor[result.size()]);
+ return result.toArray(new FilterDescriptor[result.size()]);
}
public static String[] convertFromString(String patterns, String separator) {
StringTokenizer tokenizer= new StringTokenizer(patterns, separator, true);
int tokenCount= tokenizer.countTokens();
- List result= new ArrayList(tokenCount);
+ List<String> result = new ArrayList<String>(tokenCount);
boolean escape= false;
boolean append= false;
while (tokenizer.hasMoreTokens()) {
@@ -374,15 +374,15 @@
escape= false;
}
}
- return (String[])result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
- private static void addPattern(List list, String pattern) {
+ private static void addPattern(List<String> list, String pattern) {
if (list.isEmpty())
list.add(pattern);
else {
int index= list.size() - 1;
- list.set(index, ((String)list.get(index)) + pattern);
+ list.set(index, (list.get(index)) + pattern);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
index 1c816ab..b106865 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/model/DLTKElementResourceMapping.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.model;
@@ -27,11 +26,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
import org.eclipse.dltk.core.IScriptModel;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.IType;
import org.eclipse.dltk.core.ModelException;
@@ -223,7 +222,7 @@
}
private static IFile[] getPackageContent(IScriptFolder pack) throws CoreException {
- List result= new ArrayList();
+ List<IFile> result = new ArrayList<IFile>();
IContainer container= (IContainer)pack.getResource();
if (container != null) {
IResource[] members= container.members();
@@ -233,11 +232,11 @@
IFile file= (IFile)member;
if ("class".equals(file.getFileExtension()) && file.isDerived()) //$NON-NLS-1$
continue;
- result.add(member);
+ result.add((IFile) member);
}
}
}
- return (IFile[])result.toArray(new IFile[result.size()]);
+ return result.toArray(new IFile[result.size()]);
}
@@ -269,14 +268,14 @@
return fFragments;
}
public IProject[] getProjects() {
- Set result= new HashSet();
+ Set<IProject> result = new HashSet<IProject>();
for (int i= 0; i < fFragments.length; i++) {
result.add(fFragments[i].getScriptProject().getProject());
}
- return (IProject[])result.toArray(new IProject[result.size()]);
+ return result.toArray(new IProject[result.size()]);
}
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
- List result= new ArrayList();
+ List<ResourceTraversal> result = new ArrayList<ResourceTraversal>();
if (context instanceof RemoteResourceMappingContext) {
for (int i= 0; i < fFragments.length; i++) {
result.add(new ResourceTraversal(
@@ -287,7 +286,7 @@
result.add(new LocalPackageFragementTraversal(fFragments[i]));
}
}
- return (ResourceTraversal[])result.toArray(new ResourceTraversal[result.size()]);
+ return result.toArray(new ResourceTraversal[result.size()]);
}
public String getModelProviderId() {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
index ef0975c..68f8a6e 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/BuildPathContainer.java
@@ -125,7 +125,7 @@
@Override
public IAdaptable[] getChildren() {
- List list= new ArrayList();
+ List<IAdaptable> list = new ArrayList<IAdaptable>();
IProjectFragment[] roots= getProjectFragments();
for (int i= 0; i < roots.length; i++) {
list.add(roots[i]);
@@ -148,7 +148,7 @@
}
}
}
- return (IAdaptable[]) list.toArray(new IAdaptable[list.size()]);
+ return list.toArray(new IAdaptable[list.size()]);
}
@Override
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java
index 1ed029e..b180c98 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/LibraryContainer.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
@@ -28,6 +28,7 @@
super(project);
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof LibraryContainer) {
LibraryContainer other = (LibraryContainer) obj;
@@ -36,18 +37,22 @@
return false;
}
+ @Override
public int hashCode() {
return getScriptProject().hashCode();
}
+ @Override
public IAdaptable[] getChildren() {
return getProjectFragments();
}
+ @Override
public ImageDescriptor getImageDescriptor() {
return DLTKPluginImages.DESC_OBJS_LIBRARY;
}
+ @Override
public String getLabel() {
return ScriptMessages.LibraryContainer_libraries;
}
@@ -57,8 +62,9 @@
*
* @see org.eclipse.jdt.internal.ui.packageview.PackageFragmentRootContainer#getPackageFragmentRoots()
*/
+ @Override
public IProjectFragment[] getProjectFragments() {
- List list = new ArrayList();
+ List<IProjectFragment> list = new ArrayList<IProjectFragment>();
try {
IProjectFragment[] roots = getScriptProject().getProjectFragments();
for (int i = 0; i < roots.length; i++) {
@@ -75,7 +81,6 @@
} catch (ModelException e) {
// fall through
}
- return (IProjectFragment[]) list.toArray(new IProjectFragment[list
- .size()]);
+ return list.toArray(new IProjectFragment[list.size()]);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
index d76e71f..d32be3f 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetAwareContentProvider.java
@@ -147,11 +147,11 @@
return new TreePath[] { path };
}
List modelParents = getModelPath(element);
- List result = new ArrayList();
+ List<TreePath> result = new ArrayList<TreePath>();
for (int i = 0; i < modelParents.size(); i++) {
result.addAll(getTreePaths(modelParents, i));
}
- return (TreePath[]) result.toArray(new TreePath[result.size()]);
+ return result.toArray(new TreePath[result.size()]);
}
private List getModelPath(Object element) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
index d6b9989..fa3f9eb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/scriptview/WorkingSetDropAdapter.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.scriptview;
@@ -212,7 +211,7 @@
if (index != -1) {
if (getCurrentLocation() == LOCATION_AFTER)
index++;
- List result= new ArrayList(activeWorkingSets.size());
+ List result = new ArrayList(activeWorkingSets.size());
List selected= new ArrayList(Arrays.asList(fElementsToAdds));
for (int i= 0; i < activeWorkingSets.size(); i++) {
if (i == index) {
@@ -233,7 +232,8 @@
// only move if target isn't the other working set. If this is the case
// the move will happenn automatically by refreshing the other working set
if (!isOthersWorkingSet(fWorkingSet)) {
- List elements= new ArrayList(Arrays.asList(fWorkingSet.getElements()));
+ List elements = new ArrayList(
+ Arrays.asList(fWorkingSet.getElements()));
elements.addAll(Arrays.asList(fElementsToAdds));
fWorkingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
}
@@ -243,9 +243,11 @@
for (Iterator iter= workingSets.keySet().iterator(); iter.hasNext();) {
IWorkingSet ws= (IWorkingSet)iter.next();
List toRemove= (List)workingSets.get(ws);
- List currentElements= new ArrayList(Arrays.asList(ws.getElements()));
+ List<IAdaptable> currentElements = new ArrayList<IAdaptable>(
+ Arrays.asList(ws.getElements()));
currentElements.removeAll(toRemove);
- ws.setElements((IAdaptable[])currentElements.toArray(new IAdaptable[currentElements.size()]));
+ ws.setElements(currentElements
+ .toArray(new IAdaptable[currentElements.size()]));
}
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
index c8021f8..f356ae4 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/DLTKSearchScopeFactory.java
@@ -261,14 +261,14 @@
public IProject[] getProjects(IDLTKSearchScope scope) {
IPath[] paths = scope.enclosingProjectsAndZips();
- HashSet temp = new HashSet();
+ HashSet<IProject> temp = new HashSet<IProject>();
for (int i = 0; i < paths.length; i++) {
IResource resource = ResourcesPlugin.getWorkspace().getRoot()
.findMember(paths[i]);
if (resource != null && resource.getType() == IResource.PROJECT)
- temp.add(resource);
+ temp.add((IProject) resource);
}
- return (IProject[]) temp.toArray(new IProject[temp.size()]);
+ return temp.toArray(new IProject[temp.size()]);
}
public IModelElement[] getModelElements(ISelection selection) {
@@ -284,7 +284,7 @@
if (elements.length == 0)
return new IModelElement[0];
- Set result = new HashSet(elements.length);
+ Set<IModelElement> result = new HashSet<IModelElement>(elements.length);
for (int i = 0; i < elements.length; i++) {
Object selectedElement = elements[i];
if (selectedElement instanceof IModelElement) {
@@ -309,8 +309,7 @@
}
}
- return (IModelElement[]) result
- .toArray(new IModelElement[result.size()]);
+ return result.toArray(new IModelElement[result.size()]);
}
public IDLTKSearchScope createSearchScope(IModelElement[] modelElements,
@@ -321,11 +320,12 @@
getSearchFlags(includeInterp), toolkit);
}
- private IDLTKSearchScope createSearchScope(Collection modelElements,
+ private IDLTKSearchScope createSearchScope(
+ Collection<IModelElement> modelElements,
boolean includeInterp, IDLTKLanguageToolkit toolkit) {
if (modelElements.isEmpty())
return EMPTY_SCOPE;
- IModelElement[] elementArray = (IModelElement[]) modelElements
+ IModelElement[] elementArray = modelElements
.toArray(new IModelElement[modelElements.size()]);
return SearchEngine.createSearchScope(elementArray,
getSearchFlags(includeInterp), toolkit);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
index 3d48e17..d85b284 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/search/SearchUtil.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.search;
@@ -144,7 +143,7 @@
for (int i= LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES + i);
if (lruWorkingSetNames != null) {
- Set workingSets= new HashSet(2);
+ Set<IWorkingSet> workingSets = new HashSet<IWorkingSet>(2);
for (int j= 0; j < lruWorkingSetNames.length; j++) {
IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
if (workingSet != null) {
@@ -153,7 +152,8 @@
}
foundLRU= true;
if (!workingSets.isEmpty())
- fgLRUWorkingSets.add((IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]));
+ fgLRUWorkingSets.add(workingSets
+ .toArray(new IWorkingSet[workingSets.size()]));
}
}
if (!foundLRU)
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
index a0f606c..743c9eb 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpandHover.java
@@ -125,7 +125,7 @@
if (model == null)
return null;
- List exact= new ArrayList();
+ List<Annotation> exact = new ArrayList<Annotation>();
HashMap messagesAtPosition= new HashMap();
Iterator e= model.getAnnotationIterator();
@@ -152,7 +152,7 @@
setLastRulerMouseLocation(viewer, line);
AnnotationHoverInput input= new AnnotationHoverInput();
- input.fAnnotations= (Annotation[]) exact.toArray(new Annotation[0]);
+ input.fAnnotations = exact.toArray(new Annotation[0]);
input.fViewer= viewer;
input.fRulerInfo= fCompositeRuler;
input.fAnnotationListener= fgListener;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
index c601f88..22971f0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/AnnotationExpansionControl.java
@@ -715,9 +715,9 @@
StyleRange[] ranges= text.getStyleRanges(region.getOffset(), region.getLength());
- List undoRanges= new ArrayList(ranges.length);
+ List<StyleRange> undoRanges = new ArrayList<StyleRange>(ranges.length);
for (int i= 0; i < ranges.length; i++) {
- undoRanges.add(ranges[i].clone());
+ undoRanges.add((StyleRange) ranges[i].clone());
}
int offset= region.getOffset();
@@ -739,7 +739,7 @@
index++;
if (index < undoRanges.size()) {
offset= curEnd;
- current= (StyleRange) undoRanges.get(index);
+ current = undoRanges.get(index);
curStart= current.start;
curEnd= current.start + current.length;
} else if (index == undoRanges.size()) {
@@ -766,7 +766,7 @@
}
- return (StyleRange[]) undoRanges.toArray(undoRanges.toArray(new StyleRange[0]));
+ return undoRanges.toArray(undoRanges.toArray(new StyleRange[0]));
}
private void resetViewerBackground(StyleRange[] oldRanges) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
index 2733f5b..7b2f72c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/text/hover/ScriptExpandHover.java
@@ -85,7 +85,7 @@
if (model == null)
return null;
- List exact= new ArrayList();
+ List<Annotation> exact = new ArrayList<Annotation>();
HashMap messagesAtPosition= new HashMap();
Iterator e= model.getAnnotationIterator();
@@ -125,7 +125,7 @@
setLastRulerMouseLocation(viewer, line);
if (exact.size() > 0) {
- Annotation first= (Annotation) exact.get(0);
+ Annotation first = exact.get(0);
if (!isBreakpointAnnotation(first))
exact.add(0, new NoBreakpointAnnotation());
}
@@ -134,7 +134,7 @@
return null;
AnnotationHoverInput input= new AnnotationHoverInput();
- input.fAnnotations= (Annotation[]) exact.toArray(new Annotation[0]);
+ input.fAnnotations = exact.toArray(new Annotation[0]);
input.fViewer= viewer;
input.fRulerInfo= fCompositeRuler;
input.fAnnotationListener= fgListener;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
index 7365aac..8fc587c 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPListElement.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -184,7 +183,7 @@
private IBuildpathAttribute[] getBuildpathAttributes() {
- ArrayList res = new ArrayList();
+ ArrayList<IBuildpathAttribute> res = new ArrayList<IBuildpathAttribute>();
for (int i = 0; i < fChildren.size(); i++) {
Object curr = fChildren.get(i);
if (curr instanceof BPListElementAttribute) {
@@ -195,8 +194,7 @@
}
}
res.addAll(this.fExtraAttributes);
- return (IBuildpathAttribute[]) res.toArray(new IBuildpathAttribute[res
- .size()]);
+ return res.toArray(new IBuildpathAttribute[res.size()]);
}
private IBuildpathEntry newBuildpathEntry() {
@@ -358,10 +356,9 @@
.addTrailingSeparator();
if (ScriptModelUtil.isExcludedPath(pathToExclude, exclusionFilters)) {
- List l = new ArrayList(Arrays.asList(exclusionFilters));
+ List<IPath> l = new ArrayList<IPath>(Arrays.asList(exclusionFilters));
l.remove(pathToExclude);
- IPath[] newExclusionFilters = (IPath[]) l.toArray(new IPath[l
- .size()]);
+ IPath[] newExclusionFilters = l.toArray(new IPath[l.size()]);
setAttribute(key, newExclusionFilters);
return true;
}
@@ -775,10 +772,11 @@
fLinkTarget = linkTarget;
}
- public static void insert(BPListElement element, List cpList) {
+ public static void insert(BPListElement element,
+ List<BPListElement> cpList) {
int length = cpList.size();
- BPListElement[] elements = (BPListElement[]) cpList
+ BPListElement[] elements = cpList
.toArray(new BPListElement[length]);
int i = 0;
while (i < length
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
index 1bd96ee..44c60a8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BPUserLibraryElement.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -55,7 +54,7 @@
}
private String fName;
- private List fChildren;
+ private List<BPListElement> fChildren;
private boolean fIsSystemLibrary;
private Map<String, String> fAttributes;
@@ -67,7 +66,7 @@
public BPUserLibraryElement(String name, IBuildpathContainer container,
IScriptProject project, Map<String, String> attributes) {
fName = name;
- fChildren = new ArrayList();
+ fChildren = new ArrayList<BPListElement>();
if (container != null) {
IBuildpathEntry[] entries = container.getBuildpathEntries();
BPListElement[] res = new BPListElement[entries.length];
@@ -97,7 +96,7 @@
public BPUserLibraryElement(String name, boolean isSystemLibrary,
BPListElement[] children, Map<String, String> attributes) {
fName = name;
- fChildren = new ArrayList();
+ fChildren = new ArrayList<BPListElement>();
if (children != null) {
for (int i = 0; i < children.length; i++) {
BPListElement child = children[i];
@@ -111,7 +110,7 @@
}
public BPListElement[] getChildren() {
- return (BPListElement[]) fChildren.toArray(new BPListElement[fChildren
+ return fChildren.toArray(new BPListElement[fChildren
.size()]);
}
@@ -222,7 +221,7 @@
return true;
}
for (int i = 0; i < oldEntries.length; i++) {
- BPListElement child = (BPListElement) fChildren.get(i);
+ BPListElement child = fChildren.get(i);
if (!child.getBuildpathEntry().equals(oldEntries[i])) {
return true;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
index 575e512..4c95782 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/BuildPathSupport.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -157,7 +156,8 @@
private static void updateProjectBuildpath(Shell shell, IScriptProject jproject, IBuildpathEntry newEntry, String[] changedAttributes, IProgressMonitor monitor) throws ModelException {
IBuildpathEntry[] oldBuildpath= jproject.getRawBuildpath();
int nEntries= oldBuildpath.length;
- ArrayList newEntries= new ArrayList(nEntries + 1);
+ ArrayList<IBuildpathEntry> newEntries = new ArrayList<IBuildpathEntry>(
+ nEntries + 1);
int entryKind= newEntry.getEntryKind();
IPath archivePath= newEntry.getPath();
boolean found= false;
@@ -178,7 +178,8 @@
// add new
newEntries.add(newEntry);
}
- IBuildpathEntry[] newBuildpath= (IBuildpathEntry[]) newEntries.toArray(new IBuildpathEntry[newEntries.size()]);
+ IBuildpathEntry[] newBuildpath = newEntries
+ .toArray(new IBuildpathEntry[newEntries.size()]);
jproject.setRawBuildpath(newBuildpath, monitor);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/CreateMultipleSourceFoldersDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/CreateMultipleSourceFoldersDialog.java
index 9306bf3..21ecd51 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/CreateMultipleSourceFoldersDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/CreateMultipleSourceFoldersDialog.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -202,8 +201,11 @@
return new ArrayList(fModifiedElements);
}
- private void addExlusionPatterns(List newEntries, Set modifiedEntries) {
- BuildPathBasePage.fixNestingConflicts((BPListElement[])newEntries.toArray(new BPListElement[newEntries.size()]), fExistingElements, modifiedEntries);
+ private void addExlusionPatterns(List<BPListElement> newEntries,
+ Set modifiedEntries) {
+ BuildPathBasePage.fixNestingConflicts(
+ newEntries.toArray(new BPListElement[newEntries.size()]),
+ fExistingElements, modifiedEntries);
if (!modifiedEntries.isEmpty()) {
String title= NewWizardMessages.SourceContainerWorkbookPage_exclusion_added_title;
String message= NewWizardMessages.SourceContainerWorkbookPage_exclusion_added_message;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
index ed84f18..13b8928 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/LibrariesWorkbookPage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -303,10 +302,12 @@
fLibrariesList.postSetSelection(new StructuredSelection(element));
}
- private void askForAddingExclusionPatternsDialog(List newEntries) {
+ private void askForAddingExclusionPatternsDialog(
+ List<BPListElement> newEntries) {
HashSet modified = new HashSet();
List existing = fBuildPathList.getElements();
- fixNestingConflicts((BPListElement[]) newEntries
+ fixNestingConflicts(
+ newEntries
.toArray(new BPListElement[newEntries.size()]),
(BPListElement[]) existing.toArray(new BPListElement[existing
.size()]), modified);
@@ -673,15 +674,14 @@
if (selected != null) {
// IWorkspaceRoot root =
// fCurrJProject.getProject().getWorkspace().getRoot();
- ArrayList res = new ArrayList();
+ ArrayList<BPListElement> res = new ArrayList<BPListElement>();
for (int i = 0; i < selected.length; i++) {
// IPath curr = selected[i];
res.add(new BPListElement(fCurrJProject,
IBuildpathEntry.BPE_LIBRARY, selected[i], null,
true));
}
- return (BPListElement[]) res.toArray(new BPListElement[res
- .size()]);
+ return res.toArray(new BPListElement[res.size()]);
}
} else {
// disabled
@@ -697,7 +697,7 @@
if (selected != null) {
IWorkspaceRoot root = fCurrJProject.getProject().getWorkspace()
.getRoot();
- ArrayList res = new ArrayList();
+ ArrayList<BPListElement> res = new ArrayList<BPListElement>();
for (int i = 0; i < selected.length; i++) {
IPath curr = selected[i];
IResource resource = root.findMember(curr);
@@ -705,8 +705,7 @@
res.add(newBPLibraryElement(resource, false));
}
}
- return (BPListElement[]) res.toArray(new BPListElement[res
- .size()]);
+ return res.toArray(new BPListElement[res.size()]);
}
} else {
// disabled
@@ -722,7 +721,7 @@
getShell(), fCurrJProject.getPath(),
getUsedArchiveFiles(existing));
if (selected != null) {
- ArrayList res = new ArrayList();
+ ArrayList<BPListElement> res = new ArrayList<BPListElement>();
for (int i = 0; i < selected.length; i++) {
IPath curr = selected[i];
IResource resource = root.findMember(curr);
@@ -730,8 +729,7 @@
res.add(newBPLibraryElement(resource, false));
}
}
- return (BPListElement[]) res.toArray(new BPListElement[res
- .size()]);
+ return res.toArray(new BPListElement[res.size()]);
}
} else {
IPath configured = BuildpathDialogAccess.configureArchiveEntry(
@@ -749,7 +747,7 @@
}
private IPath[] getUsedContainers(BPListElement existing) {
- ArrayList res = new ArrayList();
+ ArrayList<IPath> res = new ArrayList<IPath>();
List cplist = fLibrariesList.getElements();
for (int i = 0; i < cplist.size(); i++) {
BPListElement elem = (BPListElement) cplist.get(i);
@@ -762,11 +760,11 @@
}
}
}
- return (IPath[]) res.toArray(new IPath[res.size()]);
+ return res.toArray(new IPath[res.size()]);
}
private IPath[] getUsedArchiveFiles(BPListElement existing) {
- List res = new ArrayList();
+ List<IPath> res = new ArrayList<IPath>();
List cplist = fLibrariesList.getElements();
for (int i = 0; i < cplist.size(); i++) {
BPListElement elem = (BPListElement) cplist.get(i);
@@ -778,7 +776,7 @@
}
}
}
- return (IPath[]) res.toArray(new IPath[res.size()]);
+ return res.toArray(new IPath[res.size()]);
}
private BPListElement newBPLibraryElement(IResource res, boolean external) {
@@ -792,14 +790,13 @@
IPath[] selected = BuildpathDialogAccess
.chooseExternalArchiveEntries(getShell(), environment);
if (selected != null) {
- ArrayList res = new ArrayList();
+ ArrayList<BPListElement> res = new ArrayList<BPListElement>();
for (int i = 0; i < selected.length; i++) {
res.add(new BPListElement(fCurrJProject,
IBuildpathEntry.BPE_LIBRARY, selected[i], null,
true));
}
- return (BPListElement[]) res.toArray(new BPListElement[res
- .size()]);
+ return res.toArray(new BPListElement[res.size()]);
}
} else {
IPath configured = BuildpathDialogAccess
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
index 304d7d2..0c83bc8 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/SourceContainerWorkbookPage.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.wizards.buildpath;
@@ -95,9 +94,9 @@
}
protected static AddSourceFolderWizard newSourceFolderWizard(
- BPListElement element, List/* <BPListElement> */existingElements,
+ BPListElement element, List<BPListElement> existingElements,
boolean newFolder) {
- BPListElement[] existing = (BPListElement[]) existingElements
+ BPListElement[] existing = existingElements
.toArray(new BPListElement[existingElements.size()]);
AddSourceFolderWizard wizard = new AddSourceFolderWizard(existing,
element, false, newFolder, newFolder, newFolder ? BPListElement
@@ -108,9 +107,9 @@
}
private static AddSourceFolderWizard newLinkedSourceFolderWizard(
- BPListElement element, List/* <BPListElement> */existingElements,
+ BPListElement element, List<BPListElement> existingElements,
boolean newFolder) {
- BPListElement[] existing = (BPListElement[]) existingElements
+ BPListElement[] existing = existingElements
.toArray(new BPListElement[existingElements.size()]);
AddSourceFolderWizard wizard = new AddSourceFolderWizard(existing,
element, true, newFolder, newFolder, newFolder ? BPListElement
@@ -121,8 +120,8 @@
}
private static EditFilterWizard newEditFilterWizard(BPListElement element,
- List/* <BPListElement> */existingElements) {
- BPListElement[] existing = (BPListElement[]) existingElements
+ List<BPListElement> existingElements) {
+ BPListElement[] existing = existingElements
.toArray(new BPListElement[existingElements.size()]);
EditFilterWizard result = new EditFilterWizard(existing, element);
result.setDoFlushChange(false);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
index c41fab0..65d6f7b 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/wizards/buildpath/newsourcepage/DialogPackageExplorerActionGroup.java
@@ -17,14 +17,15 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
import org.eclipse.dltk.core.IScriptFolder;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.internal.corext.buildpath.AddSelectedSourceFolderOperation;
import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier;
+import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier.IBuildpathModifierListener;
import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifierOperation;
import org.eclipse.dltk.internal.corext.buildpath.CreateFolderOperation;
import org.eclipse.dltk.internal.corext.buildpath.EditFiltersOperation;
@@ -36,7 +37,6 @@
import org.eclipse.dltk.internal.corext.buildpath.RemoveFromBuildpathOperation;
import org.eclipse.dltk.internal.corext.buildpath.ResetAllOperation;
import org.eclipse.dltk.internal.corext.buildpath.UnexcludeOperation;
-import org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier.IBuildpathModifierListener;
import org.eclipse.dltk.internal.ui.actions.CompositeActionGroup;
import org.eclipse.dltk.internal.ui.scriptview.BuildPathContainer;
import org.eclipse.dltk.internal.ui.util.ViewerPane;
@@ -251,7 +251,7 @@
}
public BuildpathModifierAction[] getActions() {
- List result= new ArrayList();
+ List<BuildpathModifierAction> result = new ArrayList<BuildpathModifierAction>();
for (int i= 0; i < fActions.length; i++) {
BuildpathModifierAction action= fActions[i];
if (action instanceof BuildpathModifierDropDownAction) {
@@ -264,7 +264,7 @@
result.add(action);
}
}
- return (BuildpathModifierAction[])result.toArray(new BuildpathModifierAction[result.size()]);
+ return result.toArray(new BuildpathModifierAction[result.size()]);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
index 95a5888..395add0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ConfigureWorkingSetAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -36,11 +35,12 @@
* {@inheritDoc}
*/
public void run() {
- List workingSets= new ArrayList(Arrays.asList(fWorkingSetModel.getAllWorkingSets()));
+ List<IWorkingSet> workingSets = new ArrayList<IWorkingSet>(
+ Arrays.asList(fWorkingSetModel.getAllWorkingSets()));
IWorkingSet[] activeWorkingSets= fWorkingSetModel.getActiveWorkingSets();
WorkingSetConfigurationDialog dialog= new WorkingSetConfigurationDialog(
fSite.getShell(),
- (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]),
+ workingSets.toArray(new IWorkingSet[workingSets.size()]),
activeWorkingSets);
dialog.setSelection(activeWorkingSets);
if (dialog.open() == IDialogConstants.OK_ID) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
index 1ef88f1..16500b3 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/OthersWorkingSetUpdater.java
@@ -85,7 +85,9 @@
processScriptDelta(new ArrayList(Arrays.asList(fWorkingSet.getElements())), event.getDelta());
}
- private void processScriptDelta(List elements, IModelElementDelta delta) {
+
+ private void processScriptDelta(List<IAdaptable> elements,
+ IModelElementDelta delta) {
IModelElement jElement= delta.getElement();
int type= jElement.getElementType();
if (type == IModelElement.SCRIPT_PROJECT) {
@@ -95,12 +97,14 @@
if (kind == IModelElementDelta.CHANGED) {
if (index != -1 && (flags & IModelElementDelta.F_CLOSED) != 0) {
elements.set(index, ((IScriptProject)jElement).getProject());
- fWorkingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ fWorkingSet.setElements(elements
+ .toArray(new IAdaptable[elements.size()]));
} else if ((flags & IModelElementDelta.F_OPENED) != 0) {
index= elements.indexOf(((IScriptProject)jElement).getProject());
if (index != -1) {
elements.set(index, jElement);
- fWorkingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ fWorkingSet.setElements(elements
+ .toArray(new IAdaptable[elements.size()]));
}
}
}
@@ -168,7 +172,7 @@
IWorkingSet[] activeWorkingSets= fWorkingSetModel.getActiveWorkingSets();
- List result= new ArrayList();
+ List result = new ArrayList();
Set projects= new HashSet();
for (int i= 0; i < activeWorkingSets.length; i++) {
if (activeWorkingSets[i] == fWorkingSet) continue;
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
index 568a4af..b801cf9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/RemoveWorkingSetElementAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -66,11 +65,12 @@
IWorkingSet ws= getWorkingSet(selection);
if (ws == null)
return;
- List elements= new ArrayList(Arrays.asList(ws.getElements()));
+ List<IAdaptable> elements = new ArrayList<IAdaptable>(
+ Arrays.asList(ws.getElements()));
List selectedElements= selection.toList();
for (Iterator iter= selectedElements.iterator(); iter.hasNext();) {
elements.remove(iter.next());
}
- ws.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ ws.setElements(elements.toArray(new IAdaptable[elements.size()]));
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
index 6783dba..36d140d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetPage.java
@@ -240,11 +240,12 @@
*/
public void finish() {
String workingSetName= fWorkingSetName.getText();
- ArrayList elements= new ArrayList(10);
+ ArrayList<IAdaptable> elements = new ArrayList<IAdaptable>(10);
findCheckedElements(elements, fTree.getInput());
if (fWorkingSet == null) {
IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
- fWorkingSet= workingSetManager.createWorkingSet(workingSetName, (IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ fWorkingSet = workingSetManager.createWorkingSet(workingSetName,
+ elements.toArray(new IAdaptable[elements.size()]));
} else {
// Add inaccessible resources
IAdaptable[] oldItems= fWorkingSet.getElements();
@@ -266,7 +267,8 @@
}
}
fWorkingSet.setName(workingSetName);
- fWorkingSet.setElements((IAdaptable[]) elements.toArray(new IAdaptable[elements.size()]));
+ fWorkingSet.setElements(
+ elements.toArray(new IAdaptable[elements.size()]));
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
index 12260c3..f897296 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/workingsets/ScriptWorkingSetUpdater.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.workingsets;
@@ -21,10 +20,10 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.ElementChangedEvent;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IElementChangedListener;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IModelElementDelta;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetUpdater;
@@ -32,20 +31,22 @@
public class ScriptWorkingSetUpdater implements IWorkingSetUpdater, IElementChangedListener {
- private List fWorkingSets;
+ private List<IWorkingSet> fWorkingSets;
private static class WorkingSetDelta {
private IWorkingSet fWorkingSet;
- private List fElements;
+ private List<IAdaptable> fElements;
private boolean fChanged;
public WorkingSetDelta(IWorkingSet workingSet) {
fWorkingSet= workingSet;
- fElements= new ArrayList(Arrays.asList(workingSet.getElements()));
+ fElements = new ArrayList<IAdaptable>(
+ Arrays.asList(workingSet.getElements()));
}
public int indexOf(Object element) {
return fElements.indexOf(element);
}
- public void set(int index, Object element) {
+
+ public void set(int index, IAdaptable element) {
fElements.set(index, element);
fChanged= true;
}
@@ -56,13 +57,14 @@
}
public void process() {
if (fChanged) {
- fWorkingSet.setElements((IAdaptable[])fElements.toArray(new IAdaptable[fElements.size()]));
+ fWorkingSet.setElements(
+ fElements.toArray(new IAdaptable[fElements.size()]));
}
}
}
public ScriptWorkingSetUpdater() {
- fWorkingSets= new ArrayList();
+ fWorkingSets = new ArrayList<IWorkingSet>();
DLTKCore.addElementChangedListener(this);
}
@@ -112,7 +114,8 @@
public void elementChanged(ElementChangedEvent event) {
IWorkingSet[] workingSets;
synchronized(fWorkingSets) {
- workingSets= (IWorkingSet[])fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
+ workingSets = fWorkingSets
+ .toArray(new IWorkingSet[fWorkingSets.size()]);
}
for (int w= 0; w < workingSets.length; w++) {
WorkingSetDelta workingSetDelta= new WorkingSetDelta(workingSets[w]);
@@ -200,10 +203,11 @@
}
private void checkElementExistence(IWorkingSet workingSet) {
- List elements= new ArrayList(Arrays.asList(workingSet.getElements()));
+ List<IAdaptable> elements = new ArrayList<IAdaptable>(
+ Arrays.asList(workingSet.getElements()));
boolean changed= false;
- for (Iterator iter= elements.iterator(); iter.hasNext();) {
- IAdaptable element= (IAdaptable)iter.next();
+ for (Iterator<IAdaptable> iter = elements.iterator(); iter.hasNext();) {
+ IAdaptable element = iter.next();
boolean remove= false;
if (element instanceof IModelElement) {
IModelElement jElement= (IModelElement)element;
@@ -234,7 +238,8 @@
}
}
if (changed) {
- workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ workingSet.setElements(
+ elements.toArray(new IAdaptable[elements.size()]));
}
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
index fbea761..5fe6fad 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/ModelElementSorter.java
@@ -189,11 +189,10 @@
.getCompareProviders(toolkit1);
IModelCompareProvider[] tk2 = UIModelProviderManager
.getCompareProviders(toolkit1);
- Set result = new HashSet();
+ Set<IModelCompareProvider> result = new HashSet<IModelCompareProvider>();
result.addAll(Arrays.asList(tk1));
result.addAll(Arrays.asList(tk2));
- return (IModelCompareProvider[]) result
- .toArray(new IModelCompareProvider[result.size()]);
+ return result.toArray(new IModelCompareProvider[result.size()]);
} else {
return UIModelProviderManager.getCompareProviders(toolkit1);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java
index 4c78d3a..5077ec9 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/StandardModelElementContentProvider2.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
@@ -279,7 +279,7 @@
throws ModelException {
IModelElement[] fragments = root.getChildren();
- List newFragments = new ArrayList();
+ List<IModelElement> newFragments = new ArrayList<IModelElement>();
for (int i = 0; i < fragments.length; ++i) {
if (fragments[i] instanceof IScriptFolder) {
IScriptFolder scriptFolder = ((IScriptFolder) fragments[i]);
@@ -293,7 +293,7 @@
}
newFragments.add(fragments[i]);
}
- fragments = (IModelElement[]) newFragments
+ fragments = newFragments
.toArray(new IModelElement[newFragments.size()]);
if (isProjectProjectFragment(root)) {
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
index e0e1880..b285710 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/actions/CustomFiltersActionGroup.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.actions;
@@ -16,12 +15,12 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;
-import java.util.Map.Entry;
import org.eclipse.dltk.core.IScriptModel;
import org.eclipse.dltk.internal.ui.filters.CustomFiltersDialog;
@@ -243,7 +242,8 @@
*
*/
public String[] internalGetEnabledFilterIds() {
- Set enabledFilterIds= new HashSet(fEnabledFilterIds.size());
+ Set<String> enabledFilterIds = new HashSet<String>(
+ fEnabledFilterIds.size());
Iterator iter= fEnabledFilterIds.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry= (Map.Entry)iter.next();
@@ -252,7 +252,7 @@
if (isEnabled)
enabledFilterIds.add(id);
}
- return (String[])enabledFilterIds.toArray(new String[enabledFilterIds.size()]);
+ return enabledFilterIds.toArray(new String[enabledFilterIds.size()]);
}
/**
@@ -267,7 +267,7 @@
*/
public String[] removeFiltersFor(Object parent, Object element, IContentProvider contentProvider) {
String[] enabledFilters= internalGetEnabledFilterIds();
- Set newFilters= new HashSet();
+ Set<String> newFilters = new HashSet<String>();
for (int i= 0; i < enabledFilters.length; i++) {
String filterName= enabledFilters[i];
ViewerFilter filter= (ViewerFilter) fInstalledBuiltInFilters.get(filterName);
@@ -278,7 +278,7 @@
}
if (newFilters.size() == enabledFilters.length)
return new String[0];
- return (String[])newFilters.toArray(new String[newFilters.size()]);
+ return newFilters.toArray(new String[newFilters.size()]);
}
/**
@@ -411,8 +411,10 @@
return;
}
- SortedSet sortedFilters= new TreeSet(fLRUFilterIdsStack);
- String[] recentlyChangedFilterIds= (String[])sortedFilters.toArray(new String[sortedFilters.size()]);
+ SortedSet<String> sortedFilters = new TreeSet<String>(
+ fLRUFilterIdsStack);
+ String[] recentlyChangedFilterIds = sortedFilters
+ .toArray(new String[sortedFilters.size()]);
fFilterIdsUsedInLastViewMenu= new String[recentlyChangedFilterIds.length];
for (int i= 0; i < recentlyChangedFilterIds.length; i++) {
@@ -514,7 +516,8 @@
}
private String[] getUserAndBuiltInPatterns() {
- List patterns= new ArrayList(fUserDefinedPatterns.length);
+ List<String> patterns = new ArrayList<String>(
+ fUserDefinedPatterns.length);
if (areUserDefinedPatternsEnabled())
patterns.addAll(Arrays.asList(fUserDefinedPatterns));
FilterDescriptor[] filterDescs= getCachedFilterDescriptors();
@@ -525,7 +528,7 @@
if (isEnabled != null && isPatternFilter && ((Boolean)isEnabled).booleanValue())
patterns.add(filterDescs[i].getPattern());
}
- return (String[])patterns.toArray(new String[patterns.size()]);
+ return patterns.toArray(new String[patterns.size()]);
}
// ---------- view kind/defaults persistency ----------
@@ -717,7 +720,8 @@
private void cleanUpPatternDuplicates() {
if (!areUserDefinedPatternsEnabled())
return;
- List userDefinedPatterns= new ArrayList(Arrays.asList(fUserDefinedPatterns));
+ List<String> userDefinedPatterns = new ArrayList<String>(
+ Arrays.asList(fUserDefinedPatterns));
FilterDescriptor[] filters= getCachedFilterDescriptors();
for (int i= 0; i < filters.length; i++) {
@@ -731,7 +735,8 @@
}
}
}
- fUserDefinedPatterns= (String[])userDefinedPatterns.toArray(new String[userDefinedPatterns.size()]);
+ fUserDefinedPatterns = userDefinedPatterns
+ .toArray(new String[userDefinedPatterns.size()]);
setUserDefinedPatternsEnabled(fUserDefinedPatternsEnabled && fUserDefinedPatterns.length > 0);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
index 6857259..69effe5 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/LogicalPackage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 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
@@ -26,13 +26,13 @@
*/
public class LogicalPackage extends PlatformObject {
- private Set fPackages;
+ private Set<IScriptFolder> fPackages;
private String fName;
private IScriptProject fScriptProject;
public LogicalPackage(IScriptFolder fragment){
Assert.isNotNull(fragment);
- fPackages= new HashSet();
+ fPackages = new HashSet<IScriptFolder>();
fScriptProject= fragment.getScriptProject();
Assert.isNotNull(fScriptProject);
add(fragment);
@@ -44,7 +44,7 @@
}
public IScriptFolder[] getScriptFolders(){
- return (IScriptFolder[]) fPackages.toArray(new IScriptFolder[fPackages.size()]);
+ return fPackages.toArray(new IScriptFolder[fPackages.size()]);
}
public void add(IScriptFolder fragment){
@@ -89,8 +89,9 @@
}
public boolean hasSubpackages() throws ModelException {
- for (Iterator iter= fPackages.iterator(); iter.hasNext();) {
- IScriptFolder pack= (IScriptFolder) iter.next();
+ for (Iterator<IScriptFolder> iter = fPackages.iterator(); iter
+ .hasNext();) {
+ IScriptFolder pack = iter.next();
if (pack.hasSubfolders()) {
return true;
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java
index 9b38a18..4f09b3d 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewFlatContentProvider.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
@@ -85,7 +85,7 @@
* Weeds out packageFragments from external jars
*/
private IScriptFolder[] getPackageFragments(IScriptFolder[] iPackageFragments) {
- List list= new ArrayList();
+ List<IScriptFolder> list = new ArrayList<IScriptFolder>();
for (int i= 0; i < iPackageFragments.length; i++) {
IScriptFolder fragment= iPackageFragments[i];
IModelElement el= fragment.getParent();
@@ -96,7 +96,7 @@
}
list.add(fragment);
}
- return (IScriptFolder[]) list.toArray(new IScriptFolder[list.size()]);
+ return list.toArray(new IScriptFolder[list.size()]);
}
/*
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
index 862dc15..e80c5a0 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/browsing/PackagesViewHierarchicalContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 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
@@ -67,7 +67,7 @@
IScriptFolder[] topLevelChildren = getTopLevelChildrenByElementName(project
.getScriptFolders());
- List list = new ArrayList();
+ List<IScriptFolder> list = new ArrayList<IScriptFolder>();
for (int i = 0; i < topLevelChildren.length; i++) {
IScriptFolder fragment = topLevelChildren[i];
@@ -91,7 +91,8 @@
}
}
- Object[] logicalPackages = combineSamePackagesIntoLogialPackages((IScriptFolder[]) list
+ Object[] logicalPackages = combineSamePackagesIntoLogialPackages(
+ list
.toArray(new IScriptFolder[list.size()]));
if (folders.size() > 0) {
if (logicalPackages.length > 0)
@@ -163,7 +164,7 @@
// @Improve: rewrite using concatenate
} else if (parentElement instanceof LogicalPackage) {
- List children = new ArrayList();
+ List<IScriptFolder> children = new ArrayList<IScriptFolder>();
LogicalPackage logicalPackage = (LogicalPackage) parentElement;
IScriptFolder[] elements = logicalPackage.getScriptFolders();
for (int i = 0; i < elements.length; i++) {
@@ -172,7 +173,8 @@
(IProjectFragment) fragment.getParent(), fragment);
children.addAll(Arrays.asList(objects));
}
- return combineSamePackagesIntoLogialPackages((IScriptFolder[]) children
+ return combineSamePackagesIntoLogialPackages(
+ children
.toArray(new IScriptFolder[children.size()]));
} else if (parentElement instanceof IFolder) {
IFolder folder = (IFolder) parentElement;
@@ -189,13 +191,13 @@
}
private void addFragmentsToMap(List elements) {
- List packageFragments = new ArrayList();
+ List<IScriptFolder> packageFragments = new ArrayList<IScriptFolder>();
for (Iterator iter = elements.iterator(); iter.hasNext();) {
Object elem = iter.next();
if (elem instanceof IScriptFolder)
- packageFragments.add(elem);
+ packageFragments.add((IScriptFolder) elem);
}
- addFragmentsToMap((IScriptFolder[]) packageFragments
+ addFragmentsToMap(packageFragments
.toArray(new IScriptFolder[packageFragments.size()]));
}
@@ -238,7 +240,7 @@
private IScriptFolder[] findNextLevelChildrenByElementName(
IProjectFragment parent, IScriptFolder fragment) {
- List list = new ArrayList();
+ List<IScriptFolder> list = new ArrayList<IScriptFolder>();
try {
IModelElement[] children = parent.getChildren();
@@ -268,22 +270,22 @@
} catch (ModelException e) {
DLTKUIPlugin.log(e);
}
- return (IScriptFolder[]) list.toArray(new IScriptFolder[list.size()]);
+ return list.toArray(new IScriptFolder[list.size()]);
}
private IScriptFolder[] getTopLevelChildrenByElementName(
IModelElement[] elements) {
- List topLevelElements = new ArrayList();
+ List<IScriptFolder> topLevelElements = new ArrayList<IScriptFolder>();
for (int i = 0; i < elements.length; i++) {
IModelElement iJavaElement = elements[i];
// if the name of the PackageFragment is the top level package it
// will contain no "." separators
if (iJavaElement instanceof IScriptFolder
&& iJavaElement.getElementName().indexOf('.') == -1) {
- topLevelElements.add(iJavaElement);
+ topLevelElements.add((IScriptFolder) iJavaElement);
}
}
- return (IScriptFolder[]) topLevelElements
+ return topLevelElements
.toArray(new IScriptFolder[topLevelElements.size()]);
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java
index 49f8bb3..b7db710 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/FilteredTypesSelectionDialog.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
@@ -997,16 +997,16 @@
public TypeInfoUtil(ITypeInfoImageProvider extension) {
fProviderExtension = extension;
- List locations = new ArrayList();
- List labels = new ArrayList();
+ List<String> locations = new ArrayList<String>();
+ List<String> labels = new ArrayList<String>();
IInterpreterInstallType[] installs = ScriptRuntime
.getInterpreterInstallTypes(fToolkit.getNatureId());
for (int i = 0; i < installs.length; i++) {
processInterpreterInstallType(installs[i], locations, labels);
}
- fInstallLocations = (String[]) locations
+ fInstallLocations = locations
.toArray(new String[locations.size()]);
- fVMNames = (String[]) labels.toArray(new String[labels.size()]);
+ fVMNames = labels.toArray(new String[labels.size()]);
}
@@ -1015,7 +1015,8 @@
}
private void processInterpreterInstallType(
- IInterpreterInstallType installType, List locations, List labels) {
+ IInterpreterInstallType installType, List<String> locations,
+ List<String> labels) {
if (installType != null) {
IInterpreterInstall[] installs = installType
.getInterpreterInstalls();
@@ -1532,20 +1533,20 @@
* Creates new instance of TypeItemsComparator
*/
public TypeItemsComparator() {
- List locations = new ArrayList();
- List labels = new ArrayList();
+ List<String> locations = new ArrayList<String>();
+ List<String> labels = new ArrayList<String>();
IInterpreterInstallType[] installs = ScriptRuntime
.getInterpreterInstallTypes();
for (int i = 0; i < installs.length; i++) {
processVMInstallType(installs[i], locations, labels);
}
- fInstallLocations = (String[]) locations
+ fInstallLocations = locations
.toArray(new String[locations.size()]);
- fVMNames = (String[]) labels.toArray(new String[labels.size()]);
+ fVMNames = labels.toArray(new String[labels.size()]);
}
private void processVMInstallType(IInterpreterInstallType installType,
- List locations, List labels) {
+ List<String> locations, List<String> labels) {
if (installType != null) {
IInterpreterInstall[] installs = installType
.getInterpreterInstalls();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
index 09904a5..b4d1714 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/formatter/internal/AbstractFormatterSelectionBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 xored software, Inc.
+ * Copyright (c) 2008, 2016 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -97,7 +97,7 @@
IWorkbenchPreferenceContainer container) {
super(context, project, collectPreferenceKeys(TEMP_LIST, natureId,
formatterKey), container);
- factories = (IScriptFormatterFactory[]) TEMP_LIST
+ factories = TEMP_LIST
.toArray(new IScriptFormatterFactory[TEMP_LIST.size()]);
TEMP_LIST = new ArrayList();
}
@@ -722,6 +722,6 @@
private Map<IScriptFormatterFactory, IProfileManager> profileByFactory = new HashMap<IScriptFormatterFactory, IProfileManager>();
protected SourceViewer fPreviewViewer;
- private static List TEMP_LIST = new ArrayList();
+ private static List<IScriptFormatterFactory> TEMP_LIST = new ArrayList<IScriptFormatterFactory>();
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
index b087044..e44e593 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/CodeTemplateBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2016 xored software, Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -367,7 +367,7 @@
protected TemplatePersistenceData[] getTemplatesOfCategory(
ICodeTemplateCategory category) {
- ArrayList res = new ArrayList();
+ ArrayList<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>();
TemplatePersistenceData[] templates = fTemplateStore.getTemplateData();
for (int i = 0; i < templates.length; i++) {
TemplatePersistenceData curr = templates[i];
@@ -376,8 +376,7 @@
res.add(curr);
// }
}
- return (TemplatePersistenceData[]) res
- .toArray(new TemplatePersistenceData[res.size()]);
+ return res.toArray(new TemplatePersistenceData[res.size()]);
}
private TemplatePersistenceData[] getTemplatesOfContextType(
@@ -387,7 +386,7 @@
protected TemplatePersistenceData[] getTemplatesOfContextType(
String contextTypeId) {
- List res = new ArrayList();
+ List<TemplatePersistenceData> res = new ArrayList<TemplatePersistenceData>();
TemplatePersistenceData[] templates = fTemplateStore.getTemplateData();
for (int i = 0; i < templates.length; ++i) {
TemplatePersistenceData curr = templates[i];
@@ -395,13 +394,13 @@
res.add(curr);
}
}
- return (TemplatePersistenceData[]) res
+ return res
.toArray(new TemplatePersistenceData[res.size()]);
}
protected TemplateContextType[] getTemplateContextTypes(
ICodeTemplateCategory category) {
- ArrayList result = new ArrayList();
+ ArrayList<TemplateContextType> result = new ArrayList<TemplateContextType>();
TemplateContextType[] contextTypes = category.getTemplateContextTypes();
for (int i = 0; i < contextTypes.length; ++i) {
TemplateContextType contextType = contextTypes[i];
@@ -409,8 +408,7 @@
result.add(contextType);
}
}
- return (TemplateContextType[]) result
- .toArray(new TemplateContextType[result.size()]);
+ return result.toArray(new TemplateContextType[result.size()]);
}
protected boolean canAdd(List selected) {
@@ -644,11 +642,11 @@
}
private void export(List selected) {
- Set datas = new HashSet();
+ Set<TemplatePersistenceData> datas = new HashSet<TemplatePersistenceData>();
for (int i = 0; i < selected.size(); i++) {
Object curr = selected.get(i);
if (curr instanceof TemplatePersistenceData) {
- datas.add(curr);
+ datas.add((TemplatePersistenceData) curr);
} else if (curr instanceof TemplateContextType) {
TemplatePersistenceData[] cat = getTemplatesOfContextType((TemplateContextType) curr);
datas.addAll(Arrays.asList(cat));
@@ -667,7 +665,7 @@
}
}
}
- export((TemplatePersistenceData[]) datas
+ export(datas
.toArray(new TemplatePersistenceData[datas.size()]));
}
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
index 54a5f29..2d2c698 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/EditTemplateDialog.java
@@ -208,7 +208,7 @@
String delim = new Document().getLegalLineDelimiters()[0];
- List contexts = new ArrayList();
+ List<String[]> contexts = new ArrayList<String[]>();
for (Iterator it = registry.contextTypes(); it.hasNext();) {
TemplateContextType type = (TemplateContextType) it.next();
if (type.getId().equals("javadoc")) //$NON-NLS-1$
@@ -218,8 +218,7 @@
contexts.add(0,
new String[] { type.getId(), type.getName(), "" }); //$NON-NLS-1$
}
- fContextTypes = (String[][]) contexts.toArray(new String[contexts
- .size()][]);
+ fContextTypes = contexts.toArray(new String[contexts.size()][]);
fValidationStatus = new StatusInfo();
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
index 43caabe..f00f272 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/FoldingConfigurationBlock.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.preferences;
@@ -103,7 +102,7 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList overlayKeys = new ArrayList();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(
OverlayPreferenceStore.BOOLEAN,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
index 3ad439b..16b5536 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/preferences/ScriptEditorHoverConfigurationBlock.java
@@ -1,13 +1,11 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
-
package org.eclipse.dltk.ui.preferences;
import java.util.ArrayList;
@@ -19,13 +17,13 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.dltk.internal.corext.util.Messages;
-import org.eclipse.dltk.ui.dialogs.StatusInfo;
import org.eclipse.dltk.internal.ui.dialogs.StatusUtil;
import org.eclipse.dltk.internal.ui.text.hover.EditorTextHoverDescriptor;
import org.eclipse.dltk.internal.ui.util.SWTUtil;
import org.eclipse.dltk.internal.ui.util.TableLayoutComposite;
import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.dltk.ui.PreferenceConstants;
+import org.eclipse.dltk.ui.dialogs.StatusInfo;
import org.eclipse.dltk.ui.util.PixelConverter;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
@@ -186,7 +184,7 @@
private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList overlayKeys = new ArrayList();
+ ArrayList<OverlayPreferenceStore.OverlayKey> overlayKeys = new ArrayList<OverlayPreferenceStore.OverlayKey>();
// overlayKeys.add(new
// OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN,
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
index c118bd4..3623592 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/viewsupport/ProblemMarkerManager.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ui.viewsupport;
@@ -102,7 +101,7 @@
* @see IResourceChangeListener#resourceChanged
*/
public void resourceChanged(IResourceChangeEvent event) {
- HashSet changedElements= new HashSet();
+ HashSet<IResource> changedElements = new HashSet<IResource>();
try {
IResourceDelta delta= event.getDelta();
@@ -113,7 +112,8 @@
}
if (!changedElements.isEmpty()) {
- IResource[] changes= (IResource[]) changedElements.toArray(new IResource[changedElements.size()]);
+ IResource[] changes = changedElements
+ .toArray(new IResource[changedElements.size()]);
fireChanges(changes, true);
}
}
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
index 02fb5a0..71d0654 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/CopyToClipboardAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.refactoring.reorg;
@@ -166,7 +165,8 @@
public void copyToClipboard() throws CoreException {
// Set<String> fileNames
- Set fileNames = new HashSet(fResources.length
+ Set<String> fileNames = new HashSet<String>(
+ fResources.length
+ fScriptElements.length);
StringBuffer namesBuf = new StringBuffer();
processResources(fileNames, namesBuf);
@@ -192,7 +192,7 @@
// TypedSource[] typedSources=
// TypedSource.createTypedSources(modelElementsForClipboard);
- String[] fileNameArray = (String[]) fileNames
+ String[] fileNameArray = fileNames
.toArray(new String[fileNames.size()]);
copyToClipboard(resourcesForClipboard, fileNameArray, namesBuf
.toString(), modelElementsForClipboard/* , typedSources */, 0);
@@ -291,7 +291,7 @@
* TypedSource[]
* typedSources
*/) {
- List result = new ArrayList(4);
+ List<Transfer> result = new ArrayList<Transfer>(4);
if (resources.length != 0)
result.add(ResourceTransfer.getInstance());
if (modelElements.length != 0)
@@ -301,7 +301,7 @@
// if (typedSources.length != 0)
// result.add(TypedSourceTransfer.getInstance());
result.add(TextTransfer.getInstance());
- return (Transfer[]) result.toArray(new Transfer[result.size()]);
+ return result.toArray(new Transfer[result.size()]);
}
private static Object[] createDataArray(IResource[] resources,
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
index b89b81a..0da3f9d 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/PasteAction.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.refactoring.reorg;
@@ -24,9 +23,9 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.dltk.core.DLTKCore;
-import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.IModelElement;
import org.eclipse.dltk.core.IProjectFragment;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ModelException;
import org.eclipse.dltk.internal.core.ExternalProjectFragment;
import org.eclipse.dltk.internal.core.ExternalScriptFolder;
@@ -85,7 +84,7 @@
private Paster[] createEnabledPasters(TransferData[] availableDataTypes) throws ModelException {
Paster paster;
Shell shell = getShell();
- List result= new ArrayList(2);
+ List<Paster> result = new ArrayList<Paster>(2);
paster= new ProjectPaster(shell, fClipboard);
if (paster.canEnable(availableDataTypes))
result.add(paster);
@@ -109,7 +108,7 @@
// paster= new TextPaster(shell, fClipboard);
// if (paster.canEnable(availableDataTypes))
// result.add(paster);
- return (Paster[]) result.toArray(new Paster[result.size()]);
+ return result.toArray(new Paster[result.size()]);
}
private static Object getContents(final Clipboard clipboard, final Transfer transfer, Shell shell) {
@@ -443,7 +442,8 @@
}
public void paste(IModelElement[] selectedScriptElements, IResource[] selectedResources, IWorkingSet[] selectedWorkingSets, TransferData[] availableTypes) throws ModelException, InterruptedException, InvocationTargetException {
IWorkingSet workingSet= selectedWorkingSets[0];
- Set elements= new HashSet(Arrays.asList(workingSet.getElements()));
+ Set<IAdaptable> elements = new HashSet<IAdaptable>(
+ Arrays.asList(workingSet.getElements()));
IModelElement[] modelElements= getClipboardScriptElements(availableTypes);
if (modelElements != null) {
for (int i= 0; i < modelElements.length; i++) {
@@ -467,7 +467,8 @@
elements.add(element);
}
}
- workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
+ workingSet.setElements(
+ elements.toArray(new IAdaptable[elements.size()]));
}
public boolean canEnable(TransferData[] availableTypes) throws ModelException {
return isAvailable(ResourceTransfer.getInstance(), availableTypes) ||
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
index b58c913..623fe07 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptCopyProcessor.java
@@ -197,10 +197,10 @@
private String[] getAffectedProjectNatures() throws CoreException {
String[] jNatures= ScriptProcessors.computeAffectedNaturs(fCopyPolicy.getScriptElements());
String[] rNatures= ResourceProcessors.computeAffectedNatures(fCopyPolicy.getResources());
- Set result= new HashSet();
+ Set<String> result = new HashSet<String>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
- return (String[])result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public boolean canEnableComment() {
diff --git a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
index 9c1e48d..24092d7 100644
--- a/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
+++ b/core/plugins/org.eclipse.dltk.ui/ui refactoring/org/eclipse/dltk/internal/ui/refactoring/reorg/ScriptMoveProcessor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.internal.ui.refactoring.reorg;
@@ -29,10 +28,10 @@
import org.eclipse.dltk.internal.corext.refactoring.reorg.ICreateTargetQueries;
import org.eclipse.dltk.internal.corext.refactoring.reorg.ICreateTargetQuery;
import org.eclipse.dltk.internal.corext.refactoring.reorg.IReorgDestinationValidator;
+import org.eclipse.dltk.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
import org.eclipse.dltk.internal.corext.refactoring.reorg.IReorgQueries;
import org.eclipse.dltk.internal.corext.refactoring.reorg.ParentChecker;
import org.eclipse.dltk.internal.corext.refactoring.reorg.ReorgUtils;
-import org.eclipse.dltk.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
import org.eclipse.dltk.internal.corext.refactoring.tagging.ICommentProvider;
import org.eclipse.dltk.internal.corext.refactoring.tagging.IQualifiedNameUpdating;
import org.eclipse.dltk.internal.corext.refactoring.tagging.IScriptableRefactoring;
@@ -93,10 +92,10 @@
private String[] getAffectedProjectNatures() throws CoreException {
String[] jNatures= ScriptProcessors.computeAffectedNaturs(fMovePolicy.getScriptElements());
String[] rNatures= ResourceProcessors.computeAffectedNatures(fMovePolicy.getResources());
- Set result= new HashSet();
+ Set<String> result = new HashSet<String>();
result.addAll(Arrays.asList(jNatures));
result.addAll(Arrays.asList(rNatures));
- return (String[])result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
public boolean wasCanceled() {