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 18538 Details for
Bug 86862
[content type] need API for related custom objects lookup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for org.eclipse.core.runtime
org.eclipse.core.runtime_bug86862.diff (text/plain), 5.14 KB, created by
Rafael Chaves
on 2005-03-08 11:06:50 EST
(
hide
)
Description:
patch for org.eclipse.core.runtime
Filename:
MIME Type:
Creator:
Rafael Chaves
Created:
2005-03-08 11:06:50 EST
Size:
5.14 KB
patch
obsolete
>Index: src/org/eclipse/core/internal/content/ContentTypeMatcher.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/content/ContentTypeMatcher.java,v >retrieving revision 1.1 >diff -u -r1.1 ContentTypeMatcher.java >--- src/org/eclipse/core/internal/content/ContentTypeMatcher.java 4 Mar 2005 22:18:54 -0000 1.1 >+++ src/org/eclipse/core/internal/content/ContentTypeMatcher.java 8 Mar 2005 16:04:53 -0000 >@@ -11,6 +11,8 @@ > package org.eclipse.core.internal.content; > > import java.io.*; >+import java.util.ArrayList; >+import java.util.List; > import org.eclipse.core.runtime.QualifiedName; > import org.eclipse.core.runtime.content.*; > >@@ -54,6 +56,31 @@ > */ > public IContentType[] findContentTypesFor(String fileName) { > return getCatalog().findContentTypesFor(fileName, policy); >+ } >+ >+ public Object[] findRelatedObjects(IContentType type, String fileName, IRelatedRegistry 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(); > } > > private ContentTypeCatalog getCatalog() { >Index: src/org/eclipse/core/runtime/content/IContentTypeMatcher.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/runtime/content/IContentTypeMatcher.java,v >retrieving revision 1.1 >diff -u -r1.1 IContentTypeMatcher.java >--- src/org/eclipse/core/runtime/content/IContentTypeMatcher.java 4 Mar 2005 22:18:54 -0000 1.1 >+++ src/org/eclipse/core/runtime/content/IContentTypeMatcher.java 8 Mar 2005 16:04:53 -0000 >@@ -23,6 +23,44 @@ > * @since 3.1 > */ > public interface IContentTypeMatcher { >+ >+ /** >+ * A client-provided registry containing objects that are related to content types. Implementations >+ * of this interface collaborate with the content type infrastructure in order to support lookup >+ * of content type related objects. >+ * <p> >+ * Clients may implement this interface. >+ * </p> >+ * >+ * @see IContentTypeMatcher#findRelatedObjects(IContentType, String, IRelatedRegistry) >+ */ >+ interface IRelatedRegistry { >+ /** >+ * Returns all objects in this client-provided registry that are directly related to the given >+ * content type. >+ * >+ * @param type a content type >+ * @return an array containing all objects directly related to the given content type >+ */ >+ Object[] getRelatedObjects(IContentType type); >+ >+ /** >+ * Returns all objects in this client-provided registry that are directly related to the given >+ * file name. >+ * <p> >+ * This method is optional. It only has to be implemented if this registry supports >+ * file name based association in addition to content type based association. >+ * Otherwise, it can throw <code>UnsupportedOperationException</code>. >+ * </p> >+ * >+ * @param fileName a file name >+ * @return an array containing all objects directly related to the given file name >+ * @throws UnsupportedOperationException if this registry does not support file >+ * name based association >+ */ >+ Object[] getRelatedObjects(String fileName); >+ } >+ > /** > * Returns the preferred content type for the given contents and file name. > * <p> >@@ -90,6 +128,24 @@ > * @return all content types associated to the given file spec > */ > public IContentType[] findContentTypesFor(String fileName); >+ >+ /** >+ * Returns all objects in the given content type-related registry that are >+ * related to the content type and file name specified. This method will walk >+ * the content type hierarchy tree up to a root content type, collecting all related >+ * objects from the given registry. >+ * <p> >+ * The file name is optional, and has to be omitted if the given registry >+ * does not support file name based associations. >+ * </p> >+ * >+ * @param type a content type >+ * @param fileName the name of the file, or <code>null</code> >+ * @param registry a related registry >+ * @return all objects in the related registry that are associated to the >+ * content type >+ */ >+ public Object[] findRelatedObjects(IContentType type, String fileName, IRelatedRegistry registry); > > /** > * Tries to obtain a description for the given contents and file name.
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 86862
: 18538 |
18539