We've seen how a plug-in can use named attributes and values to store important data with a launch configuration. Since the interpretation of a plug-in's attributes are not known by the platform, an extension point is provided that allows you to supply a comparator for a specific attribute. This comparator is used to determine whether attributes of the specified name are equal. In many cases, the simple string compare provided by java.lang.Object.equals(Object) is suitable for comparing attributes. This technique will be used if no comparator has been provided. However, some attribute values may require special handling, such as stripping white space values from text before comparing for equality.
Comparators are contributed using the org.eclipse.debug.core.launchConfigurationComparators extension point.
The Java tools supply launch configuration comparators for comparing program source paths and class paths.
<extension point = "org.eclipse.debug.core.launchConfigurationComparators"> <launchConfigurationComparator id = "org.eclipse.jdt.launching.classpathComparator" class = "org.eclipse.jdt.internal.launching.RuntimeClasspathEntryListComparator" attribute = "org.eclipse.jdt.launching.CLASSPATH"/> <launchConfigurationComparator id = "org.eclipse.jdt.launching.sourcepathComparator" class = "org.eclipse.jdt.internal.launching.RuntimeClasspathEntryListComparator" attribute = "org.eclipse.jdt.launching.SOURCE_PATH"/> </extension>
Comparators must implement the interface java.util.Comparator.