mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Binary parsers were reported wrong by ICDescriptor.
This commit is contained in:
parent
d4a03b962f
commit
6d456f9e7e
3 changed files with 58 additions and 8 deletions
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.index.IIndexFileLocation;
|
||||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -718,4 +719,37 @@ public class CoreModelUtil {
|
||||||
|
|
||||||
return (ICConfigurationDescription[]) result.toArray(new ICConfigurationDescription[result.size()]);
|
return (ICConfigurationDescription[]) result.toArray(new ICConfigurationDescription[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns binary parser IDs for configurations
|
||||||
|
* @param cfgs - array of configurations where we need search
|
||||||
|
* @return - array of binary parser ids (Strings)
|
||||||
|
*/
|
||||||
|
public static String[] getBinaryParserIds(ICConfigurationDescription[] cfgs) {
|
||||||
|
if (cfgs == null || cfgs.length == 0)
|
||||||
|
return null;
|
||||||
|
ArrayList pids = new ArrayList();
|
||||||
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
|
ICTargetPlatformSetting tps = cfgs[i].getTargetPlatformSetting();
|
||||||
|
String[] ids = tps.getBinaryParserIds();
|
||||||
|
for (int j = 0; j < ids.length; j++) {
|
||||||
|
if (!pids.contains(ids[j]))
|
||||||
|
pids.add(ids[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (String[])pids.toArray(new String[pids.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets binary parser ID list to given configurations
|
||||||
|
* @param cfgs - array of configurations where we need search
|
||||||
|
* @param pids - array of binary parser ids (Strings)
|
||||||
|
*/
|
||||||
|
public static void setBinaryParserIds(ICConfigurationDescription[] cfgs, String[] pids) {
|
||||||
|
if (cfgs == null || cfgs.length == 0)
|
||||||
|
return;
|
||||||
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
|
cfgs[i].getTargetPlatformSetting().setBinaryParserIds(pids);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,26 @@ public class CConfigBasedDescriptor implements ICDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICExtensionReference[] get(String extensionPoint) {
|
public ICExtensionReference[] get(String extensionPoint) {
|
||||||
ICConfigExtensionReference cfgRefs[] = fCfgDes.get(extensionPoint);
|
ICConfigExtensionReference[] rs = fCfgDes.get(extensionPoint);
|
||||||
|
ArrayList refs = new ArrayList();
|
||||||
|
refs.addAll(Arrays.asList(rs));
|
||||||
|
|
||||||
|
ICConfigurationDescription[] cfgs =
|
||||||
|
fCfgDes.getProjectDescription().getConfigurations();
|
||||||
|
|
||||||
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
|
if (!fCfgDes.equals(cfgs[i])) {
|
||||||
|
rs = cfgs[i].get(extensionPoint);
|
||||||
|
for (int j=0; j<rs.length; j++) {
|
||||||
|
if (!refs.contains(rs[j]))
|
||||||
|
refs.add(rs[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ICConfigExtensionReference cfgRefs[] =
|
||||||
|
(ICConfigExtensionReference[])refs.toArray(
|
||||||
|
new ICConfigExtensionReference[refs.size()]);
|
||||||
|
|
||||||
if(cfgRefs.length == 0){
|
if(cfgRefs.length == 0){
|
||||||
return new ICExtensionReference[0];
|
return new ICExtensionReference[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -71,8 +72,6 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
protected CheckboxTableViewer tv;
|
protected CheckboxTableViewer tv;
|
||||||
protected Composite parserGroup;
|
protected Composite parserGroup;
|
||||||
|
|
||||||
private ICTargetPlatformSetting tps;
|
|
||||||
|
|
||||||
protected class BinaryParserConfiguration {
|
protected class BinaryParserConfiguration {
|
||||||
IExtension fExtension;
|
IExtension fExtension;
|
||||||
public BinaryParserConfiguration(IExtension extension) { fExtension = extension; }
|
public BinaryParserConfiguration(IExtension extension) { fExtension = extension; }
|
||||||
|
@ -168,8 +167,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateData(ICResourceDescription cfgd) {
|
public void updateData(ICResourceDescription cfgd) {
|
||||||
tps = cfgd.getConfiguration().getTargetPlatformSetting();
|
String[] ids = CoreModelUtil.getBinaryParserIds(page.getCfgsEditable());
|
||||||
String[] ids = tps.getBinaryParserIds();
|
|
||||||
Object[] data = new Object[configMap.size()];
|
Object[] data = new Object[configMap.size()];
|
||||||
HashMap clone = new HashMap(configMap);
|
HashMap clone = new HashMap(configMap);
|
||||||
// add checked elements
|
// add checked elements
|
||||||
|
@ -295,7 +293,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
tps.setBinaryParserIds(null);
|
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), null);
|
||||||
informPages(false);
|
informPages(false);
|
||||||
updateData(getResDesc());
|
updateData(getResDesc());
|
||||||
}
|
}
|
||||||
|
@ -304,7 +302,6 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
IProgressMonitor mon = new NullProgressMonitor();
|
IProgressMonitor mon = new NullProgressMonitor();
|
||||||
Iterator it = fParserPageMap.values().iterator();
|
Iterator it = fParserPageMap.values().iterator();
|
||||||
|
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
try {
|
try {
|
||||||
ICOptionPage dynamicPage = ((BinaryParserPageConfiguration)it.next()).getPage();
|
ICOptionPage dynamicPage = ((BinaryParserPageConfiguration)it.next()).getPage();
|
||||||
|
@ -358,7 +355,7 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
||||||
ids[i] = ((BinaryParserConfiguration)objs[i]).getID();
|
ids[i] = ((BinaryParserConfiguration)objs[i]).getID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tps != null) tps.setBinaryParserIds(ids);
|
CoreModelUtil.setBinaryParserIds(page.getCfgsEditable(), ids);
|
||||||
}
|
}
|
||||||
// This page can be displayed for project only
|
// This page can be displayed for project only
|
||||||
public boolean canBeVisible() {
|
public boolean canBeVisible() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue