1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-02 21:23:37 +02:00

properly set binary parsers

This commit is contained in:
David Inglis 2004-04-03 20:40:36 +00:00
parent 6e5fa262c6
commit 7d84a3a410

View file

@ -1,15 +1,16 @@
/********************************************************************** /*******************************************************************************
* Copyright (c) 2002,2003 QNX Software Systems and others. * Copyright (c) 2002,2003 QNX Software Systems and others. All rights reserved.
* All rights reserved. This program and the accompanying materials * This program and the accompanying materials are made available under the
* are made available under the terms of the Common Public License v1.0 * terms of the Common Public License v1.0 which accompanies this distribution,
* which accompanies this distribution, and is available at * and is available at http://www.eclipse.org/legal/cpl-v10.html
* http://www.eclipse.org/legal/cpl-v10.html
* *
* Contributors: * Contributors: QNX Software Systems - Initial API and implementation
* QNX Software Systems - Initial API and implementation ******************************************************************************/
***********************************************************************/
package org.eclipse.cdt.make.internal.core; package org.eclipse.cdt.make.internal.core;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor; import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICOwner; import org.eclipse.cdt.core.ICOwner;
@ -20,27 +21,43 @@ import org.eclipse.core.runtime.Preferences;
public class MakeProject implements ICOwner { public class MakeProject implements ICOwner {
public void configure(ICDescriptor cproject) throws CoreException { public void configure(ICDescriptor cDescriptor) throws CoreException {
cproject.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); cDescriptor.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
cproject.remove(CCorePlugin.BUILDER_MODEL_ID); cDescriptor.remove(CCorePlugin.BUILDER_MODEL_ID);
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY); cDescriptor.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
Preferences makePrefs = MakeCorePlugin.getDefault().getPluginPreferences(); updateBinaryParsers(cDescriptor);
String id = makePrefs.getString(CCorePlugin.PREF_BINARY_PARSER); }
if (id != null && id.length() != 0) {
cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, id); public void update(ICDescriptor cDescriptor, String extensionID) throws CoreException {
if (extensionID.equals(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID)) {
cDescriptor.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY);
}
if (extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) {
updateBinaryParsers(cDescriptor);
} }
} }
public void update(ICDescriptor cproject, String extensionID) throws CoreException { private void updateBinaryParsers(ICDescriptor cDescriptor) throws CoreException {
if (extensionID.equals(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID)) { cDescriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
cproject.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, MakeScannerProvider.INTERFACE_IDENTITY); Preferences makePrefs = MakeCorePlugin.getDefault().getPluginPreferences();
} String id = makePrefs.getString(CCorePlugin.PREF_BINARY_PARSER);
if (extensionID.equals(CCorePlugin.BINARY_PARSER_UNIQ_ID)) { if (id != null && id.length() != 0) {
Preferences makePrefs = MakeCorePlugin.getDefault().getPluginPreferences(); String[] ids = parseStringToArray(id);
String id = makePrefs.getString(CCorePlugin.PREF_BINARY_PARSER); for (int i = 0; i < ids.length; i++) {
if (id != null && id.length() != 0) { cDescriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, ids[i]);
cproject.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, id);
} }
} }
} }
}
private String[] parseStringToArray(String syms) {
if (syms != null && syms.length() > 0) {
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
ArrayList list = new ArrayList(tok.countTokens());
while (tok.hasMoreElements()) {
list.add(tok.nextToken());
}
return (String[]) list.toArray(new String[list.size()]);
}
return new String[0];
}
}