mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New method added in ICOptionPage
Preferences getPreferences()
This commit is contained in:
parent
833492ccf0
commit
71c5ec9d07
5 changed files with 38 additions and 16 deletions
|
@ -99,6 +99,9 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
|||
public void setContainer(ICOptionContainer container) {
|
||||
super.setContainer(container);
|
||||
initializeParserPageMap();
|
||||
ICOptionPage page = getCurrentBinaryParserPage();
|
||||
if (page != null)
|
||||
page.setContainer(container);
|
||||
}
|
||||
|
||||
public ICOptionPage getBinaryParserPage(String parserID) {
|
||||
|
|
|
@ -116,7 +116,6 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(getContainer().getProject());
|
||||
desc.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
desc.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, (String) idMap.get(selected));
|
||||
CCorePlugin.getDefault().getCoreModel().resetBinaryParser(getContainer().getProject());
|
||||
} else {
|
||||
fPrefs.setValue(CCorePlugin.PREF_BINARY_PARSER, (String) idMap.get(selected));
|
||||
}
|
||||
|
@ -128,11 +127,17 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
// We have to do it last to make sure the parser id is save
|
||||
// in .cdtproject
|
||||
super.performApply(new SubProgressMonitor(monitor, 1));
|
||||
|
||||
// Reset the binary parser the paths may have change.
|
||||
if (getContainer().getProject() != null)
|
||||
CCorePlugin.getDefault().getCoreModel().resetBinaryParser(getContainer().getProject());
|
||||
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
public void setContainer(ICOptionContainer container) {
|
||||
super.setContainer(container);
|
||||
|
||||
IExtensionPoint point = CCorePlugin.getDefault().getDescriptor().getExtensionPoint(CCorePlugin.BINARY_PARSER_SIMPLE_ID);
|
||||
if (point != null) {
|
||||
IExtension[] exts = point.getExtensions();
|
||||
|
@ -181,6 +186,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
// Give a change to the UI contributors to react.
|
||||
// But do it last after the comboBox is set.
|
||||
handleBinaryParserChanged();
|
||||
super.performDefaults();
|
||||
getContainer().updateContainer();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
|
|||
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
|
@ -42,6 +43,9 @@ import org.eclipse.swt.widgets.Text;
|
|||
*/
|
||||
public class GNUElfBinaryParserPage 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$
|
||||
|
||||
protected Text fAddr2LineCommandText;
|
||||
protected Text fCPPFiltCommandText;
|
||||
|
||||
|
@ -52,12 +56,14 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
|||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
String addr2line = fAddr2LineCommandText.getText().trim();
|
||||
String cppfilt = fCPPFiltCommandText.getText().trim();
|
||||
|
||||
monitor.beginTask("Saving Attributes", 1);
|
||||
IProject proj = getContainer().getProject();
|
||||
if (proj != null) {
|
||||
ICDescriptor cdesc = CCorePlugin.getDefault().getCProjectDescription(proj);
|
||||
String addr2line = fAddr2LineCommandText.getText().trim();
|
||||
String cppfilt = fCPPFiltCommandText.getText().trim();
|
||||
ICExtensionReference[] cext = cdesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
if (cext.length == 0) {
|
||||
// The value was not save yet and we need to save it now
|
||||
|
@ -87,6 +93,12 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
|||
cext[0].setExtensionData("c++filt", cppfilt);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Preferences store = getContainer().getPreferences();
|
||||
if (store != null) {
|
||||
store.setValue(PREF_ADDR2LINE_PATH, addr2line);
|
||||
store.setValue(PREF_CPPFILT_PATH, cppfilt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,9 +119,15 @@ public class GNUElfBinaryParserPage extends AbstractCOptionPage {
|
|||
}
|
||||
} 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" : addr2line);
|
||||
fCPPFiltCommandText.setText((cppfilt == null) ? "c++filt" : cppfilt);
|
||||
fAddr2LineCommandText.setText((addr2line == null || addr2line.length() == 0) ? "addr2line" : addr2line);
|
||||
fCPPFiltCommandText.setText((cppfilt == null || cppfilt.length() == 0) ? "c++filt" : cppfilt);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.ui.dialogs;
|
|||
***********************************************************************/
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
|
||||
public interface ICOptionContainer {
|
||||
|
||||
|
@ -25,6 +25,6 @@ public interface ICOptionContainer {
|
|||
*
|
||||
* @return the preference store, or <code>null</code> if none
|
||||
*/
|
||||
public IPreferenceStore getPreferenceStore();
|
||||
public Preferences getPreferences();
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
|
|||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
|
@ -56,17 +57,11 @@ public abstract class NewCProjectWizardOptionPage extends WizardPage implements
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getPreferenceStore()
|
||||
*/
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return preferenceStore;
|
||||
}
|
||||
public abstract Preferences getPreferences();
|
||||
|
||||
/**
|
||||
* @param store
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.dialogs.ICOptionContainer#getProject()
|
||||
*/
|
||||
public void setPreferenceStore(IPreferenceStore store) {
|
||||
preferenceStore = store;
|
||||
}
|
||||
|
||||
public abstract IProject getProject();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue