Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java8
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix2.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix3.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix2.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_NoPrefix.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_Prefix.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NoPrefix.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NonCodeScope.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_Prefix.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java12
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java12
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NestedPrefix.java6
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java4
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/ParameterHintTests.java30
-rw-r--r--core/org.eclipse.cdt.ui/icons/elcl16/helpprop_co.gifbin0 -> 338 bytes
-rw-r--r--core/org.eclipse.cdt.ui/plugin.properties1
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml19
-rw-r--r--core/org.eclipse.cdt.ui/schema/ProposalFilter.exsd45
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistPreferencePage.java12
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposalComparator.java12
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistInvocationContext.java2
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java45
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistPreference.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java156
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java9
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java25
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java25
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java20
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/MarkerResolutionProposal.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java2
44 files changed, 359 insertions, 211 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java
index 9223902aa8b..66a71866e9e 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist/ContentAssistTests.java
@@ -237,7 +237,7 @@ public class ContentAssistTests extends BaseUITestCase {
results = getResults( cu, c2.indexOf( "::" ) + 2 ); //$NON-NLS-1$
assertEquals( 2, results.length );
- assertEquals( "getAbility(void) enum _Ability", results[1].getDisplayString() ); //$NON-NLS-1$
+ assertEquals( "getAbility(void) : enum _Ability", results[1].getDisplayString() ); //$NON-NLS-1$
assertEquals( "Strategy(enum _Ability a)", results[0].getDisplayString() ); //$NON-NLS-1$
}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java
index d72d400d275..1b0aec11ac0 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_FunctionReference_Prefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,9 +31,9 @@ public class CompletionTest_FunctionReference_Prefix extends CompletionProposal
"xLocal : int",
"xAClassField : float",
"xVariable : int",
- "xAClassMethod(int x) void",
- "xFunction(void) bool",
- "xOtherFunction(void) void",
+ "xAClassMethod(int x) : void",
+ "xFunction(void) : bool",
+ "xOtherFunction(void) : void",
"xNamespace",
"xOtherClass",
"xFirstEnum",
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix.java
index f0c57014714..c52f8780fdf 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,8 +29,8 @@ public class CompletionTest_MemberReference_Arrow_NoPrefix extends CompletionPr
private final String[] expectedResults = {
"aField : int",
"xAClassField : float",
- "aMethod(void) int",
- "xAClassMethod(int x) void",
+ "aMethod(void) : int",
+ "xAClassMethod(int x) : void",
"aClass" // aClass is valid
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix2.java
index 50ddfeced90..f9b863edd20 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix2.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Symbian Software Systems and others.
+ * Copyright (c) 2006, 2008 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,8 +22,8 @@ public class CompletionTest_MemberReference_Arrow_NoPrefix2 extends CompletionP
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
- "A", "foo(void) void",
- "operator ->(void) B *"
+ "A", "foo(void) : void",
+ "operator ->(void) : B*"
};
public CompletionTest_MemberReference_Arrow_NoPrefix2(String name) {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix3.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix3.java
index 71b3f85c2e6..c26afe5d1d9 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix3.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_NoPrefix3.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Symbian Software Systems and others.
+ * Copyright (c) 2006, 2008 Symbian Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ public class CompletionTest_MemberReference_Arrow_NoPrefix3 extends CompletionP
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
- "B", "bar(void) void"
+ "B", "bar(void) : void"
};
public CompletionTest_MemberReference_Arrow_NoPrefix3(String name) {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix.java
index 95013740530..bb079c04620 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ public class CompletionTest_MemberReference_Arrow_Prefix extends CompletionProp
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aField : int",
- "aMethod(void) int",
+ "aMethod(void) : int",
"aClass" // aClass is valid
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix2.java
index 410138b1d66..46c234ab1fa 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix2.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Arrow_Prefix2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,7 +28,7 @@ public class CompletionTest_MemberReference_Arrow_Prefix2 extends CompletionPro
private final String[] expectedResults = {
"aClass", // aClass is valid
"aField : int",
- "aMethod(void) int"
+ "aMethod(void) : int"
};
public CompletionTest_MemberReference_Arrow_Prefix2(String name) {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_NoPrefix.java
index eb6d0877850..7eb71798352 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_NoPrefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_NoPrefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,8 +28,8 @@ public class CompletionTest_MemberReference_Dot_NoPrefix extends CompletionProp
private final String[] expectedResults = {
"aField : int",
"xAClassField : float",
- "aMethod(void) int",
- "xAClassMethod(int x) void",
+ "aMethod(void) : int",
+ "xAClassMethod(int x) : void",
"aClass" // aClass is valid
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_Prefix.java
index 64bb498eda9..e0971889d5f 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_Prefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_MemberReference_Dot_Prefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ public class CompletionTest_MemberReference_Dot_Prefix extends CompletionPropos
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aField : int",
- "aMethod(void) int",
+ "aMethod(void) : int",
"aClass" // aClass is valid
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NoPrefix.java
index 0790589d315..bbd873638a7 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NoPrefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NoPrefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ public class CompletionTest_ScopedReference_NoPrefix extends CompletionProposal
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
- "aNamespaceFunction(void) void"
+ "aNamespaceFunction(void) : void"
};
public CompletionTest_ScopedReference_NoPrefix(String name) {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NonCodeScope.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NonCodeScope.java
index 1f0753381db..8d893bd3708 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NonCodeScope.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_NonCodeScope.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,8 +28,8 @@ public class CompletionTest_ScopedReference_NonCodeScope extends CompletionProp
private final String expectedPrefix = "";
private final String[] expectedResults = {
"Foo(void)",
- "bar(void) void",
- "fum(void) void",
+ "bar(void) : void",
+ "fum(void) : void",
"x : int"
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_Prefix.java
index 91c5aa42f20..86555454348 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_Prefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_ScopedReference_Prefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@ public class CompletionTest_ScopedReference_Prefix extends CompletionProposalsB
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "a";
private final String[] expectedResults = {
- "aNamespaceFunction(void) void"
+ "aNamespaceFunction(void) : void"
};
public CompletionTest_ScopedReference_Prefix(String name) {
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java
index 7ec8280a45f..8ecb94ada1c 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Method_Prefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,12 +28,12 @@ public class CompletionTest_SingleName_Method_Prefix extends CompletionProposa
private final String[] expectedResults = {
"anotherField : int",
"aVariable : int",
- "anotherMethod(void) void",
- "aFunction(void) bool",
- "anotherFunction(void) void",
+ "anotherMethod(void) : void",
+ "aFunction(void) : bool",
+ "anotherFunction(void) : void",
"aClass",
"anotherClass",
- "anotherClass(const anotherClass &)",
+ "anotherClass(const anotherClass&)",
"anotherClass(void)",
"aNamespace",
"anEnumeration",
@@ -53,7 +53,7 @@ public class CompletionTest_SingleName_Method_Prefix extends CompletionProposa
suite.addTest(new CompletionTest_SingleName_Method_Prefix("testCompletionProposals"));
return suite;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.codeassist.tests.CompletionProposalsTest#getCompletionPosition()
*/
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java
index 5fbc6bdbb1d..4b8c51c0335 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_NoPrefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,11 +29,11 @@ public class CompletionTest_SingleName_NoPrefix extends CompletionProposalsBase
"x : int",
"aVariable : int",
"xVariable : int",
- "aFunction(void) bool",
- "anotherFunction(void) void",
- "foo(int x) void",
- "xFunction(void) bool",
- "xOtherFunction(void) void",
+ "aFunction(void) : bool",
+ "anotherFunction(void) : void",
+ "foo(int x) : void",
+ "xFunction(void) : bool",
+ "xOtherFunction(void) : void",
"aClass",
"anotherClass",
"xOtherClass",
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java
index 3a14efea0a6..0e525cb7f3d 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_SingleName_Prefix2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,8 +26,8 @@ public class CompletionTest_SingleName_Prefix2 extends CompletionProposalsBaseT
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aVariable : int",
- "aFunction(void) bool",
- "anotherFunction(void) void",
+ "aFunction(void) : bool",
+ "anotherFunction(void) : void",
"aClass",
"anotherClass",
"aNamespace",
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NestedPrefix.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NestedPrefix.java
index 51af05c381f..cfe6645e3c8 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NestedPrefix.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTest_VariableType_NestedPrefix.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,8 +28,8 @@ public class CompletionTest_VariableType_NestedPrefix extends CompletionProposa
private final String expectedPrefix = "";
private final String[] expectedResults = {
"Foo(void)",
- "bar(void) void",
- "fum(void) void",
+ "bar(void) : void",
+ "fum(void) : void",
"DEF",
"x : int"
};
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java
index 1ace88ff865..8563fe7fc3d 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/CompletionTests.java
@@ -828,7 +828,7 @@ public class CompletionTests extends AbstractContentAssistTest {
public void testFunctionWithTypedefToAnonymousType_bug192787() throws Exception {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=192787
final String[] expected= {
- "func(my_struct s) void"
+ "func(my_struct s) : void"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_DISP_STRINGS);
}
@@ -939,7 +939,7 @@ public class CompletionTests extends AbstractContentAssistTest {
// #include "header191315.h"
// void xxx() { c_lin/*cursor*/
- public void testExtenC_bug191315() throws Exception {
+ public void testExternC_bug191315() throws Exception {
StringBuffer[] content= getContentsForTest(3);
createFile(fProject, "header191315.h", content[0].toString());
createFile(fProject, "source191315.c", content[0].toString());
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/ParameterHintTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/ParameterHintTests.java
index aa676ce74dc..171750de046 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/ParameterHintTests.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/ParameterHintTests.java
@@ -66,35 +66,35 @@ public class ParameterHintTests extends AbstractContentAssistTest {
//void foo(){aFunc(
public void testFunction() throws Exception {
assertParameterHints(new String[] {
- "aFunc(int i) void"
+ "aFunc(int i) : void"
});
}
//void foo(){tFunc(
public void testTemplateFunction() throws Exception {
assertParameterHints(new String[] {
- "tFunc(T x,T y) void"
+ "tFunc(T x,T y) : void"
});
}
//void foo(){tFunc<int>(
public void testTemplateFunction2() throws Exception {
assertParameterHints(new String[] {
- "tFunc(T x,T y) void"
+ "tFunc(T x,T y) : void"
});
}
//void foo(){int a=5;aFunc ( anotherFunc ( a , (in
public void testOffsetCalculation() throws Exception {
assertParameterHints(new String[] {
- "anotherFunc(int i,int j) int"
+ "anotherFunc(int i,int j) : int"
});
}
//void foo(){int a=pie(
public void testAccurateName() throws Exception {
assertParameterHints(new String[] {
- "pie(aClass a) int"
+ "pie(aClass a) : int"
});
}
@@ -106,16 +106,16 @@ public class ParameterHintTests extends AbstractContentAssistTest {
//void aClass::aMethod(
public void testMethodDefinition() throws Exception {
assertParameterHints(new String[] {
- "aMethod(char c) void",
- "aMethod(char c,int x) void"
+ "aMethod(char c) : void",
+ "aMethod(char c,int x) : void"
});
}
//void aClass::aMethod(char c){aMethod(c,aFi
public void testMethodScope() throws Exception {
assertParameterHints(new String[] {
- "aMethod(char c) void",
- "aMethod(char c,int x) void"
+ "aMethod(char c) : void",
+ "aMethod(char c,int x) : void"
});
}
@@ -123,7 +123,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
public void testConstructor() throws Exception {
assertParameterHints(new String[] {
"aClass(void)",
- "aClass(const aClass &)"
+ "aClass(const aClass&)"
});
}
@@ -132,7 +132,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
assertParameterHints(new String[] {
"bClass(int x)",
"bClass(int x,int y)",
- "bClass(const bClass &)"
+ "bClass(const bClass&)"
});
}
@@ -140,7 +140,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
public void testTemplateConstructor() throws Exception {
assertParameterHints(new String[] {
"tClass(T t)",
- "tClass(const tClass &)"
+ "tClass(const tClass&)"
});
}
@@ -148,14 +148,14 @@ public class ParameterHintTests extends AbstractContentAssistTest {
public void _testTemplateConstructor2() throws Exception {
assertParameterHints(new String[] {
"tClass(T t)",
- "tClass(const tClass &)"
+ "tClass(const tClass&)"
});
}
//int pi = 3;void foo(){pi(
public void testFunctionsOnly() throws Exception {
assertParameterHints(new String[] {
- "pi(aClass a) int"
+ "pi(aClass a) : int"
});
}
@@ -169,7 +169,7 @@ public class ParameterHintTests extends AbstractContentAssistTest {
// int i= (int) oc->getChar(
public void testMethodWithCast() throws Exception {
assertParameterHints(new String[] {
- "getChar(int a,int b) char"
+ "getChar(int a,int b) : char"
});
}
}
diff --git a/core/org.eclipse.cdt.ui/icons/elcl16/helpprop_co.gif b/core/org.eclipse.cdt.ui/icons/elcl16/helpprop_co.gif
new file mode 100644
index 00000000000..cb55e33b5eb
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/icons/elcl16/helpprop_co.gif
Binary files differ
diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index 382666db8a2..28ee4b937db 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -427,6 +427,7 @@ ParserProposalCategory=Parsing-based Proposals
DefaultProposalCategory= &Basic Proposals
TemplateProposalCategory= Te&mplate Proposals
TextProposalCategory= &Word Proposals
+HelpProposalCategory= Help Proposals
SpecificContentAssist.name= C/C++ Content Assist
SpecificContentAssist.desc= A parameterizable command that invokes content assist with a single completion proposal category
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 8d033b36da2..6a1d64c0198 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -2162,6 +2162,13 @@
</extension>
<extension
point="org.eclipse.cdt.ui.completionProposalComputer"
+ id="helpProposalCategory"
+ name="%HelpProposalCategory">
+ <proposalCategory
+ icon="$nl$/icons/elcl16/helpprop_co.gif"/>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.ui.completionProposalComputer"
id="textProposalCategory"
name="%TextProposalCategory">
<proposalCategory
@@ -2209,7 +2216,17 @@
<partition type="__c_singleline_comment"/>
</completionProposalComputer>
</extension>
- <!-- hippie word completions -->
+ <!-- help provider proposals -->
+ <extension
+ point="org.eclipse.cdt.ui.completionProposalComputer"
+ id="HelpCompletionProposalComputer">
+ <completionProposalComputer
+ class="org.eclipse.cdt.internal.ui.text.contentassist.HelpCompletionProposalComputer"
+ categoryId="org.eclipse.cdt.ui.helpProposalCategory">
+ <partition type="__dftl_partition_content_type"/>
+ </completionProposalComputer>
+ </extension>
+ <!-- hippie word proposals -->
<extension
point="org.eclipse.cdt.ui.completionProposalComputer"
id="HippieCompletionProposalComputer">
diff --git a/core/org.eclipse.cdt.ui/schema/ProposalFilter.exsd b/core/org.eclipse.cdt.ui/schema/ProposalFilter.exsd
index 04edaf52870..9b650aa48f3 100644
--- a/core/org.eclipse.cdt.ui/schema/ProposalFilter.exsd
+++ b/core/org.eclipse.cdt.ui/schema/ProposalFilter.exsd
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.cdt.ui">
+<schema targetNamespace="org.eclipse.cdt.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.cdt.ui" id="CodeCompletionFilter" name="Code Completion Filter"/>
- </appInfo>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.cdt.ui" id="ProposalFilter" name="Completion Proposal Filter"/>
+ </appinfo>
<documentation>
When the user requests code completion for an identifier prefix then proposals are gathered from a variety of sources. It is quite common that several proposals for the same completion are gathered. After gathering it is therefore necessary to filter proposals and present them in an optimal ordering to the user.
@@ -38,9 +38,9 @@ The decision about which filter will actually be used remains with the user who
<documentation>
</documentation>
- <appInfo>
+ <appinfo>
<meta.attribute translatable="true"/>
- </appInfo>
+ </appinfo>
</annotation>
</attribute>
</complexType>
@@ -60,9 +60,9 @@ The decision about which filter will actually be used remains with the user who
<documentation>
The required name of the ProposalFilter. This name will appear in the preferences combo and should therefore be informative for the user.
</documentation>
- <appInfo>
+ <appinfo>
<meta.attribute translatable="true"/>
- </appInfo>
+ </appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
@@ -70,54 +70,55 @@ The decision about which filter will actually be used remains with the user who
<documentation>
The required fully qualified name of the implementing class which must implement org.eclipse.cdt.ui.text.contentassist.IProposalFilter
</documentation>
- <appInfo>
+ <appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.cdt.ui.text.contentassist.IProposalFilter"/>
- </appInfo>
+ </appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
- <appInfo>
+ <appinfo>
<meta.section type="since"/>
- </appInfo>
+ </appinfo>
<documentation>
CDT 3.1
</documentation>
</annotation>
<annotation>
- <appInfo>
+ <appinfo>
<meta.section type="examples"/>
- </appInfo>
+ </appinfo>
<documentation>
See the default implementation in org.eclipse.cdt.internal.ui.text.contentassist.DefaultProposalFilter as an example.
</documentation>
</annotation>
+
<annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
<documentation>
- ProposalFilters must implement interface org.eclipse.cdt.ui.text.contentassist.IProposalFilter
+ ProposalFilters must implement interface &lt;code&gt;org.eclipse.cdt.ui.text.contentassist.IProposalFilter&lt;code&gt;.
</documentation>
</annotation>
<annotation>
- <appInfo>
+ <appinfo>
<meta.section type="implementation"/>
- </appInfo>
+ </appinfo>
<documentation>
The default implementation in org.eclipse.cdt.internal.ui.text.contentassist.DefaultProposalFilter is the default filtering method which is used as long as the user preference is not changed.
</documentation>
</annotation>
<annotation>
- <appInfo>
+ <appinfo>
<meta.section type="copyright"/>
- </appInfo>
+ </appinfo>
<documentation>
Copyright (c) 2006 Norbert Ploett and others.
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistPreferencePage.java
index 9af008daf90..9dadb550140 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistPreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeAssistPreferencePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2007 QNX Software Systems and others.
+ * Copyright (c) 2002, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,7 +51,7 @@ public class CodeAssistPreferencePage extends AbstractPreferencePage {
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_ARROW));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOUBLECOLON));
// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.SHOW_DOCUMENTED_PROPOSALS));
-// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.ORDER_PROPOSALS));
+ overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.ORDER_PROPOSALS));
// overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.ADD_INCLUDE));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.CURRENT_FILE_SEARCH_SCOPE));
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.PROJECT_SEARCH_SCOPE));
@@ -111,12 +111,12 @@ public class CodeAssistPreferencePage extends AbstractPreferencePage {
// addTextField(insertionGroup, label, ContentAssistPreference.TIMEOUT_DELAY, 6, 0, true);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- // sorting and filtering
+ // sorting and filtering
label = PreferencesMessages.CEditorPreferencePage_ContentAssistPage_sortingSection_title;
Group sortingGroup = addGroupBox(contentAssistComposite, label, 2);
-// label= PreferencesMessages.CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder;
-// addCheckBox(sortingGroup, label, ContentAssistPreference.ORDER_PROPOSALS, 0);
+ label= PreferencesMessages.CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder;
+ addCheckBox(sortingGroup, label, ContentAssistPreference.ORDER_PROPOSALS, 0);
label = PreferencesMessages.CEditorPreferencePage_ContentAssistPage_proposalFilterSelect ;
addComboBox(sortingGroup, label, ContentAssistPreference.PROPOSALS_FILTER, NO_TEXT_LIMIT, 0);
@@ -163,7 +163,7 @@ public class CodeAssistPreferencePage extends AbstractPreferencePage {
store.setDefault(ContentAssistPreference.AUTOINSERT, true);
store.setDefault(ContentAssistPreference.PREFIX_COMPLETION, true);
-// store.setDefault(ContentAssistPreference.ORDER_PROPOSALS, false);
+ store.setDefault(ContentAssistPreference.ORDER_PROPOSALS, false);
// store.setDefault(ContentAssistPreference.ADD_INCLUDE, true);
store.setDefault(ContentAssistPreference.PROPOSALS_FILTER, ProposalFilterPreferencesUtil.getProposalFilternamesAsString()); // $NON_NLS 1$
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
index 74fb82ff34c..c67f5911d78 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
@@ -45,7 +45,7 @@ public final class PreferencesMessages extends NLS {
public static String CEditorPreferencePage_ContentAssistPage_insertionGroupTitle;
public static String CEditorPreferencePage_ContentAssistPage_insertSingleProposalAutomatically;
public static String CEditorPreferencePage_ContentAssistPage_insertCommonProposalAutomatically;
-// public static String CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder;
+ public static String CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder;
// public static String CEditorPreferencePage_ContentAssistPage_timeoutDelay;
public static String CEditorPreferencePage_ContentAssistPage_autoActivationGroupTitle;
public static String CEditorPreferencePage_ContentAssistPage_autoActivationEnableDot;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
index 41f09b5bf76..54adc48378f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties
@@ -24,7 +24,7 @@ CEditorPreferencePage_colors=Synta&x
CEditorPreferencePage_ContentAssistPage_insertionGroupTitle=Insertion
CEditorPreferencePage_ContentAssistPage_insertSingleProposalAutomatically=&Insert single proposals automatically
CEditorPreferencePage_ContentAssistPage_insertCommonProposalAutomatically=Insert common prefixes automatically
-#CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder=Present proposals in a&lphabetical order
+CEditorPreferencePage_ContentAssistPage_showProposalsInAlphabeticalOrder=Present proposals in a&lphabetical order
#CEditorPreferencePage_ContentAssistPage_timeoutDelay=Content Assist parsing &timeout (ms)
CEditorPreferencePage_ContentAssistPage_autoActivationGroupTitle=Auto-Activation
CEditorPreferencePage_ContentAssistPage_autoActivationEnableDot=Enable "." as trigger
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
index 5a2d2c3d947..d31c0ea330c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposal.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
+ * IBM Rational Software - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@@ -259,7 +259,7 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
} catch (BadPositionCategoryException e) {
// should not happen
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
}
@@ -276,7 +276,7 @@ public class CCompletionProposal implements ICCompletionProposal, ICompletionPro
} catch (BadPositionCategoryException e) {
// should not happen
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
return fPosition.getOffset();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposalComparator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposalComparator.java
index 6bc778336db..3a9b282c383 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposalComparator.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CCompletionProposalComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 QNX Software Systems and others.
+ * Copyright (c) 2000, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX Software Systems - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@@ -15,7 +16,7 @@ import java.util.Comparator;
import org.eclipse.cdt.ui.text.ICCompletionProposal;
-public class CCompletionProposalComparator implements Comparator {
+public class CCompletionProposalComparator implements Comparator<ICCompletionProposal> {
private boolean fOrderAlphabetically;
@@ -30,13 +31,10 @@ public class CCompletionProposalComparator implements Comparator {
fOrderAlphabetically= orderAlphabetically;
}
- /* (non-Javadoc)
+ /*
* @see Comparator#compare(Object, Object)
*/
- public int compare(Object o1, Object o2) {
- ICCompletionProposal c1= (ICCompletionProposal) o1;
- ICCompletionProposal c2= (ICCompletionProposal) o2;
-
+ public int compare(ICCompletionProposal c1, ICCompletionProposal c2) {
if (!fOrderAlphabetically) {
int relevanceDif= c2.getRelevance() - c1.getRelevance();
if (relevanceDif != 0) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistInvocationContext.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistInvocationContext.java
index aa31346639b..9e5fb52012f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistInvocationContext.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistInvocationContext.java
@@ -137,7 +137,7 @@ public class CContentAssistInvocationContext extends ContentAssistInvocationCont
fCN = fTU.getCompletionNode(fIndex, flags, offset);
} catch (CoreException e) {
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
return fCN;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
index 0fa67d90805..63c652c97cb 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CContentAssistProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
package org.eclipse.cdt.internal.ui.text.contentassist;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -69,7 +70,7 @@ public class CContentAssistProcessor extends ContentAssistProcessor {
* @see org.eclipse.cdt.ui.text.ICCompletionProposal#getRelevance()
*/
public int getRelevance() {
- return -1;
+ return RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.KEYWORD_TYPE_RELEVANCE;
}
/*
@@ -149,25 +150,45 @@ public class CContentAssistProcessor extends ContentAssistProcessor {
IProposalFilter filter = getCompletionFilter();
ICCompletionProposal[] proposalsInput= new ICCompletionProposal[proposals.size()];
// wrap proposals which are no ICCompletionProposals
+ boolean wrapped= false;
int i=0;
for (Iterator iterator = proposals.iterator(); iterator.hasNext(); ) {
ICompletionProposal proposal= (ICompletionProposal) iterator.next();
if (proposal instanceof ICCompletionProposal) {
proposalsInput[i++]= (ICCompletionProposal)proposal;
} else {
+ wrapped= true;
proposalsInput[i++]= new CCompletionProposalWrapper(proposal);
}
}
+ // filter
ICCompletionProposal[] proposalsFiltered = filter.filterProposals(proposalsInput);
- // unwrap again
- ArrayList filteredList= new ArrayList(proposalsFiltered.length);
- for (int j= 0; j < proposalsFiltered.length; j++) {
- ICCompletionProposal proposal= proposalsFiltered[j];
- if (proposal instanceof CCompletionProposalWrapper) {
- filteredList.add(((CCompletionProposalWrapper)proposal).unwrap());
- } else {
- filteredList.add(proposal);
+
+ // sort
+ boolean sortByAlphabet= CUIPlugin.getDefault().getPreferenceStore().getBoolean(ContentAssistPreference.ORDER_PROPOSALS);
+ if (sortByAlphabet) {
+ // already sorted alphabetically by DefaultProposalFilter
+ // in case of custom proposal filter, keep ordering applied by filter
+ } else {
+ // sort by relevance
+ CCompletionProposalComparator propsComp= new CCompletionProposalComparator();
+ propsComp.setOrderAlphabetically(sortByAlphabet);
+ Arrays.sort(proposalsFiltered, propsComp);
+ }
+ List filteredList;
+ if (wrapped) {
+ // unwrap again
+ filteredList= new ArrayList(proposalsFiltered.length);
+ for (int j= 0; j < proposalsFiltered.length; j++) {
+ ICCompletionProposal proposal= proposalsFiltered[j];
+ if (proposal instanceof CCompletionProposalWrapper) {
+ filteredList.add(((CCompletionProposalWrapper)proposal).unwrap());
+ } else {
+ filteredList.add(proposal);
+ }
}
+ } else {
+ filteredList= Arrays.asList(proposalsFiltered);
}
return filteredList;
}
@@ -185,10 +206,10 @@ public class CContentAssistProcessor extends ContentAssistProcessor {
}
} catch (InvalidRegistryObjectException e) {
// No action required since we will be using the fail-safe default filter
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
} catch (CoreException e) {
// No action required since we will be using the fail-safe default filter
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
if (null == filter) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
index fdf661e2389..40af3f6596c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -109,7 +109,7 @@ public final class CompletionProposalCategory {
Object[] args= { getId(), fElement.getContributor().getName(), attribute };
String message= Messages.format(ContentAssistMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
IStatus status= new Status(IStatus.WARNING, CUIPlugin.getPluginId(), IStatus.OK, message, null);
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
throw new InvalidRegistryObjectException();
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
index d0e66d604ae..9e0e2d4452d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
@@ -87,11 +88,7 @@ final class CompletionProposalComputerDescriptor {
static {
Set partitions= new HashSet();
partitions.add(IDocument.DEFAULT_CONTENT_TYPE);
- partitions.add(ICPartitions.C_PREPROCESSOR);
- partitions.add(ICPartitions.C_MULTI_LINE_COMMENT);
- partitions.add(ICPartitions.C_SINGLE_LINE_COMMENT);
- partitions.add(ICPartitions.C_STRING);
- partitions.add(ICPartitions.C_CHARACTER);
+ partitions.addAll(Arrays.asList(ICPartitions.ALL_CPARTITIONS));
PARTITION_SET= Collections.unmodifiableSet(partitions);
}
@@ -197,7 +194,7 @@ final class CompletionProposalComputerDescriptor {
Object[] args= { getId(), fElement.getContributor().getName(), attribute };
String message= Messages.format(ContentAssistMessages.CompletionProposalComputerDescriptor_illegal_attribute_message, args);
IStatus status= new Status(IStatus.WARNING, CUIPlugin.getPluginId(), IStatus.OK, message, null);
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
throw new InvalidRegistryObjectException();
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
index ad52949f8cb..c5a3b3d4276 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -325,7 +325,7 @@ public final class CompletionProposalComputerRegistry {
* @param status a status object that will be logged
*/
void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) {
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
String title= ContentAssistMessages.CompletionProposalComputerRegistry_error_dialog_title;
CompletionProposalCategory category= descriptor.getCategory();
IContributor culprit= descriptor.getContributor();
@@ -390,7 +390,7 @@ public final class CompletionProposalComputerRegistry {
}
private void informUser(IStatus status) {
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
String title= ContentAssistMessages.CompletionProposalComputerRegistry_error_dialog_title;
String message= status.getMessage();
MessageDialog.openError(CUIPlugin.getActiveWorkbenchShell(), title, message);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistPreference.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistPreference.java
index 169951ef974..80451fd239f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistPreference.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistPreference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -56,8 +56,8 @@ public class ContentAssistPreference {
// /** Preference key for visibility of proposals (unused) */
// public final static String SHOW_DOCUMENTED_PROPOSALS= "content_assist_show_visible_proposals"; //$NON-NLS-1$
-// /** Preference key for alphabetic ordering of proposals (unused) */
-// public final static String ORDER_PROPOSALS= "content_assist_order_proposals"; //$NON-NLS-1$
+ /** Preference key for alphabetic ordering of proposals */
+ public final static String ORDER_PROPOSALS= "content_assist_order_proposals"; //$NON-NLS-1$
// /** Preference key for case sensitivity of propsals */
// public final static String CASE_SENSITIVITY= "content_assist_case_sensitivity";
// /** Preference key for adding includes on code assist (unused) */
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
index 7dbdbd445b1..d3f077541dc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/DOMCompletionProposalComputer.java
@@ -41,21 +41,26 @@ import org.eclipse.cdt.core.dom.ast.IField;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
+import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.IVariable;
+import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
+import org.eclipse.cdt.core.model.IMethod;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.ui.CUIPlugin;
@@ -95,7 +100,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
try {
prefix= context.computeIdentifierPrefix().toString();
} catch (BadLocationException exc) {
- CUIPlugin.getDefault().log(exc);
+ CUIPlugin.log(exc);
}
}
addMacroProposals(context, prefix, proposals);
@@ -123,7 +128,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
if (bindings != null)
for (int j = 0; j < bindings.length; ++j)
- handleBinding(bindings[j], context, astContext, proposals);
+ handleBinding(bindings[j], context, prefix, astContext, proposals);
}
if (handleMacros)
@@ -186,26 +191,28 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
if (macros != null)
for (int i = 0; i < macros.length; ++i)
if (CharArrayUtils.equals(macros[i].getName().toCharArray(), 0, prefixChars.length, prefixChars, true))
- handleMacro(macros[i], context, proposals);
+ handleMacro(macros[i], context, prefix, proposals);
macros = completionNode.getTranslationUnit().getBuiltinMacroDefinitions();
if (macros != null)
for (int i = 0; i < macros.length; ++i)
if (CharArrayUtils.equals(macros[i].getName().toCharArray(), 0, prefixChars.length, prefixChars, true))
- handleMacro(macros[i], context, proposals);
+ handleMacro(macros[i], context, prefix, proposals);
}
- private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
- String macroName = macro.getName().toString();
+ private void handleMacro(IASTPreprocessorMacroDefinition macro, CContentAssistInvocationContext context, String prefix, List<CCompletionProposal> proposals) {
+ final String macroName = macro.getName().toString();
+ final int baseRelevance= computeBaseRelevance(prefix, macroName);
+
Image image = getImage(CElementImageProvider.getMacroImageDescriptor());
if (macro instanceof IASTPreprocessorFunctionStyleMacroDefinition) {
IASTPreprocessorFunctionStyleMacroDefinition functionMacro = (IASTPreprocessorFunctionStyleMacroDefinition)macro;
- StringBuffer repStringBuff = new StringBuffer();
+ StringBuilder repStringBuff = new StringBuilder();
repStringBuff.append(macroName);
repStringBuff.append('(');
- StringBuffer args = new StringBuffer();
+ StringBuilder args = new StringBuilder();
IASTFunctionStyleMacroParameter[] params = functionMacro.getParameters();
if (params != null)
@@ -216,7 +223,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
String argString = args.toString();
- StringBuffer descStringBuff = new StringBuffer(repStringBuff.toString());
+ StringBuilder descStringBuff = new StringBuilder(repStringBuff.toString());
descStringBuff.append(argString);
descStringBuff.append(')');
@@ -224,7 +231,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
String repString = repStringBuff.toString();
String descString = descStringBuff.toString();
- CCompletionProposal proposal = createProposal(repString, descString, image, context);
+ CCompletionProposal proposal = createProposal(repString, descString, image, baseRelevance + RelevanceConstants.MACRO_TYPE_RELEVANCE, context);
if (!context.isContextInformationStyle()) {
proposal.setCursorPosition(repString.length() - 1);
}
@@ -237,12 +244,15 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
proposals.add(proposal);
} else
- proposals.add(createProposal(macroName, macroName, image, context));
+ proposals.add(createProposal(macroName, macroName, image, baseRelevance + RelevanceConstants.MACRO_TYPE_RELEVANCE, context));
}
-
+
protected void handleBinding(IBinding binding,
CContentAssistInvocationContext cContext,
- IASTCompletionContext astContext, List<CCompletionProposal> proposals) {
+ String prefix,
+ IASTCompletionContext astContext,
+ List<CCompletionProposal> proposals) {
+
if ((binding instanceof CPPImplicitFunction
|| binding instanceof CPPImplicitFunctionTemplate || binding instanceof CPPImplicitTypedef)
&& !(binding instanceof CPPImplicitMethod)) {
@@ -250,17 +260,25 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
if (!isAnonymousBinding(binding)) {
+ final String name = binding.getName();
+ final int baseRelevance= computeBaseRelevance(prefix, name);
if (binding instanceof ICPPClassType) {
- handleClass((ICPPClassType) binding, astContext, cContext, proposals);
+ handleClass((ICPPClassType) binding, astContext, cContext, baseRelevance, proposals);
} else if (binding instanceof IFunction) {
- handleFunction((IFunction)binding, cContext, proposals);
+ handleFunction((IFunction)binding, cContext, baseRelevance, proposals);
} else if (!cContext.isContextInformationStyle()) {
if (binding instanceof IVariable) {
- handleVariable((IVariable) binding, cContext, proposals);
+ handleVariable((IVariable) binding, cContext, baseRelevance, proposals);
+ } else if (binding instanceof ITypedef) {
+ proposals.add(createProposal(name, name, getImage(binding), baseRelevance + RelevanceConstants.TYPEDEF_TYPE_RELEVANCE, cContext));
} else if (binding instanceof ICPPNamespace) {
- handleNamespace((ICPPNamespace) binding, astContext, cContext, proposals);
+ handleNamespace((ICPPNamespace) binding, astContext, cContext, baseRelevance, proposals);
+ } else if (binding instanceof IEnumeration) {
+ proposals.add(createProposal(name, name, getImage(binding), baseRelevance + RelevanceConstants.ENUMERATION_TYPE_RELEVANCE, cContext));
+ } else if (binding instanceof IEnumerator) {
+ proposals.add(createProposal(name, name, getImage(binding), baseRelevance + RelevanceConstants.ENUMERATOR_TYPE_RELEVANCE, cContext));
} else {
- proposals.add(createProposal(binding.getName(), binding.getName(), getImage(binding), cContext));
+ proposals.add(createProposal(name, name, getImage(binding), baseRelevance, cContext));
}
}
}
@@ -271,35 +289,50 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
return name.length == 0 || name[0] == '{';
}
- private void handleClass(ICPPClassType classType, IASTCompletionContext astContext, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
+ private void handleClass(ICPPClassType classType, IASTCompletionContext astContext, CContentAssistInvocationContext context, int baseRelevance, List<CCompletionProposal> proposals) {
if (context.isContextInformationStyle()) {
try {
ICPPConstructor[] constructors = classType.getConstructors();
for (int i = 0; i < constructors.length; i++) {
- handleFunction(constructors[i], context, proposals);
+ handleFunction(constructors[i], context, baseRelevance, proposals);
}
} catch (DOMException e) {
}
} else {
+ int relevance= 0;
+ try {
+ switch(classType.getKey()) {
+ case ICPPClassType.k_class:
+ relevance= RelevanceConstants.CLASS_TYPE_RELEVANCE;
+ break;
+ case ICPPClassType.k_struct:
+ relevance= RelevanceConstants.STRUCT_TYPE_RELEVANCE;
+ break;
+ case ICPPClassType.k_union:
+ relevance= RelevanceConstants.UNION_TYPE_RELEVANCE;
+ break;
+ }
+ } catch (DOMException exc) {
+ }
if (astContext instanceof IASTName && !(astContext instanceof ICPPASTQualifiedName)) {
IASTName name= (IASTName)astContext;
if (name.getParent() instanceof IASTDeclarator) {
- proposals.add(createProposal(classType.getName()+"::", classType.getName(), getImage(classType), context)); //$NON-NLS-1$
+ proposals.add(createProposal(classType.getName()+"::", classType.getName(), getImage(classType), baseRelevance + relevance, context)); //$NON-NLS-1$
}
}
- proposals.add(createProposal(classType.getName(), classType.getName(), getImage(classType), context));
+ proposals.add(createProposal(classType.getName(), classType.getName(), getImage(classType), baseRelevance + RelevanceConstants.CLASS_TYPE_RELEVANCE, context));
}
}
- private void handleFunction(IFunction function, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
+ private void handleFunction(IFunction function, CContentAssistInvocationContext context, int baseRelevance, List<CCompletionProposal> proposals) {
Image image = getImage(function);
- StringBuffer repStringBuff = new StringBuffer();
+ StringBuilder repStringBuff = new StringBuilder();
repStringBuff.append(function.getName());
repStringBuff.append('(');
- StringBuffer dispargs = new StringBuffer(); // for the displayString
- StringBuffer idargs = new StringBuffer(); // for the idString
+ StringBuilder dispargs = new StringBuilder(); // for the displayString
+ StringBuilder idargs = new StringBuilder(); // for the idString
String returnTypeStr = null;
try {
IParameter[] params = function.getParameters();
@@ -344,16 +377,16 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
String dispargString = dispargs.toString();
String idargString = idargs.toString();
- StringBuffer dispStringBuff = new StringBuffer(repStringBuff.toString());
+ StringBuilder dispStringBuff = new StringBuilder(repStringBuff.toString());
dispStringBuff.append(dispargString);
dispStringBuff.append(')');
if (returnTypeStr != null && returnTypeStr.length() > 0) {
- dispStringBuff.append(' ');
+ dispStringBuff.append(" : "); //$NON-NLS-1$
dispStringBuff.append(returnTypeStr);
}
String dispString = dispStringBuff.toString();
- StringBuffer idStringBuff = new StringBuffer(repStringBuff.toString());
+ StringBuilder idStringBuff = new StringBuilder(repStringBuff.toString());
idStringBuff.append(idargString);
idStringBuff.append(')');
String idString = idStringBuff.toString();
@@ -361,7 +394,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
repStringBuff.append(')');
String repString = repStringBuff.toString();
- CCompletionProposal proposal = createProposal(repString, dispString, idString, image, context);
+ final int relevance = function instanceof IMethod ? RelevanceConstants.METHOD_TYPE_RELEVANCE : RelevanceConstants.FUNCTION_TYPE_RELEVANCE;
+ CCompletionProposal proposal = createProposal(repString, dispString, idString, image, baseRelevance + relevance, context);
if (!context.isContextInformationStyle()) {
proposal.setCursorPosition(repString.length() - 1);
}
@@ -375,8 +409,8 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
proposals.add(proposal);
}
- private void handleVariable(IVariable variable, CContentAssistInvocationContext context, List<CCompletionProposal> proposals) {
- StringBuffer repStringBuff = new StringBuffer();
+ private void handleVariable(IVariable variable, CContentAssistInvocationContext context, int baseRelevance, List<CCompletionProposal> proposals) {
+ StringBuilder repStringBuff = new StringBuilder();
repStringBuff.append(variable.getName());
String returnTypeStr = "<unknown>"; //$NON-NLS-1$
@@ -387,34 +421,70 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
} catch (DOMException e) {
}
- StringBuffer dispStringBuff = new StringBuffer(repStringBuff.toString());
+ StringBuilder dispStringBuff = new StringBuilder(repStringBuff.toString());
if (returnTypeStr != null) {
dispStringBuff.append(" : "); //$NON-NLS-1$
dispStringBuff.append(returnTypeStr);
}
String dispString = dispStringBuff.toString();
- StringBuffer idStringBuff = new StringBuffer(repStringBuff.toString());
+ StringBuilder idStringBuff = new StringBuilder(repStringBuff.toString());
String idString = idStringBuff.toString();
String repString = repStringBuff.toString();
Image image = getImage(variable);
- CCompletionProposal proposal = createProposal(repString, dispString, idString, image, context);
+ final int relevance = isLocalVariable(variable)
+ ? RelevanceConstants.LOCAL_VARIABLE_TYPE_RELEVANCE
+ : isField(variable)
+ ? RelevanceConstants.FIELD_TYPE_RELEVANCE
+ : RelevanceConstants.VARIABLE_TYPE_RELEVANCE;
+ CCompletionProposal proposal = createProposal(repString, dispString, idString, image, baseRelevance + relevance, context);
proposals.add(proposal);
}
+ private static boolean isField(IVariable variable) {
+ return variable instanceof IField;
+ }
+
+ private static boolean isLocalVariable(IVariable variable) {
+ try {
+ return isLocalScope(variable.getScope());
+ } catch (DOMException exc) {
+ return false;
+ }
+ }
+
+ private static boolean isLocalScope(IScope scope) {
+ while (scope != null) {
+ if (scope instanceof ICPPFunctionScope ||
+ scope instanceof ICPPBlockScope ||
+ scope instanceof ICFunctionScope) {
+ return true;
+ }
+ try {
+ scope= scope.getParent();
+ } catch (DOMException e) {
+ scope= null;
+ }
+ }
+ return false;
+ }
+
private void handleNamespace(ICPPNamespace namespace,
IASTCompletionContext astContext,
- CContentAssistInvocationContext cContext, List<CCompletionProposal> proposals) {
+ CContentAssistInvocationContext cContext,
+ int baseRelevance,
+ List<CCompletionProposal> proposals) {
+
if (astContext instanceof ICPPASTQualifiedName) {
IASTCompletionContext parent = ((ICPPASTQualifiedName) astContext)
.getCompletionContext();
- handleNamespace(namespace, parent, cContext, proposals);
+ handleNamespace(namespace, parent, cContext, baseRelevance, proposals);
return;
}
- StringBuffer repStringBuff = new StringBuffer();
+ StringBuilder repStringBuff = new StringBuilder();
repStringBuff.append(namespace.getName());
if (!(astContext instanceof ICPPASTUsingDeclaration)
@@ -423,14 +493,14 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
}
String repString = repStringBuff.toString();
- proposals.add(createProposal(repString, namespace.getName(), getImage(namespace), cContext));
+ proposals.add(createProposal(repString, namespace.getName(), getImage(namespace), baseRelevance + RelevanceConstants.NAMESPACE_TYPE_RELEVANCE, cContext));
}
- private CCompletionProposal createProposal(String repString, String dispString, Image image, CContentAssistInvocationContext context) {
- return createProposal(repString, dispString, null, image, context);
+ private CCompletionProposal createProposal(String repString, String dispString, Image image, int relevance, CContentAssistInvocationContext context) {
+ return createProposal(repString, dispString, null, image, relevance, context);
}
- private CCompletionProposal createProposal(String repString, String dispString, String idString, Image image, CContentAssistInvocationContext context) {
+ private CCompletionProposal createProposal(String repString, String dispString, String idString, Image image, int relevance, CContentAssistInvocationContext context) {
int parseOffset = context.getParseOffset();
int invocationOffset = context.getInvocationOffset();
boolean doReplacement = !context.isContextInformationStyle();
@@ -439,7 +509,7 @@ public class DOMCompletionProposalComputer extends ParsingBasedProposalComputer
int repOffset = doReplacement ? parseOffset - repLength : invocationOffset;
repString = doReplacement ? repString : ""; //$NON-NLS-1$
- return new CCompletionProposal(repString, repOffset, repLength, image, dispString, idString, 1, context.getViewer());
+ return new CCompletionProposal(repString, repOffset, repLength, image, dispString, idString, relevance, context.getViewer());
}
private Image getImage(ImageDescriptor desc) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java
index ef9a4c3d64a..8b0329746b4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/HelpCompletionProposalComputer.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007 QNX Software Systems and others.
+ * Copyright (c) 2007, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Bryan Wilkinson (QNX) - Initial API and implementation
+ * Bryan Wilkinson (QNX) - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@@ -92,6 +93,7 @@ public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer
.getPrototype();
String fargs = fproto.getArguments();
+ int relevance = computeBaseRelevance(prefix, summary.getName()) + RelevanceConstants.HELP_TYPE_RELEVANCE;
CCompletionProposal proposal;
proposal = new CCompletionProposal(
fname,
@@ -99,7 +101,7 @@ public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer
repLength,
image,
fproto.getPrototypeString(true),
- 2,
+ relevance,
cContext.getViewer());
if (fdesc != null) {
@@ -123,4 +125,5 @@ public class HelpCompletionProposalComputer extends ParsingBasedProposalComputer
return proposals;
}
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java
index 61713ca00ca..cd99d50c4d4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/KeywordCompletionProposalComputer.java
@@ -46,28 +46,31 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
try {
prefix= context.computeIdentifierPrefix().toString();
} catch (BadLocationException exc) {
- CUIPlugin.getDefault().log(exc);
+ CUIPlugin.log(exc);
}
}
+ final int prefixLength = prefix.length();
// No prefix, no completions
- if (prefix.length() == 0 || context.isContextInformationStyle())
+ if (prefixLength == 0 || context.isContextInformationStyle())
return Collections.emptyList();
- String[] keywords;
+ // keywords are matched case-sensitive
+ final int relevance = RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.KEYWORD_TYPE_RELEVANCE;
+
List<CCompletionProposal> proposals = new ArrayList<CCompletionProposal>();
if (inPreprocessorDirective(context)) {
// TODO split this into a separate proposal computer?
boolean needDirectiveKeyword= inPreprocessorKeyword(context);
- keywords= preprocessorKeywords;
+ String[] keywords= preprocessorKeywords;
// add matching preprocessor keyword proposals
ImageDescriptor imagedesc = CElementImageProvider.getKeywordImageDescriptor();
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
for (int i = 0; i < keywords.length; ++i) {
String repString= keywords[i];
- if (repString.startsWith(prefix)) {
- int repLength = prefix.length();
+ if (repString.startsWith(prefix) && keywords[i].length() > prefixLength) {
+ int repLength = prefixLength;
int repOffset = context.getInvocationOffset() - repLength;
if (prefix.charAt(0) == '#') {
// strip leading '#' from replacement
@@ -78,7 +81,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
continue;
}
proposals.add(new CCompletionProposal(repString, repOffset,
- repLength, image, keywords[i], 1, context.getViewer()));
+ repLength, image, keywords[i], relevance, context.getViewer()));
}
}
} else {
@@ -87,7 +90,7 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
ITranslationUnit tu = context.getTranslationUnit();
- keywords = cppkeywords; // default to C++
+ String[] keywords = cppkeywords; // default to C++
if (tu != null && tu.isCLanguage())
keywords = ckeywords;
@@ -95,11 +98,11 @@ public class KeywordCompletionProposalComputer extends ParsingBasedProposalCompu
ImageDescriptor imagedesc = CElementImageProvider.getKeywordImageDescriptor();
Image image = imagedesc != null ? CUIPlugin.getImageDescriptorRegistry().get(imagedesc) : null;
for (int i = 0; i < keywords.length; ++i) {
- if (keywords[i].startsWith(prefix)) {
- int repLength = prefix.length();
+ if (keywords[i].startsWith(prefix) && keywords[i].length() > prefixLength) {
+ int repLength = prefixLength;
int repOffset = context.getInvocationOffset() - repLength;
proposals.add(new CCompletionProposal(keywords[i], repOffset,
- repLength, image, keywords[i], 1, context.getViewer()));
+ repLength, image, keywords[i], relevance, context.getViewer()));
}
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java
index a60650f3afa..93bd3af03f4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ParsingBasedProposalComputer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 QNX Software Systems and others.
+ * Copyright (c) 2007, 2008 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* QNX - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
@@ -54,7 +55,7 @@ public abstract class ParsingBasedProposalComputer implements ICompletionProposa
}
} catch (Exception e) {
fErrorMessage = e.toString();
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
return Collections.EMPTY_LIST;
@@ -93,4 +94,24 @@ public abstract class ParsingBasedProposalComputer implements ICompletionProposa
public void sessionStarted() {
fErrorMessage = null;
}
+
+ /**
+ * Compute base relevance depending on quality of name / prefix match.
+ *
+ * @param prefix the completion pefix
+ * @param match the matching identifier
+ * @return a relevance value inidicating the quality of the name match
+ */
+ protected int computeBaseRelevance(String prefix, String match) {
+ int baseRelevance= RelevanceConstants.DEFAULT_TYPE_RELEVANCE;
+ boolean caseMatch= prefix.length() > 0 && match.startsWith(prefix);
+ if (caseMatch) {
+ baseRelevance += RelevanceConstants.CASE_MATCH_RELEVANCE;
+ }
+ boolean exactNameMatch= match.equalsIgnoreCase(prefix);
+ if (exactNameMatch) {
+ baseRelevance += RelevanceConstants.EXACT_NAME_MATCH_RELEVANCE;
+ }
+ return baseRelevance;
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
index d05afd8b20f..14cc47c22a5 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/RelevanceConstants.java
@@ -1,19 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
+ * IBM Rational Software - Initial API and implementation
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.contentassist;
public interface RelevanceConstants {
- final int CASE_MATCH_RELEVANCE = 160;
+ /** Relevance increment for same case matches */
+ final int CASE_MATCH_RELEVANCE = 1000;
+
+ /** Relevance increment for exact name matches (disregarding case) */
final int EXACT_NAME_MATCH_RELEVANCE = 40;
+ /** Relevance constant for proposals contributed by help provider */
+ final int HELP_TYPE_RELEVANCE = 200;
+
+ // parsing-based relevance constants
final int LOCAL_VARIABLE_TYPE_RELEVANCE = 140;
final int FIELD_TYPE_RELEVANCE = 130;
final int VARIABLE_TYPE_RELEVANCE = 120;
@@ -27,6 +35,12 @@ public interface RelevanceConstants {
final int ENUMERATOR_TYPE_RELEVANCE = 40;
final int ENUMERATION_TYPE_RELEVANCE = 30;
final int MACRO_TYPE_RELEVANCE = 20;
+
+ /** Relevance constant for (key-)word proposals */
final int KEYWORD_TYPE_RELEVANCE = 10;
+
+ /** Relevance constant for editor template proposals */
+ final int TEMPLATE_TYPE_RELEVANCE = 5;
+
final int DEFAULT_TYPE_RELEVANCE = 0;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java
index 8ac35af436c..4c786fc4110 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionAssistant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -167,7 +167,7 @@ public class CCorrectionAssistant extends QuickAssistAssistant {
fViewer.revealRange(newOffset, 0);
}
} catch (BadLocationException e) {
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
fCurrentAnnotations= (Annotation[]) resultingAnnotations.toArray(new Annotation[resultingAnnotations.size()]);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java
index 4b17a1d4be9..7a19d360a1f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/CCorrectionProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Sergey Prigogin (Google)
+ * Anton Leherbauer (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.correction;
@@ -66,7 +67,7 @@ public class CCorrectionProcessor implements IQuickAssistProcessor {
if (status.isOK()) {
res.add(desc);
} else {
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
}
}
return (ContributedProcessorDescriptor[]) res.toArray(new ContributedProcessorDescriptor[res.size()]);
@@ -195,19 +196,19 @@ public class CCorrectionProcessor implements IQuickAssistProcessor {
fErrorMessage= null;
- ICompletionProposal[] res= null;
+ ICCompletionProposal[] res= null;
if (model != null && annotations != null) {
ArrayList proposals= new ArrayList(10);
IStatus status= collectProposals(context, model, annotations, true, !fAssistant.isUpdatedOffset(), proposals);
- res= (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
+ res= (ICCompletionProposal[]) proposals.toArray(new ICCompletionProposal[proposals.size()]);
if (!status.isOK()) {
fErrorMessage= status.getMessage();
- CUIPlugin.getDefault().log(status);
+ CUIPlugin.log(status);
}
}
if (res == null || res.length == 0) {
- return new ICompletionProposal[]
+ return new ICCompletionProposal[]
{ new CCompletionProposal("", 0, 0, null, CorrectionMessages.NoCorrectionProposal_description, 0) }; //$NON-NLS-1$
}
if (res.length > 1) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java
index 9d677090430..22dce4e7c0d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/ContributedProcessorDescriptor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -100,7 +100,7 @@ public final class ContributedProcessorDescriptor {
fLastResult= !(expression.evaluate(evalContext) != EvaluationResult.TRUE);
return fLastResult;
} catch (CoreException e) {
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
}
fStatus= Boolean.FALSE;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/MarkerResolutionProposal.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/MarkerResolutionProposal.java
index 41f04a4f0ff..c9f9131f84e 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/MarkerResolutionProposal.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/correction/MarkerResolutionProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -62,7 +62,7 @@ public class MarkerResolutionProposal implements ICCompletionProposal {
return CorrectionMessages.bind(CorrectionMessages.MarkerResolutionProposal_additionaldesc,
problemDesc);
} catch (CoreException e) {
- CUIPlugin.getDefault().log(e);
+ CUIPlugin.log(e);
}
return null;
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
index 910b33cb6b8..b7fceb0e058 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/template/TemplateEngine.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -48,6 +48,7 @@ import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContextType;
import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.text.c.hover.SourceViewerInformationControl;
+import org.eclipse.cdt.internal.ui.text.contentassist.RelevanceConstants;
public class TemplateEngine {
@@ -82,7 +83,7 @@ public class TemplateEngine {
* @param image
*/
public CTemplateProposal(Template template, TemplateContext context, IRegion region, Image image) {
- super(template, context, region, image, 90);
+ super(template, context, region, image, RelevanceConstants.CASE_MATCH_RELEVANCE + RelevanceConstants.TEMPLATE_TYPE_RELEVANCE);
}
public String getIdString() {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
index 8f024ed6ef3..db42f5ff2a5 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java
@@ -1415,7 +1415,7 @@ public class PreferenceConstants {
// content assist
store.setDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES, "org.eclipse.cdt.ui.textProposalCategory\0"); //$NON-NLS-1$
- store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0"); //$NON-NLS-1$
+ store.setDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER, "org.eclipse.cdt.ui.parserProposalCategory:65539\0org.eclipse.cdt.ui.textProposalCategory:65541\0org.eclipse.cdt.ui.templateProposalCategory:2\0org.eclipse.cdt.ui.helpProposalCategory:5\0"); //$NON-NLS-1$
setDefaultAndFireEvent(
store,

Back to the top