mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +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) {
|
private void processNewProject(final ICProject project) {
|
||||||
try {
|
try {
|
||||||
|
if (!PDOM.isEnabled(project.getProject()))
|
||||||
|
return;
|
||||||
project.getProject().accept(new IResourceProxyVisitor() {
|
project.getProject().accept(new IResourceProxyVisitor() {
|
||||||
public boolean visit(IResourceProxy proxy) throws CoreException {
|
public boolean visit(IResourceProxy proxy) throws CoreException {
|
||||||
if (proxy.getType() == IResource.FILE) {
|
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.
|
* Get the PDOM for the given project.
|
||||||
*
|
*
|
||||||
|
|
|
@ -85,6 +85,9 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
String initialSelected;
|
String initialSelected;
|
||||||
private IPreferenceStore prefStore=CUIPlugin.getDefault().getPreferenceStore();
|
private IPreferenceStore prefStore=CUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
|
||||||
|
boolean initialPDOMChecked;
|
||||||
|
boolean pdomChecked;
|
||||||
|
|
||||||
public IndexerBlock(){
|
public IndexerBlock(){
|
||||||
super(INDEXER_LABEL);
|
super(INDEXER_LABEL);
|
||||||
setDescription(INDEXER_DESCRIPTION);
|
setDescription(INDEXER_DESCRIPTION);
|
||||||
|
@ -216,15 +219,18 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
if (indexerUsePDOM.getSelection()) {
|
if (indexerUsePDOM.getSelection()) {
|
||||||
|
pdomChecked = true;
|
||||||
indexersComboBox.select(nullIndexerIndex);
|
indexersComboBox.select(nullIndexerIndex);
|
||||||
setPage();
|
setPage();
|
||||||
indexersComboBox.setEnabled(false);
|
indexersComboBox.setEnabled(false);
|
||||||
} else
|
} else {
|
||||||
|
pdomChecked = false;
|
||||||
indexersComboBox.setEnabled(true);
|
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
|
//TODO: Put in some logic to deal with old CDT project: upgrade old projects
|
||||||
//to use the Classic CDT Indexer
|
//to use the Classic CDT Indexer
|
||||||
|
|
||||||
|
@ -381,18 +387,16 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
|
|
||||||
if (indexerID != null) {
|
if (indexerID != null) {
|
||||||
ICOptionContainer container = getContainer();
|
ICOptionContainer container = getContainer();
|
||||||
IProject project = null;
|
final IProject project = (container != null)
|
||||||
if (container != null){
|
? container.getProject()
|
||||||
project=container.getProject();
|
: ((AbstractIndexerPage) currentPage).getCurrentProject();
|
||||||
} else {
|
|
||||||
project = ((AbstractIndexerPage) currentPage).getCurrentProject();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( project != null) {
|
if ( project != null) {
|
||||||
PDOM.setEnabled(project, indexerUsePDOM.isEnabled());
|
|
||||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||||
|
|
||||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||||
|
if (initialPDOMChecked != pdomChecked)
|
||||||
|
PDOM.setEnabled(project, pdomChecked);
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
|
descriptor.remove(CCorePlugin.INDEXER_UNIQ_ID);
|
||||||
descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerID);
|
descriptor.create(CCorePlugin.INDEXER_UNIQ_ID,indexerID);
|
||||||
|
@ -416,7 +420,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
|
|
||||||
if (prefStore != null) {
|
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
|
//First clean out the old indexer settings
|
||||||
String indexerId=prefStore.getString(CCorePlugin.PREF_INDEXER);
|
String indexerId=prefStore.getString(CCorePlugin.PREF_INDEXER);
|
||||||
ICOptionPage tempPage = getIndexerPage(indexerId);
|
ICOptionPage tempPage = getIndexerPage(indexerId);
|
||||||
|
@ -479,7 +483,10 @@ public class IndexerBlock extends AbstractCOptionPage {
|
||||||
* @param project
|
* @param project
|
||||||
*/
|
*/
|
||||||
public void setIndexerID(String indexerID, IProject 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
|
//Get the corresponding text for the given indexer id
|
||||||
selectedIndexerId = getIndexerPageName(indexerID);
|
selectedIndexerId = getIndexerPageName(indexerID);
|
||||||
//Store the currently selected indexer id
|
//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