# HG changeset patch # User fturovic # Date 1244838184 18000 # Node ID 1ef9693a4944aeda1a5f896c68d414493a3206d9 # Parent 84e7ae33a0c4a889e0efd830f3d976aaac32f52e# Parent 9236c05fb013f4c6f9c4f2e980b9038ae187bca4 merge diff -r 9236c05fb013 -r 1ef9693a4944 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jun 12 15:21:27 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jun 12 15:23:04 2009 -0500 @@ -16,63 +16,30 @@ */ package com.nokia.carbide.cdt.builder; -import java.io.*; -import java.sql.Time; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; - import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; -import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; -import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; -import com.nokia.carbide.cpp.epoc.engine.BldInfDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; -import com.nokia.carbide.cpp.epoc.engine.ImageMakefileDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.PKGViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSource; -import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; -import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfData; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExport; +import com.nokia.carbide.cdt.builder.project.*; +import com.nokia.carbide.cpp.epoc.engine.*; +import com.nokia.carbide.cpp.epoc.engine.image.*; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.*; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference; import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPBitmap; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPViewConfiguration; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.*; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGEmbeddedSISFile; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGInstallFile; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.PKGModelHelper; -import com.nokia.cpp.internal.api.utils.core.CommonPathFinder; -import com.nokia.cpp.internal.api.utils.core.FileUtils; -import com.nokia.cpp.internal.api.utils.core.Logging; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.*; +import com.nokia.cpp.internal.api.utils.core.*; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.*; + +import java.io.*; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class EpocEngineHelper { @@ -1370,7 +1337,14 @@ }); + boolean indexAll = getIndexAllPreference(); + List buildComponents = null; + if (!indexAll) // if indexAll, leave buildComponents as null because that will cause the same behavior + buildComponents = info.isBuildingFromInf() ? null : info.getInfBuildComponents(); for (IMMPReference mmp : mmps) { + if (buildComponents != null && !containsIgnoreCase(buildComponents, mmp.getPath().lastSegment())) + continue; + EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject()); final IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath()); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, @@ -1469,6 +1443,25 @@ return sourceRoots; } + + private static boolean getIndexAllPreference() { + // Can't access this pref from the project ui plugin because it would cause a circular dependency + Plugin plugin = Platform.getPlugin("com.nokia.carbide.cpp.project.ui"); //$NON-NLS-1$ + if (plugin == null) { + CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), + IStatus.WARNING, "Could not find project UI plugin!")); + return true; + } + return plugin.getPluginPreferences().getBoolean("indexAll"); //$NON-NLS-1$ + } + + private static boolean containsIgnoreCase(List list, String s) { + for (String string : list) { + if (string.equalsIgnoreCase(s)) + return true; + } + return false; + } /** * Get the list of all mmp file paths for any and all build configurations of a project. diff -r 9236c05fb013 -r 1ef9693a4944 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Fri Jun 12 15:21:27 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Fri Jun 12 15:23:04 2009 -0500 @@ -63,6 +63,7 @@ private List extraSourceEntries; private List cacheFileSource; private long cacheTimestamp; + private boolean forceRebuildCache; private final String CONFIG_DATA_CACHE = "configDataCache"; //$NON-NLS-1$ private final String SOURCES_CACHE = "sourcesCache"; //$NON-NLS-1$ @@ -164,6 +165,10 @@ buildCache(); cacheBuilt = true; } + } else if (forceRebuildCache) { + buildCache(); + forceRebuildCache = false; + cacheBuilt = true; } else { // rebuild if any of the files have changed since we built the cache last for (File file : cacheFileSource) { @@ -343,4 +348,8 @@ return null; } + public void forceRebuildCache() { + forceRebuildCache = true; + } + } diff -r 9236c05fb013 -r 1ef9693a4944 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Fri Jun 12 15:21:27 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Fri Jun 12 15:23:04 2009 -0500 @@ -16,27 +16,25 @@ */ package com.nokia.carbide.cdt.internal.builder; -import java.util.ArrayList; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICStorageElement; -import org.eclipse.cdt.core.settings.model.WriteAccessException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.settings.model.*; +import org.eclipse.core.runtime.*; + +import java.util.ArrayList; + public class CarbideProjectModifier extends CarbideProjectInfo implements ICarbideProjectModifier { // need to make all changes to the same description and save it protected ICProjectDescription projDes; + private boolean shouldForceRebuildCache; /* @@ -138,12 +136,14 @@ if (settingName.equals(PROJECT_RELATIVE_INFFILE_PROPS_KEY)) { projectRelativeBldInfPath = new Path(settingValue); } else if (settingName.equals(BLD_FROM_INF_PROPS_KEY)) { + shouldForceRebuildCache = true; if (settingValue.equalsIgnoreCase("false")) { buildFromInf = false; } else { buildFromInf = true; } } else if (settingName.equals(INF_COMPONENTS_PROPS_KEY)) { + shouldForceRebuildCache = true; setInfBuildComponentList(settingValue); } else if (settingName.equals(OVERRIDE_WORKSPACE_SETTINGS_KEY)) { if (settingValue.equalsIgnoreCase("false")) { @@ -232,18 +232,31 @@ public boolean saveChanges() { - checkInteralSettings(); + checkInternalSettings(); // make sure this flag is set before saving the ICProjectDescription projDes.setCdtProjectCreated(); + if (shouldForceRebuildCache) { + for (ICConfigurationDescription configuration : projDes.getConfigurations()) { + BuildConfigurationData data = (BuildConfigurationData) configuration.getConfigurationData(); + data.forceRebuildCache(); + } + } + try { + // replace the old info in the map with the new + CarbideBuilderPlugin.getBuildManager().setProjectInfo(this); + // save the CDT project description CCorePlugin.getDefault().setProjectDescription(projectTracker.getProject(), projDes, true, new NullProgressMonitor()); - // replace the old info in the map with the new - CarbideBuilderPlugin.getBuildManager().setProjectInfo(this); - + if (shouldForceRebuildCache) { + ICProject cproject = CoreModel.getDefault().create(projectTracker.getProject()); + if (cproject != null) + CCorePlugin.getIndexManager().reindex(cproject); + } + return true; } catch (CoreException e) { e.printStackTrace(); @@ -252,7 +265,7 @@ return false; } - public void checkInteralSettings() { + public void checkInternalSettings() { // make sure our internal settings are written to disk try { diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/ProjectUIPlugin.java Fri Jun 12 15:23:04 2009 -0500 @@ -224,6 +224,16 @@ store.setValue(PreferenceConstants.PREF_CHANGED_FILES_OPTION, option); } + public static boolean getIndexAllOption() { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + return store.getBoolean(PreferenceConstants.PREF_INDEX_ALL); + } + + public static void setIndexAllOption(boolean option) { + IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); + store.setValue(PreferenceConstants.PREF_INDEX_ALL, option); + } + static public void log(IStatus status) { Logging.log(plugin, status); } diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/messages.properties Fri Jun 12 15:23:04 2009 -0500 @@ -79,6 +79,12 @@ CarbidePreferencePage.NeverText=Never change bld.inf/mmp CarbidePreferencePage.NeverToolTip=No changes will be made CarbidePreferencePage.ChangedFilesText=When files in the project are moved/renamed/deleted +CarbidePreferencePage.IndexAllLabel=Index sources from all mmp files +CarbidePreferencePage.IndexAllToolTip=Index all sources in the project +CarbidePreferencePage.IndexingTitle=Indexing Options +CarbidePreferencePage.IndexOnlyBuildLabel=Index only source files from mmp files being built +CarbidePreferencePage.IndexOnlyBuildTooltip=Index only sources from components marked for building +CarbidePreferencePage.ProjectSyncTitle=Project Synchronization Options UpdateProjectFilesQueryDialog.DialogTitle=Project Changes Detected UpdateProjectFilesQueryDialog.ChangesDetectedLabelText=The following changes have been detected for project diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/CarbidePreferencePage.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/CarbidePreferencePage.java Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/CarbidePreferencePage.java Fri Jun 12 15:23:04 2009 -0500 @@ -16,125 +16,142 @@ */ package com.nokia.carbide.cpp.internal.project.ui.preferences; -import org.eclipse.jface.preference.PreferencePage; -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.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -import com.freescale.swt.widgets.CheckboxGroup; import com.nokia.carbide.cpp.internal.api.project.core.ResourceChangeListener; import com.nokia.carbide.cpp.internal.project.ui.Messages; import com.nokia.carbide.cpp.internal.project.ui.ProjectUIHelpIds; import com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.*; +import org.eclipse.ui.*; + public class CarbidePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - private CheckboxGroup keepProjectFilesInSync; + private Button keepProjectFilesInSync; - private Group addGroup; + private Composite addGroup; private Button addAskFirst; private Button addAlways; private Button addNever; - private Group deleteGroup; + private Composite deleteGroup; private Button deleteAskFirst; private Button deleteAlways; private Button deleteNever; + private Button indexBuildOnly; + + private Button indexAll; + public CarbidePreferencePage() { super(); } - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { + protected Control createContents(Composite parent) { Composite content = new Composite(parent, SWT.NONE); - setControl(content); - final GridLayout gridLayout = new GridLayout(); - content.setLayout(gridLayout); + content.setLayout(new GridLayout()); - keepProjectFilesInSync = new CheckboxGroup(content, SWT.CHECK); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - keepProjectFilesInSync.setLayoutData(data); + Group inSyncGroup = new Group(content, SWT.NONE); + inSyncGroup.setLayout(new GridLayout()); + inSyncGroup.setText(Messages.getString("CarbidePreferencePage.ProjectSyncTitle")); //$NON-NLS-1$ + GridDataFactory.fillDefaults().grab(true, false).applyTo(inSyncGroup); + + keepProjectFilesInSync = new Button(inSyncGroup, SWT.CHECK); + GridDataFactory.defaultsFor(keepProjectFilesInSync).indent(0, 10).applyTo(keepProjectFilesInSync); keepProjectFilesInSync.setText(Messages.getString("CarbidePreferencePage.EnableResourceListenerText")); //$NON-NLS-1$ keepProjectFilesInSync.setToolTipText(Messages.getString("CarbidePreferencePage.EnableResourceListenerTooltip")); //$NON-NLS-1$ - keepProjectFilesInSync.getGroup().setLayout(gridLayout); keepProjectFilesInSync.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - updateProjectSyncOptions(); + updateProjectSyncEnabledState(); } }); - keepProjectFilesInSync.setSelection(ProjectUIUtils.keepProjectsInSync()); - - addGroup = new Group(keepProjectFilesInSync.getGroup(), SWT.NONE); - GridLayout layout = new GridLayout(); - addGroup.setLayout(layout); - addGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - addGroup.setText(Messages.getString("CarbidePreferencePage.AddedFilesText")); //$NON-NLS-1$ + addGroup = new Composite(inSyncGroup, SWT.NONE); addGroup.setFont(parent.getFont()); + addGroup.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().grab(true, false).applyTo(addGroup); addGroup.setToolTipText(Messages.getString("CarbidePreferencePage.AddedFilesToolTip")); //$NON-NLS-1$ - int addOption = ProjectUIUtils.getAddFilesToProjectOption(); - + Label addLabel = new Label(addGroup, SWT.NONE); + addLabel.setText(Messages.getString("CarbidePreferencePage.AddedFilesText")); //$NON-NLS-1$ + addAskFirst = new Button(addGroup, SWT.RADIO); addAskFirst.setText(Messages.getString("CarbidePreferencePage.AskFirstText")); //$NON-NLS-1$ addAskFirst.setToolTipText(Messages.getString("CarbidePreferencePage.AskFirstToolTip")); //$NON-NLS-1$ - addAskFirst.setSelection(addOption == ResourceChangeListener.UPDATE_FILES_OPTION_ASK); + GridDataFactory.defaultsFor(addAskFirst).indent(10, 0).applyTo(addAskFirst); addAlways = new Button(addGroup, SWT.RADIO); addAlways.setText(Messages.getString("CarbidePreferencePage.AlwaysText")); //$NON-NLS-1$ addAlways.setToolTipText(Messages.getString("CarbidePreferencePage.AlwaysToolTip")); //$NON-NLS-1$ - addAlways.setSelection(addOption == ResourceChangeListener.UPDATE_FILES_OPTION_ALWAYS); + GridDataFactory.defaultsFor(addAlways).indent(10, 0).applyTo(addAlways); addNever = new Button(addGroup, SWT.RADIO); addNever.setText(Messages.getString("CarbidePreferencePage.NeverText")); //$NON-NLS-1$ addNever.setToolTipText(Messages.getString("CarbidePreferencePage.NeverToolTip")); //$NON-NLS-1$ - addNever.setSelection(addOption == ResourceChangeListener.UPDATE_FILES_OPTION_NEVER); + GridDataFactory.defaultsFor(addNever).indent(10, 0).applyTo(addNever); - int deleteOption = ProjectUIUtils.getChangedFilesInProjectOption(); - deleteGroup = new Group(keepProjectFilesInSync.getGroup(), SWT.NONE); - GridLayout layout2 = new GridLayout(); - deleteGroup.setLayout(layout2); - GridData gd2 = new GridData(GridData.FILL_HORIZONTAL); - deleteGroup.setLayoutData(gd2); - deleteGroup.setText(Messages.getString("CarbidePreferencePage.ChangedFilesText")); //$NON-NLS-1$ + deleteGroup = new Composite(inSyncGroup, SWT.NONE); + deleteGroup.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().grab(true, false).applyTo(deleteGroup); deleteGroup.setFont(parent.getFont()); deleteGroup.setToolTipText(Messages.getString("CarbidePreferencePage.ChangedFilesToolTip")); //$NON-NLS-1$ + Label deleteLabel = new Label(deleteGroup, SWT.NONE); + deleteLabel.setText(Messages.getString("CarbidePreferencePage.ChangedFilesText")); //$NON-NLS-1$ + deleteAskFirst = new Button(deleteGroup, SWT.RADIO); deleteAskFirst.setText(Messages.getString("CarbidePreferencePage.AskFirstText")); //$NON-NLS-1$ deleteAskFirst.setToolTipText(Messages.getString("CarbidePreferencePage.AskFirstToolTip")); //$NON-NLS-1$ - deleteAskFirst.setSelection(deleteOption == ResourceChangeListener.UPDATE_FILES_OPTION_ASK); + GridDataFactory.defaultsFor(deleteAskFirst).indent(10, 0).applyTo(deleteAskFirst); deleteAlways = new Button(deleteGroup, SWT.RADIO); deleteAlways.setText(Messages.getString("CarbidePreferencePage.AlwaysText")); //$NON-NLS-1$ deleteAlways.setToolTipText(Messages.getString("CarbidePreferencePage.AlwaysToolTip")); //$NON-NLS-1$ - deleteAlways.setSelection(deleteOption == ResourceChangeListener.UPDATE_FILES_OPTION_ALWAYS); + GridDataFactory.defaultsFor(deleteAlways).indent(10, 0).applyTo(deleteAlways); deleteNever = new Button(deleteGroup, SWT.RADIO); deleteNever.setText(Messages.getString("CarbidePreferencePage.NeverText")); //$NON-NLS-1$ deleteNever.setToolTipText(Messages.getString("CarbidePreferencePage.NeverToolTip")); //$NON-NLS-1$ - deleteNever.setSelection(deleteOption == ResourceChangeListener.UPDATE_FILES_OPTION_NEVER); + GridDataFactory.defaultsFor(deleteNever).indent(10, 0).applyTo(deleteNever); + + boolean keepInSync = ProjectUIUtils.keepProjectsInSync(); + int addOption = ProjectUIUtils.getAddFilesToProjectOption(); + int deleteOption = ProjectUIUtils.getChangedFilesInProjectOption(); + setUpdateFilesOptions(keepInSync, addOption, deleteOption); + updateProjectSyncEnabledState(); + + Group indexGroup = new Group(content, SWT.NONE); + indexGroup.setLayout(new GridLayout()); + indexGroup.setText(Messages.getString("CarbidePreferencePage.IndexingTitle")); //$NON-NLS-1$ + GridDataFactory.fillDefaults().grab(true, false).applyTo(indexGroup); - updateProjectSyncOptions(); + indexBuildOnly = new Button(indexGroup, SWT.RADIO); + indexBuildOnly.setText(Messages.getString("CarbidePreferencePage.IndexOnlyBuildLabel")); //$NON-NLS-1$ + indexBuildOnly.setToolTipText(Messages.getString("CarbidePreferencePage.IndexOnlyBuildTooltip")); //$NON-NLS-1$ + GridDataFactory.defaultsFor(indexBuildOnly).applyTo(indexBuildOnly); - PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), ProjectUIHelpIds.CARBIDE_PREFS_PAGE); + indexAll = new Button(indexGroup, SWT.RADIO); + indexAll.setText(Messages.getString("CarbidePreferencePage.IndexAllLabel")); //$NON-NLS-1$ + indexAll.setToolTipText(Messages.getString("CarbidePreferencePage.IndexAllToolTip")); //$NON-NLS-1$ + GridDataFactory.defaultsFor(indexAll).applyTo(indexAll); + + boolean indexAllOption = ProjectUIUtils.getIndexAllOption(); + indexBuildOnly.setSelection(!indexAllOption); + indexAll.setSelection(indexAllOption); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(content, ProjectUIHelpIds.CARBIDE_PREFS_PAGE); + + return content; } - private void updateProjectSyncOptions() { + private void updateProjectSyncEnabledState() { boolean enabled = keepProjectFilesInSync.getSelection(); addGroup.setEnabled(enabled); addAskFirst.setEnabled(enabled); @@ -146,14 +163,29 @@ deleteNever.setEnabled(enabled); } - @Override - protected Control createContents(Composite parent) { - return null; - } - public void init(IWorkbench workbench) { } + @Override + protected void performDefaults() { + setUpdateFilesOptions(true, 0, 0); + updateProjectSyncEnabledState(); + indexBuildOnly.setSelection(true); + indexAll.setSelection(false); + super.performDefaults(); + } + + private void setUpdateFilesOptions(boolean keepInSync, int addOptions, int deleteOptions) { + keepProjectFilesInSync.setSelection(keepInSync); + addAskFirst.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_ASK == addOptions); + addAlways.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_ALWAYS == addOptions); + addNever.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_NEVER == addOptions); + deleteAskFirst.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_ASK == deleteOptions); + deleteAlways.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_ALWAYS == deleteOptions); + deleteNever.setSelection(ResourceChangeListener.UPDATE_FILES_OPTION_NEVER == deleteOptions); + } + + public boolean performOk() { ProjectUIUtils.setKeepProjectsInSync(keepProjectFilesInSync.getSelection()); @@ -174,6 +206,8 @@ ProjectUIUtils.setChangedFilesInProjectOption(ResourceChangeListener.UPDATE_FILES_OPTION_NEVER); } + ProjectUIUtils.setIndexAllOption(indexAll.getSelection()); + return super.performOk(); } diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceConstants.java Fri Jun 12 15:23:04 2009 -0500 @@ -26,4 +26,6 @@ public final static String PREF_ADDED_FILES_OPTION = "addedFilesOption"; //$NON-NLS-1$ public final static String PREF_CHANGED_FILES_OPTION = "changedFilesOption"; //$NON-NLS-1$ + + public static final String PREF_INDEX_ALL = "indexAll"; //$NON-NLS-1$ } diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/preferences/PreferenceInitializer.java Fri Jun 12 15:23:04 2009 -0500 @@ -34,6 +34,7 @@ public void initializeDefaultPreferences() { IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, true); + store.setDefault(PreferenceConstants.PREF_INDEX_ALL, false); } } diff -r 9236c05fb013 -r 1ef9693a4944 project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/utils/ProjectUIUtils.java --- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/utils/ProjectUIUtils.java Fri Jun 12 15:21:27 2009 -0500 +++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/project/ui/utils/ProjectUIUtils.java Fri Jun 12 15:23:04 2009 -0500 @@ -84,4 +84,22 @@ public static void setChangedFilesInProjectOption(int option) { ProjectUIPlugin.setChangedFilesInProjectOption(option); } + + /** + * Returns the preference option for whether or not to index all source files + * or just those of the build components + * @return the option + */ + public static boolean getIndexAllOption() { + return ProjectUIPlugin.getIndexAllOption(); + } + + /** + * Sets the preference option for whether or not to index all source files + * or just those of the build components + * @param option true to enable the feature, false to disable + */ + public static void setIndexAllOption(boolean option) { + ProjectUIPlugin.setIndexAllOption(option); + } }