mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 12:25:35 +02:00
Move addSourcePaths() to the source Manager.
This commit is contained in:
parent
947c512932
commit
119012a5f9
4 changed files with 51 additions and 12 deletions
|
@ -11,6 +11,7 @@ import java.util.HashMap;
|
|||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
|
@ -99,7 +100,8 @@ public class CDebugModel
|
|||
// Temporary
|
||||
try
|
||||
{
|
||||
cdiTarget.getSession().addSearchPaths( new String[] { project.getLocation().toOSString() } );
|
||||
ICDISourceManager mgr = cdiTarget.getSession().getSourceManager();
|
||||
mgr.addSourcePaths( new String[] { project.getLocation().toOSString() });
|
||||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
|
|
|
@ -110,9 +110,4 @@ public interface ICDISession {
|
|||
*/
|
||||
void terminate() throws CDIException;
|
||||
|
||||
/**
|
||||
* Add directories to the begining of the search path
|
||||
* for source files.
|
||||
*/
|
||||
void addSearchPaths(String[] dirs) throws CDIException;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,18 @@ import java.io.File;
|
|||
*/
|
||||
public interface ICDISourceManager extends ICDISessionObject
|
||||
{
|
||||
/**
|
||||
* Set the source search paths for the debu session.
|
||||
* @param String
|
||||
*/
|
||||
void addSourcePaths(String[] srcPaths) throws CDIException;
|
||||
|
||||
/**
|
||||
* Return the array of source paths
|
||||
* @return String array of search paths.
|
||||
*/
|
||||
String[] getSourcePaths() throws CDIException;
|
||||
|
||||
/**
|
||||
* Returns an array of directories. Returns the empty array
|
||||
* if the source path is empty.
|
||||
|
|
|
@ -6,22 +6,27 @@
|
|||
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||
import org.eclipse.cdt.debug.mi.core.MISession;
|
||||
import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIEnvironmentDirectory;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
|
||||
import sun.security.krb5.internal.crypto.e;
|
||||
|
||||
/**
|
||||
* @author alain
|
||||
*
|
||||
* To change this generated comment edit the template variable "typecomment":
|
||||
* Window>Preferences>Java>Templates.
|
||||
* To enable and disable the creation of type comments go to
|
||||
* Window>Preferences>Java>Code Generation.
|
||||
*/
|
||||
public class SourceManager extends SessionObject implements ICDISourceManager {
|
||||
|
||||
List sourcePaths;
|
||||
|
||||
public SourceManager(CSession session) {
|
||||
super(session);
|
||||
sourcePaths = new ArrayList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,4 +48,29 @@ public class SourceManager extends SessionObject implements ICDISourceManager {
|
|||
public void set(File[] directories) throws CDIException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#addSourcePaths(String[])
|
||||
*/
|
||||
public void addSourcePaths(String[] dirs) throws CDIException {
|
||||
MISession mi = getCSession().getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
MIEnvironmentDirectory dir = factory.createMIEnvironmentDirectory(dirs);
|
||||
try {
|
||||
mi.postCommand(dir);
|
||||
MIInfo info = dir.getMIInfo();
|
||||
} catch (MIException e) {
|
||||
throw new CDIException(e.getMessage());
|
||||
}
|
||||
for (int i = 0; i < dirs.length; i++) {
|
||||
sourcePaths.add(dirs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getSourcePaths()
|
||||
*/
|
||||
public String[] getSourcePaths() {
|
||||
return (String[])sourcePaths.toArray(new String[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue