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 264653 | Differences between
and this patch

Collapse All | Expand All

(-)schema/editorconfiguration.exsd (+18 lines)
Lines 69-74 Link Here
69
               </appinfo>
69
               </appinfo>
70
            </annotation>
70
            </annotation>
71
         </attribute>
71
         </attribute>
72
         <attribute name="priority" type="decimal" default="0">
73
            <annotation>
74
               <documentation>
75
                  Decimal value defining the priority of the given extension implementation.
76
                  Extension with the highest priority value will be used. Default priority value is 0.
77
                  No special order among several extensions with the same priority value should be expected.
78
               </documentation>
79
            </annotation>
80
         </attribute>
72
      </complexType>
81
      </complexType>
73
   </element>
82
   </element>
74
83
Lines 216-221 Link Here
216
               </appinfo>
225
               </appinfo>
217
            </annotation>
226
            </annotation>
218
         </attribute>
227
         </attribute>
228
         <attribute name="priority" type="decimal" default="0">
229
            <annotation>
230
               <documentation>
231
                  Decimal value defining the priority of the given extension implementation.
232
                  Extension with the highest priority value will be used. Default priority value is 0.
233
                  No special order among several extensions with the same priority value should be expected.
234
               </documentation>
235
            </annotation>
236
         </attribute>
219
      </complexType>
237
      </complexType>
220
   </element>
238
   </element>
221
239
(-)src/org/eclipse/wst/sse/ui/internal/ExtendedConfigurationBuilder.java (-1 / +47 lines)
Lines 14-19 Link Here
14
14
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.HashMap;
16
import java.util.HashMap;
17
import java.util.Iterator;
17
import java.util.List;
18
import java.util.List;
18
import java.util.Map;
19
import java.util.Map;
19
20
Lines 77-82 Link Here
77
	private static final String EP_EXTENDEDCONFIGURATION = "editorConfiguration"; //$NON-NLS-1$
78
	private static final String EP_EXTENDEDCONFIGURATION = "editorConfiguration"; //$NON-NLS-1$
78
	private static ExtendedConfigurationBuilder instance = null;
79
	private static ExtendedConfigurationBuilder instance = null;
79
	public static final String VALUE = "value"; //$NON-NLS-1$
80
	public static final String VALUE = "value"; //$NON-NLS-1$
81
	public static final String PRIORITY = "priority"; //$NON-NLS-1$
80
82
81
	/**
83
	/**
82
	 * Creates an extension. If the extension plugin has not been loaded a
84
	 * Creates an extension. If the extension plugin has not been loaded a
Lines 185-191 Link Here
185
		List configurations = getConfigurations(extensionType, targetID);
187
		List configurations = getConfigurations(extensionType, targetID);
186
		if (configurations.isEmpty())
188
		if (configurations.isEmpty())
187
			return null;
189
			return null;
188
		return configurations.get(0);
190
		
191
		// select configuration with the highest 'priority' value
192
		Iterator i = configurations.iterator();
193
		Object start = i.next();
194
		
195
		if (start instanceof IConfigurationElement) {
196
			IConfigurationElement rt = (IConfigurationElement) start;
197
			float maxPriority = readPriority(rt);
198
199
			for (;i.hasNext();) {
200
				Object next = i.next();
201
				if (next instanceof IConfigurationElement) {
202
					IConfigurationElement configuration = (IConfigurationElement) i.next();
203
					float priority = readPriority(configuration);
204
					if (priority > maxPriority) {
205
						maxPriority = priority;
206
						rt = configuration;
207
					}
208
				}
209
			}
210
			return rt;
211
		} else {
212
			return start;
213
		}
214
	}
215
	
216
	/**
217
	 * Reads the <code>priority</code> decimal value for configuration.
218
	 * If undefined or invalid, the default value is returned.
219
	 * Default value is <code>.0f</code>.
220
	 * @param configuration configuration element possibly containing the
221
	 * <code>priority</code> attribute
222
	 * @return value defined by <code>priority</code> attribute or
223
	 * <code>.0f</code>.
224
	 */
225
	private float readPriority(IConfigurationElement configuration) {
226
		String priorityVal = configuration.getAttribute(PRIORITY);
227
		if (priorityVal != null) {
228
			try {
229
				return Float.parseFloat(priorityVal);
230
			} catch (NumberFormatException e) {
231
				return .0f;
232
			}
233
		}
234
		return .0f;
189
	}
235
	}
190
236
191
	/**
237
	/**

Return to bug 264653