mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Changes was doen int the Core Model:
ICModel, ICProject, ICContainer, ICTranslationUnit IArchive and IBinary We now adjust the code
This commit is contained in:
parent
cac6e16c0f
commit
edd1a22fb3
2 changed files with 27 additions and 21 deletions
|
@ -13,10 +13,11 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICFile;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.CDebugModel;
|
||||
import org.eclipse.cdt.debug.core.ICBreakpointManager;
|
||||
|
@ -89,6 +90,7 @@ import org.eclipse.core.runtime.IAdaptable;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
|
@ -2252,7 +2254,7 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
|
||||
{
|
||||
ICFile cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
|
||||
ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
|
||||
if ( cFile instanceof IBinary )
|
||||
{
|
||||
((IBinary)cFile).isLittleEndian();
|
||||
|
@ -2279,16 +2281,16 @@ public class CDebugTarget extends CDebugElement
|
|||
ArrayList list = new ArrayList();
|
||||
if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
|
||||
{
|
||||
ICFile cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
|
||||
if ( cFile instanceof IBinary )
|
||||
ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
|
||||
if ( cFile instanceof IParent )
|
||||
{
|
||||
list.addAll( getCFileGlobals( cFile ) );
|
||||
list.addAll( getCFileGlobals( (IParent)cFile ) );
|
||||
}
|
||||
}
|
||||
return (IGlobalVariable[])list.toArray( new IGlobalVariable[list.size()] );
|
||||
}
|
||||
|
||||
private List getCFileGlobals( ICFile file )
|
||||
private List getCFileGlobals( IParent file )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
ICElement[] elements = file.getChildren();
|
||||
|
@ -2298,9 +2300,9 @@ public class CDebugTarget extends CDebugElement
|
|||
{
|
||||
list.add( createGlobalVariable( (org.eclipse.cdt.core.model.IVariable)elements[i] ) );
|
||||
}
|
||||
else if ( elements[i] instanceof org.eclipse.cdt.core.model.ICFile )
|
||||
else if ( elements[i] instanceof org.eclipse.cdt.core.model.IParent )
|
||||
{
|
||||
list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.ICFile)elements[i] ) );
|
||||
list.addAll( getCFileGlobals( (org.eclipse.cdt.core.model.IParent)elements[i] ) );
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
@ -2317,14 +2319,18 @@ public class CDebugTarget extends CDebugElement
|
|||
|
||||
public IPath getPath()
|
||||
{
|
||||
IPath path = null;
|
||||
if ( var.getParent() != null && var.getParent() instanceof ICFile )
|
||||
IPath path = new Path("");
|
||||
try
|
||||
{
|
||||
if ( !(var.getParent() instanceof IBinary) && ((ICFile)var.getParent()).getFile() != null )
|
||||
IResource res = var.getUnderlyingResource();
|
||||
if ( res != null )
|
||||
{
|
||||
path = ((ICFile)var.getParent()).getFile().getLocation();
|
||||
path = res.getLocation();
|
||||
}
|
||||
}
|
||||
catch (CModelException e)
|
||||
{
|
||||
}
|
||||
return path;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.eclipse.cdt.core.CProjectNature;
|
|||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.IArchiveContainer;
|
||||
import org.eclipse.cdt.core.model.IBinaryContainer;
|
||||
import org.eclipse.cdt.core.model.ICFolder;
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
|
@ -93,7 +93,7 @@ public class CProjectHelper {
|
|||
/**
|
||||
* Adds a source container to a ICProject.
|
||||
*/
|
||||
public static ICFolder addSourceContainer(ICProject cproject, String containerName) throws CoreException {
|
||||
public static ICContainer addSourceContainer(ICProject cproject, String containerName) throws CoreException {
|
||||
IProject project= cproject.getProject();
|
||||
IContainer container= null;
|
||||
if (containerName == null || containerName.length() == 0) {
|
||||
|
@ -106,15 +106,15 @@ public class CProjectHelper {
|
|||
container= folder;
|
||||
}
|
||||
|
||||
return (ICFolder)container;
|
||||
return (ICContainer)container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a source container to a ICProject and imports all files contained
|
||||
* in the given Zip file.
|
||||
*/
|
||||
public static ICFolder addSourceContainerWithImport(ICProject cproject, String containerName, ZipFile zipFile) throws InvocationTargetException, CoreException {
|
||||
ICFolder root= addSourceContainer(cproject, containerName);
|
||||
public static ICContainer addSourceContainerWithImport(ICProject cproject, String containerName, ZipFile zipFile) throws InvocationTargetException, CoreException {
|
||||
ICContainer root= addSourceContainer(cproject, containerName);
|
||||
importFilesFromZip(zipFile, root.getPath(), null);
|
||||
return root;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue