1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Generify ArrayList.

Change-Id: Icb3dfc7fb8519a4d25f08c3dabce4a8b073dd880
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2019-10-10 22:33:11 +03:00
parent 8ba5a7191f
commit d9cf1e1e2b
2 changed files with 16 additions and 46 deletions

View file

@ -500,19 +500,19 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
* The list of projects to sort.
* @return A new list of projects, ordered by build order.
*/
private List getBuildOrder(List resourceCollection) {
private List<IProject> getBuildOrder(List<IProject> resourceCollection) {
String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
if (orderedNames != null) {
List orderedProjs = new ArrayList(resourceCollection.size());
List<IProject> orderedProjs = new ArrayList<>(resourceCollection.size());
//Projects may not be in the build order but should be built if
// selected
List unorderedProjects = new ArrayList(resourceCollection.size());
List<IProject> unorderedProjects = new ArrayList<>(resourceCollection.size());
unorderedProjects.addAll(resourceCollection);
for (int i = 0; i < orderedNames.length; i++) {
String projectName = orderedNames[i];
for (int j = 0; j < resourceCollection.size(); j++) {
IProject proj = (IProject) resourceCollection.get(j);
IProject proj = resourceCollection.get(j);
if (proj.getName().equals(projectName)) {
orderedProjs.add(proj);
unorderedProjects.remove(proj);
@ -527,9 +527,9 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
// Try the project prerequisite order then
IProject[] projects = new IProject[resourceCollection.size()];
projects = (IProject[]) resourceCollection.toArray(projects);
projects = resourceCollection.toArray(projects);
IWorkspace.ProjectOrder po = ResourcesPlugin.getWorkspace().computeProjectOrder(projects);
ArrayList orderedProjs = new ArrayList();
ArrayList<IProject> orderedProjs = new ArrayList<>();
orderedProjs.addAll(Arrays.asList(po.projects));
return orderedProjs;
}
@ -806,9 +806,9 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ICProject cProject = CDebugUtils.getCProject(configuration);
if (cProject != null) {
project = cProject.getProject();
HashSet projectSet = new HashSet();
HashSet<IProject> projectSet = new HashSet<>();
getReferencedProjectSet(project, projectSet);
orderedProjects = getBuildOrder(new ArrayList(projectSet));
orderedProjects = getBuildOrder(new ArrayList<>(projectSet));
}
monitor.worked(scale);

View file

@ -140,9 +140,6 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
}
};
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
@ -292,9 +289,6 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return (IContainer) getWorkspaceRoot().findMember(containerPath);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
boolean isShared = !configuration.isLocal();
@ -324,7 +318,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
fFavoritesTable.setInput(config);
fFavoritesTable.setCheckedElements(new Object[] {});
try {
List groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList());
List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<>());
if (groups.isEmpty()) {
// check old attributes for backwards compatible
if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
@ -335,10 +329,10 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
}
}
if (!groups.isEmpty()) {
List list = new ArrayList();
Iterator iterator = groups.iterator();
List<LaunchGroupExtension> list = new ArrayList<>();
Iterator<String> iterator = groups.iterator();
while (iterator.hasNext()) {
String id = (String) iterator.next();
String id = iterator.next();
LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id);
if (extension != null) {
list.add(extension);
@ -391,7 +385,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
boolean run = config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false);
if (debug || run) {
// old attributes
List groups = new ArrayList();
List<LaunchGroupExtension> groups = new ArrayList<>();
int num = 0;
if (debug) {
groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP));
@ -417,11 +411,11 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
}
config.setAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, (String) null);
config.setAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, (String) null);
List groups = null;
List<String> groups = null;
for (int i = 0; i < checked.length; i++) {
LaunchGroupExtension group = (LaunchGroupExtension) checked[i];
if (groups == null) {
groups = new ArrayList();
groups = new ArrayList<>();
}
groups.add(group.getIdentifier());
}
@ -438,9 +432,6 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return ResourcesPlugin.getWorkspace().getRoot();
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public boolean isValid(ILaunchConfiguration config) {
setMessage(null);
@ -469,27 +460,18 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return true;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setContainer(null);
setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, config, true, true);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
updateConfigFromLocalShared(configuration);
updateConfigFromFavorites(configuration);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
@Override
public String getName() {
return LaunchConfigurationsMessages.CommonTab__Common_15;
@ -505,32 +487,20 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return "org.eclipse.debug.ui.commonTab"; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave()
*/
@Override
public boolean canSave() {
return validateLocalShared();
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
@Override
public Image getImage() {
return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
}
@ -543,7 +513,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
@Override
public Object[] getElements(Object inputElement) {
ILaunchGroup[] groups = DebugUITools.getLaunchGroups();
List possibleGroups = new ArrayList();
List<ILaunchGroup> possibleGroups = new ArrayList<>();
ILaunchConfiguration configuration = (ILaunchConfiguration) inputElement;
for (int i = 0; i < groups.length; i++) {
ILaunchGroup extension = groups[i];