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
|
* @return
|
||||||
*/
|
*/
|
||||||
public static TemplateParameterManager getInstance() {
|
public synchronized static TemplateParameterManager getInstance() {
|
||||||
int index = findFreeCounter();
|
int index = findFreeCounter();
|
||||||
if( index == -1 )
|
if( index == -1 )
|
||||||
return new TemplateParameterManager(++counter);
|
return new TemplateParameterManager(++counter);
|
||||||
|
@ -82,7 +82,7 @@ final class TemplateParameterManager
|
||||||
return counters[ index ];
|
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 )
|
if( c.counterId > 0 && c.counterId < NUMBER_OF_INSTANCES )
|
||||||
instancesUsed[ c.counterId ] = false;
|
instancesUsed[ c.counterId ] = false;
|
||||||
|
|
|
@ -2137,6 +2137,7 @@ public class ParserSymbolTable {
|
||||||
|
|
||||||
static protected class LookupData
|
static protected class LookupData
|
||||||
{
|
{
|
||||||
|
protected static final TypeFilter ANY_FILTER = new TypeFilter( TypeInfo.t_any );
|
||||||
public Set ambiguities;
|
public Set ambiguities;
|
||||||
public String name;
|
public String name;
|
||||||
public Map usingDirectives;
|
public Map usingDirectives;
|
||||||
|
@ -2164,11 +2165,12 @@ public class ParserSymbolTable {
|
||||||
|
|
||||||
public LookupData( String n, TypeInfo.eType t ){
|
public LookupData( String n, TypeInfo.eType t ){
|
||||||
name = n;
|
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 ) {
|
public LookupData( String n, TypeFilter f ) {
|
||||||
name = n;
|
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;
|
package org.eclipse.cdt.internal.ui.text.contentassist;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.CharArrayReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
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.cdt.ui.CUIPlugin;
|
||||||
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.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
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.prefixEquals(prefix.toCharArray(), proposalName.toCharArray(), true /* do not ignore case */)) {
|
||||||
if(CharOperation.equals(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;
|
return CASE_MATCH_RELEVANCE + EXACT_NAME_MATCH_RELEVANCE;
|
||||||
}
|
} else {
|
||||||
return CASE_MATCH_RELEVANCE;
|
return CASE_MATCH_RELEVANCE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private int computeTypeRelevance(int type){
|
private int computeTypeRelevance(int type){
|
||||||
switch (type){
|
switch (type){
|
||||||
case ICElement.C_VARIABLE_LOCAL:
|
case ICElement.C_VARIABLE_LOCAL:
|
||||||
|
@ -148,11 +152,7 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
IResource currentResource = sourceUnit.getResource();
|
IResource currentResource = sourceUnit.getResource();
|
||||||
IPath realPath = currentResource.getLocation();
|
IPath realPath = currentResource.getLocation();
|
||||||
IProject project = currentResource.getProject();
|
IProject project = currentResource.getProject();
|
||||||
Reader reader = null;
|
Reader reader = new BufferedReader( new CharArrayReader( sourceUnit.getContents() ));
|
||||||
try {
|
|
||||||
reader = ParserUtil.createResourceReader(sourceUnit.getResource());
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
}
|
|
||||||
|
|
||||||
//Get the scanner info
|
//Get the scanner info
|
||||||
IScannerInfo scanInfo = new ScannerInfo();
|
IScannerInfo scanInfo = new ScannerInfo();
|
||||||
|
@ -203,9 +203,10 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
elementRequestor.stopTimer();
|
elementRequestor.stopTimer();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addNodeToCompletions(IASTNode node, String prefix, int totalNumberOfResults, boolean addStaticMethodsOnly, boolean addStaticFieldsOnly, int parameterIndex){
|
private void addNodeToCompletions(IASTNode node, String prefix, int totalNumberOfResults, boolean addStaticMethodsOnly, boolean addStaticFieldsOnly, int parameterIndex){
|
||||||
if(node instanceof IASTField){
|
if(node instanceof IASTField){
|
||||||
|
|
Loading…
Add table
Reference in a new issue