mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 11:25:35 +02:00
New methods getBinaryParser()
This commit is contained in:
parent
0a52804874
commit
56d92428d9
1 changed files with 41 additions and 1 deletions
|
@ -6,12 +6,14 @@ package org.eclipse.cdt.core;
|
|||
*/
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.core.builder.ICBuilder;
|
||||
import org.eclipse.cdt.core.index.IndexModel;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IBinaryParser;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.internal.core.CDescriptorManager;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -157,6 +159,44 @@ public class CCorePlugin extends Plugin {
|
|||
return getConsole(null);
|
||||
}
|
||||
|
||||
public String[] getBinaryParserFormats() {
|
||||
ArrayList list = new ArrayList();
|
||||
IExtensionPoint extensionPoint = getDescriptor().getExtensionPoint("BinaryParser");
|
||||
if (extensionPoint != null) {
|
||||
IExtension[] extensions = extensionPoint.getExtensions();
|
||||
for(int i = 0; i < extensions.length; i++){
|
||||
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
|
||||
for( int j = 0; j < configElements.length; j++ ) {
|
||||
String attr = configElements[j].getAttribute("format");
|
||||
if (attr != null) {
|
||||
list.add(attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (String[])list.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public IBinaryParser getBinaryParser(String format) {
|
||||
try {
|
||||
IExtensionPoint extensionPoint = getDescriptor().getExtensionPoint("BinaryParser");
|
||||
if (extensionPoint != null) {
|
||||
IExtension[] extensions = extensionPoint.getExtensions();
|
||||
for(int i = 0; i < extensions.length; i++){
|
||||
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
|
||||
for( int j = 0; j < configElements.length; j++ ) {
|
||||
String attr = configElements[j].getAttribute("format");
|
||||
if (attr != null && attr.equalsIgnoreCase(format)) {
|
||||
return (IBinaryParser)configElements[j].createExecutableExtension("class");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CoreModel getCoreModel() {
|
||||
return CoreModel.getDefault();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue