Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-04-06 05:38:04 +0000
committerAlain Magloire2004-04-06 05:38:04 +0000
commitf7ff3c2496e2f3b716249b1f5ad3c2078cfb9111 (patch)
tree669ab113c8c60f19527a56aa5d93a83ab46f21f3 /core/org.eclipse.cdt.ui
parentceefe291d86e01a60e10344430fb147293ddbcb3 (diff)
downloadorg.eclipse.cdt-f7ff3c2496e2f3b716249b1f5ad3c2078cfb9111.tar.gz
org.eclipse.cdt-f7ff3c2496e2f3b716249b1f5ad3c2078cfb9111.tar.xz
org.eclipse.cdt-f7ff3c2496e2f3b716249b1f5ad3c2078cfb9111.zip
bug fix and support for external headers in the CEditor.
Diffstat (limited to 'core/org.eclipse.cdt.ui')
-rw-r--r--core/org.eclipse.cdt.ui/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java21
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java15
3 files changed, 41 insertions, 2 deletions
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;
+ }
}

Back to the top