Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 198544 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/tests/runtime/content/IContentTypeManagerTest.java (+9 lines)
Lines 540-545 Link Here
540
		IContentType inappropriate = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1");
540
		IContentType inappropriate = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1");
541
		IContentType appropriate = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
541
		IContentType appropriate = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml");
542
		IContentType appropriateSpecific1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension");
542
		IContentType appropriateSpecific1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension");
543
		IContentType appropriateSpecific1LowPriority = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension-low-priority");
543
		IContentType appropriateSpecific2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-specific-name");
544
		IContentType appropriateSpecific2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-specific-name");
544
545
545
		// if only inappropriate is provided, none will be selected
546
		// if only inappropriate is provided, none will be selected
Lines 563-568 Link Here
563
		assertTrue("4.1", appropriateSpecific1.equals(selected[0]) || appropriateSpecific1.equals(selected[1]));
564
		assertTrue("4.1", appropriateSpecific1.equals(selected[0]) || appropriateSpecific1.equals(selected[1]));
564
		assertTrue("4.2", appropriateSpecific2.equals(selected[0]) || appropriateSpecific2.equals(selected[1]));
565
		assertTrue("4.2", appropriateSpecific2.equals(selected[0]) || appropriateSpecific2.equals(selected[1]));
565
		assertTrue("4.3", appropriate.equals(selected[2]));
566
		assertTrue("4.3", appropriate.equals(selected[2]));
567
		
568
		// if appropriate and a more specific appropriate type (but with low priority) are provided, the specific type will be selected
569
		finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1LowPriority}), null);
570
		assertEquals("5.0", appropriateSpecific1LowPriority, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
571
		
572
		// if appropriate and two specific appropriate types (but one with lower priority) are provided, the specific type with higher priority will be selected
573
		finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1, appropriateSpecific1LowPriority}), null);
574
		assertEquals("5.1", appropriateSpecific1, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null));
566
	}
575
	}
567
576
568
	public void testDefaultProperties() throws IOException /* never actually thrown */{
577
	public void testDefaultProperties() throws IOException /* never actually thrown */{
(-)plugin.xml (+7 lines)
Lines 238-243 Link Here
238
      <content-type
238
      <content-type
239
            name="Void content type"
239
            name="Void content type"
240
            id="void"/>      
240
            id="void"/>      
241
      <content-type
242
            base-type="org.eclipse.core.runtime.xml"
243
            file-extensions="xml2"
244
            id="xml-based-different-extension-low-priority"
245
            name="XML Based with Different Extension and Low Priority"
246
            priority="low">
247
      </content-type>
241
   </extension>
248
   </extension>
242
   <extension
249
   <extension
243
         point="org.eclipse.core.runtime.adapters">
250
         point="org.eclipse.core.runtime.adapters">

Return to bug 198544