Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-02-05 09:45:38 -0500
committerAnton Leherbauer2008-02-05 09:45:38 -0500
commit224215d6fe13dc1f66ae524fba62ba0d57d6485a (patch)
tree0086362752b2f47fe4c460e18f9382ec86ab2a25
parentbc335d2fb816b55de3473be4bc1a816a4fafcb97 (diff)
downloadorg.eclipse.cdt-224215d6fe13dc1f66ae524fba62ba0d57d6485a.tar.gz
org.eclipse.cdt-224215d6fe13dc1f66ae524fba62ba0d57d6485a.tar.xz
org.eclipse.cdt-224215d6fe13dc1f66ae524fba62ba0d57d6485a.zip
Fix for 217727: Binary files do not open in the binary editor
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/EditorUtility.java14
1 files changed, 13 insertions, 1 deletions
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 247fbc1e37..524b4ae560 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
@@ -493,10 +493,22 @@ public class EditorUtility {
}
contentType= CCorePlugin.getContentType(project, input.getName());
}
+ // handle binary files without content-type (e.g. executables without extension)
+ if (contentType == null && cElement != null) {
+ final int elementType= cElement.getElementType();
+ if (elementType == ICElement.C_ARCHIVE || elementType == ICElement.C_BINARY) {
+ contentType= Platform.getContentTypeManager().getContentType(CCorePlugin.CONTENT_TYPE_BINARYFILE);
+ }
+ }
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
IEditorDescriptor desc= registry.getDefaultEditor(input.getName(), contentType);
if (desc != null) {
- return desc.getId();
+ String editorID= desc.getId();
+ if (input instanceof IFileEditorInput) {
+ IFile file= ((IFileEditorInput)input).getFile();
+ IDE.setDefaultEditor(file, editorID);
+ }
+ return editorID;
}
return DEFAULT_TEXT_EDITOR_ID;

Back to the top