[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Indexer Patch for 1.2
|
This patch adds an index enablement
tab to the project properties page for both managed and standard make projects
for the 1.2 stream. Since I don't have commit permission on managed and
make plugins, I thought it'd be best for someone who did to apply the entire
patch - perhaps Alain or Dave Inglis.
Thanks,
Bogdan
Index: .classpath
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/.classpath,v
retrieving revision 1.7.2.1
diff -u -r1.7.2.1 .classpath
--- .classpath 15 Dec 2003 16:05:25 -0000 1.7.2.1
+++ .classpath 7 Dec 2004 18:42:38 -0000
@@ -2,7 +2,21 @@
<classpath>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="src" path="utils.ui/"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="/org.eclipse.ui"/>
+ <classpathentry kind="src" path="/org.eclipse.core.resources"/>
+ <classpathentry kind="src" path="/org.apache.xerces"/>
+ <classpathentry kind="src" path="/org.eclipse.search"/>
+ <classpathentry kind="src" path="/org.eclipse.compare"/>
+ <classpathentry kind="src" path="/org.eclipse.debug.ui"/>
+ <classpathentry kind="src" path="/org.eclipse.debug.core"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core.aix"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core.linux"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core.qnx"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core.solaris"/>
+ <classpathentry kind="src" path="/org.eclipse.cdt.core.win32"/>
+ <classpathentry kind="src" path="/org.eclipse.core.boot"/>
+ <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Index: .project
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/.project,v
retrieving revision 1.2.10.1
diff -u -r1.2.10.1 .project
--- .project 15 Dec 2003 16:05:25 -0000 1.2.10.1
+++ .project 7 Dec 2004 18:42:38 -0000
@@ -3,11 +3,21 @@
<name>org.eclipse.cdt.ui</name>
<comment></comment>
<projects>
+ <project>org.apache.xerces</project>
<project>org.eclipse.cdt.core</project>
+ <project>org.eclipse.cdt.core.aix</project>
<project>org.eclipse.cdt.core.linux</project>
<project>org.eclipse.cdt.core.qnx</project>
<project>org.eclipse.cdt.core.solaris</project>
<project>org.eclipse.cdt.core.win32</project>
+ <project>org.eclipse.compare</project>
+ <project>org.eclipse.core.boot</project>
+ <project>org.eclipse.core.resources</project>
+ <project>org.eclipse.core.runtime</project>
+ <project>org.eclipse.debug.core</project>
+ <project>org.eclipse.debug.ui</project>
+ <project>org.eclipse.search</project>
+ <project>org.eclipse.ui</project>
</projects>
<buildSpec>
<buildCommand>
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.203.2.20
diff -u -r1.203.2.20 ChangeLog
--- ChangeLog 31 May 2004 19:29:42 -0000 1.203.2.20
+++ ChangeLog 7 Dec 2004 18:42:39 -0000
@@ -1,3 +1,14 @@
+2004-12-07 Bogdan Gheorghe
+
+ Added Index Enablement block
+
+ * src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java
+ * src/org/eclipse/cdt/ui/dialogs/IndexerOptionDialogPage.java
+ * src/org/eclipse/cdt/ui/dialogs/IndexerOptionPropertyPage.java
+ * src/org/eclipse/cdt/internal/ui/CUIMessages.properties
+ * plugin.properties
+ * plugin.xml
+
2004-05-31 Alain Magloire
Thomas patch dealing with memory leaks.
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.properties,v
retrieving revision 1.28
diff -u -r1.28 plugin.properties
--- plugin.properties 1 Oct 2003 13:33:39 -0000 1.28
+++ plugin.properties 7 Dec 2004 18:42:39 -0000
@@ -94,3 +94,5 @@
# Menus
searchMenu.label= Se&arch
+# Indexer
+CDTIndexerProperty.name=C/C++ Indexer
\ No newline at end of file
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.53.2.1
diff -u -r1.53.2.1 plugin.xml
--- plugin.xml 15 Dec 2003 16:05:25 -0000 1.53.2.1
+++ plugin.xml 7 Dec 2004 18:42:39 -0000
@@ -27,9 +27,9 @@
<extension-point id="CElementFilters" name="%elementFiltersName"/>
<extension-point id="BinaryParserPage" name="Binary Parser Page"/>
<!-- =========================================================================== -->
-<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
-<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
<!-- Extension Implementation: must implement org.eclipse.jface.text.ITextHover -->
+<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
+<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
<!-- =========================================================================== -->
<extension-point id="textHovers" name="%textHoversName"/>
@@ -130,8 +130,8 @@
id="org.eclipse.cdt.ui.CView">
</view>
</extension>
-<!-- For C Wizards -->
<!-- The wizards -->
+<!-- For C Wizards -->
<extension
point="org.eclipse.ui.newWizards">
<category
@@ -482,6 +482,15 @@
class="org.eclipse.cdt.ui.dialogs.GNUElfBinaryParserPage"
id="ElfBinaryParserPage">
</parserPage>
+ </extension>
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ objectClass="org.eclipse.core.resources.IProject"
+ name="%CDTIndexerProperty.name"
+ class="org.eclipse.cdt.ui.dialogs.IndexerOptionPropertyPage"
+ id="org.eclipse.cdt.ui.indexer">
+ </page>
</extension>
</plugin>
Index: src/org/eclipse/cdt/internal/ui/CUIMessages.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIMessages.properties,v
retrieving revision 1.2
diff -u -r1.2 CUIMessages.properties
--- src/org/eclipse/cdt/internal/ui/CUIMessages.properties 22 Sep 2003 04:31:51 -0000 1.2
+++ src/org/eclipse/cdt/internal/ui/CUIMessages.properties 7 Dec 2004 18:42:40 -0000
@@ -12,3 +12,7 @@
Drag.move.problem.title=Drag and Drop Problem
Drag.move.problem.message={0} is read only. Do you still wish to delete it?
ExceptionDialog.seeErrorLogMessage=See error log for more details.
+
+IndexerOptions.indexer = C/C++ Indexer
+IndexerOptions.enableIndexing = Enable C/C++ &Indexing
+
Index: src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java
diff -N src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/dialogs/IndexerBlock.java 7 Dec 2004 18:42:40 -0000
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Corp. - Rational Software - initial implementation
+ ******************************************************************************/
+
+package org.eclipse.cdt.ui.dialogs;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class IndexerBlock extends AbstractCOptionPage {
+
+ private IndexerOptionDialogPage optionPage;
+
+
+ private static final String INDEXER_LABEL = "IndexerBlock.label"; //$NON-NLS-1$
+ private static final String INDEXER_DESC = "IndexerBlock.desc"; //$NON-NLS-1$
+
+ public IndexerBlock(){
+ super(CUIPlugin.getResourceString(INDEXER_LABEL));
+ setDescription(CUIPlugin.getResourceString(INDEXER_DESC));
+ optionPage = new IndexerOptionDialogPage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void performApply(IProgressMonitor monitor) throws CoreException {
+ IProject newProject = null;
+ newProject = getContainer().getProject();
+
+ optionPage.persistIndexerValues(newProject);
+
+ boolean indexProject = optionPage.getIndexerValue();
+
+ if (indexProject && newProject != null)
+ CCorePlugin.getDefault().getCoreModel().getIndexManager().indexAll(newProject);
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
+ */
+ public void performDefaults() {
+ // TODO Auto-generated method stub
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite result = new Composite(parent, SWT.NONE);
+ result.setLayout(new GridLayout());
+ result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ optionPage.createControl(result);
+ optionPage.setIndexerValue(true);
+
+ setControl(result);
+
+
+ }
+
+ public boolean isIndexEnabled(){
+ return optionPage.getIndexerValue();
+ }
+
+}
Index: src/org/eclipse/cdt/ui/dialogs/IndexerOptionDialogPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/dialogs/IndexerOptionDialogPage.java
diff -N src/org/eclipse/cdt/ui/dialogs/IndexerOptionDialogPage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/dialogs/IndexerOptionDialogPage.java 7 Dec 2004 18:42:41 -0000
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Corp. - Rational Software - initial implementation
+ ******************************************************************************/
+
+package org.eclipse.cdt.ui.dialogs;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
+import org.eclipse.cdt.internal.ui.CUIMessages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+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.Group;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class IndexerOptionDialogPage extends DialogPage {
+
+ private static final String ENABLE_PREPROCESSOR_PROBLEMS = CUIMessages.getString( "IndexerOptions.enablePreprocessor" ); //$NON-NLS-1$
+ private static final String ENABLE_SEMANTIC_PROBLEMS = CUIMessages.getString( "IndexerOptions.enableSemantic" ); //$NON-NLS-1$
+ private static final String ENABLE_SYNTACTIC_PROBLEMS = CUIMessages.getString( "IndexerOptions.enableSyntactic" ); //$NON-NLS-1$
+ private static final String ENABLE_INDEXING = CUIMessages.getString( "IndexerOptions.enableIndexing" ); //$NON-NLS-1$
+ private static final String INDEXER = CUIMessages.getString("IndexerOptions.indexer" ); //$NON-NLS-1$
+ private static final String INDEXER_PROBLEMS = CUIMessages.getString("IndexerOptions.problemReporting" ); //$NON-NLS-1$
+
+ private Button indexerEnabled;
+ private Button preprocessorProblemsEnabled;
+ private Button syntacticProblemsEnabled;
+ private Button semanticProblemsEnabled;
+
+ public IndexerOptionDialogPage(){
+ super();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite result= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth= 0;
+ layout.verticalSpacing= convertVerticalDLUsToPixels(10);
+ layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ result.setLayout(layout);
+
+ Group group= new Group(result, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ group.setText( INDEXER );
+
+ indexerEnabled = createCheckButton(group, ENABLE_INDEXING );
+
+ setControl(result);
+ }
+
+ /**
+ * Creates a button with the given label and sets the default
+ * configuration data.
+ */
+ private Button createCheckButton( Composite parent, String label )
+ {
+ Button button = new Button( parent, SWT.CHECK | SWT.LEFT );
+ button.setText( label );
+ // FieldEditor GridData
+ GridData data = new GridData();
+ button.setLayoutData( data );
+ return button;
+ }
+
+ public void setIndexerValue(boolean value){
+ indexerEnabled.setSelection(value);
+ }
+
+ public boolean getIndexerValue(){
+ return indexerEnabled.getSelection();
+ }
+
+
+ public void persistIndexerValues(IProject project){
+ ICDescriptor descriptor = null;
+ Element rootElement = null;
+ IProject newProject = null;
+
+ try {
+ newProject = project;
+ descriptor = CCorePlugin.getDefault().getCProjectDescription(newProject);
+ rootElement = descriptor.getProjectData(IndexManager.CDT_INDEXER);
+
+ // Clear out all current children
+ Node child = rootElement.getFirstChild();
+ while (child != null) {
+ rootElement.removeChild(child);
+ child = rootElement.getFirstChild();
+ }
+ Document doc = rootElement.getOwnerDocument();
+
+ boolean indexProject = getIndexerValue();
+
+ saveIndexerEnabled(indexProject, rootElement, doc);
+
+ descriptor.saveProjectData();
+
+ //Update project session property
+
+ project.setSessionProperty(IndexManager.activationKey,new Boolean(indexProject));
+
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void saveIndexerEnabled (boolean indexerEnabled, Element rootElement, Document doc ) {
+
+ Element indexEnabled = doc.createElement(IndexManager.INDEXER_ENABLED);
+ Boolean tempValue= new Boolean(indexerEnabled);
+
+ indexEnabled.setAttribute(IndexManager.INDEXER_VALUE,tempValue.toString());
+ rootElement.appendChild(indexEnabled);
+
+ }
+
+}
Index: src/org/eclipse/cdt/ui/dialogs/IndexerOptionPropertyPage.java
===================================================================
RCS file: src/org/eclipse/cdt/ui/dialogs/IndexerOptionPropertyPage.java
diff -N src/org/eclipse/cdt/ui/dialogs/IndexerOptionPropertyPage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/ui/dialogs/IndexerOptionPropertyPage.java 7 Dec 2004 18:42:41 -0000
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Corp. - Rational Software - initial implementation
+ ******************************************************************************/
+
+package org.eclipse.cdt.ui.dialogs;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.PropertyPage;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+public class IndexerOptionPropertyPage extends PropertyPage {
+
+ private IndexerOptionDialogPage optionPage;
+ private boolean oldIndexerValue;
+ private int oldIndexerProblemsValue;
+ private boolean requestedIndexAll;
+
+ public IndexerOptionPropertyPage(){
+ super();
+ optionPage = new IndexerOptionDialogPage();
+ requestedIndexAll = false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new FillLayout());
+
+ optionPage.createControl(composite);
+ //WorkbenchHelp.setHelp(composite, ICHelpContextIds.PROJECT_INDEXER_PROPERTIES);
+ initialize();
+
+ return composite;
+ }
+
+
+ protected void performDefaults() {
+ initialize();
+ super.performDefaults();
+ }
+
+ private void initialize(){
+ IProject project = getProject();
+
+ try {
+ oldIndexerValue = getIndexerEnabled(project);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ optionPage.setIndexerValue(oldIndexerValue);
+ }
+
+ /*
+ * @see IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+
+ boolean newIndexerValue = optionPage.getIndexerValue();
+
+ boolean indexChanged = (oldIndexerValue != newIndexerValue);
+
+ if ( indexChanged ){
+ //persist new values
+ IProject tempProject = getProject();
+ optionPage.persistIndexerValues(tempProject);
+
+
+ //if indexer is now on send a index all request
+ if( indexChanged && newIndexerValue && !requestedIndexAll ) {
+ CCorePlugin.getDefault().getCoreModel().getIndexManager().indexAll(tempProject);
+ requestedIndexAll = true;
+ } else if( indexChanged && !newIndexerValue ) {
+ CCorePlugin.getDefault().getCoreModel().getIndexManager().discardJobs( tempProject.getName() );
+ }
+ }
+ return true;
+ }
+
+ public IProject getProject(){
+ Object tempElement = getElement();
+ IProject project = null;
+ if (tempElement != null && tempElement instanceof IProject)
+ project = (IProject) tempElement;
+
+ return project;
+ }
+
+ public boolean getIndexerEnabled(IProject project) throws CoreException {
+ // See if there's already one associated with the resource for this
+ // session
+ Boolean indexValue = (Boolean) project.getSessionProperty(IndexManager.activationKey);
+
+ // Try to load one for the project
+ if (indexValue == null) {
+ indexValue = loadIndexerEnabledFromCDescriptor(project);
+ }
+
+ // There is nothing persisted for the session, or saved in a file so
+ // create a build info object
+ if (indexValue != null) {
+ project.setSessionProperty(IndexManager.activationKey, indexValue);
+ }
+ else{
+ //Hmm, no persisted indexer value. Could be an old project - set to true and persist
+ indexValue = new Boolean(true);
+ optionPage.setIndexerValue(true);
+ optionPage.persistIndexerValues(project);
+ }
+
+ return indexValue.booleanValue();
+ }
+
+ /**
+ * Loads dis from .cdtproject file
+ * @param project
+ * @param includes
+ * @param symbols
+ * @throws CoreException
+ */
+ private Boolean loadIndexerEnabledFromCDescriptor(IProject project) throws CoreException {
+ ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
+
+ Node child = descriptor.getProjectData(IndexManager.CDT_INDEXER).getFirstChild();
+ Boolean strBool = null;
+
+ while (child != null) {
+ if (child.getNodeName().equals(IndexManager.INDEXER_ENABLED))
+ strBool = Boolean.valueOf(((Element)child).getAttribute(IndexManager.INDEXER_VALUE));
+
+
+ child = child.getNextSibling();
+ }
+
+ return strBool;
+ }
+
+
+}
Index: .project
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/.project,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 .project
--- .project 15 Dec 2003 16:06:18 -0000 1.1.2.1
+++ .project 7 Dec 2004 18:42:17 -0000
@@ -4,12 +4,17 @@
<comment></comment>
<projects>
<project>org.eclipse.cdt.core</project>
+ <project>org.eclipse.cdt.core.aix</project>
<project>org.eclipse.cdt.core.linux</project>
<project>org.eclipse.cdt.core.qnx</project>
<project>org.eclipse.cdt.core.solaris</project>
<project>org.eclipse.cdt.core.win32</project>
<project>org.eclipse.cdt.managedbuilder.core</project>
<project>org.eclipse.cdt.ui</project>
+ <project>org.eclipse.core.boot</project>
+ <project>org.eclipse.core.resources</project>
+ <project>org.eclipse.core.runtime</project>
+ <project>org.eclipse.ui</project>
</projects>
<buildSpec>
<buildCommand>
Index: src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java,v
retrieving revision 1.2
diff -u -r1.2 NewManagedProjectOptionPage.java
--- src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java 22 Sep 2003 02:31:53 -0000 1.2
+++ src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectOptionPage.java 7 Dec 2004 18:42:17 -0000
@@ -13,6 +13,7 @@
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedProjectOptionBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.cdt.ui.dialogs.IndexerBlock;
import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
@@ -22,13 +23,15 @@
public class NewManagedProjectOptionPage extends NewCProjectWizardOptionPage {
public class ManagedWizardOptionBlock extends ManagedProjectOptionBlock {
-
+ IndexerBlock indexBlock;
+
public ManagedWizardOptionBlock(ICOptionContainer parent) {
super(parent);
}
protected void addTabs() {
addTab(new ReferenceBlock());
+ addTab(indexBlock = new IndexerBlock());
}
}
Index: .project
===================================================================
RCS file: /home/tools/org.eclipse.cdt.make.ui/.project,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 .project
--- .project 15 Dec 2003 16:06:00 -0000 1.4.2.1
+++ .project 7 Dec 2004 18:40:35 -0000
@@ -4,12 +4,17 @@
<comment></comment>
<projects>
<project>org.eclipse.cdt.core</project>
+ <project>org.eclipse.cdt.core.aix</project>
<project>org.eclipse.cdt.core.linux</project>
<project>org.eclipse.cdt.core.qnx</project>
<project>org.eclipse.cdt.core.solaris</project>
<project>org.eclipse.cdt.core.win32</project>
<project>org.eclipse.cdt.make.core</project>
<project>org.eclipse.cdt.ui</project>
+ <project>org.eclipse.core.boot</project>
+ <project>org.eclipse.core.resources</project>
+ <project>org.eclipse.core.runtime</project>
+ <project>org.eclipse.ui</project>
</projects>
<buildSpec>
<buildCommand>
Index: src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java,v
retrieving revision 1.6
diff -u -r1.6 MakeProjectWizardOptionPage.java
--- src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java 3 Sep 2003 20:44:40 -0000 1.6
+++ src/org/eclipse/cdt/make/ui/wizards/MakeProjectWizardOptionPage.java 7 Dec 2004 18:40:35 -0000
@@ -7,6 +7,7 @@
import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
+import org.eclipse.cdt.ui.dialogs.IndexerBlock;
import org.eclipse.cdt.ui.dialogs.ReferenceBlock;
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
@@ -30,7 +31,8 @@
public class MakeProjectWizardOptionPage extends NewCProjectWizardOptionPage {
public class MakeWizardOptionBlock extends MakeProjectOptionBlock {
-
+ IndexerBlock indexBlock;
+
public MakeWizardOptionBlock(ICOptionContainer parent) {
super(parent);
}
@@ -38,6 +40,7 @@
protected void addTabs() {
addTab(new ReferenceBlock());
super.addTabs();
+ addTab(indexBlock = new IndexerBlock());
}
}
Index: index/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/index/ChangeLog,v
retrieving revision 1.24.2.4
diff -u -r1.24.2.4 ChangeLog
--- index/ChangeLog 13 Feb 2004 22:03:10 -0000 1.24.2.4
+++ index/ChangeLog 7 Dec 2004 18:39:40 -0000
@@ -1,3 +1,10 @@
+2004-12-07 Bogdan Gheorghe
+ - Added Index Enablement checking
+
+ * index/org/eclipse/cdt/internal/core/index/search/indexing/IndexManager.java
+ * index/org/eclipse/cdt/internal/core/index/search/indexing/IndexRequest.java
+
+
2004-02-13 Bogdan Gheorghe
PR 51232
Index: index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 IndexManager.java
--- index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java 27 Oct 2003 20:44:57 -0000 1.8.2.1
+++ index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java 7 Dec 2004 18:39:41 -0000
@@ -22,6 +22,8 @@
import java.util.zip.CRC32;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.ICLogConstants;
import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.index.impl.Index;
@@ -37,7 +39,11 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.QualifiedName;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
public class IndexManager extends JobManager implements IIndexConstants {
@@ -67,6 +73,16 @@
public static boolean VERBOSE = false;
+ public final static String INDEX_MODEL_ID = CCorePlugin.PLUGIN_ID + ".newindexmodel"; //$NON-NLS-1$
+ public final static String ACTIVATION = "enable"; //$NON-NLS-1$
+ public final static QualifiedName activationKey = new QualifiedName(INDEX_MODEL_ID, ACTIVATION);
+
+ public static final String INDEXER_ENABLED = "indexEnabled"; //$NON-NLS-1$
+ public static final String INDEXER_PROBLEMS_ENABLED = "indexerProblemsEnabled"; //$NON-NLS-1$
+ public static final String CDT_INDEXER = "cdt_indexer"; //$NON-NLS-1$
+ public static final String INDEXER_VALUE = "indexValue"; //$NON-NLS-1$
+
+
public synchronized void aboutToUpdateIndex(IPath path, Integer newIndexState) {
// newIndexState is either UPDATING_STATE or REBUILDING_STATE
// must tag the index as inconsistent, in case we exit before the update job is started
@@ -105,6 +121,16 @@
* Note: the actual operation is performed in background
*/
public void addSource(IFile resource, IPath indexedContainer){
+
+ IProject project = resource.getProject();
+
+ boolean indexEnabled = false;
+ if (project != null)
+ indexEnabled = isIndexEnabled(project);
+ else
+ org.eclipse.cdt.internal.core.model.Util.log(null, "IndexManager addSource: File has no project associated : " + resource.getName(), ICLogConstants.CDT); //$NON-NLS-1$
+
+
if (CCorePlugin.getDefault() == null) return;
AddCompilationUnitToIndex job = new AddCompilationUnitToIndex(resource, indexedContainer, this);
if (this.awaitingJobsCount() < MAX_FILES_IN_MEMORY) {
@@ -115,7 +141,9 @@
}
public void updateDependencies(IResource resource){
- if (CCorePlugin.getDefault() == null) return;
+ if (CCorePlugin.getDefault() == null || !isIndexEnabled( resource.getProject()) )
+ return;
+
UpdateDependency job = new UpdateDependency(resource);
request(job);
@@ -240,18 +268,26 @@
public void indexAll(IProject project) {
if (CCorePlugin.getDefault() == null) return;
- // check if the same request is not already in the queue
- IndexRequest request = new IndexAllProject(project, this);
- for (int i = this.jobEnd; i > this.jobStart; i--) // NB: don't check job at jobStart, as it may have already started (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32488)
- if (request.equals(this.awaitingJobs[i])) return;
- this.request(request);
+ //check to see if indexing isEnabled for this project
+ boolean indexEnabled = isIndexEnabled(project);
+
+ if (indexEnabled){
+ // check if the same request is not already in the queue
+ IndexRequest request = new IndexAllProject(project, this);
+ for (int i = this.jobEnd; i > this.jobStart; i--) // NB: don't check job at jobStart, as it may have already started (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=32488)
+ if (request.equals(this.awaitingJobs[i])) return;
+ this.request(request);
+ }
}
/**
* Index the content of the given source folder.
*/
public void indexSourceFolder(CProject javaProject, IPath sourceFolder, final char[][] exclusionPattern) {
IProject project = javaProject.getProject();
-
+
+ if( !isIndexEnabled( project ) )
+ return;
+
if (this.jobEnd > this.jobStart) {
// check if a job to index the project is not already in the queue
IndexRequest request = new IndexAllProject(project, this);
@@ -308,7 +344,8 @@
IndexRequest request = null;
if (target instanceof IProject) {
IProject p = (IProject) target;
- request = new IndexAllProject(p, this);
+ if( p.exists() && isIndexEnabled( p ) )
+ request = new IndexAllProject(p, this);
}
if (request != null)
@@ -347,7 +384,10 @@
* Note: the actual operation is performed in background
*/
public void remove(String resourceName, IPath indexedContainer){
- request(new RemoveFromIndex(resourceName, indexedContainer, this));
+ IProject project = CCorePlugin.getWorkspace().getRoot().getProject(indexedContainer.toString());
+
+ if( isIndexEnabled( project ) )
+ request(new RemoveFromIndex(resourceName, indexedContainer, this));
}
/**
* Removes the index for a given path.
@@ -390,7 +430,10 @@
*/
public void removeSourceFolderFromIndex(CProject javaProject, IPath sourceFolder, char[][] exclusionPatterns) {
IProject project = javaProject.getProject();
-
+
+ if( !isIndexEnabled( project ) )
+ return;
+
if (this.jobEnd > this.jobStart) {
// check if a job to index the project is not already in the queue
IndexRequest request = new IndexAllProject(project, this);
@@ -573,4 +616,60 @@
JobManager.verbose("-> index state updated to: " + state + " for: "+indexName); //$NON-NLS-1$ //$NON-NLS-2$
}
}
+
+ /**
+ * @param project
+ * @return
+ */
+ public boolean isIndexEnabled(IProject project) {
+ if( project == null || !project.exists() || !project.isOpen() )
+ return false;
+
+ Boolean indexValue = null;
+
+ try {
+ indexValue = (Boolean) project.getSessionProperty(activationKey);
+ } catch (CoreException e) {
+ }
+
+ if (indexValue != null)
+ return indexValue.booleanValue();
+
+ try {
+ //Load value for project
+ indexValue = loadIndexerEnabledFromCDescriptor(project);
+ if (indexValue != null){
+ project.setSessionProperty(IndexManager.activationKey, indexValue);
+ return indexValue.booleanValue();
+ }
+
+// TODO: Indexer Block Place holder for Managed Make - take out
+ indexValue = new Boolean(true);
+ project.setSessionProperty(IndexManager.activationKey, indexValue);
+ return indexValue.booleanValue();
+ } catch (CoreException e1) {
+ }
+
+ return false;
+ }
+
+ private Boolean loadIndexerEnabledFromCDescriptor(IProject project) throws CoreException {
+ // Check if we have the property in the descriptor
+ // We pass false since we do not want to create the descriptor if it does not exists.
+ ICDescriptor descriptor = CCorePlugin.getDefault().getCProjectDescription(project);
+ Boolean strBool = null;
+ if (descriptor != null) {
+ Node child = descriptor.getProjectData(CDT_INDEXER).getFirstChild();
+
+ while (child != null) {
+ if (child.getNodeName().equals(INDEXER_ENABLED))
+ strBool = Boolean.valueOf(((Element)child).getAttribute(INDEXER_VALUE));
+
+
+ child = child.getNextSibling();
+ }
+ }
+
+ return strBool;
+ }
}
Index: index/org/eclipse/cdt/internal/core/search/indexing/IndexRequest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexRequest.java,v
retrieving revision 1.2
diff -u -r1.2 IndexRequest.java
--- index/org/eclipse/cdt/internal/core/search/indexing/IndexRequest.java 4 Jul 2003 03:02:07 -0000 1.2
+++ index/org/eclipse/cdt/internal/core/search/indexing/IndexRequest.java 7 Dec 2004 18:39:41 -0000
@@ -13,9 +13,11 @@
import java.io.IOException;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.search.processing.IJob;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.cdt.internal.core.index.IIndex;
public abstract class IndexRequest implements IJob {
protected boolean isCancelled = false;
@@ -37,6 +39,10 @@
}
public boolean isReadyToRun() {
+ IProject project = CCorePlugin.getWorkspace().getRoot().getProject(indexPath.segment(0));
+ if ( !project.isAccessible() || !this.manager.isIndexEnabled( project ) )
+ return false;
+
// tag the index as inconsistent
this.manager.aboutToUpdateIndex(indexPath, updatedIndexState());
return true;