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 21328 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]
Work-in-progress patch
Bug91966-EditorRegistry.patch (text/plain), 5.25 KB, created by
Kim Horne
on 2005-05-18 09:18:46 EDT
(
hide
)
Description:
Work-in-progress patch
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2005-05-18 09:18:46 EDT
Size:
5.25 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 13:15:50 -0000 >@@ -1220,17 +1220,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; >+ IEditorDescriptor desc = getEditorForContentType(fileName, contentType);; > > return desc; > } >@@ -1361,38 +1351,78 @@ > } > > /** >- * 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]); >+ } >+ } >+ } >+ >+ 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]); >+ } >+ } >+ >+ } >+ //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 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