mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
support multiple binary parsers
This commit is contained in:
parent
215a710dc7
commit
f594128873
8 changed files with 438 additions and 234 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2004-04-02 David Inglis
|
||||||
|
|
||||||
|
Support selection of multiple binary parsers.
|
||||||
|
|
||||||
|
* plugin.xml
|
||||||
|
* src/org/eclipse/cdt/internal/ui/CUIMessages.properties
|
||||||
|
* src/org/eclipse/cdt/ui/dialogs/AbstractBinaryParserPage.java
|
||||||
|
* src/org/eclipse/cdt/ui/dialogs/AbstractCOptionPage.java
|
||||||
|
* src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
|
||||||
|
* src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java
|
||||||
|
* src/org/eclipse/cdt/ui/dialogs/GNUElfBinaryParserPage.java
|
||||||
|
|
||||||
2004-04-02 Alain Magloire
|
2004-04-02 Alain Magloire
|
||||||
|
|
||||||
Add new filter to hide/show non C Projects.
|
Add new filter to hide/show non C Projects.
|
||||||
|
|
|
@ -556,9 +556,6 @@
|
||||||
class="org.eclipse.cdt.ui.dialogs.GNUElfBinaryParserPage"
|
class="org.eclipse.cdt.ui.dialogs.GNUElfBinaryParserPage"
|
||||||
id="ElfBinaryParserPage">
|
id="ElfBinaryParserPage">
|
||||||
</parserPage>
|
</parserPage>
|
||||||
</extension>
|
|
||||||
<extension
|
|
||||||
point="org.eclipse.cdt.ui.BinaryParserPage">
|
|
||||||
<parserPage
|
<parserPage
|
||||||
parserID="org.eclipse.cdt.core.Cygwin_PE"
|
parserID="org.eclipse.cdt.core.Cygwin_PE"
|
||||||
class="org.eclipse.cdt.ui.dialogs.CygwinPEBinaryParserPage"
|
class="org.eclipse.cdt.ui.dialogs.CygwinPEBinaryParserPage"
|
||||||
|
|
|
@ -25,6 +25,8 @@ TabFolderOptionBlock.error=Error
|
||||||
TabFolderOptionBlock.error.settingOptions=Error setting options
|
TabFolderOptionBlock.error.settingOptions=Error setting options
|
||||||
|
|
||||||
BinaryParserBlock.binaryParser=Binary Parser:
|
BinaryParserBlock.binaryParser=Binary Parser:
|
||||||
|
BinaryParserBlock.button.up=Up
|
||||||
|
BinaryParserBlock.button.down=Down
|
||||||
BinaryParserBlock.binaryParserOptions=Binary Parser Options
|
BinaryParserBlock.binaryParserOptions=Binary Parser Options
|
||||||
BinaryParserBlock.settingBinaryParser=Setting Binary Parser...
|
BinaryParserBlock.settingBinaryParser=Setting Binary Parser...
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
package org.eclipse.cdt.ui.dialogs;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
@ -22,7 +23,6 @@ import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
|
|
||||||
public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
||||||
|
|
||||||
|
@ -31,17 +31,48 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
||||||
|
|
||||||
// Composite parent provided by the block.
|
// Composite parent provided by the block.
|
||||||
protected Composite fCompositeParent;
|
protected Composite fCompositeParent;
|
||||||
|
private ICOptionPage fCurrentPage;
|
||||||
|
|
||||||
public AbstractBinaryParserPage() {
|
protected class BinaryParserPageConfiguration {
|
||||||
super();
|
|
||||||
|
ICOptionPage page;
|
||||||
|
IConfigurationElement fElement;
|
||||||
|
|
||||||
|
public BinaryParserPageConfiguration(IConfigurationElement element) {
|
||||||
|
fElement = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICOptionPage getPage() throws CoreException {
|
||||||
|
if (page == null) {
|
||||||
|
page = (ICOptionPage) fElement.createExecutableExtension("class"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractBinaryParserPage(String title) {
|
protected AbstractBinaryParserPage(String title) {
|
||||||
super(title);
|
super(title);
|
||||||
|
initializeParserPageMap();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractBinaryParserPage(String title, ImageDescriptor image) {
|
protected AbstractBinaryParserPage(String title, ImageDescriptor image) {
|
||||||
super(title, image);
|
super(title, image);
|
||||||
|
initializeParserPageMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeParserPageMap() {
|
||||||
|
fParserPageMap = new HashMap(5);
|
||||||
|
|
||||||
|
IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor();
|
||||||
|
IExtensionPoint extensionPoint = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$
|
||||||
|
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
|
||||||
|
for (int i = 0; i < infos.length; i++) {
|
||||||
|
if (infos[i].getName().equals("parserPage")) { //$NON-NLS-1$
|
||||||
|
String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$
|
||||||
|
fParserPageMap.put(id, new BinaryParserPageConfiguration(infos[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Composite getCompositeParent() {
|
protected Composite getCompositeParent() {
|
||||||
|
@ -50,110 +81,81 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
||||||
|
|
||||||
protected void setCompositeParent(Composite parent) {
|
protected void setCompositeParent(Composite parent) {
|
||||||
fCompositeParent = parent;
|
fCompositeParent = parent;
|
||||||
|
fCompositeParent.setLayout(new TabFolderLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setVisible(boolean visible) {
|
||||||
* Save the current Binary parser page.
|
super.setVisible(visible);
|
||||||
*/
|
handleBinaryParserChanged();
|
||||||
protected void setCurrentBinaryParserPage(ICOptionPage current) {
|
|
||||||
fCurrentBinaryParserPage = current;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current Binary parser page.
|
|
||||||
*/
|
|
||||||
protected ICOptionPage getCurrentBinaryParserPage() {
|
|
||||||
return fCurrentBinaryParserPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that the user changed the selection of the Binary Parser.
|
* Notification that the user changed the selection of the Binary Parser.
|
||||||
*/
|
*/
|
||||||
protected void handleBinaryParserChanged() {
|
protected void handleBinaryParserChanged() {
|
||||||
loadDynamicBinaryParserArea();
|
if (getCompositeParent() == null) {
|
||||||
}
|
return;
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the contributed piece of UI that was registered for the Binary parser id.
|
|
||||||
*/
|
|
||||||
protected void loadDynamicBinaryParserArea() {
|
|
||||||
// Dispose of any current child widgets in the tab holder area
|
|
||||||
Control[] children = getCompositeParent().getChildren();
|
|
||||||
for (int i = 0; i < children.length; i++) {
|
|
||||||
children[i].dispose();
|
|
||||||
}
|
}
|
||||||
|
String[] enabled = getBinaryParserIDs();
|
||||||
// Retrieve the dynamic UI for the current parser
|
ICOptionPage page;
|
||||||
String parserID = getCurrentBinaryParserID();
|
for (int i = 0; i < enabled.length; i++) { // create all enabled pages
|
||||||
ICOptionPage page = getBinaryParserPage(parserID);
|
page = getBinaryParserPage(enabled[i]);
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
Composite parent = getCompositeParent();
|
if (page.getControl() == null) {
|
||||||
page.setContainer(getContainer());
|
Composite parent = getCompositeParent();
|
||||||
page.createControl(parent);
|
page.setContainer(getContainer());
|
||||||
page.getControl().setVisible(true);
|
page.createControl(parent);
|
||||||
parent.layout(true);
|
parent.layout(true);
|
||||||
}
|
} else {
|
||||||
setCurrentBinaryParserPage(page);
|
page.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContainer(ICOptionContainer container) {
|
|
||||||
super.setContainer(container);
|
|
||||||
initializeParserPageMap();
|
|
||||||
ICOptionPage page = getCurrentBinaryParserPage();
|
|
||||||
if (page != null)
|
|
||||||
page.setContainer(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICOptionPage getBinaryParserPage(String parserID) {
|
|
||||||
if (fParserPageMap == null) {
|
|
||||||
initializeParserPageMap();
|
|
||||||
}
|
|
||||||
IConfigurationElement configElement = (IConfigurationElement) fParserPageMap.get(parserID);
|
|
||||||
ICOptionPage page = null;
|
|
||||||
if (configElement != null) {
|
|
||||||
try {
|
|
||||||
page = (ICOptionPage) configElement.createExecutableExtension("class"); //$NON-NLS-1$
|
|
||||||
} catch (CoreException ce) {
|
|
||||||
//ce.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return page;
|
// Retrieve the dynamic UI for the current parser
|
||||||
|
String parserID = getCurrentBinaryParserID();
|
||||||
|
page = getBinaryParserPage(parserID);
|
||||||
|
if (page != null) {
|
||||||
|
page.setVisible(true);
|
||||||
|
}
|
||||||
|
setCurrentPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeParserPageMap() {
|
protected ICOptionPage getCurrentPage() {
|
||||||
fParserPageMap = new HashMap(5);
|
return fCurrentPage;
|
||||||
|
}
|
||||||
|
|
||||||
IPluginDescriptor descriptor = CUIPlugin.getDefault().getDescriptor();
|
protected void setCurrentPage(ICOptionPage page) {
|
||||||
IExtensionPoint extensionPoint = descriptor.getExtensionPoint("BinaryParserPage"); //$NON-NLS-1$
|
fCurrentPage = page;
|
||||||
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
|
}
|
||||||
for (int i = 0; i < infos.length; i++) {
|
|
||||||
String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$
|
protected ICOptionPage getBinaryParserPage(String parserID) {
|
||||||
fParserPageMap.put(id, infos[i]);
|
BinaryParserPageConfiguration configElement = (BinaryParserPageConfiguration) fParserPageMap.get(parserID);
|
||||||
|
if (configElement != null) {
|
||||||
|
try {
|
||||||
|
return configElement.getPage();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected String getCurrentBinaryParserID();
|
abstract protected String getCurrentBinaryParserID();
|
||||||
|
|
||||||
|
abstract protected String[] getBinaryParserIDs();
|
||||||
|
|
||||||
abstract public void createControl(Composite parent);
|
abstract public void createControl(Composite parent);
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
|
||||||
*/
|
*/
|
||||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
abstract public void performApply(IProgressMonitor monitor) throws CoreException;
|
||||||
ICOptionPage page = getCurrentBinaryParserPage();
|
|
||||||
if (page != null) {
|
|
||||||
page.performApply(monitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||||
*/
|
*/
|
||||||
public void performDefaults() {
|
abstract public void performDefaults();
|
||||||
ICOptionPage page = getCurrentBinaryParserPage();
|
|
||||||
if (page != null) {
|
|
||||||
page.performDefaults();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,15 +22,15 @@ public abstract class AbstractCOptionPage extends DialogPage implements ICOption
|
||||||
private ICOptionContainer fContainer;
|
private ICOptionContainer fContainer;
|
||||||
|
|
||||||
|
|
||||||
public AbstractCOptionPage() {
|
protected AbstractCOptionPage() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractCOptionPage(String title) {
|
protected AbstractCOptionPage(String title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractCOptionPage(String title, ImageDescriptor image) {
|
protected AbstractCOptionPage(String title, ImageDescriptor image) {
|
||||||
super(title, image);
|
super(title, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,13 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.ui.dialogs;
|
package org.eclipse.cdt.ui.dialogs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
@ -19,6 +24,13 @@ import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||||
import org.eclipse.cdt.core.ICExtensionReference;
|
import org.eclipse.cdt.core.ICExtensionReference;
|
||||||
import org.eclipse.cdt.internal.ui.CUIMessages;
|
import org.eclipse.cdt.internal.ui.CUIMessages;
|
||||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||||
|
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -28,81 +40,142 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Combo;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
|
||||||
public class BinaryParserBlock extends AbstractBinaryParserPage {
|
public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
|
|
||||||
private static final String PREFIX = "BinaryParserBlock"; //$NON-NLS-1$
|
private static final String PREFIX = "BinaryParserBlock"; //$NON-NLS-1$
|
||||||
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$
|
||||||
private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$
|
private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$
|
||||||
|
|
||||||
protected Combo comboBox;
|
protected CheckedListDialogField binaryList;
|
||||||
HashMap idMap = new HashMap();
|
Map configMap;
|
||||||
String initial;
|
List initialSelected;
|
||||||
Preferences fPrefs;
|
|
||||||
|
|
||||||
public BinaryParserBlock(Preferences prefs) {
|
protected class BinaryParserConfiguration {
|
||||||
|
|
||||||
|
IExtension fExtension;
|
||||||
|
public BinaryParserConfiguration(IExtension extension) {
|
||||||
|
fExtension = extension;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return fExtension.getUniqueIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return fExtension.getLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return fExtension.getUniqueIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof BinaryParserConfiguration) {
|
||||||
|
return this.getID().equals(((BinaryParserConfiguration) obj).getID());
|
||||||
|
}
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class BinaryParserLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
|
public String getText(Object element) {
|
||||||
|
return ((BinaryParserConfiguration) element).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BinaryParserBlock() {
|
||||||
super(CUIPlugin.getResourceString(LABEL));
|
super(CUIPlugin.getResourceString(LABEL));
|
||||||
setDescription(CUIPlugin.getResourceString(DESC));
|
setDescription(CUIPlugin.getResourceString(DESC));
|
||||||
fPrefs = prefs;
|
String[] buttonLabels = new String[]{
|
||||||
|
/* 0 */CUIMessages.getString("BinaryParserBlock.button.up"), //$NON-NLS-1$
|
||||||
|
/* 1 */CUIMessages.getString("BinaryParserBlock.button.down")}; //$NON-NLS-1$
|
||||||
|
|
||||||
|
IListAdapter listAdapter = new IListAdapter() {
|
||||||
|
|
||||||
|
public void customButtonPressed(ListDialogField field, int index) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(ListDialogField field) {
|
||||||
|
handleBinaryParserChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doubleClicked(ListDialogField field) {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
binaryList = new CheckedListDialogField(listAdapter, buttonLabels, new BinaryParserLabelProvider()) {
|
||||||
|
|
||||||
|
protected int getListStyle() {
|
||||||
|
int style = super.getListStyle();
|
||||||
|
return style & ~SWT.MULTI;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
binaryList.setDialogFieldListener(new IDialogFieldListener() {
|
||||||
|
|
||||||
|
public void dialogFieldChanged(DialogField field) {
|
||||||
|
if (getContainer() != null) {
|
||||||
|
getContainer().updateContainer();
|
||||||
|
handleBinaryParserChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
binaryList.setLabelText(CUIMessages.getString("BinaryParserBlock.binaryParser")); //$NON-NLS-1$
|
||||||
|
binaryList.setUpButtonIndex(0);
|
||||||
|
binaryList.setDownButtonIndex(1);
|
||||||
|
initializeParserList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeParserList() {
|
||||||
|
IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.BINARY_PARSER_SIMPLE_ID);
|
||||||
|
if (point != null) {
|
||||||
|
IExtension[] exts = point.getExtensions();
|
||||||
|
configMap = new HashMap(exts.length);
|
||||||
|
for (int i = 0; i < exts.length; i++) {
|
||||||
|
configMap.put(exts[i].getUniqueIdentifier(), new BinaryParserConfiguration(exts[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Composite control = ControlFactory.createComposite(parent, 2);
|
PixelConverter converter = new PixelConverter(parent);
|
||||||
((GridLayout) control.getLayout()).makeColumnsEqualWidth = false;
|
|
||||||
((GridLayout) control.getLayout()).marginWidth = 5;
|
Composite composite = ControlFactory.createComposite(parent, 1);
|
||||||
setControl(control);
|
((GridData) (composite.getLayoutData())).horizontalAlignment = GridData.FILL_HORIZONTAL;
|
||||||
|
setControl(composite);
|
||||||
|
|
||||||
WorkbenchHelp.setHelp(getControl(), ICHelpContextIds.BINARY_PARSER_PAGE);
|
WorkbenchHelp.setHelp(getControl(), ICHelpContextIds.BINARY_PARSER_PAGE);
|
||||||
|
|
||||||
ControlFactory.createEmptySpace(control, 2);
|
Composite listComposite = ControlFactory.createComposite(composite, 1);
|
||||||
|
LayoutUtil.doDefaultLayout(listComposite, new DialogField[]{binaryList}, true);
|
||||||
|
LayoutUtil.setHorizontalGrabbing(binaryList.getListControl(null));
|
||||||
|
|
||||||
Label label = ControlFactory.createLabel(control, CUIMessages.getString("BinaryParserBlock.binaryParser")); //$NON-NLS-1$
|
int buttonBarWidth = converter.convertWidthInCharsToPixels(15);
|
||||||
label.setLayoutData(new GridData());
|
binaryList.setButtonsMinWidth(buttonBarWidth);
|
||||||
comboBox = new Combo(control, SWT.DROP_DOWN | SWT.READ_ONLY);
|
|
||||||
GridData gd = new GridData(GridData.GRAB_HORIZONTAL);
|
|
||||||
gd.grabExcessHorizontalSpace = true;
|
|
||||||
comboBox.setLayoutData(gd);
|
|
||||||
comboBox.addSelectionListener(new SelectionAdapter() {
|
|
||||||
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
getContainer().updateContainer();
|
|
||||||
handleBinaryParserChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Iterator items = idMap.keySet().iterator();
|
|
||||||
while (items.hasNext()) {
|
|
||||||
comboBox.add((String) items.next());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (initial != null) {
|
|
||||||
comboBox.setText(initial);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the Parser UI contribution.
|
// Add the Parser UI contribution.
|
||||||
Group parserGroup = new Group(control, SWT.SHADOW_ETCHED_IN);
|
Group parserGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
|
||||||
parserGroup.setText(CUIMessages.getString("BinaryParserBlock.binaryParserOptions")); //$NON-NLS-1$
|
parserGroup.setText(CUIMessages.getString("BinaryParserBlock.binaryParserOptions")); //$NON-NLS-1$
|
||||||
GridLayout tabHolderLayout = new GridLayout();
|
|
||||||
tabHolderLayout.marginHeight = 0;
|
GridData gd = new GridData();
|
||||||
tabHolderLayout.marginWidth = 0;
|
gd.heightHint = converter.convertHorizontalDLUsToPixels(150);
|
||||||
tabHolderLayout.numColumns = 1;
|
gd.horizontalAlignment = GridData.FILL;
|
||||||
parserGroup.setLayout(tabHolderLayout);
|
gd.grabExcessHorizontalSpace = true;
|
||||||
gd = new GridData(GridData.FILL_BOTH);
|
gd.grabExcessVerticalSpace = true;
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
parserGroup.setLayoutData(gd);
|
parserGroup.setLayoutData(gd);
|
||||||
// Must set the composite parent to super class.
|
// Must set the composite parent to super class.
|
||||||
setCompositeParent(parserGroup);
|
setCompositeParent(parserGroup);
|
||||||
// fire a change event, to quick start.
|
// fire a change event, to quick start.
|
||||||
handleBinaryParserChanged();
|
handleBinaryParserChanged();
|
||||||
|
parent.layout(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,42 +184,56 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
monitor.beginTask(CUIMessages.getString("BinaryParserBlock.settingBinaryParser"), 2); //$NON-NLS-1$
|
monitor.beginTask(CUIMessages.getString("BinaryParserBlock.settingBinaryParser"), 2); //$NON-NLS-1$
|
||||||
final String selected = comboBox.getText();
|
List parsers = binaryList.getElements();
|
||||||
|
final List selected = new ArrayList(); // must do this to get proper order.
|
||||||
|
for (int i = 0; i < parsers.size(); i++) {
|
||||||
|
if (binaryList.isChecked(parsers.get(i))) {
|
||||||
|
selected.add(parsers.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
if (getContainer().getProject() != null) {
|
if (getContainer().getProject() != null) {
|
||||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||||
|
|
||||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||||
if (initial == null || !selected.equals(initial)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String) idMap.get(selected));
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
|
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID,
|
||||||
|
((BinaryParserConfiguration) selected.get(i)).getID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
// Give a chance to the contributions to save.
|
// Give a chance to the contributions to save.
|
||||||
// We have to do it last to make sure the parser id
|
// We have to do it last to make sure the parser id
|
||||||
// is save
|
// is save
|
||||||
// in .cdtproject
|
// in .cdtproject
|
||||||
ICOptionPage page = getCurrentBinaryParserPage();
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
if (page != null) {
|
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
if (page != null && page.getControl() != null) {
|
||||||
|
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op, monitor);
|
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op, monitor);
|
||||||
} else {
|
} else {
|
||||||
if (initial == null || !selected.equals(initial)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
fPrefs.setValue(CCorePlugin.PREF_BINARY_PARSER, (String) idMap.get(selected));
|
Preferences store = getContainer().getPreferences();
|
||||||
|
if (store != null) {
|
||||||
|
store.setValue(CCorePlugin.PREF_BINARY_PARSER, arrayToString(selected.toArray()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
// Give a chance to the contributions to save.
|
// Give a chance to the contributions to save.
|
||||||
// We have to do it last to make sure the parser id is save
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
// in .cdtproject
|
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||||
ICOptionPage page = getCurrentBinaryParserPage();
|
if (page != null && page.getControl() != null) {
|
||||||
if (page != null) {
|
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initial = selected;
|
initialSelected = selected;
|
||||||
}
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
@ -154,67 +241,132 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
public void setContainer(ICOptionContainer container) {
|
public void setContainer(ICOptionContainer container) {
|
||||||
super.setContainer(container);
|
super.setContainer(container);
|
||||||
|
|
||||||
IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.BINARY_PARSER_SIMPLE_ID);
|
List elements = new ArrayList();
|
||||||
if (point != null) {
|
|
||||||
IExtension[] exts = point.getExtensions();
|
|
||||||
for (int i = 0; i < exts.length; i++) {
|
|
||||||
idMap.put(exts[i].getLabel(), exts[i].getUniqueIdentifier());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getContainer().getProject() != null) {
|
if (getContainer().getProject() != null) {
|
||||||
try {
|
try {
|
||||||
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(getContainer().getProject());
|
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(getContainer().getProject());
|
||||||
ICExtensionReference[] ref = desc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
ICExtensionReference[] ref = desc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
if (ref.length > 0) {
|
initialSelected = new ArrayList(ref.length);
|
||||||
IExtension ext = point.getExtension(ref[0].getID());
|
for (int i = 0; i < ref.length; i++) {
|
||||||
if (ext != null) {
|
if (configMap.get(ref[i].getID()) != null) {
|
||||||
initial = ext.getLabel();
|
initialSelected.add(configMap.get(ref[i].getID()));
|
||||||
|
elements.add(configMap.get(ref[i].getID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
Iterator iter = configMap.entrySet().iterator();
|
||||||
if (initial == null) {
|
while (iter.hasNext()) {
|
||||||
String id = fPrefs.getString(CCorePlugin.PREF_BINARY_PARSER);
|
Entry entry = (Entry) iter.next();
|
||||||
if (id == null || id.length() == 0) {
|
if (!elements.contains(entry.getValue())) {
|
||||||
initial = point.getExtension(CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID).getLabel();
|
elements.add(entry.getValue());
|
||||||
} else {
|
|
||||||
IExtension ext = point.getExtension(id);
|
|
||||||
if (ext != null) {
|
|
||||||
initial = ext.getLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
binaryList.setElements(elements);
|
||||||
|
if (initialSelected != null)
|
||||||
|
binaryList.setCheckedElements(initialSelected);
|
||||||
}
|
}
|
||||||
|
if (initialSelected == null) {
|
||||||
|
Preferences store = getContainer().getPreferences();
|
||||||
|
String id = null;
|
||||||
|
if (store != null) {
|
||||||
|
id = store.getString(CCorePlugin.PREF_BINARY_PARSER);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id != null && id.length() > 0) {
|
||||||
|
String[] ids = parseStringToArray(id);
|
||||||
|
initialSelected = new ArrayList(ids.length);
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
if (configMap.get(ids[i]) != null) {
|
||||||
|
initialSelected.add(configMap.get(ids[i]));
|
||||||
|
elements.add(configMap.get(ids[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Iterator iter = configMap.entrySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Entry entry = (Entry) iter.next();
|
||||||
|
if (!elements.contains(entry.getValue())) {
|
||||||
|
elements.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaryList.setElements(elements);
|
||||||
|
if (initialSelected != null)
|
||||||
|
binaryList.setCheckedElements(initialSelected);
|
||||||
|
// reset this since we only want to prevent applying non-changed selections on the project
|
||||||
|
// and project creation we always want to apply selection.
|
||||||
|
initialSelected = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private String arrayToString(Object[] array) {
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
for (int i = 0; i < array.length; i++) {
|
||||||
|
buf.append(array[i].toString()).append(';');
|
||||||
|
}
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.BINARY_PARSER_SIMPLE_ID);
|
String id = null;
|
||||||
String id;
|
|
||||||
if (getContainer().getProject() != null) {
|
// default current pages.
|
||||||
id = fPrefs.getString(CCorePlugin.PREF_BINARY_PARSER);
|
List selected = binaryList.getCheckedElements();
|
||||||
} else {
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
id = fPrefs.getDefaultString(CCorePlugin.PREF_BINARY_PARSER);
|
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||||
|
if (page != null) {
|
||||||
|
page.performDefaults();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String selected;
|
Preferences store = getContainer().getPreferences();
|
||||||
if (id == null || id.length() == 0) {
|
if (store != null) {
|
||||||
selected = point.getExtension(CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID).getLabel();
|
if (getContainer().getProject() != null) {
|
||||||
} else {
|
id = store.getString(CCorePlugin.PREF_BINARY_PARSER);
|
||||||
selected = point.getExtension(id).getLabel();
|
} else {
|
||||||
|
id = store.getDefaultString(CCorePlugin.PREF_BINARY_PARSER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
comboBox.setText(selected);
|
//default selection
|
||||||
|
selected.clear();
|
||||||
|
if (id != null) {
|
||||||
|
String[] ids = parseStringToArray(id);
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
if (configMap.get(ids[i]) != null) {
|
||||||
|
selected.add(configMap.get(ids[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binaryList.setCheckedElements(selected);
|
||||||
// Give a change to the UI contributors to react.
|
// Give a change to the UI contributors to react.
|
||||||
// But do it last after the comboBox is set.
|
// But do it last after the comboBox is set.
|
||||||
handleBinaryParserChanged();
|
handleBinaryParserChanged();
|
||||||
super.performDefaults();
|
|
||||||
getContainer().updateContainer();
|
getContainer().updateContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getCurrentBinaryParserID() {
|
protected String getCurrentBinaryParserID() {
|
||||||
String selected = comboBox.getText();
|
List list = binaryList.getSelectedElements();
|
||||||
return (String) idMap.get(selected);
|
if (list.size() > 0) {
|
||||||
|
BinaryParserConfiguration selected = (BinaryParserConfiguration) list.get(0);
|
||||||
|
if (binaryList.isChecked(selected)) {
|
||||||
|
return selected.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String[] getBinaryParserIDs() {
|
||||||
|
return (String[]) configMap.keySet().toArray(new String[configMap.keySet().size()]);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -87,17 +87,17 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < cext.length; i++) {
|
for (int i = 0; i < cext.length; i++) {
|
||||||
if (cext[i].getID().equals(parserID)) {
|
if (cext[i].getID().equals(parserID)) {
|
||||||
String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$
|
String orig = cext[i].getExtensionData("addr2line"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(addr2line)) {
|
if (orig == null || !orig.equals(addr2line)) {
|
||||||
cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$
|
cext[i].setExtensionData("addr2line", addr2line); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("c++filt"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(cppfilt)) {
|
if (orig == null || !orig.equals(cppfilt)) {
|
||||||
cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$
|
cext[i].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
orig = cext[0].getExtensionData("cygpath"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("cygpath"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(cygpath)) {
|
if (orig == null || !orig.equals(cygpath)) {
|
||||||
cext[0].setExtensionData("cygpath", cygpath); //$NON-NLS-1$
|
cext[i].setExtensionData("cygpath", cygpath); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,28 +122,21 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage {
|
||||||
String cppfilt = null;
|
String cppfilt = null;
|
||||||
String cygpath = null;
|
String cygpath = null;
|
||||||
IProject proj = getContainer().getProject();
|
IProject proj = getContainer().getProject();
|
||||||
if (proj != null) {
|
Preferences store = getContainer().getPreferences();
|
||||||
try {
|
if (store != null) {
|
||||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
|
if (proj != null) {
|
||||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
|
||||||
if (cext.length > 0) {
|
|
||||||
addr2line = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$;
|
|
||||||
cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$;
|
|
||||||
cygpath = cext[0].getExtensionData("cygpath"); //$NON-NLS-1$;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Preferences store = getContainer().getPreferences();
|
|
||||||
if (store != null) {
|
|
||||||
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
||||||
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
||||||
cygpath = store.getString(PREF_CYGPATH_PATH);
|
cygpath = store.getString(PREF_CYGPATH_PATH);
|
||||||
|
} else {
|
||||||
|
addr2line = store.getDefaultString(PREF_ADDR2LINE_PATH);
|
||||||
|
cppfilt = store.getDefaultString(PREF_CPPFILT_PATH);
|
||||||
|
cygpath = store.getDefaultString(PREF_CYGPATH_PATH);
|
||||||
}
|
}
|
||||||
|
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$;
|
||||||
|
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$;
|
||||||
|
fCygPathCommandText.setText((cygpath == null || cygpath.length() == 0) ? "cygpath" : cygpath); //$NON-NLS-1$;
|
||||||
}
|
}
|
||||||
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$;
|
|
||||||
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$;
|
|
||||||
fCygPathCommandText.setText((cygpath == null || cygpath.length() == 0) ? "cygpath" : cygpath); //$NON-NLS-1$;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -269,7 +262,35 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage {
|
||||||
});
|
});
|
||||||
|
|
||||||
setControl(comp);
|
setControl(comp);
|
||||||
performDefaults();
|
initializeValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeValues() {
|
||||||
|
String addr2line = null;
|
||||||
|
String cppfilt = null;
|
||||||
|
String cygpath = null;
|
||||||
|
IProject proj = getContainer().getProject();
|
||||||
|
if (proj != null) {
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
addr2line = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$;
|
||||||
|
cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$;
|
||||||
|
cygpath = cext[0].getExtensionData("cygpath"); //$NON-NLS-1$;
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Preferences store = getContainer().getPreferences();
|
||||||
|
if (store != null) {
|
||||||
|
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
||||||
|
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
||||||
|
cygpath = store.getString(PREF_CYGPATH_PATH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$;
|
||||||
|
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$;
|
||||||
|
fCygPathCommandText.setText((cygpath == null || cygpath.length() == 0) ? "cygpath" : cygpath); //$NON-NLS-1$;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -85,13 +85,13 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
||||||
for (int i = 0; i < cext.length; i++) {
|
for (int i = 0; i < cext.length; i++) {
|
||||||
if (cext[i].getID().equals(parserID)) {
|
if (cext[i].getID().equals(parserID)) {
|
||||||
|
|
||||||
String orig = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$
|
String orig = cext[i].getExtensionData("addr2line"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(addr2line)) {
|
if (orig == null || !orig.equals(addr2line)) {
|
||||||
cext[0].setExtensionData("addr2line", addr2line); //$NON-NLS-1$
|
cext[i].setExtensionData("addr2line", addr2line); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
orig = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("c++filt"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(cppfilt)) {
|
if (orig == null || !orig.equals(cppfilt)) {
|
||||||
cext[0].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$
|
cext[i].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,25 +114,18 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
||||||
String addr2line = null;
|
String addr2line = null;
|
||||||
String cppfilt = null;
|
String cppfilt = null;
|
||||||
IProject proj = getContainer().getProject();
|
IProject proj = getContainer().getProject();
|
||||||
if (proj != null) {
|
Preferences store = getContainer().getPreferences();
|
||||||
try {
|
if (store != null) {
|
||||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
|
if (proj != null) {
|
||||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
|
||||||
if (cext.length > 0) {
|
|
||||||
addr2line = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$
|
|
||||||
cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Preferences store = getContainer().getPreferences();
|
|
||||||
if (store != null) {
|
|
||||||
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
||||||
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
||||||
|
} else {
|
||||||
|
addr2line = store.getDefaultString(PREF_ADDR2LINE_PATH);
|
||||||
|
cppfilt = store.getDefaultString(PREF_CPPFILT_PATH);
|
||||||
}
|
}
|
||||||
|
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$
|
||||||
|
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$
|
|
||||||
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -220,7 +213,32 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
||||||
});
|
});
|
||||||
|
|
||||||
setControl(comp);
|
setControl(comp);
|
||||||
performDefaults();
|
initialziedValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialziedValues() {
|
||||||
|
String addr2line = null;
|
||||||
|
String cppfilt = null;
|
||||||
|
IProject proj = getContainer().getProject();
|
||||||
|
if (proj != null) {
|
||||||
|
try {
|
||||||
|
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
|
||||||
|
ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
|
if (cext.length > 0) {
|
||||||
|
addr2line = cext[0].getExtensionData("addr2line"); //$NON-NLS-1$
|
||||||
|
cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Preferences store = getContainer().getPreferences();
|
||||||
|
if (store != null) {
|
||||||
|
addr2line = store.getString(PREF_ADDR2LINE_PATH);
|
||||||
|
cppfilt = store.getString(PREF_CPPFILT_PATH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line); //$NON-NLS-1$
|
||||||
|
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue