mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Indexer watchdog patch
This commit is contained in:
parent
050a97e1c7
commit
85666c920f
8 changed files with 150 additions and 8 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2004-04-12 Bogdan Gheorghe
|
||||||
|
Added Indexer watchdog
|
||||||
|
|
||||||
2004-04-12 Bogdan Gheorghe
|
2004-04-12 Bogdan Gheorghe
|
||||||
Added Enumerator and Derived types to index
|
Added Enumerator and Derived types to index
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class AddCompilationUnitToIndex extends AddFileToIndex {
|
||||||
}
|
}
|
||||||
protected boolean indexDocument(IIndex index) throws IOException {
|
protected boolean indexDocument(IIndex index) throws IOException {
|
||||||
if (!initializeContents()) return false;
|
if (!initializeContents()) return false;
|
||||||
index.add(new IFileDocument(resource, this.contents), new SourceIndexer(resource));
|
index.add(new IFileDocument(resource, this.contents), new SourceIndexer(resource, manager.getTimeout()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public boolean initializeContents() {
|
public boolean initializeContents() {
|
||||||
|
|
|
@ -32,12 +32,14 @@ import org.eclipse.cdt.internal.core.search.SimpleLookupTable;
|
||||||
import org.eclipse.cdt.internal.core.search.processing.IJob;
|
import org.eclipse.cdt.internal.core.search.processing.IJob;
|
||||||
import org.eclipse.cdt.internal.core.search.processing.JobManager;
|
import org.eclipse.cdt.internal.core.search.processing.JobManager;
|
||||||
import org.eclipse.cdt.internal.core.sourcedependency.UpdateDependency;
|
import org.eclipse.cdt.internal.core.sourcedependency.UpdateDependency;
|
||||||
|
import org.eclipse.cdt.utils.TimeOut;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
|
|
||||||
|
|
||||||
public class IndexManager extends JobManager implements IIndexConstants {
|
public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
|
@ -67,6 +69,8 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
|
|
||||||
public static boolean VERBOSE = false;
|
public static boolean VERBOSE = false;
|
||||||
|
|
||||||
|
private TimeOut timeoutThread = null;
|
||||||
|
|
||||||
public synchronized void aboutToUpdateIndex(IPath path, Integer newIndexState) {
|
public synchronized void aboutToUpdateIndex(IPath path, Integer newIndexState) {
|
||||||
// newIndexState is either UPDATING_STATE or REBUILDING_STATE
|
// newIndexState is either UPDATING_STATE or REBUILDING_STATE
|
||||||
// must tag the index as inconsistent, in case we exit before the update job is started
|
// must tag the index as inconsistent, in case we exit before the update job is started
|
||||||
|
@ -410,8 +414,18 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
this.monitors = new HashMap(5);
|
this.monitors = new HashMap(5);
|
||||||
this.indexStates = null;
|
this.indexStates = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.timeoutThread == null){
|
||||||
|
this.timeoutThread = new TimeOut("Indexer TimeOut Thread"); //$NON-NLS-1$
|
||||||
|
this.timeoutThread.setThreadPriority(Thread.MAX_PRIORITY);
|
||||||
|
|
||||||
|
Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
|
prefs.setDefault(SourceIndexer.CDT_INDEXER_TIMEOUT,20000);
|
||||||
|
}
|
||||||
|
|
||||||
this.indexNames = new SimpleLookupTable();
|
this.indexNames = new SimpleLookupTable();
|
||||||
this.cCorePluginLocation = null;
|
this.cCorePluginLocation = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveIndex(IIndex index) throws IOException {
|
public void saveIndex(IIndex index) throws IOException {
|
||||||
|
@ -509,6 +523,8 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.timeoutThread = null;
|
||||||
|
|
||||||
super.shutdown();
|
super.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,4 +589,11 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
JobManager.verbose("-> index state updated to: " + state + " for: "+indexName); //$NON-NLS-1$ //$NON-NLS-2$
|
JobManager.verbose("-> index state updated to: " + state + " for: "+indexName); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TimeOut getTimeout() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return this.timeoutThread ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.parser.IParser;
|
import org.eclipse.cdt.core.parser.IParser;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
|
import org.eclipse.cdt.core.parser.ParseError;
|
||||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||||
import org.eclipse.cdt.core.parser.ParserFactoryError;
|
import org.eclipse.cdt.core.parser.ParserFactoryError;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
@ -34,6 +35,7 @@ import org.eclipse.cdt.core.parser.ParserUtil;
|
||||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.internal.core.index.IDocument;
|
import org.eclipse.cdt.internal.core.index.IDocument;
|
||||||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||||
|
import org.eclipse.cdt.utils.TimeOut;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -57,10 +59,18 @@ public class SourceIndexer extends AbstractIndexer {
|
||||||
//public static final String[] FILE_TYPES= new String[] {"cpp","c", "cc", "cxx"}; //$NON-NLS-1$
|
//public static final String[] FILE_TYPES= new String[] {"cpp","c", "cc", "cxx"}; //$NON-NLS-1$
|
||||||
|
|
||||||
//protected DefaultProblemFactory problemFactory= new DefaultProblemFactory(Locale.getDefault());
|
//protected DefaultProblemFactory problemFactory= new DefaultProblemFactory(Locale.getDefault());
|
||||||
IFile resourceFile;
|
public static final String CDT_INDEXER_TIMEOUT= "CDT_INDEXER_TIMEOUT"; //$NON-NLS-1$
|
||||||
|
|
||||||
SourceIndexer(IFile resourceFile) {
|
IFile resourceFile;
|
||||||
this.resourceFile = resourceFile;
|
TimeOut timeOut = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param resource
|
||||||
|
* @param out
|
||||||
|
*/
|
||||||
|
public SourceIndexer(IFile resource, TimeOut timeOut) {
|
||||||
|
this.resourceFile = resource;
|
||||||
|
this.timeOut = timeOut;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the file types the <code>IIndexer</code> handles.
|
* Returns the file types the <code>IIndexer</code> handles.
|
||||||
|
@ -73,7 +83,7 @@ public class SourceIndexer extends AbstractIndexer {
|
||||||
// Add the name of the file to the index
|
// Add the name of the file to the index
|
||||||
output.addDocument(document);
|
output.addDocument(document);
|
||||||
// Create a new Parser
|
// Create a new Parser
|
||||||
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, resourceFile);
|
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, resourceFile, timeOut);
|
||||||
//requestor.removeMarkers(resourceFile);
|
//requestor.removeMarkers(resourceFile);
|
||||||
|
|
||||||
//Get the scanner info
|
//Get the scanner info
|
||||||
|
@ -105,6 +115,12 @@ public class SourceIndexer extends AbstractIndexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
// start timer
|
||||||
|
String timeOut = CCorePlugin.getDefault().getPluginPreferences().getString(CDT_INDEXER_TIMEOUT);
|
||||||
|
Integer timeOutValue = new Integer(timeOut);
|
||||||
|
requestor.setTimeout(timeOutValue.intValue());
|
||||||
|
requestor.startTimer();
|
||||||
boolean retVal = parser.parse();
|
boolean retVal = parser.parse();
|
||||||
|
|
||||||
if (!retVal)
|
if (!retVal)
|
||||||
|
@ -122,11 +138,15 @@ public class SourceIndexer extends AbstractIndexer {
|
||||||
org.eclipse.cdt.internal.core.model.Util.log(null, "Out Of Memory error: " + vmErr.getMessage() + " on File: " + resourceFile.getName(), ICLogConstants.CDT); //$NON-NLS-1$ //$NON-NLS-2$
|
org.eclipse.cdt.internal.core.model.Util.log(null, "Out Of Memory error: " + vmErr.getMessage() + " on File: " + resourceFile.getName(), ICLogConstants.CDT); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ParseError e){
|
||||||
|
org.eclipse.cdt.internal.core.model.Util.log(null, "Parser Timeout on File: " + resourceFile.getName(), ICLogConstants.CDT); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
catch ( Exception ex ){
|
catch ( Exception ex ){
|
||||||
if (ex instanceof IOException)
|
if (ex instanceof IOException)
|
||||||
throw (IOException) ex;
|
throw (IOException) ex;
|
||||||
}
|
}
|
||||||
finally{
|
finally{
|
||||||
|
requestor.stopTimer();
|
||||||
//Release all resources
|
//Release all resources
|
||||||
parser=null;
|
parser=null;
|
||||||
currentProject = null;
|
currentProject = null;
|
||||||
|
|
|
@ -61,10 +61,13 @@ import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
||||||
|
import org.eclipse.cdt.utils.TimeOut;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author bgheorgh
|
* @author bgheorgh
|
||||||
|
@ -85,10 +88,14 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
||||||
private IASTInclusion currentInclude = null;
|
private IASTInclusion currentInclude = null;
|
||||||
private LinkedList includeStack = new LinkedList();
|
private LinkedList includeStack = new LinkedList();
|
||||||
|
|
||||||
public SourceIndexerRequestor(SourceIndexer indexer, IFile resourceFile) {
|
private IProgressMonitor pm = new NullProgressMonitor();
|
||||||
|
private TimeOut timeoutThread = null;
|
||||||
|
|
||||||
|
public SourceIndexerRequestor(SourceIndexer indexer, IFile resourceFile, TimeOut timeOut) {
|
||||||
super();
|
super();
|
||||||
this.indexer = indexer;
|
this.indexer = indexer;
|
||||||
this.resourceFile = resourceFile;
|
this.resourceFile = resourceFile;
|
||||||
|
this.timeoutThread = timeOut;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
||||||
|
@ -587,12 +594,42 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.text.contentassist.ITimeoutThreadOwner#setTimeout(int)
|
||||||
|
*/
|
||||||
|
public void setTimeout(int timeout) {
|
||||||
|
timeoutThread.setTimeout(timeout);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.text.contentassist.ITimeoutThreadOwner#startTimer()
|
||||||
|
*/
|
||||||
|
public void startTimer() {
|
||||||
|
createProgressMonitor();
|
||||||
|
timeoutThread.startTimer();
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.text.contentassist.ITimeoutThreadOwner#stopTimer()
|
||||||
|
*/
|
||||||
|
public void stopTimer() {
|
||||||
|
timeoutThread.stopTimer();
|
||||||
|
pm.setCanceled(false);
|
||||||
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#parserTimeout()
|
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#parserTimeout()
|
||||||
*/
|
*/
|
||||||
public boolean parserTimeout() {
|
public boolean parserTimeout() {
|
||||||
// TODO Auto-generated method stub
|
if ((pm != null) && (pm.isCanceled()))
|
||||||
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Creates a new progress monitor with each start timer
|
||||||
|
*/
|
||||||
|
private void createProgressMonitor() {
|
||||||
|
pm.setCanceled(false);
|
||||||
|
timeoutThread.setProgressMonitor(pm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,17 @@ public class TimeOut implements Runnable {
|
||||||
// long timerTime=0;
|
// long timerTime=0;
|
||||||
private int threadPriority = Thread.MIN_PRIORITY + 1;
|
private int threadPriority = Thread.MIN_PRIORITY + 1;
|
||||||
boolean debug = false;
|
boolean debug = false;
|
||||||
|
private String threadName = null;
|
||||||
|
|
||||||
public TimeOut(){
|
public TimeOut(){
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TimeOut(String threadName){
|
||||||
|
this.threadName = threadName;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
while (this.thread != null) {
|
while (this.thread != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -86,7 +92,12 @@ public class TimeOut implements Runnable {
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
enabled=false;
|
enabled=false;
|
||||||
thread = new Thread(this, "Time Out Thread"); //$NON-NLS-1$
|
if (threadName!=null){
|
||||||
|
thread = new Thread(this, threadName);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
thread = new Thread(this, "Time Out Thread"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.setPriority(threadPriority);
|
thread.setPriority(threadPriority);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2004-04-12 Bogdan Gheorghe
|
||||||
|
Added Indexer Timeout field to Work In Progress Preference page
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/ui/preferences/WorkInProgressPreferencePage.java
|
||||||
|
|
||||||
2004-04-12 Hoda Amer
|
2004-04-12 Hoda Amer
|
||||||
Fix for bug#57692 : [Content Assist] CompletionEngine::completionOnSingleNameReference() behaviour incorrect
|
Fix for bug#57692 : [Content Assist] CompletionEngine::completionOnSingleNameReference() behaviour incorrect
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,12 @@ package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.internal.core.search.indexing.SourceIndexer;
|
||||||
import org.eclipse.cdt.internal.ui.search.CSearchPage;
|
import org.eclipse.cdt.internal.ui.search.CSearchPage;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.preference.PreferencePage;
|
import org.eclipse.jface.preference.PreferencePage;
|
||||||
|
@ -24,6 +27,8 @@ import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||||
|
|
||||||
|
@ -39,8 +44,10 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
|
|
||||||
private Combo fExternLinks;
|
private Combo fExternLinks;
|
||||||
private Button fExternEnabled;
|
private Button fExternEnabled;
|
||||||
|
private Button fIProblemMarkers;
|
||||||
|
|
||||||
protected OverlayPreferenceStore fOverlayStore;
|
protected OverlayPreferenceStore fOverlayStore;
|
||||||
|
private Text fTextControl;
|
||||||
|
|
||||||
public WorkInProgressPreferencePage(){
|
public WorkInProgressPreferencePage(){
|
||||||
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
setPreferenceStore(CUIPlugin.getDefault().getPreferenceStore());
|
||||||
|
@ -51,6 +58,7 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
ArrayList overlayKeys = new ArrayList();
|
ArrayList overlayKeys = new ArrayList();
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CSearchPage.EXTERNALMATCH_ENABLED));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CSearchPage.EXTERNALMATCH_ENABLED));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, CSearchPage.EXTERNALMATCH_VISIBLE));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, CSearchPage.EXTERNALMATCH_VISIBLE));
|
||||||
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, SourceIndexer.CDT_INDEXER_TIMEOUT));
|
||||||
|
|
||||||
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
|
OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
|
||||||
overlayKeys.toArray(keys);
|
overlayKeys.toArray(keys);
|
||||||
|
@ -107,6 +115,13 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Group indexerTimeoutGroup= new Group(result, SWT.NONE);
|
||||||
|
indexerTimeoutGroup.setLayout(new GridLayout());
|
||||||
|
indexerTimeoutGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
indexerTimeoutGroup.setText("Indexer Timeout"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
fTextControl = (Text) addTextField( indexerTimeoutGroup, "Time out (ms)","TimeOut",6,0,true);
|
||||||
|
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -120,6 +135,8 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
fExternLinks.select(fOverlayStore.getInt(CSearchPage.EXTERNALMATCH_VISIBLE));
|
fExternLinks.select(fOverlayStore.getInt(CSearchPage.EXTERNALMATCH_VISIBLE));
|
||||||
fExternLinks.setEnabled(extEnabled);
|
fExternLinks.setEnabled(extEnabled);
|
||||||
|
|
||||||
|
fTextControl.setText(fOverlayStore.getString(SourceIndexer.CDT_INDEXER_TIMEOUT));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,11 +171,36 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
button.setLayoutData( data );
|
button.setLayoutData( data );
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
|
||||||
|
|
||||||
|
Label labelControl = new Label(composite, SWT.NONE);
|
||||||
|
labelControl.setText(label);
|
||||||
|
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
|
gd.horizontalIndent = indentation;
|
||||||
|
labelControl.setLayoutData(gd);
|
||||||
|
|
||||||
|
Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
|
||||||
|
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
|
||||||
|
gd.widthHint = convertWidthInCharsToPixels(textLimit + 1);
|
||||||
|
textControl.setLayoutData(gd);
|
||||||
|
textControl.setTextLimit(textLimit);
|
||||||
|
|
||||||
|
return textControl;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* @see IPreferencePage#performOk()
|
* @see IPreferencePage#performOk()
|
||||||
*/
|
*/
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
|
fOverlayStore.setValue(SourceIndexer.CDT_INDEXER_TIMEOUT, fTextControl.getText());
|
||||||
|
|
||||||
fOverlayStore.propagate();
|
fOverlayStore.propagate();
|
||||||
|
|
||||||
|
// Store IProblem Marker value in CCorePlugin Preferences
|
||||||
|
Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
|
prefs.setValue(SourceIndexer.CDT_INDEXER_TIMEOUT,fOverlayStore.getString(SourceIndexer.CDT_INDEXER_TIMEOUT));
|
||||||
|
CCorePlugin.getDefault().savePluginPreferences();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +210,7 @@ public class WorkInProgressPreferencePage extends PreferencePage
|
||||||
public static void initDefaults(IPreferenceStore store) {
|
public static void initDefaults(IPreferenceStore store) {
|
||||||
store.setDefault(CSearchPage.EXTERNALMATCH_ENABLED, false);
|
store.setDefault(CSearchPage.EXTERNALMATCH_ENABLED, false);
|
||||||
store.setDefault(CSearchPage.EXTERNALMATCH_VISIBLE, 0);
|
store.setDefault(CSearchPage.EXTERNALMATCH_VISIBLE, 0);
|
||||||
|
store.setDefault(SourceIndexer.CDT_INDEXER_TIMEOUT, "20000");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue