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 (-9 / +13 lines)
Lines 138-155 Link Here
138
            name="Sub Foo Bar"
138
            name="Sub Foo Bar"
139
            id="subFooBar"/>
139
            id="subFooBar"/>
140
      <content-type
140
      <content-type
141
            base-type="org.eclipse.core.runtime.xml"
142
            file-extensions="xml2"
141
            file-extensions="xml2"
143
            id="xml-based-different-extension"
142
            base-type="org.eclipse.core.runtime.xml"
144
            name="XML Based with Different Extension"
143
            name="XML Based with Different Extension"
145
            priority="high">
144
            id="xml-based-different-extension">
146
      </content-type>
145
      </content-type>
147
      <content-type
146
      <content-type
148
            base-type="org.eclipse.core.runtime.xml"
149
            file-names="xml-based.xml"
147
            file-names="xml-based.xml"
150
            id="xml-based-specific-name"
148
            base-type="org.eclipse.core.runtime.xml"
151
            name="XML Based with Specific Name"
149
            name="XML Based with Specific Name"
152
            priority="high"/>
150
            id="xml-based-specific-name"/>
153
      <content-type
151
      <content-type
154
            file-extensions="samplebin1"
152
            file-extensions="samplebin1"
155
            name="Sample Binary 1"
153
            name="Sample Binary 1"
Lines 224-233 Link Here
224
      <!-- content types for content describer tests -->
222
      <!-- content types for content describer tests -->
225
      <content-type
223
      <content-type
226
            base-type="org.eclipse.core.runtime.xml"
224
            base-type="org.eclipse.core.runtime.xml"
227
            describer="org.eclipse.core.runtime.content.XMLRootElementContentDescriber:org.eclipse.core.runtime.tests.root-element"
228
            id="root-element"
229
            name="Root Element"
225
            name="Root Element"
230
            priority="high"/>
226
            id="root-element"
227
            describer="org.eclipse.core.runtime.content.XMLRootElementContentDescriber:org.eclipse.core.runtime.tests.root-element"/>
231
      <content-type
228
      <content-type
232
            base-type="org.eclipse.core.runtime.xml"
229
            base-type="org.eclipse.core.runtime.xml"
233
            name="DTD"
230
            name="DTD"
Lines 241-246 Link Here
241
      <content-type
238
      <content-type
242
            name="Void content type"
239
            name="Void content type"
243
            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>
244
   </extension>
248
   </extension>
245
   <extension
249
   <extension
246
         point="org.eclipse.core.runtime.adapters">
250
         point="org.eclipse.core.runtime.adapters">

Return to bug 198544