Refactor source mapping to com.nokia.cdt.debug.common plugin
authortimkelly
Thu, 11 Mar 2010 14:50:13 -0600
changeset 1099 88ab187cbeb8
parent 1098 ccb2c2352e06
child 1100 34e416ee69ea
Refactor source mapping to com.nokia.cdt.debug.common plugin
debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml
debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java
debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF
debuggercdi/com.nokia.cdt.debug.launch/plugin.xml
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java
debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/NokiaAbstractLaunchDelegate.java
--- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/plugin.xml	Thu Mar 11 14:50:13 2010 -0600
@@ -31,13 +31,6 @@
       </debugger>
    </extension>
  
-    <extension
-         point="org.eclipse.debug.core.sourcePathComputers">
-      <sourcePathComputer
-            class="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputerDelegate"
-            id="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer"/>
-   </extension>
- 
  <!-- Import Executable Wizard -->
    <extension
          point="org.eclipse.ui.importWizards">
@@ -137,17 +130,7 @@
       </cextension>
    </extension>
     
- <!-- *************** Source Container Types **************** -->
-   
-      <extension
-         point="org.eclipse.debug.core.sourceContainerTypes">
-      <sourceContainerType
-            class="com.nokia.cdt.debug.cw.symbian.SymbianSourceContainerType"
-            description="Maps source files to EPOCROOT"
-            id="com.nokia.cdt.debug.cw.symbian.containerType.mapping"
-            name="Symbian OS SDK Mapping"/>
-    </extension>
-  
+
      <!-- *************** HW Breakpoint Actions **************** -->
    
      <extension
@@ -187,6 +170,8 @@
    </extension>   
 
    <!-- *************** Executables manager extensions **************** -->
+
+<!--  Moved to  com.nokia.carbide.cpp.edc
    <extension
        point="org.eclipse.cdt.debug.core.ExecutablesProvider">
       <provider class="com.nokia.cdt.debug.cw.symbian.CarbideExecutablesProvider"/>
@@ -199,9 +184,10 @@
 
    <extension
        point="org.eclipse.cdt.debug.core.SourceRemappingProvider">
-      <provider class="com.nokia.cdt.debug.cw.symbian.ui.executables.SymbianSourceFileRemappingFactory"/>
+      <provider class="com.nokia.cdt.debug.common.executables.SymbianSourceFileRemappingFactory"/>
    </extension>
-   
+-->
+
    <!-- *************** Preference Page Keyword Filtering **************** -->
    <extension
          point="org.eclipse.ui.keywords">
--- a/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.cw.symbian/src/com/nokia/cdt/debug/cw/symbian/SettingsData.java	Thu Mar 11 14:50:13 2010 -0600
@@ -176,7 +176,7 @@
 	static private void addSymbianSDKMapping(String epocRoot, ILaunchConfigurationWorkingCopy configuration) {
 		if (epocRoot.length() > 0 && new File(epocRoot).exists())
 			configuration.setAttribute(SymbianPlugin.Epoc_Root, epocRoot);
-}
+	}
 
 	static public void addSymbianSDKMapping(Path executable, ILaunchConfigurationWorkingCopy configuration) {
 		
--- a/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF	Thu Mar 11 14:50:13 2010 -0600
@@ -6,7 +6,8 @@
 Bundle-Activator: com.nokia.cdt.internal.debug.launch.LaunchPlugin
 Bundle-Vendor: Nokia
 Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui,
+Require-Bundle: com.nokia.cdt.debug.common,
+ org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.cdt.launch,
  org.eclipse.cdt.debug.core,
@@ -28,10 +29,12 @@
  com.nokia.cpp.utils.core,
  com.freescale.cdt.debug.cw.core.ui,
  com.nokia.carbide.remoteConnections,
- com.nokia.cpp.utils.ui
+ com.nokia.cpp.utils.ui,
+ com.nokia.carbide.cpp.edc;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.nokia.cdt.internal.debug.launch,
  com.nokia.cdt.internal.debug.launch.ui,
  com.nokia.cdt.internal.debug.launch.wizard
 Bundle-ClassPath: lib/JSiMa.jar,
  .
+
--- a/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/plugin.xml	Thu Mar 11 14:50:13 2010 -0600
@@ -7,7 +7,7 @@
 
        <launchDelegate
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
-            sourcePathComputerId="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer"
+            sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer"
             delegateDescription="Launch a classic Carbide Emulator debug session."          
             name="Classic Symbian OS Emulation"
             delegate="com.nokia.cdt.internal.debug.launch.EmulationLaunchDelegate"
@@ -24,7 +24,7 @@
             type="com.nokia.cdt.debug.launch.appTRKLaunch"
             id="com.nokia.cdt.debug.launch.appTRKLaunchDelegate"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
-            sourcePathComputerId="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer">
+            sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
       </launchDelegate>
  
       <launchDelegate
@@ -35,7 +35,7 @@
             type="com.nokia.cdt.debug.launch.systemTRKLaunch"
             id="com.nokia.cdt.debug.launch.systemTRKLaunchDelegate"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
-            sourcePathComputerId="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer">
+            sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
       </launchDelegate>
  
       <launchDelegate
@@ -46,7 +46,7 @@
             type="com.nokia.cdt.debug.launch.attachLaunch"
             id="com.nokia.cdt.debug.launch.attachLaunchDelegate"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
-            sourcePathComputerId="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer">
+            sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
       </launchDelegate>
     
       <launchDelegate
@@ -57,7 +57,7 @@
             type="com.nokia.cdt.debug.launch.t32Launch"
             id="com.nokia.cdt.debug.launch.t32LaunchDelegate"
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
-            sourcePathComputerId="com.nokia.cdt.debug.cw.symbian.CarbideSourcePathComputer">
+            sourcePathComputerId="com.nokia.cdt.debug.common.internal.source.lookup.CarbideSourcePathComputer">
       </launchDelegate>
       
    </extension>
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java	Thu Mar 11 14:50:13 2010 -0600
@@ -20,7 +20,7 @@
 import org.eclipse.ui.IFileEditorInput;
 
 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
-import com.nokia.cdt.debug.cw.symbian.ui.executables.SymbianSourceFileRemapping;
+import com.nokia.carbide.cpp.edc.executables.SymbianSourceFileRemapping;
 
 public abstract class AbstractSymbianLaunchShortcut implements ILaunchShortcut2 {
 
--- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/NokiaAbstractLaunchDelegate.java	Thu Mar 11 14:18:02 2010 -0600
+++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/NokiaAbstractLaunchDelegate.java	Thu Mar 11 14:50:13 2010 -0600
@@ -19,10 +19,8 @@
 import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -41,22 +39,16 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.jobs.IJobManager;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
 
 import com.freescale.cdt.debug.cw.core.cdi.Session;
 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
-import com.nokia.cdt.debug.cw.symbian.SymbianPlugin;
-import com.nokia.cdt.debug.cw.symbian.SymbianSourceContainer;
+import com.nokia.carbide.cpp.debug.kernelaware.OSDataManager;
+import com.nokia.cdt.debug.common.internal.source.lookup.SourceMappingUtils;
 import com.nokia.cdt.debug.cw.symbian.ui.executables.ExecutableTargeted;
-import com.nokia.carbide.cpp.debug.kernelaware.OSDataManager;
 import com.nokia.cdt.internal.debug.launch.ui.ExecutablesTab;
 
 public abstract class NokiaAbstractLaunchDelegate extends
@@ -204,7 +196,7 @@
 			ICProject project, ILaunchConfiguration config)
 			throws CoreException {
 		ILaunchConfigurationWorkingCopy workingCopy = config.getWorkingCopy();
-		addSourceMappingToLaunch(workingCopy);
+		SourceMappingUtils.addSourceMappingToLaunch(workingCopy);
 		return workingCopy.doSave();
 	}
 
@@ -343,62 +335,7 @@
 	}
 
 
-	private void addSourceMappingToDirector(AbstractSourceLookupDirector director, ILaunchConfiguration configuration) throws CoreException {
 
-		ArrayList containerList = new ArrayList(Arrays.asList(director.getSourceContainers()));
-
-		boolean hasSymbianContainer = false;
-
-		SymbianSourceContainer symbianContainer = null;
-		
-		for (Iterator iter = containerList.iterator(); iter.hasNext() && !hasSymbianContainer;) {
-			ISourceContainer container = (ISourceContainer) iter.next();
-			if (container instanceof SymbianSourceContainer)
-			{
-				hasSymbianContainer = true;
-			}
-		}
-
-		if (!hasSymbianContainer) {
-			
-			String epocRootPath = configuration.getAttribute( SymbianPlugin.Epoc_Root, (String)null );
-			if (epocRootPath != null)
-			{
-				symbianContainer = new SymbianSourceContainer(new Path(epocRootPath));
-				symbianContainer.init(director);
-				containerList.add(symbianContainer);
-			}
-		}
-		
-		director.setSourceContainers((ISourceContainer[]) containerList.toArray(new ISourceContainer[containerList.size()]));
-	}
-	
-	private void addSourceMappingToLaunch(ILaunchConfigurationWorkingCopy configuration) throws CoreException {
-		String memento = null;
-		String type = null;
-
-		memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
-		type = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String) null);
-		if (type == null) {
-			type = configuration.getType().getSourceLocatorId();
-		}
-		ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
-		ISourceLocator locator = launchManager.newSourceLocator(type);
-		if (locator instanceof AbstractSourceLookupDirector) {
-			AbstractSourceLookupDirector director = (AbstractSourceLookupDirector) locator;
-			if (memento == null) {
-				director.initializeDefaults(configuration);
-			} else {
-				director.initializeFromMemento(memento, configuration);
-			}
-
-			addSourceMappingToDirector(director, configuration);
-			
-			configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, director.getMemento());
-			configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, director.getId());
-		}
-	}
-	
 	protected String getTargetLabel(String processName) {
 		String format = "{0} (Launched {1})"; //$NON-NLS-1$
 		String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));