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 21335 Details for
Bug 91966
[EditorMgmt] resolution policy for editors needs to be revamped to accomodate content types
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]
Replacement for the above patch that changes the ordering
Bug91966-EditorRegistry-2.txt (text/plain), 5.97 KB, created by
Kim Horne
on 2005-05-18 10:49:15 EDT
(
hide
)
Description:
Replacement for the above patch that changes the ordering
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2005-05-18 10:49:15 EDT
Size:
5.97 KB
patch
obsolete
>Index: EditorRegistry.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java,v >retrieving revision 1.41 >diff -u -r1.41 EditorRegistry.java >--- EditorRegistry.java 4 Apr 2005 13:13:41 -0000 1.41 >+++ EditorRegistry.java 18 May 2005 14:48:34 -0000 >@@ -94,7 +94,11 @@ > * @return the objects related to the filename > */ > public Object[] getRelatedObjects(String fileName) { >- return getEditors(fileName); >+ IFileEditorMapping mapping = getMappingFor(fileName); >+ if (mapping == null) >+ return EMPTY; >+ >+ return mapping.getEditors(); > } > > } >@@ -483,7 +487,7 @@ > /** > * Add the system editors to the provided map. This will always add an > * editor with an id of {@link #SYSTEM_EXTERNAL_EDITOR_ID} and may also add >- * an editor with id of {@ #SYSTEM_INPLACE_EDITOR_ID} if the system >+ * an editor with id of {@link #SYSTEM_INPLACE_EDITOR_ID} if the system > * configuration supports it. > * > * @param map the map to augment >@@ -1220,19 +1224,7 @@ > * @see org.eclipse.ui.IEditorRegistry#getDefaultEditor(java.lang.String, org.eclipse.core.runtime.content.IContentType) > */ > public IEditorDescriptor getDefaultEditor(String fileName, IContentType contentType) { >- FileEditorMapping[] mapping = getMappingForFilename(fileName); >- IEditorDescriptor desc = null; >- if (contentType != null) >- desc = getEditorForContentType(fileName, contentType); >- if (desc == null && mapping[0] != null) >- desc = mapping[0].getDefaultEditor(); >- if (desc == null && mapping[1] != null) >- desc = mapping[1].getDefaultEditor(); >- >- if (WorkbenchActivityHelper.filterItem(desc)) >- return null; >- >- return desc; >+ return getEditorForContentType(fileName, contentType); > } > > /** >@@ -1361,38 +1353,79 @@ > } > > /** >- * Find objects related to the content type. >- * >- * This method is temporary and exists only to back us off of the >- * soon-to-be-removed IContentTypeManager.IRelatedRegistry API. >- * >- * @param type >- * @param fileName >- * @param registry >- * @return the related objects >- */ >- private Object[] findRelatedObjects(IContentType type, String fileName, RelatedRegistry registry) { >- List allRelated = new ArrayList(); >- // first add any objects directly related to the content type >- Object[] related = registry.getRelatedObjects(type); >- for (int i = 0; i < related.length; i++) >- allRelated.add(related[i]); >- // backward compatibility requested - add any objects related to the file name >- if (fileName != null) { >- related = registry.getRelatedObjects(fileName); >- for (int i = 0; i < related.length; i++) >- if (!allRelated.contains(related[i])) >- // we don't want to return duplicates >- allRelated.add(related[i]); >- } >- // now add any indirectly related objects, walking up the content type hierarchy >- while ((type = type.getBaseType()) != null) { >- related = registry.getRelatedObjects(type); >- for (int i = 0; i < related.length; i++) >- if (!allRelated.contains(related[i])) >- // we don't want to return duplicates >- allRelated.add(related[i]); >- } >- return allRelated.toArray(); >- } >+ * Find objects related to the content type. >+ * >+ * This method is temporary and exists only to back us off of the >+ * soon-to-be-removed IContentTypeManager.IRelatedRegistry API. >+ * >+ * @param type >+ * @param fileName >+ * @param registry >+ * @return the related objects >+ */ >+ private Object[] findRelatedObjects(IContentType type, String fileName, >+ RelatedRegistry registry) { >+ List allRelated = new ArrayList(); >+ Object[] related; >+ >+ // backward compatibility requested - add any objects related directly to the file name >+ if (fileName != null) { >+ related = registry.getRelatedObjects(fileName); >+ for (int i = 0; i < related.length; i++) { >+ // we don't want to return duplicates >+ if (!allRelated.contains(related[i])) { >+ // if it's not filtered, add it to the list >+ if (!WorkbenchActivityHelper.filterItem(related[i])) >+ allRelated.add(related[i]); >+ } >+ } >+ } >+ >+ //now add any objects related to the file extension >+ if (fileName != null) { >+ int index = fileName.lastIndexOf('.'); >+ if (index > -1) { >+ String extension = "*" + fileName.substring(index); //$NON-NLS-1$ >+ related = registry.getRelatedObjects(extension); >+ for (int i = 0; i < related.length; i++) { >+ // we don't want to return duplicates >+ if (!allRelated.contains(related[i])) { >+ // if it's not filtered, add it to the list >+ if (!WorkbenchActivityHelper.filterItem(related[i])) >+ allRelated.add(related[i]); >+ } >+ } >+ } >+ } >+ >+ if (type != null) { >+ // now add any objects directly related to the content type >+ related = registry.getRelatedObjects(type); >+ for (int i = 0; i < related.length; i++) { >+ // we don't want to return duplicates >+ if (!allRelated.contains(related[i])) { >+ // if it's not filtered, add it to the list >+ if (!WorkbenchActivityHelper.filterItem(related[i])) >+ allRelated.add(related[i]); >+ } >+ } >+ >+ } >+ >+ if (type != null) { >+ // now add any indirectly related objects, walking up the content type hierarchy >+ while ((type = type.getBaseType()) != null) { >+ related = registry.getRelatedObjects(type); >+ for (int i = 0; i < related.length; i++) { >+ // we don't want to return duplicates >+ if (!allRelated.contains(related[i])) { >+ // if it's not filtered, add it to the list >+ if (!WorkbenchActivityHelper.filterItem(related[i])) >+ allRelated.add(related[i]); >+ } >+ } >+ } >+ } >+ return allRelated.toArray(); >+ } > }
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 91966
:
21328
| 21335