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.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.builder.ICBuilder;
|
import org.eclipse.cdt.core.builder.ICBuilder;
|
||||||
import org.eclipse.cdt.core.index.IndexModel;
|
import org.eclipse.cdt.core.index.IndexModel;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
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.core.resources.IConsole;
|
||||||
import org.eclipse.cdt.internal.core.CDescriptorManager;
|
import org.eclipse.cdt.internal.core.CDescriptorManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -152,11 +154,49 @@ public class CCorePlugin extends Plugin {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConsole getConsole() throws CoreException {
|
public IConsole getConsole() throws CoreException {
|
||||||
return getConsole(null);
|
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() {
|
public CoreModel getCoreModel() {
|
||||||
return CoreModel.getDefault();
|
return CoreModel.getDefault();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue