diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 86649354da3..9b2ebfd8f8f 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -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 Changing the sequence when we shutdown, this will diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java index fc079c6413e..a2df5a40893 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java @@ -333,7 +333,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { } private Object[] filterNonCResources(Object[] objects, ICProject cproject) { - ICElement[] binaries = getExecutables(cproject); + ICElement[] binaries = getBinaries(cproject); ICElement[] archives = getArchives(cproject); ISourceRoot[] roots = null; try { @@ -431,6 +431,25 @@ public class BaseCElementContentProvider implements ITreeContentProvider { 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) { IArchiveContainer container = cproject.getArchiveContainer(); return getArchives(container); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java index e3ef2baf445..43ed9711f55 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java @@ -155,8 +155,11 @@ public class EditorUtility { if (element instanceof ITranslationUnit) { ITranslationUnit unit= (ITranslationUnit) element; IResource resource= unit.getResource(); - if (resource instanceof IFile) + if (resource instanceof IFile) { return new FileEditorInput((IFile) resource); + } else { + return new ExternalEditorInput(getStorage(unit)); + } } if (element instanceof IBinary) { @@ -305,4 +308,14 @@ public class EditorUtility { } 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; + } }