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

Content Assist Work : Moved logging and testing to the UI side of CDT

This commit is contained in:
Hoda Amer 2004-01-15 18:06:14 +00:00
parent e69bf2d4b5
commit 1196d4a5ff
52 changed files with 3184 additions and 2658 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,159 +0,0 @@
/*******************************************************************************
* Copyright (c) 2001 Rational Software Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.core.codeassist.tests;
import java.io.FileInputStream;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
/**
* @author hamer
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CompletionProposalsTest extends TestCase{
private final static long MAGIC_NUMBER = 1000;
private ICProject fCProject;
private IFile headerFile;
private IFile bodyFile;
private NullProgressMonitor monitor;
public static Test suite() {
TestSuite suite= new TestSuite(CompletionProposalsTest.class.getName());
suite.addTest(new CompletionProposalsTest("testCompletionProposals"));
return suite;
}
public CompletionProposalsTest(String name) {
super(name);
}
protected void setUp() throws Exception {
monitor = new NullProgressMonitor();
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
fCProject= CProjectHelper.createCProject("TestProject1", "bin");
bodyFile = fCProject.getProject().getFile("CompletionProposalsTestStart.cpp");
headerFile = fCProject.getProject().getFile("CompletionProposalsTestStart.h");
if ((!headerFile.exists()) || (!bodyFile.exists())) {
try{
FileInputStream bodyFileIn = new FileInputStream(pluginRoot+ "resources/cfiles/CompletionProposalsTestStart.cpp");
bodyFile.create(bodyFileIn,false, monitor);
FileInputStream headerFileIn = new FileInputStream(pluginRoot+ "resources/cfiles/CompletionProposalsTestStart.h");
headerFile.create(headerFileIn,false, monitor);
} catch (CoreException e) {
e.printStackTrace();
}
}
if (!fCProject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
addNatureToProject(fCProject.getProject(), CCProjectNature.CC_NATURE_ID, null);
}
// use the new indexer
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
indexManager.reset();
}
private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = proj.getDescription();
String[] prevNatures= description.getNatureIds();
String[] newNatures= new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length]= natureId;
description.setNatureIds(newNatures);
proj.setDescription(description, monitor);
}
protected void tearDown() {
try{
CProjectHelper.delete(fCProject);
}
catch (ResourceException e) {}
catch (CoreException e) {}
}
public void testCompletionProposals(){
try{
TranslationUnit headerTu = new TranslationUnit(fCProject, headerFile);
TranslationUnit tu = new TranslationUnit(fCProject, bodyFile);
String buffer = tu.getBuffer().getContents();
Document document = new Document(buffer);
int pos = buffer.indexOf(" a ") + 2;
CCompletionProcessor completionProcessor = new CCompletionProcessor(null);
IWorkingCopy wc = null;
try{
wc = tu.getWorkingCopy();
}catch (CModelException e){
fail("Failed to get working copy");
}
ICompletionProposal[] results = completionProcessor.evalProposals(document, pos, wc, null);
try {
Thread.sleep(MAGIC_NUMBER);
} catch (InterruptedException e1) {
fail( "Bogdan's hack did not suffice");
}
// assertEquals(results.length, 8);
for (int i = 0; i<results.length; i++){
ICompletionProposal proposal = results[i];
String displayString = proposal.getDisplayString();
switch(i){
case 0:
// assertEquals(displayString, "aVariable : int");
break;
case 1:
// assertEquals(displayString, "aFunction() bool");
break;
case 2:
// assertEquals(displayString, "aClass");
break;
case 3:
// assertEquals(displayString, "anotherClass");
break;
case 4:
// assertEquals(displayString, "anEnumeration");
break;
case 5:
// assertEquals(displayString, "AStruct");
break;
case 6:
// assertEquals(displayString, "AMacro");
break;
}
}
} catch(CModelException e){
}
}
}

View file

@ -29,8 +29,8 @@ import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.cdt.testplugin.TestPluginLauncher;

View file

@ -21,7 +21,7 @@ import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.model.IBuffer;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.cdt.testplugin.TestPluginLauncher;

View file

@ -1,24 +0,0 @@
#include "CompletionProposalsTestStart.h"
#define AMacro(x) x+1
int aVariable = 0;
bool aFunction();
enum anEnumeration {
first,
second,
third
};
struct AStruct{
int aStructField;
};
void foo(){
int aLocalDeclaration = 1;
}
void anotherClass::anotherMethod(){
a
};

View file

@ -1,11 +0,0 @@
class aClass {
public:
int aField;
int aMethod();
};
class anotherClass {
public:
int anotherField;
void anotherMethod();
};

View file

@ -11,7 +11,6 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.build.managed.tests.ManagedBuildTests;
import org.eclipse.cdt.core.build.managed.tests.StandardBuildTests;
import org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest;
import org.eclipse.cdt.core.indexer.tests.DependencyTests;
import org.eclipse.cdt.core.indexer.tests.IndexManagerTests;
import org.eclipse.cdt.core.model.failedTests.CModelElementsFailedTests;
@ -59,7 +58,6 @@ public class AutomatedIntegrationSuite extends TestSuite {
suite.addTest(ElementDeltaTests.suite());
suite.addTest(WorkingCopyTests.suite());
suite.addTest(SearchTestSuite.suite());
suite.addTestSuite( CompletionProposalsTest.class);
suite.addTest(DependencyTests.suite());
//Indexer Tests need to be run after any indexer client tests
//as the last test shuts down the indexing thread

View file

@ -6,9 +6,6 @@ org.eclipse.cdt.core/debug/model=false
# Reports parser activity
org.eclipse.cdt.core/debug/parser=false
# Reports contentAssist activity
org.eclipse.cdt.core/debug/contentassist=false
# Reports background indexer activity: indexing, saving index file, index queries
org.eclipse.cdt.core/debug/indexmanager=false

View file

@ -1,3 +1,6 @@
2004-01-15 Hoda Amer
Moved Content Assist log to the UI plugin
2004-01-13 Alain Magloire
Small fix on in the elf parser, we have to check for

View file

@ -7,7 +7,6 @@ package org.eclipse.cdt.core.model;
import java.util.Map;
import org.eclipse.cdt.internal.core.model.IBufferFactory;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* Represents an entire C translation unit (<code>.c</code> source file).

View file

@ -1,4 +1,4 @@
package org.eclipse.cdt.internal.core.model;
package org.eclipse.cdt.core.model;
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
@ -12,8 +12,6 @@ package org.eclipse.cdt.internal.core.model;
***********************************************************************/
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.model.*;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ElementChangedEvent;
import org.eclipse.cdt.core.model.IArchive;

View file

@ -23,6 +23,4 @@ public interface IDebugLogConstants {
public static final DebugLogConstant PARSER = new DebugLogConstant( 1 );
public static final DebugLogConstant MODEL = new DebugLogConstant ( 2 );
public static final DebugLogConstant CONTENTASSIST = new DebugLogConstant ( 3 );
}

View file

@ -11,6 +11,7 @@ import java.util.Iterator;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.*;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IBuffer;
import org.eclipse.cdt.core.model.ICElement;

View file

@ -26,7 +26,6 @@ public class Util implements ICLogConstants {
public static boolean VERBOSE_PARSER = false;
public static boolean VERBOSE_MODEL = false;
public static boolean VERBOSE_CONTENTASSIST = false;
private Util() {
}
@ -218,9 +217,6 @@ public class Util implements ICLogConstants {
else if (client.equals(IDebugLogConstants.MODEL)){
return VERBOSE_MODEL;
}
else if (client.equals(IDebugLogConstants.CONTENTASSIST)){
return VERBOSE_CONTENTASSIST;
}
return false;
}

View file

@ -66,7 +66,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
}
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#commit(boolean, org.eclipse.core.runtime.IProgressMonitor)
* @see org.eclipse.cdt.core.model.IWorkingCopy#commit(boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
public void commit(boolean force, IProgressMonitor monitor)
throws CModelException {
@ -106,7 +106,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
}
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#destroy()
* @see org.eclipse.cdt.core.model.IWorkingCopy#destroy()
*/
public void destroy() {
if (--this.useCount > 0) {
@ -171,7 +171,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
}
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#getOriginalElement()
* @see org.eclipse.cdt.core.model.IWorkingCopy#getOriginalElement()
*/
public ITranslationUnit getOriginalElement() {
return new TranslationUnit(getParent(), getFile());
@ -281,7 +281,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#reconcile()
* @see org.eclipse.cdt.core.model.IWorkingCopy#reconcile()
*/
public IMarker[] reconcile() throws CModelException {
reconcile(false, null);
@ -289,7 +289,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
}
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#reconcile(boolean, org.eclipse.core.runtime.IProgressMonitor)
* @see org.eclipse.cdt.core.model.IWorkingCopy#reconcile(boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
public boolean reconcile(boolean forceProblemDetection, IProgressMonitor monitor)
throws CModelException {
@ -343,7 +343,7 @@ public class WorkingCopy extends TranslationUnit implements IWorkingCopy {
return somethingChanged;
}
/**
* @see org.eclipse.cdt.internal.core.model.IWorkingCopy#restore()
* @see org.eclipse.cdt.core.model.IWorkingCopy#restore()
*/
public void restore() throws CModelException{
if (this.useCount == 0) throw newNotPresentException(); //was destroyed

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@ public interface IASTNode {
public static final LookupKind ALL = new LookupKind( 0 );
public static final LookupKind STRUCTURES = new LookupKind( 1 );
public static final LookupKind STRUCS = new LookupKind( 2 );
public static final LookupKind STRUCTS = new LookupKind( 2 );
public static final LookupKind UNIONS = new LookupKind( 3 );
public static final LookupKind CLASSES = new LookupKind( 4 );
public static final LookupKind FUNCTIONS = new LookupKind( 5 );

View file

@ -74,7 +74,7 @@ public class TypeFilter {
return false;
}
}
else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t_bool, TypeInfo.t_enumerator ) )
else if ( typeInfo.isType( TypeInfo.t_type ) || typeInfo.isType( TypeInfo.t_bool, TypeInfo.t_void ) )
{
if( ( acceptedKinds.contains( LookupKind.VARIABLES ) && !symbolIsMember && !symbolIsLocal ) ||
( acceptedKinds.contains( LookupKind.LOCAL_VARIABLES ) && !symbolIsMember && symbolIsLocal ) ||
@ -99,7 +99,7 @@ public class TypeFilter {
else if ( kind == LookupKind.STRUCTURES ) { acceptedTypes.add( TypeInfo.t_class );
acceptedTypes.add( TypeInfo.t_struct );
acceptedTypes.add( TypeInfo.t_union ); }
else if ( kind == LookupKind.STRUCS ) { acceptedTypes.add( TypeInfo.t_struct ); }
else if ( kind == LookupKind.STRUCTS ) { acceptedTypes.add( TypeInfo.t_struct ); }
else if ( kind == LookupKind.UNIONS ) { acceptedTypes.add( TypeInfo.t_union ); }
else if ( kind == LookupKind.CLASSES ) { acceptedTypes.add( TypeInfo.t_class ); }
else if ( kind == LookupKind.CONSTRUCTORS ){ acceptedTypes.add( TypeInfo.t_constructor ); }

View file

@ -119,7 +119,7 @@ public class ASTUtil {
type.append("(");
type.append(getPointerOperator(po));
type.append(")");
String[] parameters =getParameterTypes(declaration.getParameters());
String[] parameters =getParameterTypes(declaration.getParameters(), false /* replace with takeVarArgs() later*/);
type.append(getParametersString(parameters));
}
return type.toString();
@ -200,19 +200,25 @@ public class ASTUtil {
public static String[] getFunctionParameterTypes(IASTFunction functionDeclaration)
{
Iterator parameters = functionDeclaration.getParameters();
return getParameterTypes(parameters);
return getParameterTypes(parameters, functionDeclaration.takesVarArgs());
}
public static String[] getParameterTypes(Iterator parameters){
public static String[] getParameterTypes(Iterator parameters, boolean takesVarArgs){
List paramList = new ArrayList();
while (parameters.hasNext()){
IASTParameterDeclaration param = (IASTParameterDeclaration)parameters.next();
paramList.add(getType(param));
}
String[] parameterTypes = new String[paramList.size()];
int paramListSize = paramList.size();
if(takesVarArgs)
paramListSize++;
String[] parameterTypes = new String[paramListSize];
for(int i=0; i<paramList.size(); ++i){
parameterTypes[i] = (String)paramList.get(i);
}
// add the ellipse to the parameter type list
if(takesVarArgs)
parameterTypes[paramListSize-1] = "...";
return parameterTypes;
}
public static String getParametersString(String[] parameterTypes)

View file

@ -20,9 +20,9 @@ import java.util.Iterator;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.Util;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.search.AcceptMatchOperation;
import org.eclipse.cdt.internal.core.search.CSearchScope;
import org.eclipse.cdt.internal.core.search.CWorkspaceScope;

View file

@ -26,6 +26,7 @@ import java.util.LinkedList;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.parser.DefaultProblemHandler;
import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.core.parser.IProblem;
@ -80,7 +81,6 @@ import org.eclipse.cdt.core.search.ICSearchPattern;
import org.eclipse.cdt.core.search.ICSearchResultCollector;
import org.eclipse.cdt.core.search.ICSearchScope;
import org.eclipse.cdt.core.search.IMatch;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;

View file

@ -17,6 +17,7 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.core.search.SearchEngine;
@ -26,7 +27,6 @@ import org.eclipse.cdt.internal.core.model.BufferManager;
import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.model.DeltaProcessor;
import org.eclipse.cdt.internal.core.model.IBufferFactory;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.Util;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.internal.core.search.indexing.SourceIndexer;
@ -731,9 +731,6 @@ public class CCorePlugin extends Plugin {
option = Platform.getDebugOption(MODEL);
if(option != null) Util.VERBOSE_MODEL = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
option = Platform.getDebugOption(CONTENTASSIST);
if(option != null) Util.VERBOSE_CONTENTASSIST = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
boolean indexFlag = false;
option = Platform.getDebugOption(INDEX_MANAGER);

View file

@ -3,7 +3,26 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="ui"/>
<classpathentry kind="src" path="core"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface.text_3.0.0/jfacetextsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jface.text_3.0.0/jfacetext.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.text_3.0.0/textsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.text_3.0.0/text.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.resources_3.0.0/resourcessrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_3.0.0/resources.jar"/>
<classpathentry kind="src" path="/org.eclipse.cdt.ui"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_WIN32_WIN32_X86_SRC/org.eclipse.swt.win32_3.0.0/ws/win32/swtsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.swt.win32_3.0.0/ws/win32/swt.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui_3.0.0/uisrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui_3.0.0/ui.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.jface_3.0.0/jfacesrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jface_3.0.0/jface.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.ui.workbench_3.0.0/workbenchsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench_3.0.0/workbench.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_JDT_SOURCE_SRC/org.junit_3.8.1/junitsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.junit_3.8.1/junit.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.runtime.compatibility_3.0.0/compatibilitysrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime.compatibility_3.0.0/compatibility.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.core.runtime_3.0.0/runtimesrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_3.0.0/runtime.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi.util_3.0.0/utilsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi.util_3.0.0/util.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi_3.0.0/osgisrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi_3.0.0/osgi.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi_3.0.0/coresrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi_3.0.0/core.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi_3.0.0/resolversrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi_3.0.0/resolver.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi_3.0.0/defaultAdaptorsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi_3.0.0/defaultAdaptor.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.osgi_3.0.0/eclipseAdaptorsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.osgi_3.0.0/eclipseAdaptor.jar"/>
<classpathentry sourcepath="ORG_ECLIPSE_PLATFORM_SOURCE_SRC/org.eclipse.update.configurator_3.0.0/configuratorsrc.zip" kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.update.configurator_3.0.0/configurator.jar"/>
<classpathentry kind="src" path="/org.eclipse.cdt.core"/>
<classpathentry kind="src" path="/org.eclipse.cdt.core.tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -4,6 +4,7 @@
<comment></comment>
<projects>
<project>org.eclipse.cdt.core</project>
<project>org.eclipse.cdt.core.tests</project>
<project>org.eclipse.cdt.ui</project>
</projects>
<buildSpec>

View file

@ -1,3 +1,8 @@
2004-01-15 Hoda Amer
Moved Content Assist testing to the UI.tests plugin
Started a new framework of JUnit tests for content assist.
Added Content assist tests to the AutomatedSuite test of the UI.tests plugin
2003-07-17 Peter Graves
Remove the usage of the assert, as it's a reserved keyword in
Java 1.4 (Bugzilla 40377)

View file

@ -19,6 +19,8 @@
<import plugin="org.eclipse.ui"/>
<import plugin="org.junit"/>
<import plugin="org.eclipse.core.runtime.compatibility"/>
<import plugin="org.eclipse.cdt.core"/>
<import plugin="org.eclipse.cdt.core.tests"/>
</requires>

View file

@ -0,0 +1,30 @@
#define AMacro(x) x+1
int aVariable = 0;
bool aFunction();
enum anEnumeration {
aFirstEnum,
aSecondEnum,
aThirdEnum
};
struct AStruct{
int aStructField;
};
void anotherFunction(){
int aLocalDeclaration = 1;
}
class aClass {
public:
int aField;
int aMethod();
};
class anotherClass {
public:
int anotherField;
void anotherMethod();
};

View file

@ -0,0 +1,6 @@
#include "CompletionTestStart.h"
void anotherClass::anotherMethod()
{
a
}

View file

@ -0,0 +1,7 @@
#include "CompletionTestStart.h"
void anotherClass::anotherMethod()
{
aClass c;
c.a
}

View file

@ -0,0 +1,3 @@
#include "CompletionTestStart.h"
a

View file

@ -9,6 +9,9 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.ui.tests.text.PartitionTokenScannerTest;
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsTest1;
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsTest2;
import org.eclipse.cdt.ui.tests.text.contentassist.CompletionProposalsTest3;
import org.eclipse.cdt.ui.tests.textmanipulation.TextBufferTest;
@ -32,8 +35,9 @@ public class AutomatedSuite extends TestSuite {
public AutomatedSuite() {
addTest(PartitionTokenScannerTest.suite());
addTest(TextBufferTest.suite());
addTest(CompletionProposalsTest1.suite());
addTest(CompletionProposalsTest2.suite());
addTest(CompletionProposalsTest3.suite());
}
}

View file

@ -0,0 +1,200 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist;
/**
* @author hamer
*
* This abstract class is the base class for all completion proposals test cases
*
*/
import java.io.FileInputStream;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
import org.eclipse.cdt.core.parser.ast.IASTNode;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
public abstract class CompletionProposalsTest extends TestCase{
private final String pluginName = "org.eclipse.cdt.ui.tests";
private final String projectName = "TestProject1";
private final String projectType = "bin";
private ICProject fCProject;
private IFile fCFile;
private IFile fHeaderFile;
private NullProgressMonitor monitor;
private TranslationUnit tu = null;
private String buffer = "";
private Document document = null;
public CompletionProposalsTest(String name) {
super(name);
}
/*
* Derived classes have to provide there abstract methods
*/
protected abstract String getFileName();
protected abstract String getFileFullPath();
protected abstract String getHeaderFileName();
protected abstract String getHeaderFileFullPath();
protected abstract int getCompletionPosition();
protected abstract String getExpectedScopeClassName();
protected abstract String getExpectedContextClassName();
protected abstract String getExpectedPrefix();
protected abstract IASTCompletionNode.CompletionKind getExpectedKind();
protected abstract String[] getExpectedResultsValues();
protected void setUp() throws Exception {
monitor = new NullProgressMonitor();
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin(pluginName).find(new Path("/")).getFile();
fCProject= CProjectHelper.createCProject(projectName, projectType);
fHeaderFile = fCProject.getProject().getFile(getHeaderFileName());
String fileName = getFileName();
fCFile = fCProject.getProject().getFile(fileName);
if ( (!fCFile.exists()) &&( !fHeaderFile.exists() )) {
try{
String fileFullPath = pluginRoot+ getFileFullPath();
FileInputStream headerFileIn = new FileInputStream(pluginRoot+ getHeaderFileFullPath());
fHeaderFile.create(headerFileIn,false, monitor);
FileInputStream bodyFileIn = new FileInputStream(fileFullPath);
fCFile.create(bodyFileIn,false, monitor);
} catch (CoreException e) {
e.printStackTrace();
}
}
if (!fCProject.getProject().hasNature(CCProjectNature.CC_NATURE_ID)) {
addNatureToProject(fCProject.getProject(), CCProjectNature.CC_NATURE_ID, null);
}
// use the new indexer
IndexManager indexManager = CCorePlugin.getDefault().getCoreModel().getIndexManager();
indexManager.reset();
}
private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = proj.getDescription();
String[] prevNatures= description.getNatureIds();
String[] newNatures= new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length]= natureId;
description.setNatureIds(newNatures);
proj.setDescription(description, monitor);
}
protected void tearDown() {
try{
CProjectHelper.delete(fCProject);
}
catch (ResourceException e) {}
catch (CoreException e) {}
}
public void testCompletionProposals(){
try{
// setup the translation unit, the buffer and the document
TranslationUnit header = new TranslationUnit(fCProject, fHeaderFile);
tu = new TranslationUnit(fCProject, fCFile);
buffer = tu.getBuffer().getContents();
document = new Document(buffer);
int pos = getCompletionPosition();
CCompletionProcessor completionProcessor = new CCompletionProcessor(null);
IWorkingCopy wc = null;
try{
wc = tu.getWorkingCopy();
}catch (CModelException e){
fail("Failed to get working copy");
}
// call the CompletionProcessor
ICompletionProposal[] results = completionProcessor.evalProposals(document, pos, wc, null);
assertTrue(results != null);
// check the completion node
IASTCompletionNode completionNode = completionProcessor.getCurrentCompletionNode();
assertNotNull(completionNode);
// scope
IASTScope scope = completionNode.getCompletionScope();
assertNotNull(scope);
String scopeClassName = scope.getClass().getName();
assertTrue(scope.getClass().getName().endsWith(getExpectedScopeClassName()));
// context
IASTNode context = completionNode.getCompletionContext();
if(context == null)
assertTrue(getExpectedContextClassName().equals("null"));
else
assertTrue(context.getClass().getName().endsWith(getExpectedContextClassName()));
// kind
IASTCompletionNode.CompletionKind kind = completionNode.getCompletionKind();
assertTrue(kind == getExpectedKind());
// prefix
String prefix = completionNode.getCompletionPrefix();
assertEquals(prefix, getExpectedPrefix());
String[] expected = getExpectedResultsValues();
assertEquals(results.length, expected.length);
for (int i = 0; i<results.length; i++){
ICompletionProposal proposal = results[i];
String displayString = proposal.getDisplayString();
assertEquals(displayString, expected[i]);
}
} catch(CModelException e){
}
}
/**
* @return Returns the buffer.
*/
public String getBuffer() {
return buffer;
}
/**
* @return Returns the document.
*/
public Document getDocument() {
return document;
}
/**
* @return Returns the tu.
*/
public TranslationUnit getTranslationUnit() {
return tu;
}
}

View file

@ -0,0 +1,125 @@
/*******************************************************************************
* Copyright (c) 2001 Rational Software Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
/**
* @author hamer
*
*/
public class CompletionProposalsTest1 extends CompletionProposalsTest{
private final String fileName = "CompletionTestStart1.cpp";
private final String fileFullPath ="resources/contentassist/" + fileName;
private final String headerFileName = "CompletionTestStart.h";
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedScopeName = "ASTMethod";
private final String expectedContextName = "null";
private final CompletionKind expectedKind = CompletionKind.STATEMENT_START;
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"anotherField : int",
"aVariable : int",
"anotherMethod() void",
"aFunction() bool",
"anotherFunction() void",
"aClass",
"anotherClass",
"anEnumeration",
"AStruct",
// "AMacro",
"asm",
"auto"
};
public CompletionProposalsTest1(String name) {
super(name);
}
public static Test suite() {
TestSuite suite= new TestSuite(CompletionProposalsTest1.class.getName());
suite.addTest(new CompletionProposalsTest1("testCompletionProposals"));
return suite;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
*/
protected int getCompletionPosition() {
return getBuffer().indexOf(" a ") + 2;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
*/
protected String getExpectedScopeClassName() {
return expectedScopeName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
*/
protected String getExpectedContextClassName() {
return expectedContextName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
*/
protected CompletionKind getExpectedKind() {
return expectedKind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
*/
protected String getExpectedPrefix() {
return expectedPrefix;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
*/
protected String[] getExpectedResultsValues() {
return expectedResults;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
*/
protected String getFileName() {
return fileName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
*/
protected String getFileFullPath() {
return fileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
*/
protected String getHeaderFileFullPath() {
return headerFileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
*/
protected String getHeaderFileName() {
return headerFileName;
}
}

View file

@ -0,0 +1,113 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
/**
* @author hamer
*
*/
public class CompletionProposalsTest2 extends CompletionProposalsTest{
private final String fileName = "CompletionTestStart2.cpp";
private final String fileFullPath ="resources/contentassist/" + fileName;
private final String headerFileName = "CompletionTestStart.h";
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedScopeName = "ASTMethod";
private final String expectedContextName = "ASTClassSpecifier";
private final CompletionKind expectedKind = CompletionKind.MEMBER_REFERENCE;
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aField : int",
"aMethod() int"
};
public CompletionProposalsTest2(String name) {
super(name);
}
public static Test suite() {
TestSuite suite= new TestSuite(CompletionProposalsTest2.class.getName());
suite.addTest(new CompletionProposalsTest2("testCompletionProposals"));
return suite;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
*/
protected int getCompletionPosition() {
return getBuffer().indexOf(" c.a ") + 4;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
*/
protected String getExpectedScopeClassName() {
return expectedScopeName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
*/
protected String getExpectedContextClassName() {
return expectedContextName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
*/
protected CompletionKind getExpectedKind() {
return expectedKind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
*/
protected String getExpectedPrefix() {
return expectedPrefix;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
*/
protected String[] getExpectedResultsValues() {
return expectedResults;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
*/
protected String getFileName() {
return fileName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
*/
protected String getFileFullPath() {
return fileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
*/
protected String getHeaderFileFullPath() {
return headerFileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
*/
protected String getHeaderFileName() {
return headerFileName;
}
}

View file

@ -0,0 +1,118 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.ui.tests.text.contentassist;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
/**
* @author hamer
*
*/
public class CompletionProposalsTest3 extends CompletionProposalsTest{
private final String fileName = "CompletionTestStart3.cpp";
private final String fileFullPath ="resources/contentassist/" + fileName;
private final String headerFileName = "CompletionTestStart.h";
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedScopeName = "ASTCompilationUnit";
private final String expectedContextName = "null";
private final CompletionKind expectedKind = CompletionKind.VARIABLE_TYPE;
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aClass",
"anotherClass",
"anEnumeration",
"AStruct",
// "AMacro",
"asm",
"auto"
};
public CompletionProposalsTest3(String name) {
super(name);
}
public static Test suite() {
TestSuite suite= new TestSuite(CompletionProposalsTest2.class.getName());
suite.addTest(new CompletionProposalsTest2("testCompletionProposals"));
return suite;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
*/
protected int getCompletionPosition() {
return getBuffer().indexOf(" c.a ") + 4;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedScope()
*/
protected String getExpectedScopeClassName() {
return expectedScopeName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedContext()
*/
protected String getExpectedContextClassName() {
return expectedContextName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedKind()
*/
protected CompletionKind getExpectedKind() {
return expectedKind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedPrefix()
*/
protected String getExpectedPrefix() {
return expectedPrefix;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getExpectedResultsValues()
*/
protected String[] getExpectedResultsValues() {
return expectedResults;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileName()
*/
protected String getFileName() {
return fileName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getFileFullPath()
*/
protected String getFileFullPath() {
return fileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileFullPath()
*/
protected String getHeaderFileFullPath() {
return headerFileFullPath;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getHeaderFileName()
*/
protected String getHeaderFileName() {
return headerFileName;
}
}

View file

@ -0,0 +1,5 @@
org.eclipse.cdt.ui/debug=true
# Reports contentAssist activity
org.eclipse.cdt.ui/debug/contentassist=false

View file

@ -1,3 +1,6 @@
2004-01-15 Hoda Amer
Moved Content Assist log to the UI plugin
2004-01-15 John Camelon
Updated references to LookupResult as it was renamed to ILookupResult.
Updated references of ParserFactoryException to ParserFactoryError.

View file

@ -9,7 +9,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.WorkingCopy;
import org.eclipse.cdt.internal.ui.CFileElementWorkingCopy;
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;

View file

@ -14,8 +14,8 @@ import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBuffer;
import org.eclipse.cdt.core.model.IOpenable;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.IBufferFactory;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.CStatusConstants;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IEditorInputDelegate;

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
import org.eclipse.cdt.internal.ui.text.CPairMatcher;

View file

@ -16,7 +16,7 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
import org.eclipse.core.runtime.CoreException;

View file

@ -7,7 +7,7 @@ package org.eclipse.cdt.internal.ui.text;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.editor.CContentOutlinePage;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.ui.CUIPlugin;

View file

@ -13,6 +13,7 @@ import java.util.List;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.IASTCompletionNode;
import org.eclipse.cdt.core.search.BasicSearchMatch;
@ -20,7 +21,6 @@ import org.eclipse.cdt.core.search.BasicSearchResultCollector;
import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.core.search.ICSearchScope;
import org.eclipse.cdt.core.search.SearchEngine;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
import org.eclipse.cdt.internal.corext.template.ContextType;
import org.eclipse.cdt.internal.corext.template.ContextTypeRegistry;
@ -119,6 +119,7 @@ public class CCompletionProcessor implements IContentAssistProcessor {
private int fCurrentOffset = 0;
private IWorkingCopy fCurrentSourceUnit = null;
private IASTCompletionNode fCurrentCompletionNode = null;
private int fNumberOfComputedResults= 0;
private ITextViewer fTextViewer;
@ -383,12 +384,18 @@ public class CCompletionProcessor implements IContentAssistProcessor {
// clear the completion list at the result collector
resultCollector.reset(viewer);
IASTCompletionNode completionNode = addProposalsFromModel(completions);
addProposalsFromSearch(completionNode, completions);
addProposalsFromCompletionContributors(completionNode, completions);
addProposalsFromTemplates(viewer, completionNode, completions);
fCurrentCompletionNode = addProposalsFromModel(completions);
if(fCurrentCompletionNode != null){
addProposalsFromSearch(fCurrentCompletionNode, completions);
addProposalsFromCompletionContributors(fCurrentCompletionNode, completions);
addProposalsFromTemplates(viewer, fCurrentCompletionNode, completions);
return order ( (ICCompletionProposal[]) completions.toArray(new ICCompletionProposal[0]) );
return order ( (ICCompletionProposal[]) completions.toArray(new ICCompletionProposal[0]) );
}
else{
return null;
}
}
private void addProposalsFromTemplates(ITextViewer viewer, IASTCompletionNode completionNode, List completions){
@ -670,4 +677,12 @@ public class CCompletionProcessor implements IContentAssistProcessor {
} // end switch
} // end while
}
/**
* @return Returns the fCurrentCompletionNode.
* This method is added for JUnit tests.
*/
public IASTCompletionNode getCurrentCompletionNode() {
return fCurrentCompletionNode;
}
}

View file

@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IScannerInfo;
@ -50,10 +51,9 @@ import org.eclipse.cdt.core.parser.ast.IASTCompletionNode.CompletionKind;
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
import org.eclipse.cdt.core.parser.ast.IASTNode.ILookupResult;
import org.eclipse.cdt.internal.core.CharOperation;
import org.eclipse.cdt.internal.core.model.IDebugLogConstants;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.Util;
import org.eclipse.cdt.internal.core.parser.util.ASTUtil;
import org.eclipse.cdt.internal.ui.util.IDebugLogConstants;
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;
@ -176,7 +176,7 @@ public class CompletionEngine implements RelevanceConstants{
IScannerInfo buildScanInfo = provider.getScannerInformation(project);
if( buildScanInfo != null )
scanInfo = new ScannerInfo(buildScanInfo.getDefinedSymbols(), buildScanInfo.getIncludePaths());
}
}
//C or CPP?
ParserLanguage language = CoreModel.getDefault().hasCCNature(project) ? ParserLanguage.CPP : ParserLanguage.C;
@ -339,10 +339,13 @@ public class CompletionEngine implements RelevanceConstants{
}
private void addKeywordsToCompletions(Iterator keywords){
int numOfKeywords = 0;
while (keywords.hasNext()){
String keyword = (String) keywords.next();
addKeywordToCompletions(keyword);
numOfKeywords++;
}
log("No of Keywords = " + numOfKeywords);
}
private void resetElementNumbers(){
@ -364,6 +367,9 @@ public class CompletionEngine implements RelevanceConstants{
return;
Iterator nodes = result.getNodes();
int numberOfElements = result.getResultsSize();
log("No of Lookup Results = " + numberOfElements);
resetElementNumbers();
while (nodes.hasNext()){
IASTNode node = (IASTNode) nodes.next();
@ -418,7 +424,7 @@ public class CompletionEngine implements RelevanceConstants{
ILookupResult result = null;
// lookup fields and methods with the right visibility
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[7];
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[8];
kinds[0] = IASTNode.LookupKind.FIELDS;
kinds[1] = IASTNode.LookupKind.METHODS;
kinds[2] = IASTNode.LookupKind.VARIABLES;
@ -426,6 +432,8 @@ public class CompletionEngine implements RelevanceConstants{
kinds[4] = IASTNode.LookupKind.ENUMERATIONS;
kinds[5] = IASTNode.LookupKind.NAMESPACES;
kinds[6] = IASTNode.LookupKind.FUNCTIONS;
kinds[7] = IASTNode.LookupKind.LOCAL_VARIABLES;
result = lookup (searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
addToCompletions (result);
}
@ -491,16 +499,16 @@ public class CompletionEngine implements RelevanceConstants{
IASTScope searchNode = completionNode.getCompletionScope();
// if prefix is not empty
if (completionNode.getCompletionPrefix().length() > 0){
// here we have to look for anything that could be referenced within this scope
// here we have to look for any names that could be referenced within this scope
// 1. lookup local variables, global variables, functions, methods, structures, enums, macros, and namespaces
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[7];
kinds[0] = IASTNode.LookupKind.LOCAL_VARIABLES;
kinds[1] = IASTNode.LookupKind.FIELDS;
kinds[2] = IASTNode.LookupKind.VARIABLES;
kinds[3] = IASTNode.LookupKind.STRUCTURES;
kinds[4] = IASTNode.LookupKind.ENUMERATIONS;
kinds[5] = IASTNode.LookupKind.METHODS;
kinds[6] = IASTNode.LookupKind.FUNCTIONS;
kinds[3] = IASTNode.LookupKind.METHODS;
kinds[4] = IASTNode.LookupKind.FUNCTIONS;
kinds[5] = IASTNode.LookupKind.NAMESPACES;
kinds[6] = IASTNode.LookupKind.ENUMERATORS;
ILookupResult result = lookup(searchNode, completionNode.getCompletionPrefix(), kinds, completionNode.getCompletionContext());
addToCompletions(result);
} else // prefix is empty
@ -571,6 +579,7 @@ public class CompletionEngine implements RelevanceConstants{
}
public IASTCompletionNode complete(IWorkingCopy sourceUnit, int completionOffset) {
long startTime = System.currentTimeMillis();
// 1- Parse the translation unit
IASTCompletionNode completionNode = parse(sourceUnit, completionOffset);
@ -584,7 +593,13 @@ public class CompletionEngine implements RelevanceConstants{
logNode("Scope = " , completionNode.getCompletionScope());
logNode("Context = " , completionNode.getCompletionContext());
logKind("Kind = ", completionNode.getCompletionKind().getEnumValue());
logKind("Kind = ", completionNode.getCompletionKind());
log ("Prefix = " + completionNode.getCompletionPrefix());
if (completionNode.getCompletionScope() == null){
log("Null Completion Scope Error");
return null;
}
// set the completionStart and the completionLength
completionStart = completionOffset - completionNode.getCompletionPrefix().length();
@ -592,149 +607,118 @@ public class CompletionEngine implements RelevanceConstants{
CompletionKind kind = completionNode.getCompletionKind();
// 2- Check the return value
if(kind == IASTCompletionNode.CompletionKind.MEMBER_REFERENCE){
if(kind == CompletionKind.MEMBER_REFERENCE){
// completionOnMemberReference
completionOnMemberReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.SCOPED_REFERENCE){
else if(kind == CompletionKind.SCOPED_REFERENCE){
// completionOnMemberReference
completionOnScopedReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.FIELD_TYPE){
else if(kind == CompletionKind.STATEMENT_START )
{
// CompletionOnStatementStart
completionOnStatementStart(completionNode);
}
else if(kind == CompletionKind.FIELD_TYPE){
// CompletionOnFieldType
completionOnFieldType(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.VARIABLE_TYPE) {
else if(kind == CompletionKind.VARIABLE_TYPE) {
// CompletionOnVariableType
completionOnVariableType(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.ARGUMENT_TYPE){
else if(kind == CompletionKind.ARGUMENT_TYPE){
// CompletionOnArgumentType
completionOnTypeReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE){
else if(kind == CompletionKind.SINGLE_NAME_REFERENCE){
// CompletionOnSingleNameReference
completionOnSingleNameReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.TYPE_REFERENCE){
else if(kind == CompletionKind.TYPE_REFERENCE){
// CompletionOnStructureReference
completionOnTypeReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.CLASS_REFERENCE){
else if(kind == CompletionKind.CLASS_REFERENCE){
// CompletionOnClassReference
completionOnClassReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.NAMESPACE_REFERENCE){
else if(kind == CompletionKind.NAMESPACE_REFERENCE){
// completionOnNamespaceReference
completionOnNamespaceReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.EXCEPTION_REFERENCE){
else if(kind == CompletionKind.EXCEPTION_REFERENCE){
// CompletionOnExceptionReference
completionOnExceptionReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.MACRO_REFERENCE){
else if(kind == CompletionKind.MACRO_REFERENCE){
// CompletionOnMacroReference
completionOnMacroReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.FUNCTION_REFERENCE){
else if(kind == CompletionKind.FUNCTION_REFERENCE){
// completionOnFunctionReference
completionOnFunctionReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.CONSTRUCTOR_REFERENCE){
else if(kind == CompletionKind.CONSTRUCTOR_REFERENCE){
// completionOnConstructorReference
completionOnConstructorReference(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.KEYWORD){
else if(kind == CompletionKind.KEYWORD){
// CompletionOnKeyword
completionOnKeyword(completionNode);
}
else if(kind == IASTCompletionNode.CompletionKind.STATEMENT_START )
{
completionOnStatementStart(completionNode);
}
addKeywordsToCompletions( completionNode.getKeywords());
if((kind != CompletionKind.MEMBER_REFERENCE) &&(kind != CompletionKind.SCOPED_REFERENCE)){
addKeywordsToCompletions( completionNode.getKeywords());
}
log("Time spent in Completion Engine = "+ ( System.currentTimeMillis() - startTime ) + " ms");
return completionNode;
}
private void logKind(String message, int kindEnum){
private void logKind(String message, IASTCompletionNode.CompletionKind kind){
if (! CCorePlugin.getDefault().isDebugging() && Util.isActive(IDebugLogConstants.CONTENTASSIST) )
return;
String kindStr = "";
switch (kindEnum){
case 0:
if(kind == IASTCompletionNode.CompletionKind.MEMBER_REFERENCE)
kindStr = "MEMBER_REFERENCE";
break;
case 1:
else if(kind == IASTCompletionNode.CompletionKind.SCOPED_REFERENCE)
kindStr = "SCOPED_REFERENCE";
break;
case 2:
kindStr = "FIELD_TYPE";
break;
case 3:
kindStr = "VARIABLE_TYPE";
break;
case 4:
else if(kind == IASTCompletionNode.CompletionKind.FIELD_TYPE)
kindStr = "FIELD_TYPE Class Scope";
else if(kind == IASTCompletionNode.CompletionKind.VARIABLE_TYPE)
kindStr = "VARIABLE_TYPE Global Scope";
else if(kind == IASTCompletionNode.CompletionKind.ARGUMENT_TYPE)
kindStr = "ARGUMENT_TYPE";
break;
case 5:
else if(kind == IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE)
kindStr = "SINGLE_NAME_REFERENCE";
break;
case 6:
else if(kind == IASTCompletionNode.CompletionKind.TYPE_REFERENCE)
kindStr = "TYPE_REFERENCE";
break;
case 7:
else if(kind == IASTCompletionNode.CompletionKind.CLASS_REFERENCE)
kindStr = "CLASS_REFERENCE";
break;
case 8:
else if(kind == IASTCompletionNode.CompletionKind.NAMESPACE_REFERENCE)
kindStr = "NAMESPACE_REFERENCE";
break;
case 9:
else if(kind == IASTCompletionNode.CompletionKind.EXCEPTION_REFERENCE)
kindStr = "EXCEPTION_REFERENCE";
break;
case 10:
else if(kind == IASTCompletionNode.CompletionKind.MACRO_REFERENCE)
kindStr = "MACRO_REFERENCE";
break;
case 11:
else if(kind == IASTCompletionNode.CompletionKind.FUNCTION_REFERENCE)
kindStr = "FUNCTION_REFERENCE";
break;
case 12:
else if(kind == IASTCompletionNode.CompletionKind.CONSTRUCTOR_REFERENCE)
kindStr = "CONSTRUCTOR_REFERENCE";
break;
case 13:
else if(kind == IASTCompletionNode.CompletionKind.KEYWORD)
kindStr = "KEYWORD";
break;
case 14:
else if(kind == IASTCompletionNode.CompletionKind.PREPROCESSOR_DIRECTIVE)
kindStr = "PREPROCESSOR_DIRECTIVE";
break;
case 15:
else if(kind == IASTCompletionNode.CompletionKind.USER_SPECIFIED_NAME)
kindStr = "USER_SPECIFIED_NAME";
break;
case 16:
else if(kind == IASTCompletionNode.CompletionKind.STATEMENT_START)
kindStr = "STATEMENT_START";
break;
case 200:
else if(kind == IASTCompletionNode.CompletionKind.NO_SUCH_KIND)
kindStr = "NO_SUCH_KIND";
break;
}
log (message + kindStr);
}
private void logNode(String message, IASTNode node){
@ -768,6 +752,11 @@ public class CompletionEngine implements RelevanceConstants{
log(message + name);
return;
}
if(node instanceof IASTCodeScope){
String name = "Code Scope";
log(message + name);
return;
}
log(message + node.toString());
return;
@ -780,66 +769,48 @@ public class CompletionEngine implements RelevanceConstants{
StringBuffer kindName = new StringBuffer("Looking For ");
for(int i = 0; i<kinds.length; i++){
LookupKind kind = (LookupKind) kinds[i];
switch (kind.getEnumValue()){
case 0:
if(kind == IASTNode.LookupKind.ALL)
kindName.append("ALL");
break;
case 1:
else if(kind == IASTNode.LookupKind.STRUCTURES)
kindName.append("STRUCTURES");
break;
case 2:
kindName.append("STRUCS");
break;
case 3:
else if(kind == IASTNode.LookupKind.STRUCTS)
kindName.append("STRUCTS");
else if(kind == IASTNode.LookupKind.UNIONS)
kindName.append("UNIONS");
break;
case 4:
else if(kind == IASTNode.LookupKind.CLASSES)
kindName.append("CLASSES");
break;
case 5:
else if(kind == IASTNode.LookupKind.FUNCTIONS)
kindName.append("FUNCTIONS");
break;
case 6:
else if(kind == IASTNode.LookupKind.VARIABLES)
kindName.append("VARIABLES");
break;
case 7:
else if(kind == IASTNode.LookupKind.LOCAL_VARIABLES)
kindName.append("LOCAL_VARIABLES");
break;
case 8:
else if(kind == IASTNode.LookupKind.MEMBERS)
kindName.append("MEMBERS");
break;
case 9:
else if(kind == IASTNode.LookupKind.METHODS)
kindName.append("METHODS");
break;
case 10:
else if(kind == IASTNode.LookupKind.FIELDS)
kindName.append("FIELDS");
break;
case 11:
else if(kind == IASTNode.LookupKind.CONSTRUCTORS)
kindName.append("CONSTRUCTORS");
break;
case 12:
else if(kind == IASTNode.LookupKind.NAMESPACES)
kindName.append("NAMESPACES");
break;
case 13:
else if(kind == IASTNode.LookupKind.MACROS)
kindName.append("MACROS");
break;
case 14:
else if(kind == IASTNode.LookupKind.ENUMERATIONS)
kindName.append("ENUMERATIONS");
break;
case 15:
else if(kind == IASTNode.LookupKind.ENUMERATORS)
kindName.append("ENUMERATORS");
break;
case 16:
else if(kind == IASTNode.LookupKind.THIS)
kindName.append("THIS");
break;
}
kindName.append(", ");
}
log (kindName.toString());
}
private void log(String message){
if (! CCorePlugin.getDefault().isDebugging() && Util.isActive(IDebugLogConstants.CONTENTASSIST))
if (! CUIPlugin.getDefault().isDebugging() && Util.isActive(IDebugLogConstants.CONTENTASSIST))
return;
Util.debugLog(message, IDebugLogConstants.CONTENTASSIST, false);
Util.debugLog(message, IDebugLogConstants.CONTENTASSIST);
}
}

View file

@ -15,8 +15,8 @@ import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.spawner.ProcessFactory;

View file

@ -0,0 +1,30 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.ui.util;
/**
* @author hamer
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public interface IDebugLogConstants {
public class DebugLogConstant {
private DebugLogConstant( int value )
{
this.value = value;
}
private final int value;
}
public static final DebugLogConstant CONTENTASSIST = new DebugLogConstant ( 1 );
}

View file

@ -0,0 +1,50 @@
/**********************************************************************
* Copyright (c) 2004 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.ui.util;
import org.eclipse.cdt.ui.CUIPlugin;
/**
* @author hamer
*
*/
public class Util implements IDebugLogConstants{
public static boolean VERBOSE_CONTENTASSIST = false;
private Util() {
}
/*
* Add a log entry
*/
public static void debugLog(String message, DebugLogConstant client) {
if( CUIPlugin.getDefault() == null ) return;
if ( CUIPlugin.getDefault().isDebugging() && isActive(client)) {
while (message.length() > 100) {
String partial = message.substring(0, 100);
message = message.substring(100);
System.out.println(partial + "\\");
}
if (message.endsWith("\n")) {
System.err.print(message);
} else {
System.out.println(message);
}
}
}
public static boolean isActive(DebugLogConstant client) {
if (client.equals(IDebugLogConstants.CONTENTASSIST)){
return VERBOSE_CONTENTASSIST;
}
return false;
}
}

View file

@ -19,8 +19,8 @@ import java.util.ResourceBundle;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.model.IBufferFactory;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.BuildConsoleManager;
import org.eclipse.cdt.internal.ui.CElementAdapterFactory;
import org.eclipse.cdt.internal.ui.CPluginImages;
@ -36,6 +36,7 @@ import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
import org.eclipse.cdt.internal.ui.text.CTextTools;
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
import org.eclipse.cdt.internal.ui.util.ProblemMarkerManager;
import org.eclipse.cdt.internal.ui.util.Util;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@ -80,6 +81,8 @@ public class CUIPlugin extends AbstractUIPlugin {
private ImageDescriptorRegistry fImageDescriptorRegistry;
static String SEPARATOR = System.getProperty("file.separator");
private static final String CONTENTASSIST = CUIPlugin.PLUGIN_ID + "/debug/contentassist" ; //$NON-NLS-1$
// -------- static methods --------
@ -308,6 +311,8 @@ public class CUIPlugin extends AbstractUIPlugin {
*/
public void startup() throws CoreException {
super.startup();
//Set debug tracing options
CUIPlugin.getDefault().configurePluginDebugOptions();
runUI(new Runnable() {
public void run() {
@ -381,4 +386,13 @@ public class CUIPlugin extends AbstractUIPlugin {
fSharedTextColors= new SharedTextColors();
return fSharedTextColors;
}
public void configurePluginDebugOptions(){
if(CUIPlugin.getDefault().isDebugging()){
String option = Platform.getDebugOption(CONTENTASSIST);
if(option != null) Util.VERBOSE_CONTENTASSIST = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
}
}
}

View file

@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.ui;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;

View file

@ -11,7 +11,7 @@
package org.eclipse.cdt.ui;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.ui.IEditorInput;
/**

View file

@ -28,13 +28,13 @@ import org.eclipse.cdt.core.model.IOpenable;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.IStructure;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.core.search.BasicSearchMatch;
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.core.search.ICSearchPattern;
import org.eclipse.cdt.core.search.ICSearchScope;
import org.eclipse.cdt.core.search.SearchEngine;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.cdt.internal.ui.wizards.NewWizardMessages;