mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug fix and support for external headers in the CEditor.
This commit is contained in:
parent
ceefe291d8
commit
f7ff3c2496
3 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-04-06 Alain Magloire
|
||||||
|
|
||||||
|
Bug fixes and support for external headers.
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/ui/BaseCElmentContentProvider.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/util/EditorUtility.java
|
||||||
|
|
||||||
2004-04-05 Alain Magloire
|
2004-04-05 Alain Magloire
|
||||||
|
|
||||||
Changing the sequence when we shutdown, this will
|
Changing the sequence when we shutdown, this will
|
||||||
|
|
|
@ -333,7 +333,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[] filterNonCResources(Object[] objects, ICProject cproject) {
|
private Object[] filterNonCResources(Object[] objects, ICProject cproject) {
|
||||||
ICElement[] binaries = getExecutables(cproject);
|
ICElement[] binaries = getBinaries(cproject);
|
||||||
ICElement[] archives = getArchives(cproject);
|
ICElement[] archives = getArchives(cproject);
|
||||||
ISourceRoot[] roots = null;
|
ISourceRoot[] roots = null;
|
||||||
try {
|
try {
|
||||||
|
@ -431,6 +431,25 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
return bins;
|
return bins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IBinary[] getBinaries(ICProject cproject) {
|
||||||
|
IBinaryContainer container = cproject.getBinaryContainer();
|
||||||
|
return getBinaries(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IBinary[] getBinaries(IBinaryContainer container) {
|
||||||
|
ICElement[] celements = container.getChildren();
|
||||||
|
ArrayList list = new ArrayList(celements.length);
|
||||||
|
for (int i = 0; i < celements.length; i++) {
|
||||||
|
if (celements[i] instanceof IBinary) {
|
||||||
|
IBinary bin = (IBinary)celements[i];
|
||||||
|
list.add(bin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IBinary[] bins = new IBinary[list.size()];
|
||||||
|
list.toArray(bins);
|
||||||
|
return bins;
|
||||||
|
}
|
||||||
|
|
||||||
protected IArchive[] getArchives(ICProject cproject) {
|
protected IArchive[] getArchives(ICProject cproject) {
|
||||||
IArchiveContainer container = cproject.getArchiveContainer();
|
IArchiveContainer container = cproject.getArchiveContainer();
|
||||||
return getArchives(container);
|
return getArchives(container);
|
||||||
|
|
|
@ -155,8 +155,11 @@ public class EditorUtility {
|
||||||
if (element instanceof ITranslationUnit) {
|
if (element instanceof ITranslationUnit) {
|
||||||
ITranslationUnit unit= (ITranslationUnit) element;
|
ITranslationUnit unit= (ITranslationUnit) element;
|
||||||
IResource resource= unit.getResource();
|
IResource resource= unit.getResource();
|
||||||
if (resource instanceof IFile)
|
if (resource instanceof IFile) {
|
||||||
return new FileEditorInput((IFile) resource);
|
return new FileEditorInput((IFile) resource);
|
||||||
|
} else {
|
||||||
|
return new ExternalEditorInput(getStorage(unit));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element instanceof IBinary) {
|
if (element instanceof IBinary) {
|
||||||
|
@ -305,4 +308,14 @@ public class EditorUtility {
|
||||||
}
|
}
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IStorage getStorage(ITranslationUnit tu) {
|
||||||
|
IStorage store = null;
|
||||||
|
try {
|
||||||
|
store = new FileStorage (new ByteArrayInputStream(tu.getBuffer().getContents().getBytes()), tu.getPath());
|
||||||
|
} catch (CModelException e) {
|
||||||
|
// nothing;
|
||||||
|
}
|
||||||
|
return store;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue