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:
parent
cacd52eb8b
commit
95d5594fd0
3 changed files with 17 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,10 +97,13 @@ 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;
|
||||
}
|
||||
return CASE_MATCH_RELEVANCE;
|
||||
}
|
||||
return 0;
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
private int computeTypeRelevance(int type){
|
||||
switch (type){
|
||||
|
@ -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,8 +203,9 @@ public class CompletionEngine implements RelevanceConstants {
|
|||
elementRequestor.stopTimer();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void addNodeToCompletions(IASTNode node, String prefix, int totalNumberOfResults, boolean addStaticMethodsOnly, boolean addStaticFieldsOnly, int parameterIndex){
|
||||
|
|
Loading…
Add table
Reference in a new issue