Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 99116 Details for
Bug 230865
[EditorMgmt] File > Open File editor should also use content describer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
patch.txt (text/plain), 3.58 KB, created by
Dani Megert
on 2008-05-07 12:51:03 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2008-05-07 12:51:03 EDT
Size:
3.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/ide/IDE.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/ide/IDE.java,v >retrieving revision 1.60 >diff -u -r1.60 IDE.java >--- src/org/eclipse/ui/ide/IDE.java 24 Oct 2007 09:47:40 -0000 1.60 >+++ src/org/eclipse/ui/ide/IDE.java 7 May 2008 16:49:55 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ui.ide; > >+import java.io.IOException; >+import java.io.InputStream; > import java.net.URI; > import java.util.ArrayList; > import java.util.Collections; >@@ -820,6 +822,60 @@ > } > > /** >+ * Returns an editor id appropriate for opening the given file >+ * store. >+ * <p> >+ * The editor descriptor is determined using a multi-step process. This >+ * method will attempt to resolve the editor based on content-type bindings >+ * as well as traditional name/extension bindings. >+ * </p> >+ * <ol> >+ * <li>The workbench editor registry is consulted to determine if an editor >+ * extension has been registered for the file type. If so, an instance of >+ * the editor extension is opened on the file. See >+ * <code>IEditorRegistry.getDefaultEditor(String)</code>.</li> >+ * <li>The operating system is consulted to determine if an in-place >+ * component editor is available (e.g. OLE editor on Win32 platforms).</li> >+ * <li>The operating system is consulted to determine if an external editor >+ * is available.</li> >+ * </ol> >+ * </p> >+ * >+ * @param fileStore >+ * the file store >+ * @return the id of an editor, appropriate for opening the file >+ * @throws PartInitException >+ * if no editor can be found >+ */ >+ private static String getEditorId(IFileStore fileStore) throws PartInitException { >+ String name = fileStore.fetchInfo().getName(); >+ if (name == null) { >+ throw new IllegalArgumentException(); >+ } >+ >+ IContentType contentType= null; >+ try { >+ InputStream is = null; >+ try { >+ is = fileStore.openInputStream(EFS.NONE, null); >+ contentType= Platform.getContentTypeManager().findContentTypeFor(is, name); >+ } finally { >+ if (is != null) { >+ is.close(); >+ } >+ } >+ } catch (CoreException ex) { >+ // continue without content type >+ } catch (IOException ex) { >+ // continue without content type >+ } >+ >+ IEditorRegistry editorReg= PlatformUI.getWorkbench().getEditorRegistry(); >+ >+ return getEditorDescriptor(name, editorReg, editorReg.getDefaultEditor(name, contentType)).getId(); >+ } >+ >+ /** > * Returns an editor descriptor appropriate for opening a file resource with > * the given name. > * <p> >@@ -1090,26 +1146,6 @@ > return page.openEditor(input, editorId); > } > >- /** >- * Get the id of the editor associated with the given <code>IFileStore</code>. >- * >- * @param fileStore >- * the <code>IFileStore</code> representing the file for which the editor id is desired >- * @return the id of the appropriate editor >- * @since 3.3 >- */ >- private static String getEditorId(IFileStore fileStore) { >- IEditorDescriptor descriptor; >- try { >- descriptor = IDE.getEditorDescriptor(fileStore.getName()); >- } catch (PartInitException e) { >- return null; >- } >- if (descriptor != null) >- return descriptor.getId(); >- return null; >- } >- > /** > * Save all dirty editors in the workbench whose editor input is a child > * resource of one of the <code>IResource</code>'s provided. Opens a
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 230865
:
99059
|
99064
|
99076
| 99116