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 18539 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.tests.runtime
org.eclipse.core.tests.runtime_bug86862.diff (text/plain), 4.61 KB, created by
Rafael Chaves
on 2005-03-08 11:07:06 EST
(
hide
)
Description:
patch for org.eclipse.core.tests.runtime
Filename:
MIME Type:
Creator:
Rafael Chaves
Created:
2005-03-08 11:07:06 EST
Size:
4.61 KB
patch
obsolete
>Index: src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java,v >retrieving revision 1.56 >diff -u -r1.56 IContentTypeManagerTest.java >--- src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java 4 Mar 2005 22:18:54 -0000 1.56 >+++ src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java 8 Mar 2005 15:59:14 -0000 >@@ -12,11 +12,13 @@ > > import java.io.*; > import java.util.*; >-import junit.framework.*; >+import junit.framework.AssertionFailedError; >+import junit.framework.Test; > import org.eclipse.core.internal.content.*; > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.content.*; > import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent; >+import org.eclipse.core.runtime.content.IContentTypeMatcher.IRelatedRegistry; > import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.core.tests.harness.BundleTestingHelper; > import org.eclipse.core.tests.harness.TestRegistryChangeListener; >@@ -71,8 +73,8 @@ > private final static String XML_UTF_8 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><org.eclipse.core.runtime.tests.root/>"; > > public static Test suite() { >- //return new IContentTypeManagerTest("testListParsing"); >- return new TestSuite(IContentTypeManagerTest.class); >+ return new IContentTypeManagerTest("testRelatedRegistry"); >+ //return new TestSuite(IContentTypeManagerTest.class); > } > > public IContentTypeManagerTest(String name) { >@@ -1099,6 +1101,71 @@ > assertNotNull("9.2", subFooBar); > assertTrue("9.3", contains(fooBarTypes, fooBar)); > assertTrue("9.4", contains(fooBarTypes, subFooBar)); >+ } >+ >+ public void testRelatedRegistry() { >+ IContentTypeManager manager = Platform.getContentTypeManager(); >+ IContentType text = manager.getContentType(Platform.PI_RUNTIME + ".text"); >+ IContentType xml = manager.getContentType(Platform.PI_RUNTIME + ".xml"); >+ String textEditor = "Text editor"; >+ String xmlEditor = "XML editor"; >+ String legacyTextEditor = "Legacy Text editor"; >+ String legacyXmlEditor = "Legacy XML editor"; >+ final Object[][] contentTypeAssociations = { {text, textEditor}, {xml, xmlEditor}}; >+ final Object[][] legacyAssociations = { {"legacy.txt", legacyTextEditor}, {"legacy.xml", legacyXmlEditor}}; >+ >+ IContentTypeMatcher matcher = manager.getMatcher(new LocalSelectionPolicy()); >+ >+ IRelatedRegistry registry = new IRelatedRegistry() { >+ public Object[] getRelatedObjects(IContentType type) { >+ List result = new ArrayList(); >+ for (int i = 0; i < contentTypeAssociations.length; i++) >+ if (contentTypeAssociations[i][0].equals(type)) >+ result.add(contentTypeAssociations[i][1]); >+ return result.toArray(); >+ } >+ >+ public Object[] getRelatedObjects(String fileName) { >+ List result = new ArrayList(); >+ for (int i = 0; i < contentTypeAssociations.length; i++) >+ if (legacyAssociations[i][0].equals(fileName)) >+ result.add(legacyAssociations[i][1]); >+ return result.toArray(); >+ } >+ }; >+ >+ Object[] editors; >+ editors = matcher.findRelatedObjects(xml, null, registry); >+ assertEquals("1.0", 2, editors.length); >+ assertEquals("1.1", editors[0], xmlEditor); >+ assertEquals("1.1", editors[1], textEditor); >+ >+ editors = matcher.findRelatedObjects(text, null, registry); >+ assertEquals("2.0", 1, editors.length); >+ assertEquals("2.1", editors[0], textEditor); >+ >+ editors = matcher.findRelatedObjects(xml, "legacy.txt", registry); >+ assertEquals("3.0", 3, editors.length); >+ assertEquals("3.1", editors[0], xmlEditor); >+ assertEquals("3.2", editors[1], legacyTextEditor); >+ assertEquals("3.3", editors[2], textEditor); >+ >+ editors = matcher.findRelatedObjects(text, "legacy.xml", registry); >+ assertEquals("4.0", 2, editors.length); >+ assertEquals("4.1", editors[0], textEditor); >+ assertEquals("4.2", editors[1], legacyXmlEditor); >+ >+ editors = matcher.findRelatedObjects(xml, "legacy.xml", registry); >+ assertEquals("5.0", 3, editors.length); >+ assertEquals("5.1", editors[0], xmlEditor); >+ assertEquals("5.2", editors[1], legacyXmlEditor); >+ assertEquals("5.3", editors[2], textEditor); >+ >+ editors = matcher.findRelatedObjects(text, "legacy.txt", registry); >+ assertEquals("6.0", 2, editors.length); >+ assertEquals("6.1", editors[0], textEditor); >+ assertEquals("6.2", editors[1], legacyTextEditor); >+ > } > > public void testRootElementAndDTDDescriber() throws IOException {
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