Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2010-12-02 15:42:38 -0500
committerSergey Prigogin2010-12-02 15:42:38 -0500
commitf3b4634427e366e4d3218205347beed08176e672 (patch)
tree2ee30f43ce66a441c1acab41283e67204750beed /debug/org.eclipse.cdt.debug.ui
parent9792e732c49a01ac2de784cf7e36fd71a48c922d (diff)
downloadorg.eclipse.cdt-f3b4634427e366e4d3218205347beed08176e672.tar.gz
org.eclipse.cdt-f3b4634427e366e4d3218205347beed08176e672.tar.xz
org.eclipse.cdt-f3b4634427e366e4d3218205347beed08176e672.zip
Generics.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java65
1 files changed, 32 insertions, 33 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
index 276d6f6672..cbef6f18eb 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
@@ -6,14 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * QNX Software Systems - Initial API and implementation
+ * QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.ui.sourcelookup;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
@@ -37,39 +36,37 @@ public class DefaultSourceLocator extends CSourceLookupDirector {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#initializeFromMemento(java.lang.String, org.eclipse.debug.core.ILaunchConfiguration)
*/
- public void initializeFromMemento( String memento, ILaunchConfiguration configuration ) throws CoreException {
- Element rootElement = DebugPlugin.parseDocument( memento );
- if ( rootElement.getNodeName().equalsIgnoreCase( OldDefaultSourceLocator.ELEMENT_NAME ) ) {
- initializeFromOldMemento( memento, configuration );
- }
- else {
- super.initializeFromMemento( memento, configuration );
+ public void initializeFromMemento(String memento, ILaunchConfiguration configuration) throws CoreException {
+ Element rootElement = DebugPlugin.parseDocument(memento);
+ if (rootElement.getNodeName().equalsIgnoreCase(OldDefaultSourceLocator.ELEMENT_NAME)) {
+ initializeFromOldMemento(memento, configuration);
+ } else {
+ super.initializeFromMemento(memento, configuration);
}
}
- private void initializeFromOldMemento( String memento, ILaunchConfiguration configuration ) throws CoreException {
+ private void initializeFromOldMemento(String memento, ILaunchConfiguration configuration) throws CoreException {
dispose();
- setLaunchConfiguration( configuration );
+ setLaunchConfiguration(configuration);
OldDefaultSourceLocator old = new OldDefaultSourceLocator();
- old.initializeFromMemento( memento );
- ICSourceLocator csl = (ICSourceLocator)old.getAdapter( ICSourceLocator.class );
- setFindDuplicates( csl.searchForDuplicateFiles() );
+ old.initializeFromMemento(memento);
+ ICSourceLocator csl = (ICSourceLocator)old.getAdapter(ICSourceLocator.class);
+ setFindDuplicates(csl.searchForDuplicateFiles());
ICSourceLocation[] locations = csl.getSourceLocations();
// Check if the old source locator includes all referenced projects.
// If so, DefaultSpourceContainer should be used.
IProject project = csl.getProject();
- List list = CDebugUtils.getReferencedProjects( project );
- HashSet names = new HashSet( list.size() + 1 );
- names.add( project.getName() );
- Iterator it = list.iterator();
- while( it.hasNext() ) {
- names.add( ((IProject)it.next()).getName() );
+ List<IProject> list = CDebugUtils.getReferencedProjects(project);
+ HashSet<String> names = new HashSet<String>(list.size() + 1);
+ names.add(project.getName());
+ for (IProject proj : list) {
+ names.add(proj.getName());
}
boolean includesDefault = true;
- for( int i = 0; i < locations.length; ++i ) {
- if ( locations[i] instanceof IProjectSourceLocation && ((IProjectSourceLocation)locations[i]).isGeneric() ) {
- if ( !names.contains( ((IProjectSourceLocation)locations[i]).getProject().getName() ) ) {
+ for (int i = 0; i < locations.length; ++i) {
+ if (locations[i] instanceof IProjectSourceLocation && ((IProjectSourceLocation)locations[i]).isGeneric()) {
+ if (!names.contains(((IProjectSourceLocation)locations[i]).getProject().getName())) {
includesDefault = false;
break;
}
@@ -77,20 +74,22 @@ public class DefaultSourceLocator extends CSourceLookupDirector {
}
// Generate an array of new source containers including DefaultSourceContainer
- ArrayList locs = new ArrayList( locations.length );
- for ( int i = 0; i < locations.length; ++i ) {
- if ( !includesDefault || !( locations[i] instanceof IProjectSourceLocation && names.contains( ((IProjectSourceLocation)locations[i]).getProject().getName() ) ) )
- locs.add( locations[i] );
+ ArrayList<ICSourceLocation> locs = new ArrayList<ICSourceLocation>(locations.length);
+ for (int i = 0; i < locations.length; ++i) {
+ if (!includesDefault || !(locations[i] instanceof IProjectSourceLocation &&
+ names.contains(((IProjectSourceLocation)locations[i]).getProject().getName()))) {
+ locs.add(locations[i]);
+ }
}
- ISourceContainer[] containers = SourceUtils.convertSourceLocations( (ICSourceLocation[])locs.toArray( new ICSourceLocation[locs.size()] ) );
- ArrayList cons = new ArrayList( Arrays.asList( containers ) );
- if ( includesDefault ) {
+ ISourceContainer[] containers = SourceUtils.convertSourceLocations(locs.toArray(new ICSourceLocation[locs.size()]));
+ ArrayList<ISourceContainer> cons = new ArrayList<ISourceContainer>(Arrays.asList(containers));
+ if (includesDefault) {
DefaultSourceContainer defaultContainer = new DefaultSourceContainer();
- defaultContainer.init( this );
- cons.add( 0, defaultContainer );
+ defaultContainer.init(this);
+ cons.add(0, defaultContainer);
}
- setSourceContainers( (ISourceContainer[])cons.toArray( new ISourceContainer[cons.size()] ) );
+ setSourceContainers(cons.toArray(new ISourceContainer[cons.size()]));
initializeParticipants();
}
}

Back to the top