diff options
author | Alain Magloire | 2004-12-03 02:24:15 +0000 |
---|---|---|
committer | Alain Magloire | 2004-12-03 02:24:15 +0000 |
commit | a9ab1c4438403e009423f5ccbbf7d161ca53fe7e (patch) | |
tree | ecc166c4cd4c9c6ad0952761107cb33a81922734 | |
parent | 2dfbe4a67b77dedc959e09cad2b492d80bc19e2b (diff) | |
download | org.eclipse.cdt-a9ab1c4438403e009423f5ccbbf7d161ca53fe7e.tar.gz org.eclipse.cdt-a9ab1c4438403e009423f5ccbbf7d161ca53fe7e.tar.xz org.eclipse.cdt-a9ab1c4438403e009423f5ccbbf7d161ca53fe7e.zip |
2004-12-02 Alain Magloire
Fix for 40081
Textfield to choose NM.
Fix MacOX binary parser page.
* src/org/eclipse/cdt/internal/ui/CUIMessages.properties.
* src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java
* src/org/eclipse/cdt/ui/dialogs/CygwinPEBinarParserPage.java
* src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java
5 files changed, 71 insertions, 196 deletions
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 6a83e52b30c..9ab37866073 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,12 @@ +2004-12-02 Alain Magloire + Fix for 40081 + Textfield to choose NM. + Fix MacOX binary parser page. + * src/org/eclipse/cdt/internal/ui/CUIMessages.properties. + * src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java + * src/org/eclipse/cdt/ui/dialogs/CygwinPEBinarParserPage.java + * src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java + 2004-11-25 Alain Magloire Fix for PR 79327 * src/org/eclipse/cdt/internal/ui/cview/CViewLabelProvider.java diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties index b969fe0ff8e..e36b5f4e359 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties @@ -39,6 +39,7 @@ BinaryParserPage.label.browse1=B&rowse... BinaryParserPage.label.browse2=Br&owse... BinaryParserPage.label.cppfiltCommand=c++filt Command: BinaryParserPage.label.cygpathCommand=cygpath Command: +BinaryParserPage.label.nmCommand=nm Command: AbstractErrorParserBlock.task.setErrorParser=Setting Error Parsers... ConvertProjectWizardPage.convertTo=Convert to C or C++ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java index 97d2b91ea57..77df41f93c1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/BinaryParserBlock.java @@ -51,6 +51,7 @@ import org.eclipse.ui.help.WorkbenchHelp; public class BinaryParserBlock extends AbstractBinaryParserPage { + private static final int DEFAULT_HEIGHT = 160; private static final String PREFIX = "BinaryParserBlock"; //$NON-NLS-1$ private static final String LABEL = PREFIX + ".label"; //$NON-NLS-1$ private static final String DESC = PREFIX + ".desc"; //$NON-NLS-1$ @@ -194,7 +195,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage { Composite parserGroup = new Composite(composite, SWT.NULL); GridData gd = new GridData(); - gd.heightHint = converter.convertHorizontalDLUsToPixels(150); + gd.heightHint = converter.convertHorizontalDLUsToPixels(DEFAULT_HEIGHT); gd.horizontalAlignment = GridData.FILL; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java index 1e0403ac5be..b2d611716cb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/CygwinPEBinaryParserPage.java @@ -48,10 +48,12 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { public final static String PREF_ADDR2LINE_PATH = CUIPlugin.PLUGIN_ID + ".addr2line"; //$NON-NLS-1$ public final static String PREF_CPPFILT_PATH = CUIPlugin.PLUGIN_ID + ".cppfilt"; //$NON-NLS-1$ public final static String PREF_CYGPATH_PATH = CUIPlugin.PLUGIN_ID + ".cygpath"; //$NON-NLS-1$ + public final static String PREF_NM_PATH = CUIPlugin.PLUGIN_ID + ".nm"; //$NON-NLS-1$ protected Text fAddr2LineCommandText; protected Text fCPPFiltCommandText; protected Text fCygPathCommandText; + protected Text fNMCommandText; /* * (non-Javadoc) @@ -66,6 +68,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { String addr2line = fAddr2LineCommandText.getText().trim(); String cppfilt = fCPPFiltCommandText.getText().trim(); String cygpath = fCygPathCommandText.getText().trim(); + String nm = fNMCommandText.getText().trim(); monitor.beginTask(CUIMessages.getString("BinaryParserPage.task.savingAttributes"), 1); //$NON-NLS-1$ IProject proj = getContainer().getProject(); @@ -99,6 +102,10 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { if (orig == null || !orig.equals(cygpath)) { cext[i].setExtensionData("cygpath", cygpath); //$NON-NLS-1$ } + orig = cext[i].getExtensionData("nm"); //$NON-NLS-1$ + if (orig == null || !orig.equals(nm)) { + cext[i].setExtensionData("nm", nm); //$NON-NLS-1$ + } } } } @@ -108,6 +115,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { store.setValue(PREF_ADDR2LINE_PATH, addr2line); store.setValue(PREF_CPPFILT_PATH, cppfilt); store.setValue(PREF_CYGPATH_PATH, cygpath); + store.setValue(PREF_NM_PATH, nm); } } } @@ -121,6 +129,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { String addr2line = null; String cppfilt = null; String cygpath = null; + String nm = null; IProject proj = getContainer().getProject(); Preferences store = getContainer().getPreferences(); if (store != null) { @@ -128,14 +137,17 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { addr2line = store.getString(PREF_ADDR2LINE_PATH); cppfilt = store.getString(PREF_CPPFILT_PATH); cygpath = store.getString(PREF_CYGPATH_PATH); + nm = store.getString(PREF_NM_PATH); } else { addr2line = store.getDefaultString(PREF_ADDR2LINE_PATH); cppfilt = store.getDefaultString(PREF_CPPFILT_PATH); cygpath = store.getDefaultString(PREF_CYGPATH_PATH); + nm = store.getDefaultString(PREF_NM_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$; + fNMCommandText.setText((nm == null || nm.length() == 0) ? "nm" : nm); //$NON-NLS-1$; } } @@ -265,6 +277,45 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { } }); + + label = ControlFactory.createLabel(comp, CUIMessages.getString("BinaryParserPage.label.nmCommand")); //$NON-NLS-1$ + gd = new GridData(); + gd.horizontalSpan = 2; + label.setLayoutData(gd); + + fNMCommandText = ControlFactory.createTextField(comp, SWT.SINGLE | SWT.BORDER); + gd = new GridData(GridData.FILL_HORIZONTAL); + fNMCommandText.setLayoutData(gd); + fNMCommandText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent evt) { + //updateLaunchConfigurationDialog(); + } + }); + button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse2")); //$NON-NLS-1$ + button.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent evt) { + handleCygPathButtonSelected(); + //updateLaunchConfigurationDialog(); + } + + private void handleCygPathButtonSelected() { + FileDialog dialog = new FileDialog(getShell(), SWT.NONE); + dialog.setText(CUIMessages.getString("BinaryParserPage.label.nmCommand")); //$NON-NLS-1$ + String command = fNMCommandText.getText().trim(); + int lastSeparatorIndex = command.lastIndexOf(File.separator); + if (lastSeparatorIndex != -1) { + dialog.setFilterPath(command.substring(0, lastSeparatorIndex)); + } + String res = dialog.open(); + if (res == null) { + return; + } + fNMCommandText.setText(res); + } + }); + setControl(comp); initializeValues(); } @@ -273,6 +324,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { String addr2line = null; String cppfilt = null; String cygpath = null; + String nm = null; IProject proj = getContainer().getProject(); if (proj != null) { try { @@ -282,6 +334,7 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { 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$; + nm = cext[0].getExtensionData("nm"); //$NON-NLS-1$; } } catch (CoreException e) { } @@ -291,10 +344,12 @@ public class CygwinPEBinaryParserPage extends AbstractCOptionPage { addr2line = store.getString(PREF_ADDR2LINE_PATH); cppfilt = store.getString(PREF_CPPFILT_PATH); cygpath = store.getString(PREF_CYGPATH_PATH); + nm = store.getString(PREF_NM_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$; + fNMCommandText.setText((nm == null || nm.length() == 0) ? "nm" : nm); //$NON-NLS-1$; } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java index b993af0e719..40e4386b682 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/dialogs/MachOBinaryParserPage.java @@ -11,207 +11,16 @@ package org.eclipse.cdt.ui.dialogs; -import java.io.File; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.ICDescriptor; -import org.eclipse.cdt.core.ICExtensionReference; -import org.eclipse.cdt.internal.ui.CUIMessages; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.utils.ui.controls.ControlFactory; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; /** */ -public class MachOBinaryParserPage extends AbstractCOptionPage { - - public final static String PREF_CPPFILT_PATH = CUIPlugin.PLUGIN_ID + ".cppfilt"; //$NON-NLS-1$ +public class MachOBinaryParserPage extends AbstractGNUBinaryParserPage { - protected Text fCPPFiltCommandText; - - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor) + /* (non-Javadoc) + * @see org.eclipse.cdt.ui.dialogs.AbstractGNUBinaryParserPage#getRealBinaryParserPage() */ - public void performApply(IProgressMonitor monitor) throws CoreException { - if (monitor == null) { - monitor = new NullProgressMonitor(); - } - - String cppfilt = fCPPFiltCommandText.getText().trim(); - - monitor.beginTask(CUIMessages.getString("BinaryParserPage.task.savingAttributes"), 1); //$NON-NLS-1$ - IProject proj = getContainer().getProject(); - if (proj != null) { - String parserID = ""; //$NON-NLS-1$ - ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj); - ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID); - if (cext.length > 0) { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$ - IConfigurationElement[] infos = point.getConfigurationElements(); - for (int i = 0; i < infos.length; i++) { - String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$ - String clazz = infos[i].getAttribute("class"); //$NON-NLS-1$ - String ego = getRealBinaryParserPage().getClass().getName(); - if (clazz != null && clazz.equals(ego)) { - parserID = id; - break; - } - } - for (int i = 0; i < cext.length; i++) { - if (cext[i].getID().equals(parserID)) { - - String orig = cext[i].getExtensionData("c++filt"); //$NON-NLS-1$ - if (orig == null || !orig.equals(cppfilt)) { - cext[i].setExtensionData("c++filt", cppfilt); //$NON-NLS-1$ - } - } - } - } - } else { - Preferences store = getContainer().getPreferences(); - if (store != null) { - store.setValue(PREF_CPPFILT_PATH, cppfilt); - } - } - } - - /** - * If this class is inherited from then this method MUST be implemented - * in the derived class. - */ - protected Object getRealBinaryParserPage() { + protected AbstractGNUBinaryParserPage getRealBinaryParserPage() { return this; } - /* - * (non-Javadoc) - * - * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults() - */ - public void performDefaults() { - String addr2line = null; - String cppfilt = null; - IProject proj = getContainer().getProject(); - Preferences store = getContainer().getPreferences(); - if (store != null) { - if (proj != null) { - cppfilt = store.getString(PREF_CPPFILT_PATH); - } else { - cppfilt = store.getDefaultString(PREF_CPPFILT_PATH); - } - fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$ - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - Group comp = new Group(parent, SWT.SHADOW_ETCHED_IN); - comp.setText(CUIMessages.getString("BinaryParserBlock.binaryParserOptions")); //$NON-NLS-1$ - comp.setLayout(new GridLayout(2, true)); - comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - ((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false; - - Label label = ControlFactory.createLabel(comp, CUIMessages.getString("BinaryParserPage.label.addr2lineCommand")); //$NON-NLS-1$ - GridData gd = new GridData(); - gd.horizontalSpan = 2; - label.setLayoutData(gd); - - Button button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ - button.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - //updateLaunchConfigurationDialog(); - } - - }); - - label = ControlFactory.createLabel(comp, CUIMessages.getString("BinaryParserPage.label.cppfiltCommand")); //$NON-NLS-1$ - gd = new GridData(); - gd.horizontalSpan = 2; - label.setLayoutData(gd); - - fCPPFiltCommandText = ControlFactory.createTextField(comp, SWT.SINGLE | SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - fCPPFiltCommandText.setLayoutData(gd); - fCPPFiltCommandText.addModifyListener(new ModifyListener() { - - public void modifyText(ModifyEvent evt) { - //updateLaunchConfigurationDialog(); - } - }); - button = ControlFactory.createPushButton(comp, CUIMessages.getString("BinaryParserPage.label.browse")); //$NON-NLS-1$ - button.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent evt) { - handleCPPFiltButtonSelected(); - //updateLaunchConfigurationDialog(); - } - - private void handleCPPFiltButtonSelected() { - FileDialog dialog = new FileDialog(getShell(), SWT.NONE); - dialog.setText(CUIMessages.getString("BinaryParserPage.label.cppfiltCommand")); //$NON-NLS-1$ - String command = fCPPFiltCommandText.getText().trim(); - int lastSeparatorIndex = command.lastIndexOf(File.separator); - if (lastSeparatorIndex != -1) { - dialog.setFilterPath(command.substring(0, lastSeparatorIndex)); - } - String res = dialog.open(); - if (res == null) { - return; - } - fCPPFiltCommandText.setText(res); - } - }); - - setControl(comp); - initialziedValues(); - } - - private void initialziedValues() { - 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) { - cppfilt = cext[0].getExtensionData("c++filt"); //$NON-NLS-1$ - } - } catch (CoreException e) { - } - } else { - Preferences store = getContainer().getPreferences(); - if (store != null) { - cppfilt = store.getString(PREF_CPPFILT_PATH); - } - } - fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt); //$NON-NLS-1$ - } - } |