1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix content assist to work w/WorkingCopy again.

Further memory enhancements.
This commit is contained in:
John Camelon 2004-05-20 21:40:56 +00:00
parent cacd52eb8b
commit 95d5594fd0
3 changed files with 17 additions and 14 deletions

View file

@ -74,7 +74,7 @@ final class TemplateParameterManager
/**
* @return
*/
public static TemplateParameterManager getInstance() {
public synchronized static TemplateParameterManager getInstance() {
int index = findFreeCounter();
if( index == -1 )
return new TemplateParameterManager(++counter);
@ -82,7 +82,7 @@ final class TemplateParameterManager
return counters[ index ];
}
public static void returnInstance( TemplateParameterManager c )
public synchronized static void returnInstance( TemplateParameterManager c )
{
if( c.counterId > 0 && c.counterId < NUMBER_OF_INSTANCES )
instancesUsed[ c.counterId ] = false;

View file

@ -2137,6 +2137,7 @@ public class ParserSymbolTable {
static protected class LookupData
{
protected static final TypeFilter ANY_FILTER = new TypeFilter( TypeInfo.t_any );
public Set ambiguities;
public String name;
public Map usingDirectives;
@ -2164,11 +2165,12 @@ public class ParserSymbolTable {
public LookupData( String n, TypeInfo.eType t ){
name = n;
filter = new TypeFilter( t );
if( t == TypeInfo.t_any ) filter = ANY_FILTER;
else filter = new TypeFilter( t );
}
public LookupData( String n, TypeFilter f ) {
name = n;
filter = ( f != null ) ? f : new TypeFilter( TypeInfo.t_any );
filter = ( f != null ) ? f : ANY_FILTER;
}
}

View file

@ -10,6 +10,8 @@
**********************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
import java.io.BufferedReader;
import java.io.CharArrayReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
@ -65,7 +67,6 @@ import org.eclipse.cdt.internal.ui.util.Util;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
@ -96,11 +97,14 @@ public class CompletionEngine implements RelevanceConstants {
if (CharOperation.prefixEquals(prefix.toCharArray(), proposalName.toCharArray(), true /* do not ignore case */)) {
if(CharOperation.equals(prefix.toCharArray(), proposalName.toCharArray(), true /* do not ignore case */)) {
return CASE_MATCH_RELEVANCE + EXACT_NAME_MATCH_RELEVANCE;
}
} else {
return CASE_MATCH_RELEVANCE;
}
}
else {
return 0;
}
}
private int computeTypeRelevance(int type){
switch (type){
case ICElement.C_VARIABLE_LOCAL:
@ -148,11 +152,7 @@ public class CompletionEngine implements RelevanceConstants {
IResource currentResource = sourceUnit.getResource();
IPath realPath = currentResource.getLocation();
IProject project = currentResource.getProject();
Reader reader = null;
try {
reader = ParserUtil.createResourceReader(sourceUnit.getResource());
} catch (CoreException e1) {
}
Reader reader = new BufferedReader( new CharArrayReader( sourceUnit.getContents() ));
//Get the scanner info
IScannerInfo scanInfo = new ScannerInfo();
@ -203,9 +203,10 @@ public class CompletionEngine implements RelevanceConstants {
elementRequestor.stopTimer();
}
return result;
}
} else {
return null;
}
}
private void addNodeToCompletions(IASTNode node, String prefix, int totalNumberOfResults, boolean addStaticMethodsOnly, boolean addStaticFieldsOnly, int parameterIndex){
if(node instanceof IASTField){