debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/source/lookup/CarbideSourcePathComputerDelegate.java
changeset 1103 a5d7a2345c4a
parent 1096 96e5879cd42d
equal deleted inserted replaced
1102:fc2867001a80 1103:a5d7a2345c4a
    25 import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
    25 import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
    26 import org.eclipse.core.resources.IProject;
    26 import org.eclipse.core.resources.IProject;
    27 import org.eclipse.core.resources.ResourcesPlugin;
    27 import org.eclipse.core.resources.ResourcesPlugin;
    28 import org.eclipse.core.runtime.CoreException;
    28 import org.eclipse.core.runtime.CoreException;
    29 import org.eclipse.core.runtime.IProgressMonitor;
    29 import org.eclipse.core.runtime.IProgressMonitor;
       
    30 import org.eclipse.core.runtime.Platform;
    30 import org.eclipse.debug.core.ILaunchConfiguration;
    31 import org.eclipse.debug.core.ILaunchConfiguration;
    31 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
    32 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
    32 import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
    33 import org.eclipse.debug.core.sourcelookup.ISourcePathComputerDelegate;
    33 import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
    34 import org.eclipse.debug.core.sourcelookup.containers.ProjectSourceContainer;
    34 
    35 
    38  * Computes the default source lookup path for a launch configuration.
    39  * Computes the default source lookup path for a launch configuration.
    39  */
    40  */
    40 public class CarbideSourcePathComputerDelegate implements ISourcePathComputerDelegate {
    41 public class CarbideSourcePathComputerDelegate implements ISourcePathComputerDelegate {
    41 
    42 
    42 	/** From legacy DE support. */
    43 	/** From legacy DE support. */
    43 	public static final String PSC_FindSourceOutsideWorkspace = "com.freescale.cdt.debug.cw.PN_FindSourceOutsideWorkspace";
    44 	public static final String PSC_FindSourceOutsideWorkspace = "com.freescale.cdt.debug.cw.PN_FindSourceOutsideWorkspace"; // $//$NON-NLS-N$
       
    45 	
       
    46 	/** Plugin ID to look up Carbide global debugger prefs */
       
    47 	public static final String CWPluginID = "com.freescale.cdt.debug.cw.core"; // $//$NON-NLS-N$
    44 	
    48 	
    45 	/** 
    49 	/** 
    46 	 * Constructor for CSourcePathComputerDelegate. 
    50 	 * Constructor for CSourcePathComputerDelegate. 
    47 	 */
    51 	 */
    48 	public CarbideSourcePathComputerDelegate() {
    52 	public CarbideSourcePathComputerDelegate() {
    66 			IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
    70 			IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
    67 			if ( project.exists() ) {
    71 			if ( project.exists() ) {
    68 				containers.add( 0, new ProjectSourceContainer( project, true ) );
    72 				containers.add( 0, new ProjectSourceContainer( project, true ) );
    69 			}
    73 			}
    70 		}
    74 		}
    71 		if (CarbideCommonDebuggerPlugin.getDefault().getPluginPreferences().getBoolean(
    75 		
    72 				PSC_FindSourceOutsideWorkspace))		
    76 		if (Platform.getPreferencesService().getBoolean( CWPluginID, PSC_FindSourceOutsideWorkspace, false, null)){
    73 			containers.add( 0, new AbsolutePathSourceContainer() );
    77 			containers.add( 0, new AbsolutePathSourceContainer() );
       
    78 		}
    74 		return (ISourceContainer[])containers.toArray( new ISourceContainer[containers.size()] );
    79 		return (ISourceContainer[])containers.toArray( new ISourceContainer[containers.size()] );
    75 	}
    80 	}
    76 }
    81 }