1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 11:25:35 +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. * The list of projects to sort.
* @return A new list of projects, ordered by build order. * @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(); String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
if (orderedNames != null) { 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 //Projects may not be in the build order but should be built if
// selected // selected
List unorderedProjects = new ArrayList(resourceCollection.size()); List<IProject> unorderedProjects = new ArrayList<>(resourceCollection.size());
unorderedProjects.addAll(resourceCollection); unorderedProjects.addAll(resourceCollection);
for (int i = 0; i < orderedNames.length; i++) { for (int i = 0; i < orderedNames.length; i++) {
String projectName = orderedNames[i]; String projectName = orderedNames[i];
for (int j = 0; j < resourceCollection.size(); j++) { for (int j = 0; j < resourceCollection.size(); j++) {
IProject proj = (IProject) resourceCollection.get(j); IProject proj = resourceCollection.get(j);
if (proj.getName().equals(projectName)) { if (proj.getName().equals(projectName)) {
orderedProjs.add(proj); orderedProjs.add(proj);
unorderedProjects.remove(proj); unorderedProjects.remove(proj);
@ -527,9 +527,9 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
// Try the project prerequisite order then // Try the project prerequisite order then
IProject[] projects = new IProject[resourceCollection.size()]; IProject[] projects = new IProject[resourceCollection.size()];
projects = (IProject[]) resourceCollection.toArray(projects); projects = resourceCollection.toArray(projects);
IWorkspace.ProjectOrder po = ResourcesPlugin.getWorkspace().computeProjectOrder(projects); IWorkspace.ProjectOrder po = ResourcesPlugin.getWorkspace().computeProjectOrder(projects);
ArrayList orderedProjs = new ArrayList(); ArrayList<IProject> orderedProjs = new ArrayList<>();
orderedProjs.addAll(Arrays.asList(po.projects)); orderedProjs.addAll(Arrays.asList(po.projects));
return orderedProjs; return orderedProjs;
} }
@ -806,9 +806,9 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat
ICProject cProject = CDebugUtils.getCProject(configuration); ICProject cProject = CDebugUtils.getCProject(configuration);
if (cProject != null) { if (cProject != null) {
project = cProject.getProject(); project = cProject.getProject();
HashSet projectSet = new HashSet(); HashSet<IProject> projectSet = new HashSet<>();
getReferencedProjectSet(project, projectSet); getReferencedProjectSet(project, projectSet);
orderedProjects = getBuildOrder(new ArrayList(projectSet)); orderedProjects = getBuildOrder(new ArrayList<>(projectSet));
} }
monitor.worked(scale); 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 @Override
public void createControl(Composite parent) { public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE); Composite comp = new Composite(parent, SWT.NONE);
@ -292,9 +289,6 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return (IContainer) getWorkspaceRoot().findMember(containerPath); return (IContainer) getWorkspaceRoot().findMember(containerPath);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override @Override
public void initializeFrom(ILaunchConfiguration configuration) { public void initializeFrom(ILaunchConfiguration configuration) {
boolean isShared = !configuration.isLocal(); boolean isShared = !configuration.isLocal();
@ -324,7 +318,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
fFavoritesTable.setInput(config); fFavoritesTable.setInput(config);
fFavoritesTable.setCheckedElements(new Object[] {}); fFavoritesTable.setCheckedElements(new Object[] {});
try { 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()) { if (groups.isEmpty()) {
// check old attributes for backwards compatible // check old attributes for backwards compatible
if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) { if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) {
@ -335,10 +329,10 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
} }
} }
if (!groups.isEmpty()) { if (!groups.isEmpty()) {
List list = new ArrayList(); List<LaunchGroupExtension> list = new ArrayList<>();
Iterator iterator = groups.iterator(); Iterator<String> iterator = groups.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String id = (String) iterator.next(); String id = iterator.next();
LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id); LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id);
if (extension != null) { if (extension != null) {
list.add(extension); list.add(extension);
@ -391,7 +385,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
boolean run = config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false); boolean run = config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false);
if (debug || run) { if (debug || run) {
// old attributes // old attributes
List groups = new ArrayList(); List<LaunchGroupExtension> groups = new ArrayList<>();
int num = 0; int num = 0;
if (debug) { if (debug) {
groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP)); 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_DEBUG_FAVORITE, (String) null);
config.setAttribute(IDebugUIConstants.ATTR_RUN_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++) { for (int i = 0; i < checked.length; i++) {
LaunchGroupExtension group = (LaunchGroupExtension) checked[i]; LaunchGroupExtension group = (LaunchGroupExtension) checked[i];
if (groups == null) { if (groups == null) {
groups = new ArrayList(); groups = new ArrayList<>();
} }
groups.add(group.getIdentifier()); groups.add(group.getIdentifier());
} }
@ -438,9 +432,6 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return ResourcesPlugin.getWorkspace().getRoot(); return ResourcesPlugin.getWorkspace().getRoot();
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override @Override
public boolean isValid(ILaunchConfiguration config) { public boolean isValid(ILaunchConfiguration config) {
setMessage(null); setMessage(null);
@ -469,27 +460,18 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return true; return true;
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override @Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) { public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setContainer(null); config.setContainer(null);
setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, config, true, true); setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, config, true, true);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override @Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) { public void performApply(ILaunchConfigurationWorkingCopy configuration) {
updateConfigFromLocalShared(configuration); updateConfigFromLocalShared(configuration);
updateConfigFromFavorites(configuration); updateConfigFromFavorites(configuration);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
@Override @Override
public String getName() { public String getName() {
return LaunchConfigurationsMessages.CommonTab__Common_15; return LaunchConfigurationsMessages.CommonTab__Common_15;
@ -505,32 +487,20 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
return "org.eclipse.debug.ui.commonTab"; //$NON-NLS-1$ return "org.eclipse.debug.ui.commonTab"; //$NON-NLS-1$
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave()
*/
@Override @Override
public boolean canSave() { public boolean canSave() {
return validateLocalShared(); return validateLocalShared();
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
@Override @Override
public Image getImage() { public Image getImage() {
return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB); return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB);
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override @Override
public void activated(ILaunchConfigurationWorkingCopy workingCopy) { public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
} }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override @Override
public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
} }
@ -543,7 +513,7 @@ public class CommonTabLite extends AbstractLaunchConfigurationTab {
@Override @Override
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {
ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); ILaunchGroup[] groups = DebugUITools.getLaunchGroups();
List possibleGroups = new ArrayList(); List<ILaunchGroup> possibleGroups = new ArrayList<>();
ILaunchConfiguration configuration = (ILaunchConfiguration) inputElement; ILaunchConfiguration configuration = (ILaunchConfiguration) inputElement;
for (int i = 0; i < groups.length; i++) { for (int i = 0; i < groups.length; i++) {
ILaunchGroup extension = groups[i]; ILaunchGroup extension = groups[i];