Added support to search extension by extension point id + extension id. Enhance search of "class" attribute.
This commit is contained in:
parent
836c789066
commit
9a3b1f3a4c
|
|
@ -59,10 +59,16 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
private boolean accept(IConfigurationElement element) {
|
private boolean accept(IConfigurationElement element) {
|
||||||
for (String name : filters.keySet()) {
|
for (String name : filters.keySet()) {
|
||||||
String expected = filters.get(name);
|
String expected = filters.get(name);
|
||||||
|
if (name.equals("Extension.ID")) {
|
||||||
|
String id = element.getDeclaringExtension().getUniqueIdentifier();
|
||||||
|
if (!expected.equals(id))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
String actual = element.getAttribute(name);
|
String actual = element.getAttribute(name);
|
||||||
if (!expected.equals(actual))
|
if (!expected.equals(actual))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,6 +76,17 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
public T next() {
|
public T next() {
|
||||||
iterateUntilAccepted();
|
iterateUntilAccepted();
|
||||||
IConfigurationElement e = elements[index++];
|
IConfigurationElement e = elements[index++];
|
||||||
|
if (e.getAttribute("class") == null) {
|
||||||
|
IConfigurationElement[] childs = e.getChildren();
|
||||||
|
if (childs != null && childs.length > 0) {
|
||||||
|
for(IConfigurationElement child : childs) {
|
||||||
|
if (child.getAttribute("class") != null) {
|
||||||
|
e = child;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return (T) e.createExecutableExtension("class");
|
return (T) e.createExecutableExtension("class");
|
||||||
} catch (CoreException ex) {
|
} catch (CoreException ex) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue