diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index a5bbb5a0c1b..ffc2be8e15b 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,11 @@ +2002-11-13 David Inglis + + * plugin.properties + * plugin.xml + * src/.../internal/ui/preferences/CIndexerPropertyPage.java + Added new property page on c project to enable/disable the indexing service. + + 2002-11-06 Alain Magloire Fix for Bugzilla 25869. diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index cc497903d99..f08d7754fe7 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -55,6 +55,7 @@ CPluginPreferencePage.name=C/C++ CPluginEditorPreferencePage.name=C/C++ Editor CPluginTemplatePreferencePage.name=Code Templates CProjectPropertyPage.name=C/C++ Project +CIndexerPropertyPage.name=C/C++ Indexer CLaunchingPropertyPage.executionArguments.name=C Execution Arguments CApplicationLauncher.label=Executable CApplicationLauncher.description=Launch a local command diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 4440dd28129..64a2f01a7a4 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -266,6 +266,7 @@ + + + + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CIndexerPropertyPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CIndexerPropertyPage.java new file mode 100644 index 00000000000..3d91f31f5b7 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CIndexerPropertyPage.java @@ -0,0 +1,62 @@ +package org.eclipse.cdt.internal.ui.preferences; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.index.IndexModel; +import org.eclipse.core.resources.IProject; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.dialogs.PropertyPage; + +public class CIndexerPropertyPage extends PropertyPage { + private Button indexerSwitch; + + protected Control createContents(Composite parent) { + Composite composite= new Composite(parent, SWT.NONE); + GridLayout grid = new GridLayout(); + grid.numColumns = 1; + composite.setLayout(grid); + + IProject project= getProject(); + IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); + + indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT); + indexerSwitch.setAlignment(SWT.LEFT); + indexerSwitch.setText("Enable indexing service for this project"); + indexerSwitch.setSelection(indexer.isEnabled(project)); + return composite; + } + + /** + * @see PreferencePage#performOk + */ + public boolean performOk() { + IProject project= getProject(); + IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); + indexer.setEnabled(project, indexerSwitch.getSelection()); + return true; + } + + private IProject getProject() { + Object element= getElement(); + if (element instanceof IProject) { + return (IProject)element; + } + return null; + } + + protected void performDefaults() { + IProject project= getProject(); + IndexModel indexer = CCorePlugin.getDefault().getIndexModel(); + indexer.setEnabled(project, false); + super.performDefaults(); + } + +}