mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Bug 125576 - PDOM wouldn't turn off.
This commit is contained in:
parent
29c2e5c8da
commit
a8d7b7028c
3 changed files with 25 additions and 19 deletions
|
@ -184,6 +184,8 @@ public class PDOMUpdator extends Job {
|
|||
|
||||
private void processNewProject(final ICProject project) {
|
||||
try {
|
||||
if (!PDOM.isEnabled(project.getProject()))
|
||||
return;
|
||||
project.getProject().accept(new IResourceProxyVisitor() {
|
||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||
if (proxy.getType() == IResource.FILE) {
|
||||
|
|
|
@ -58,6 +58,10 @@ public class PDOM {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isInitialized(IProject project) {
|
||||
return getPreferences(project) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PDOM for the given project.
|
||||
*
|
||||
|
|
|
@ -85,6 +85,9 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
String initialSelected;
|
||||
private IPreferenceStore prefStore=CUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
boolean initialPDOMChecked;
|
||||
boolean pdomChecked;
|
||||
|
||||
public IndexerBlock(){
|
||||
super(INDEXER_LABEL);
|
||||
setDescription(INDEXER_DESCRIPTION);
|
||||
|
@ -216,15 +219,18 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
}
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (indexerUsePDOM.getSelection()) {
|
||||
pdomChecked = true;
|
||||
indexersComboBox.select(nullIndexerIndex);
|
||||
setPage();
|
||||
indexersComboBox.setEnabled(false);
|
||||
} else
|
||||
} else {
|
||||
pdomChecked = false;
|
||||
indexersComboBox.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
indexerUsePDOM.setSelection(prefStore.getBoolean(CCorePlugin.USE_PDOM_PREF));
|
||||
|
||||
pdomChecked = initialPDOMChecked = prefStore.getBoolean(CCorePlugin.USE_PDOM_PREF);
|
||||
indexerUsePDOM.setSelection(initialPDOMChecked);
|
||||
//TODO: Put in some logic to deal with old CDT project: upgrade old projects
|
||||
//to use the Classic CDT Indexer
|
||||
|
||||
|
@ -381,18 +387,16 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
|
||||
if (indexerID != null) {
|
||||
ICOptionContainer container = getContainer();
|
||||
IProject project = null;
|
||||
if (container != null){
|
||||
project=container.getProject();
|
||||
} else {
|
||||
project = ((AbstractIndexerPage) currentPage).getCurrentProject();
|
||||
}
|
||||
final IProject project = (container != null)
|
||||
? container.getProject()
|
||||
: ((AbstractIndexerPage) currentPage).getCurrentProject();
|
||||
|
||||
if ( project != null) {
|
||||
PDOM.setEnabled(project, indexerUsePDOM.isEnabled());
|
||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||
|
||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||
if (initialPDOMChecked != pdomChecked)
|
||||
PDOM.setEnabled(project, pdomChecked);
|
||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
|
||||
descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerID);
|
||||
|
@ -416,7 +420,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
|
||||
if (prefStore != null) {
|
||||
prefStore.setValue(CCorePlugin.USE_PDOM_PREF, indexerUsePDOM.getEnabled());
|
||||
prefStore.setValue(CCorePlugin.USE_PDOM_PREF, pdomChecked);
|
||||
//First clean out the old indexer settings
|
||||
String indexerId=prefStore.getString(CCorePlugin.PREF_INDEXER);
|
||||
ICOptionPage tempPage = getIndexerPage(indexerId);
|
||||
|
@ -479,7 +483,10 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
* @param project
|
||||
*/
|
||||
public void setIndexerID(String indexerID, IProject project) {
|
||||
indexerUsePDOM.setSelection(PDOM.isEnabled(project));
|
||||
if (PDOM.isInitialized(project)) {
|
||||
initialPDOMChecked = pdomChecked = PDOM.isEnabled(project);
|
||||
indexerUsePDOM.setSelection(initialPDOMChecked);
|
||||
}
|
||||
//Get the corresponding text for the given indexer id
|
||||
selectedIndexerId = getIndexerPageName(indexerID);
|
||||
//Store the currently selected indexer id
|
||||
|
@ -523,11 +530,4 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
|
||||
}
|
||||
|
||||
public boolean getUsePDOM() {
|
||||
IProject project = getProject();
|
||||
if (project == null)
|
||||
return false;
|
||||
|
||||
return PDOM.isEnabled(project);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue