mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content Assist work
This commit is contained in:
parent
7742dab0b8
commit
0b91eeb637
20 changed files with 441 additions and 333 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-12-09 Hoda Amer
|
||||||
|
Modified the Completion Proposal test to include case sensitivity
|
||||||
|
in the order of proposals.
|
||||||
|
|
||||||
2003-12-09 John Camelon
|
2003-12-09 John Camelon
|
||||||
Added ContextualParseTest.java and some test cases.
|
Added ContextualParseTest.java and some test cases.
|
||||||
|
|
||||||
|
|
|
@ -135,14 +135,14 @@ public class CompletionProposalsTest extends TestCase{
|
||||||
assertEquals(displayString, "anotherClass");
|
assertEquals(displayString, "anotherClass");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
assertEquals(displayString, "AStruct");
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
assertEquals(displayString, "AMacro");
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
assertEquals(displayString, "anEnumeration");
|
assertEquals(displayString, "anEnumeration");
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
assertEquals(displayString, "AStruct");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
assertEquals(displayString, "AMacro");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(CModelException e){
|
} catch(CModelException e){
|
||||||
|
|
|
@ -65,6 +65,8 @@ import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupResult;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,6 +118,14 @@ public class CompleteParseBaseTest extends TestCase
|
||||||
|
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTNode#lookup(java.lang.String, org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind)
|
||||||
|
*/
|
||||||
|
public LookupResult lookup(String prefix, LookupKind kind) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CodeScope extends Scope implements IASTCodeScope
|
public static class CodeScope extends Scope implements IASTCodeScope
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-12-09 Hoda Amer
|
||||||
|
Modified IASTCompletionNode.CompletionKind
|
||||||
|
modified IASTNode.LookupKind
|
||||||
|
Changed IASTScope to extend IASTNode
|
||||||
|
|
||||||
2003-15-09 John Camelon
|
2003-15-09 John Camelon
|
||||||
Fixed Bug 47234 : new ParserMode required for a better CModel
|
Fixed Bug 47234 : new ParserMode required for a better CModel
|
||||||
Updated IASTCompletionNode to include a scope as well as a context.
|
Updated IASTCompletionNode to include a scope as well as a context.
|
||||||
|
|
|
@ -20,23 +20,20 @@ public interface IASTCompletionNode {
|
||||||
|
|
||||||
public static class CompletionKind extends Enum
|
public static class CompletionKind extends Enum
|
||||||
{
|
{
|
||||||
public static final CompletionKind DOT_MEMBER = new CompletionKind( 0 );
|
public static final CompletionKind MEMBER_REFERENCE = new CompletionKind( 0 );
|
||||||
public static final CompletionKind ARROW_MEMBER = new CompletionKind( 1 );
|
public static final CompletionKind SCOPED_REFERENCE = new CompletionKind( 1 );
|
||||||
public static final CompletionKind QUALIFIEDNAME_MEMBER = new CompletionKind( 2 );
|
public static final CompletionKind FIELD_TYPE = new CompletionKind( 2 );
|
||||||
public static final CompletionKind FIELD_TYPE = new CompletionKind( 3 );
|
public static final CompletionKind VARIABLE_TYPE = new CompletionKind( 3 );
|
||||||
public static final CompletionKind VARIABLE_TYPE = new CompletionKind( 4 );
|
public static final CompletionKind ARGUMENT_TYPE = new CompletionKind( 4 );
|
||||||
public static final CompletionKind ARGUMENT_TYPE = new CompletionKind( 5 );
|
public static final CompletionKind SINGLE_NAME_REFERENCE = new CompletionKind( 5 );
|
||||||
public static final CompletionKind METHOD_RETURN_TYPE = new CompletionKind( 6 );
|
public static final CompletionKind TYPE_REFERENCE = new CompletionKind( 6 );
|
||||||
public static final CompletionKind FUNCTIOND_RETURN_TYPE = new CompletionKind( 7 );
|
public static final CompletionKind CLASS_REFERENCE = new CompletionKind( 7 );
|
||||||
public static final CompletionKind SINGLE_NAME_REFERENCE = new CompletionKind( 8 );
|
public static final CompletionKind NAMESPACE_REFERENCE = new CompletionKind( 8 );
|
||||||
public static final CompletionKind QUALIFIED_NAME_REFERENCE = new CompletionKind( 9 );
|
public static final CompletionKind EXCEPTION_REFERENCE = new CompletionKind( 9 );
|
||||||
public static final CompletionKind STRUCTURE_REFERENCE = new CompletionKind( 10 );
|
public static final CompletionKind MACRO_REFERENCE = new CompletionKind( 10 );
|
||||||
public static final CompletionKind CLASS_REFERENCE = new CompletionKind( 11 );
|
public static final CompletionKind FUNCTION_REFERENCE = new CompletionKind( 11 );
|
||||||
public static final CompletionKind EXCEPTION_REFERENCE = new CompletionKind( 12 );
|
public static final CompletionKind CONSTRUCTOR_REFERENCE = new CompletionKind( 12 );
|
||||||
public static final CompletionKind MACRO_REFERENCE = new CompletionKind( 13 );
|
public static final CompletionKind KEYWORD = new CompletionKind( 13 );
|
||||||
public static final CompletionKind MESSAGE_SEND = new CompletionKind( 14 );
|
|
||||||
public static final CompletionKind QUALIFIED_ALLOCATION_EXPRESSION = new CompletionKind( 15 );
|
|
||||||
public static final CompletionKind KEYWORD = new CompletionKind( 16 );
|
|
||||||
|
|
||||||
//TODO MORE TO COME
|
//TODO MORE TO COME
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,13 +30,14 @@ public interface IASTNode {
|
||||||
public static final LookupKind FUNCTIONS = new LookupKind( 5 );
|
public static final LookupKind FUNCTIONS = new LookupKind( 5 );
|
||||||
public static final LookupKind VARIABLES = new LookupKind( 6 );
|
public static final LookupKind VARIABLES = new LookupKind( 6 );
|
||||||
public static final LookupKind LOCAL_VARIABLES = new LookupKind( 7 );
|
public static final LookupKind LOCAL_VARIABLES = new LookupKind( 7 );
|
||||||
public static final LookupKind METHODS = new LookupKind( 8 );
|
public static final LookupKind MEMBERS = new LookupKind( 8 );
|
||||||
public static final LookupKind FIELDS = new LookupKind( 9 );
|
public static final LookupKind METHODS = new LookupKind( 9 );
|
||||||
public static final LookupKind CONSTRUCTORS = new LookupKind (10);
|
public static final LookupKind FIELDS = new LookupKind( 10 );
|
||||||
public static final LookupKind NAMESPACES = new LookupKind( 11 );
|
public static final LookupKind CONSTRUCTORS = new LookupKind (11);
|
||||||
public static final LookupKind MACROS = new LookupKind( 12 );
|
public static final LookupKind NAMESPACES = new LookupKind( 12 );
|
||||||
public static final LookupKind ENUMERATIONS = new LookupKind( 13 );
|
public static final LookupKind MACROS = new LookupKind( 13 );
|
||||||
public static final LookupKind ENUMERATORS = new LookupKind( 14 );
|
public static final LookupKind ENUMERATIONS = new LookupKind( 14 );
|
||||||
|
public static final LookupKind ENUMERATORS = new LookupKind( 15 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumValue
|
* @param enumValue
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Iterator;
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IASTScope {
|
public interface IASTScope extends IASTNode{
|
||||||
|
|
||||||
public Iterator getDeclarations() throws ASTNotImplementedException;
|
public Iterator getDeclarations() throws ASTNotImplementedException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ import java.util.List;
|
||||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind;
|
||||||
|
import org.eclipse.cdt.core.parser.ast.IASTNode.LookupResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -74,4 +76,12 @@ public class ASTCompilationUnit implements IASTCompilationUnit, IASTQScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.parser.ast.IASTNode#lookup(java.lang.String, org.eclipse.cdt.core.parser.ast.IASTNode.LookupKind)
|
||||||
|
*/
|
||||||
|
public LookupResult lookup(String prefix, LookupKind kind) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2003-12-09 Hoda Amer
|
||||||
|
Content Assist work: Modified the project scope user preference
|
||||||
|
Removed the case sensitivily user preference.
|
||||||
|
Exported content assist strings to a properties file.
|
||||||
|
|
||||||
2003-12-03 Hoda Amer
|
2003-12-03 Hoda Amer
|
||||||
Content Assist work :Added a new internal package for content assist
|
Content Assist work :Added a new internal package for content assist
|
||||||
Added more functionality to the CompletionEngine.
|
Added more functionality to the CompletionEngine.
|
||||||
|
|
|
@ -75,7 +75,6 @@ import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.editors.text.TextEditor;
|
import org.eclipse.ui.editors.text.TextEditor;
|
||||||
import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
|
import org.eclipse.ui.editors.text.TextEditorPreferenceConstants;
|
||||||
import org.eclipse.ui.internal.editors.text.EditorsPlugin;
|
|
||||||
import org.eclipse.ui.part.EditorActionBarContributor;
|
import org.eclipse.ui.part.EditorActionBarContributor;
|
||||||
import org.eclipse.ui.part.IShowInSource;
|
import org.eclipse.ui.part.IShowInSource;
|
||||||
import org.eclipse.ui.part.ShowInContext;
|
import org.eclipse.ui.part.ShowInContext;
|
||||||
|
@ -83,6 +82,7 @@ import org.eclipse.ui.texteditor.AnnotationPreference;
|
||||||
import org.eclipse.ui.texteditor.ContentAssistAction;
|
import org.eclipse.ui.texteditor.ContentAssistAction;
|
||||||
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
|
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
|
||||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
||||||
|
import org.eclipse.ui.texteditor.ExtendedTextEditorPreferenceConstants;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
||||||
|
@ -865,12 +865,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
fSourceViewerDecorationSupport.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
|
fSourceViewerDecorationSupport.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
|
||||||
|
|
||||||
fSourceViewerDecorationSupport.setCursorLinePainterPreferenceKeys(
|
fSourceViewerDecorationSupport.setCursorLinePainterPreferenceKeys(
|
||||||
TextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
|
ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
|
||||||
TextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
|
ExtendedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
|
||||||
fSourceViewerDecorationSupport.setMarginPainterPreferenceKeys(
|
fSourceViewerDecorationSupport.setMarginPainterPreferenceKeys(
|
||||||
TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN,
|
ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN,
|
||||||
TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR,
|
ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR,
|
||||||
TextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
|
ExtendedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
|
||||||
fSourceViewerDecorationSupport.setSymbolicFontName(getFontPropertyPreferenceKey());
|
fSourceViewerDecorationSupport.setSymbolicFontName(getFontPropertyPreferenceKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,16 +15,13 @@ package org.eclipse.cdt.internal.ui.editor;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
|
|
||||||
import org.eclipse.jface.text.Assert;
|
|
||||||
|
|
||||||
import org.eclipse.ui.IEditorInput;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
||||||
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
|
import org.eclipse.cdt.ui.IWorkingCopyManagerExtension;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.jface.text.Assert;
|
||||||
|
import org.eclipse.ui.IEditorInput;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,15 +80,15 @@ public class WorkingCopyManager implements IWorkingCopyManager, IWorkingCopyMana
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
|
* @see org.eclipse.cdt.ui.IWorkingCopyManager#getWorkingCopy(org.eclipse.ui.IEditorInput)
|
||||||
*/
|
*/
|
||||||
public ITranslationUnit getWorkingCopy(IEditorInput input) {
|
public IWorkingCopy getWorkingCopy(IEditorInput input) {
|
||||||
ITranslationUnit unit= fMap == null ? null : (ITranslationUnit) fMap.get(input);
|
IWorkingCopy unit= fMap == null ? null : (IWorkingCopy) fMap.get(input);
|
||||||
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
|
return unit != null ? unit : fDocumentProvider.getWorkingCopy(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.core.model.ITranslationUnit)
|
* @see org.eclipse.cdt.internal.ui.editor.IWorkingCopyManagerExtension#setWorkingCopy(org.eclipse.ui.IEditorInput, org.eclipse.cdt.core.model.ITranslationUnit)
|
||||||
*/
|
*/
|
||||||
public void setWorkingCopy(IEditorInput input, ITranslationUnit workingCopy) {
|
public void setWorkingCopy(IEditorInput input, IWorkingCopy workingCopy) {
|
||||||
if (fDocumentProvider.isConnected(input)) {
|
if (fDocumentProvider.isConnected(input)) {
|
||||||
if (fMap == null)
|
if (fMap == null)
|
||||||
fMap= new HashMap();
|
fMap= new HashMap();
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.List;
|
import org.eclipse.swt.widgets.List;
|
||||||
import org.eclipse.swt.widgets.TabFolder;
|
import org.eclipse.swt.widgets.TabFolder;
|
||||||
|
@ -186,20 +187,23 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.AUTOACTIVATION));
|
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, ContentAssistPreference.AUTOACTIVATION_DELAY));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, ContentAssistPreference.AUTOACTIVATION_DELAY));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.AUTOINSERT));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.AUTOINSERT));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_BACKGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_BACKGROUND));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_FOREGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PROPOSALS_FOREGROUND));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_BACKGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_BACKGROUND));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_FOREGROUND));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.PARAMETERS_FOREGROUND));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOT));
|
||||||
|
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.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.CASE_SENSITIVITY));
|
//overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.CASE_SENSITIVITY));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.ADD_INCLUDE));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.ADD_INCLUDE));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.PROJECT_SCOPE_SEARCH));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.CURRENT_FILE_SEARCH_SCOPE));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_TAG_COLOR));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.PROJECT_SEARCH_SCOPE));
|
||||||
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ContentAssistPreference.PROJECT_AND_DEPENDENCY_SEARCH_SCOPE));
|
||||||
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_TAG_COLOR));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_TAG_BOLD));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_TAG_BOLD));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PreferenceConstants.EDITOR_TASK_INDICATION_COLOR));
|
||||||
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION));
|
overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PreferenceConstants.EDITOR_TASK_INDICATION));
|
||||||
|
@ -273,9 +277,11 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
|
|
||||||
store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, true);
|
store.setDefault(ExtendedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER, true);
|
||||||
|
|
||||||
store.setDefault(ContentAssistPreference.AUTOACTIVATION, false);
|
store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOT, true);
|
||||||
|
store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_ARROW, true);
|
||||||
|
store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOUBLECOLON, true);
|
||||||
store.setDefault(ContentAssistPreference.AUTOACTIVATION_DELAY, 500);
|
store.setDefault(ContentAssistPreference.AUTOACTIVATION_DELAY, 500);
|
||||||
|
|
||||||
store.setDefault(ContentAssistPreference.AUTOINSERT, true);
|
store.setDefault(ContentAssistPreference.AUTOINSERT, true);
|
||||||
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_BACKGROUND, new RGB(254, 241, 233));
|
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_BACKGROUND, new RGB(254, 241, 233));
|
||||||
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_FOREGROUND, new RGB(0, 0, 0));
|
PreferenceConverter.setDefault(store, ContentAssistPreference.PROPOSALS_FOREGROUND, new RGB(0, 0, 0));
|
||||||
|
@ -284,11 +290,13 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, ".,");
|
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, ".,");
|
||||||
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, "@");
|
//store.setDefault(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, "@");
|
||||||
//store.setDefault(ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, true);
|
//store.setDefault(ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, true);
|
||||||
store.setDefault(ContentAssistPreference.CASE_SENSITIVITY, false);
|
//store.setDefault(ContentAssistPreference.CASE_SENSITIVITY, false);
|
||||||
store.setDefault(ContentAssistPreference.ORDER_PROPOSALS, false);
|
store.setDefault(ContentAssistPreference.ORDER_PROPOSALS, false);
|
||||||
store.setDefault(ContentAssistPreference.ADD_INCLUDE, true);
|
store.setDefault(ContentAssistPreference.ADD_INCLUDE, true);
|
||||||
store.setDefault(ContentAssistPreference.PROJECT_SCOPE_SEARCH, false);
|
store.setDefault(ContentAssistPreference.CURRENT_FILE_SEARCH_SCOPE, true);
|
||||||
|
store.setDefault(ContentAssistPreference.PROJECT_SEARCH_SCOPE, false);
|
||||||
|
store.setDefault(ContentAssistPreference.PROJECT_AND_DEPENDENCY_SEARCH_SCOPE, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -829,47 +837,61 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
GridLayout layout = new GridLayout();
|
GridLayout layout = new GridLayout();
|
||||||
layout.numColumns = 2;
|
layout.numColumns = 2;
|
||||||
contentAssistComposite.setLayout(layout);
|
contentAssistComposite.setLayout(layout);
|
||||||
|
|
||||||
String label= "&Search entire project for completion proposals";
|
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||||
addCheckBox(contentAssistComposite, label, ContentAssistPreference.PROJECT_SCOPE_SEARCH, 0);
|
// The following three radio buttons are grouped together
|
||||||
|
String label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.searchGroupTitle");
|
||||||
label = "Insert single &proposals automatically";
|
Group searchGroup = addGroupBox(contentAssistComposite, label, 2);
|
||||||
|
|
||||||
|
label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.searchGroupCurrentFileOption");
|
||||||
|
addRadioButton(searchGroup, label, ContentAssistPreference.CURRENT_FILE_SEARCH_SCOPE, 0);
|
||||||
|
|
||||||
|
label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.searchGroupCurrentProjectOption");
|
||||||
|
addRadioButton(searchGroup, label, ContentAssistPreference.PROJECT_SEARCH_SCOPE, 0);
|
||||||
|
|
||||||
|
label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.searchGroupCurrentProjectAndDependenciesOption");
|
||||||
|
addRadioButton(searchGroup, label, ContentAssistPreference.PROJECT_AND_DEPENDENCY_SEARCH_SCOPE, 0);
|
||||||
|
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||||
|
|
||||||
|
|
||||||
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.insertSingleProposalAutomatically");
|
||||||
addCheckBox(contentAssistComposite, label, ContentAssistPreference.AUTOINSERT, 0);
|
addCheckBox(contentAssistComposite, label, ContentAssistPreference.AUTOINSERT, 0);
|
||||||
|
|
||||||
//label= "Show only proposals visible in the invocation conte&xt";
|
//label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.showOnlyProposalsWithCorrectVisibility");
|
||||||
//addCheckBox(contentAssistComposite, label, ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, 0);
|
//addCheckBox(contentAssistComposite, label, ContentAssistPreference.SHOW_VISIBLE_PROPOSALS, 0);
|
||||||
|
|
||||||
label= "Show only proposals with &matching cases";
|
//label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.showProposalsInAlphabeticalOrder");
|
||||||
addCheckBox(contentAssistComposite, label, ContentAssistPreference.CASE_SENSITIVITY, 0);
|
|
||||||
|
|
||||||
//label= "Present proposals in a&lphabetical order";
|
|
||||||
//addCheckBox(contentAssistComposite, label, ContentAssistPreference.ORDER_PROPOSALS, 0);
|
//addCheckBox(contentAssistComposite, label, ContentAssistPreference.ORDER_PROPOSALS, 0);
|
||||||
|
|
||||||
label = "&Enable auto activation";
|
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||||
addCheckBox(contentAssistComposite, label, ContentAssistPreference.AUTOACTIVATION, 0);
|
// The following items are grouped for Auto Activation
|
||||||
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.autoActivationGroupTitle");
|
||||||
|
Group enableGroup = addGroupBox(contentAssistComposite, label, 2);
|
||||||
|
|
||||||
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.autoActivationEnableDot");
|
||||||
|
addCheckBox(enableGroup, label, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOT, 0);
|
||||||
|
|
||||||
//label= "Automatically add &include for proposals from system functions";
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.autoActivationEnableArrow");
|
||||||
//addCheckBox(contentAssistComposite, label, ContentAssistPreference.ADD_INCLUDE, 0);
|
addCheckBox(enableGroup, label, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_ARROW, 0);
|
||||||
|
|
||||||
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.autoActivationEnableDoubleColon");
|
||||||
|
addCheckBox(enableGroup, label, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOUBLECOLON, 0);
|
||||||
|
|
||||||
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.autoActivationDelay");
|
||||||
|
addTextField(enableGroup, label, ContentAssistPreference.AUTOACTIVATION_DELAY, 4, 0, true);
|
||||||
|
|
||||||
label = "Auto activation dela&y:";
|
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||||
addTextField(contentAssistComposite, label, ContentAssistPreference.AUTOACTIVATION_DELAY, 4, 0, true);
|
|
||||||
|
|
||||||
label = "Auto activation &triggers for C:";
|
label = PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.completionProposalBackgroundColor");
|
||||||
addTextField(contentAssistComposite, label, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_C, 25, 0, false);
|
|
||||||
|
|
||||||
//label= "Auto activation triggers for &JavaDoc:";
|
|
||||||
//addTextField(contentAssistComposite, label, ContentAssistPreference.AUTOACTIVATION_TRIGGERS_JAVADOC, 25, 0);
|
|
||||||
|
|
||||||
label = "&Background for completion proposals:";
|
|
||||||
addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_BACKGROUND, 0);
|
addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_BACKGROUND, 0);
|
||||||
|
|
||||||
label= "&Foreground for completion proposals:";
|
label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.completionProposalForegroundColor");
|
||||||
addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0);
|
addColorButton(contentAssistComposite, label, ContentAssistPreference.PROPOSALS_FOREGROUND, 0);
|
||||||
|
|
||||||
// label= "Bac&kground for method parameters:";
|
// label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.parameterBackgroundColor");
|
||||||
// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0);
|
// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_BACKGROUND, 0);
|
||||||
//
|
//
|
||||||
// label= "Fo®round for method parameters:";
|
// label= PreferencesMessages.getString("CEditorPreferencePage.ContentAssistPage.parameterForegroundColor");
|
||||||
// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0);
|
// addColorButton(contentAssistComposite, label, ContentAssistPreference.PARAMETERS_FOREGROUND, 0);
|
||||||
|
|
||||||
WorkbenchHelp.setHelp(contentAssistComposite, ICHelpContextIds.C_EDITOR_CONTENT_ASSIST_PREF_PAGE);
|
WorkbenchHelp.setHelp(contentAssistComposite, ICHelpContextIds.C_EDITOR_CONTENT_ASSIST_PREF_PAGE);
|
||||||
|
@ -890,22 +912,22 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
|
||||||
TabItem item = new TabItem(folder, SWT.NONE);
|
TabItem item = new TabItem(folder, SWT.NONE);
|
||||||
item.setText("&General");
|
item.setText(PreferencesMessages.getString("CEditorPreferencePage.generalTabTitle"));
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setControl(createBehaviorPage(folder));
|
item.setControl(createBehaviorPage(folder));
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
item = new TabItem(folder, SWT.NONE);
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setText("Annotations");
|
item.setText(PreferencesMessages.getString("CEditorPreferencePage.annotationTabTitle"));
|
||||||
item.setControl(createAnnotationsPage(folder));
|
item.setControl(createAnnotationsPage(folder));
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
item = new TabItem(folder, SWT.NONE);
|
||||||
item.setText("&Colors");
|
item.setText(PreferencesMessages.getString("CEditorPreferencePage.colorsTabTitle"));
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setControl(createColorPage(folder));
|
item.setControl(createColorPage(folder));
|
||||||
|
|
||||||
item = new TabItem(folder, SWT.NONE);
|
item = new TabItem(folder, SWT.NONE);
|
||||||
item.setText("Content A&ssist");
|
item.setText(PreferencesMessages.getString("CEditorPreferencePage.contentAssistTabTitle"));
|
||||||
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
item.setImage(CPluginImages.get(CPluginImages.IMG_OBJS_TUNIT));
|
||||||
item.setControl(createContentAssistPage(folder));
|
item.setControl(createContentAssistPage(folder));
|
||||||
|
|
||||||
|
@ -1067,6 +1089,16 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Group addGroupBox(Composite parent, String label, int nColumns ){
|
||||||
|
Group group = new Group(parent, SWT.NONE);
|
||||||
|
group.setText(label);
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.numColumns = nColumns;
|
||||||
|
group.setLayout(layout);
|
||||||
|
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
private Button addCheckBox(Composite parent, String label, String key, int indentation) {
|
private Button addCheckBox(Composite parent, String label, String key, int indentation) {
|
||||||
Button checkBox = new Button(parent, SWT.CHECK);
|
Button checkBox = new Button(parent, SWT.CHECK);
|
||||||
checkBox.setText(label);
|
checkBox.setText(label);
|
||||||
|
@ -1082,6 +1114,21 @@ public class CEditorPreferencePage extends PreferencePage implements IWorkbenchP
|
||||||
return checkBox;
|
return checkBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Button addRadioButton(Composite parent, String label, String key, int indentation) {
|
||||||
|
Button radioButton = new Button(parent, SWT.RADIO);
|
||||||
|
radioButton.setText(label);
|
||||||
|
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalIndent = indentation;
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
radioButton.setLayoutData(gd);
|
||||||
|
radioButton.addSelectionListener(fCheckBoxListener);
|
||||||
|
|
||||||
|
fCheckBoxes.put(radioButton, key);
|
||||||
|
|
||||||
|
return radioButton;
|
||||||
|
}
|
||||||
|
|
||||||
private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
|
private Control addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
|
||||||
|
|
||||||
Label labelControl = new Label(composite, SWT.NONE);
|
Label labelControl = new Label(composite, SWT.NONE);
|
||||||
|
|
|
@ -108,7 +108,12 @@ public class EditTemplateDialog extends StatusDialog {
|
||||||
assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
|
assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
|
||||||
|
|
||||||
//assistant.enableAutoInsert(store.getBoolean(ContentAssistPreference.AUTOINSERT));
|
//assistant.enableAutoInsert(store.getBoolean(ContentAssistPreference.AUTOINSERT));
|
||||||
assistant.enableAutoActivation(store.getBoolean(ContentAssistPreference.AUTOACTIVATION));
|
boolean enabled = (store.getBoolean(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOT)
|
||||||
|
|| store.getBoolean(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_ARROW)
|
||||||
|
|| store.getBoolean(ContentAssistPreference.AUTOACTIVATION_TRIGGERS_DOUBLECOLON)
|
||||||
|
);
|
||||||
|
assistant.enableAutoActivation(enabled);
|
||||||
|
|
||||||
assistant.setAutoActivationDelay(store.getInt(ContentAssistPreference.AUTOACTIVATION_DELAY));
|
assistant.setAutoActivationDelay(store.getInt(ContentAssistPreference.AUTOACTIVATION_DELAY));
|
||||||
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
|
||||||
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
|
||||||
|
|
|
@ -60,3 +60,24 @@ TodoTaskInputDialog.error.entryExists=Entry with the same name already exists.
|
||||||
TodoTaskInputDialog.error.noSpace=Name can not start or end with a whitespace.
|
TodoTaskInputDialog.error.noSpace=Name can not start or end with a whitespace.
|
||||||
|
|
||||||
CEditorPreferencePage.cCommentTaskTags=Task Tags
|
CEditorPreferencePage.cCommentTaskTags=Task Tags
|
||||||
|
|
||||||
|
CEditorPreferencePage.generalTabTitle=&General
|
||||||
|
CEditorPreferencePage.annotationTabTitle= &Annotations
|
||||||
|
CEditorPreferencePage.colorsTabTitle=&Colors
|
||||||
|
CEditorPreferencePage.contentAssistTabTitle=Content A&ssist
|
||||||
|
|
||||||
|
CEditorPreferencePage.ContentAssistPage.searchGroupTitle=Search scope for completion proposals:
|
||||||
|
CEditorPreferencePage.ContentAssistPage.searchGroupCurrentFileOption=&Search current file and included files
|
||||||
|
CEditorPreferencePage.ContentAssistPage.searchGroupCurrentProjectOption=Search current &project
|
||||||
|
CEditorPreferencePage.ContentAssistPage.searchGroupCurrentProjectAndDependenciesOption=Search current project and &dependent projects
|
||||||
|
CEditorPreferencePage.ContentAssistPage.insertSingleProposalAutomatically=Insert single &proposals automatically
|
||||||
|
CEditorPreferencePage.ContentAssistPage.showOnlyProposalsWithCorrectVisibility=Show only proposals visible in the invocation conte&xt
|
||||||
|
CEditorPreferencePage.ContentAssistPage.showProposalsInAlphabeticalOrder=Present proposals in a&lphabetical order
|
||||||
|
CEditorPreferencePage.ContentAssistPage.autoActivationGroupTitle=Auto activation:
|
||||||
|
CEditorPreferencePage.ContentAssistPage.autoActivationEnableDot=Enable . as trigger
|
||||||
|
CEditorPreferencePage.ContentAssistPage.autoActivationEnableArrow=Enable -> as trigger
|
||||||
|
CEditorPreferencePage.ContentAssistPage.autoActivationDelay=dela&y (in milli seconds)
|
||||||
|
CEditorPreferencePage.ContentAssistPage.completionProposalBackgroundColor=&Background for completion proposals:
|
||||||
|
CEditorPreferencePage.ContentAssistPage.completionProposalForegroundColor=&Foreground for completion proposals:
|
||||||
|
CEditorPreferencePage.ContentAssistPage.parameterBackgroundColor=Bac&kground for method parameters:
|
||||||
|
CEditorPreferencePage.ContentAssistPage.parameterForegroundColor=Fo®round for method parameters:
|
|
@ -27,6 +27,7 @@ import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.model.CElement;
|
import org.eclipse.cdt.internal.core.model.CElement;
|
||||||
|
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
||||||
import org.eclipse.cdt.internal.core.sourcedependency.DependencyQueryJob;
|
import org.eclipse.cdt.internal.core.sourcedependency.DependencyQueryJob;
|
||||||
|
@ -43,7 +44,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.FunctionPrototypeSummary;
|
import org.eclipse.cdt.ui.FunctionPrototypeSummary;
|
||||||
import org.eclipse.cdt.ui.IFunctionSummary;
|
import org.eclipse.cdt.ui.IFunctionSummary;
|
||||||
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
import org.eclipse.cdt.ui.IWorkingCopyManager;
|
||||||
import org.eclipse.cdt.ui.text.*;
|
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -82,6 +83,9 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
SearchEngine searchEngine = null;
|
SearchEngine searchEngine = null;
|
||||||
CSearchResultLabelProvider labelProvider = null;
|
CSearchResultLabelProvider labelProvider = null;
|
||||||
|
|
||||||
|
int currentOffset = 0;
|
||||||
|
IWorkingCopy currentSourceUnit = null;
|
||||||
|
|
||||||
public CCompletionProcessor(IEditorPart editor) {
|
public CCompletionProcessor(IEditorPart editor) {
|
||||||
fEditor = (CEditor) editor;
|
fEditor = (CEditor) editor;
|
||||||
|
|
||||||
|
@ -218,10 +222,13 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
|
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
|
||||||
|
|
||||||
IWorkingCopyManager fManager = CUIPlugin.getDefault().getWorkingCopyManager();
|
IWorkingCopyManager fManager = CUIPlugin.getDefault().getWorkingCopyManager();
|
||||||
ITranslationUnit unit = fManager.getWorkingCopy(fEditor.getEditorInput());
|
IWorkingCopy unit = fManager.getWorkingCopy(fEditor.getEditorInput());
|
||||||
|
|
||||||
IDocument document = viewer.getDocument();
|
IDocument document = viewer.getDocument();
|
||||||
|
|
||||||
|
currentOffset = documentOffset;
|
||||||
|
currentSourceUnit = unit;
|
||||||
|
|
||||||
ICCompletionProposal[] results = null;
|
ICCompletionProposal[] results = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -476,14 +483,20 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
// clear the completion list at the result collector
|
// clear the completion list at the result collector
|
||||||
resultCollector.clearCompletions();
|
resultCollector.clearCompletions();
|
||||||
|
|
||||||
|
//invoke the completion engine
|
||||||
|
//IASTCompletionNode completionNode = completionEngine.complete(currentSourceUnit, currentOffset, completions);
|
||||||
|
|
||||||
|
// figure out the search scope
|
||||||
IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = CUIPlugin.getDefault().getPreferenceStore();
|
||||||
boolean projectScope = store.getBoolean(ContentAssistPreference.PROJECT_SCOPE_SEARCH);
|
boolean fileScope = store.getBoolean(ContentAssistPreference.CURRENT_FILE_SEARCH_SCOPE);
|
||||||
|
boolean projectScope = store.getBoolean(ContentAssistPreference.PROJECT_SEARCH_SCOPE);
|
||||||
|
boolean projectScopeAndDependency = store.getBoolean(ContentAssistPreference.PROJECT_AND_DEPENDENCY_SEARCH_SCOPE);
|
||||||
ICSearchScope scope = null;
|
ICSearchScope scope = null;
|
||||||
|
|
||||||
if (projectScope){
|
if ((projectScope) || (projectScopeAndDependency)){
|
||||||
ICElement[] projectScopeElement = new ICElement[1];
|
ICElement[] projectScopeElement = new ICElement[1];
|
||||||
projectScopeElement[0] = (ICElement)currentScope.getCProject();
|
projectScopeElement[0] = (ICElement)currentScope.getCProject();
|
||||||
scope = SearchEngine.createCSearchScope(projectScopeElement, true);
|
scope = SearchEngine.createCSearchScope(projectScopeElement, projectScopeAndDependency);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Try to get the file
|
//Try to get the file
|
||||||
|
@ -552,30 +565,31 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int completionStart = region.getOffset();
|
sendResultsToCollector(elementsFound.iterator(), region.getOffset(), region.getLength(), frag );
|
||||||
int completionLength = region.getLength();
|
completions.addAll(resultCollector.getCompletions());
|
||||||
Iterator i = elementsFound.iterator();
|
}
|
||||||
while (i.hasNext()){
|
|
||||||
|
private void sendResultsToCollector(Iterator results , int completionStart, int completionLength, String prefix){
|
||||||
|
while (results.hasNext()){
|
||||||
ASTAccessVisibility visibility;
|
ASTAccessVisibility visibility;
|
||||||
|
|
||||||
BasicSearchMatch match = (BasicSearchMatch)i.next();
|
BasicSearchMatch match = (BasicSearchMatch)results.next();
|
||||||
int type = match.getElementType();
|
int type = match.getElementType();
|
||||||
int relevance = completionEngine.computeRelevance(type, frag, match.getName());
|
int relevance = completionEngine.computeRelevance(type, prefix, match.getName());
|
||||||
if(relevance > 0){
|
switch (type){
|
||||||
switch (type){
|
case ICElement.C_FIELD:
|
||||||
case ICElement.C_FIELD:
|
switch (match.getVisibility()){
|
||||||
switch (match.getVisibility()){
|
case ICElement.CPP_PUBLIC:
|
||||||
case ICElement.CPP_PUBLIC:
|
visibility = ASTAccessVisibility.PUBLIC;
|
||||||
visibility = ASTAccessVisibility.PUBLIC;
|
|
||||||
break;
|
break;
|
||||||
case ICElement.CPP_PROTECTED:
|
case ICElement.CPP_PROTECTED:
|
||||||
visibility = ASTAccessVisibility.PROTECTED;
|
visibility = ASTAccessVisibility.PROTECTED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
visibility = ASTAccessVisibility.PRIVATE;
|
visibility = ASTAccessVisibility.PRIVATE;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
resultCollector.acceptField(
|
resultCollector.acceptField(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
null,
|
null,
|
||||||
visibility,
|
visibility,
|
||||||
|
@ -584,102 +598,99 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
relevance);
|
relevance);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICElement.C_VARIABLE:
|
case ICElement.C_VARIABLE:
|
||||||
case ICElement.C_VARIABLE_DECLARATION:
|
case ICElement.C_VARIABLE_DECLARATION:
|
||||||
resultCollector.acceptVariable(
|
resultCollector.acceptVariable(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
null,
|
null,
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
relevance);
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_METHOD:
|
case ICElement.C_METHOD:
|
||||||
case ICElement.C_METHOD_DECLARATION:
|
case ICElement.C_METHOD_DECLARATION:
|
||||||
switch (match.getVisibility()){
|
switch (match.getVisibility()){
|
||||||
case ICElement.CPP_PUBLIC:
|
case ICElement.CPP_PUBLIC:
|
||||||
visibility = ASTAccessVisibility.PUBLIC;
|
visibility = ASTAccessVisibility.PUBLIC;
|
||||||
break;
|
break;
|
||||||
case ICElement.CPP_PROTECTED:
|
case ICElement.CPP_PROTECTED:
|
||||||
visibility = ASTAccessVisibility.PROTECTED;
|
visibility = ASTAccessVisibility.PROTECTED;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
visibility = ASTAccessVisibility.PRIVATE;
|
visibility = ASTAccessVisibility.PRIVATE;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
resultCollector.acceptMethod(
|
resultCollector.acceptMethod(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
null,
|
null,
|
||||||
match.getReturnType(),
|
match.getReturnType(),
|
||||||
visibility,
|
visibility,
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_FUNCTION:
|
case ICElement.C_FUNCTION:
|
||||||
case ICElement.C_FUNCTION_DECLARATION:
|
case ICElement.C_FUNCTION_DECLARATION:
|
||||||
resultCollector.acceptFunction(
|
resultCollector.acceptFunction(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
null,
|
null,
|
||||||
match.getReturnType(),
|
match.getReturnType(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
resultCollector.acceptClass(
|
resultCollector.acceptClass(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_STRUCT:
|
case ICElement.C_STRUCT:
|
||||||
resultCollector.acceptStruct(
|
resultCollector.acceptStruct(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_UNION:
|
case ICElement.C_UNION:
|
||||||
resultCollector.acceptUnion(
|
resultCollector.acceptUnion(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_NAMESPACE:
|
case ICElement.C_NAMESPACE:
|
||||||
resultCollector.acceptNamespace(
|
resultCollector.acceptNamespace(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_MACRO:
|
case ICElement.C_MACRO:
|
||||||
resultCollector.acceptMacro(
|
resultCollector.acceptMacro(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_ENUMERATION:
|
case ICElement.C_ENUMERATION:
|
||||||
resultCollector.acceptEnumeration(
|
resultCollector.acceptEnumeration(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
case ICElement.C_ENUMERATOR:
|
case ICElement.C_ENUMERATOR:
|
||||||
resultCollector.acceptEnumerator(
|
resultCollector.acceptEnumerator(
|
||||||
match.getName(),
|
match.getName(),
|
||||||
completionStart,
|
completionStart,
|
||||||
completionLength,
|
completionLength,
|
||||||
completionEngine.computeRelevance(type, prefix, match.getName()));
|
relevance);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
} // end if relevance
|
} // end while
|
||||||
} // end while
|
|
||||||
completions.addAll(resultCollector.getCompletions());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,12 +98,8 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
} else {
|
} else {
|
||||||
return CASE_MATCH_RELEVANCE;
|
return CASE_MATCH_RELEVANCE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
boolean matchCase = store.getBoolean(ContentAssistPreference.CASE_SENSITIVITY);
|
else {
|
||||||
|
|
||||||
if(matchCase)
|
|
||||||
return CASE_NOT_VALID_RELEVANCE;
|
|
||||||
else
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,100 +189,79 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
if(node instanceof IASTField){
|
if(node instanceof IASTField){
|
||||||
IASTField field = (IASTField)node;
|
IASTField field = (IASTField)node;
|
||||||
int relevance = computeRelevance(ICElement.C_FIELD, prefix, field.getName());
|
int relevance = computeRelevance(ICElement.C_FIELD, prefix, field.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptField(field.getName(),
|
||||||
requestor.acceptField(field.getName(),
|
ASTUtil.getType(field.getAbstractDeclaration()),
|
||||||
ASTUtil.getType(field.getAbstractDeclaration()),
|
field.getVisiblity(), completionStart, completionLength, relevance);
|
||||||
field.getVisiblity(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTVariable){
|
else if(node instanceof IASTVariable){
|
||||||
IASTVariable variable = (IASTVariable)node;
|
IASTVariable variable = (IASTVariable)node;
|
||||||
int relevance = computeRelevance(ICElement.C_VARIABLE, prefix, variable.getName());
|
int relevance = computeRelevance(ICElement.C_VARIABLE, prefix, variable.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptVariable(variable.getName(),
|
||||||
requestor.acceptVariable(variable.getName(),
|
ASTUtil.getType(variable.getAbstractDeclaration()),
|
||||||
ASTUtil.getType(variable.getAbstractDeclaration()),
|
completionStart, completionLength, relevance);
|
||||||
completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTMethod) {
|
else if(node instanceof IASTMethod) {
|
||||||
IASTMethod method = (IASTMethod)node;
|
IASTMethod method = (IASTMethod)node;
|
||||||
int relevance = computeRelevance(ICElement.C_METHOD, prefix, method.getName());
|
int relevance = computeRelevance(ICElement.C_METHOD, prefix, method.getName());
|
||||||
if(relevance >= 0){
|
String parameterString = ASTUtil.getParametersString(ASTUtil.getFunctionParameterTypes(method));
|
||||||
String parameterString = ASTUtil.getParametersString(ASTUtil.getFunctionParameterTypes(method));
|
requestor.acceptMethod(method.getName(),
|
||||||
requestor.acceptMethod(method.getName(),
|
ASTUtil.getType(method.getReturnType()), parameterString,
|
||||||
ASTUtil.getType(method.getReturnType()), parameterString,
|
method.getVisiblity(), completionStart, completionLength, relevance);
|
||||||
method.getVisiblity(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTFunction){
|
else if(node instanceof IASTFunction){
|
||||||
IASTFunction function = (IASTFunction)node;
|
IASTFunction function = (IASTFunction)node;
|
||||||
int relevance = computeRelevance(ICElement.C_FUNCTION, prefix, function.getName());
|
int relevance = computeRelevance(ICElement.C_FUNCTION, prefix, function.getName());
|
||||||
if(relevance >= 0){
|
String parameterString = ASTUtil.getParametersString(ASTUtil.getFunctionParameterTypes(function));
|
||||||
String parameterString = ASTUtil.getParametersString(ASTUtil.getFunctionParameterTypes(function));
|
requestor.acceptFunction(function.getName(),
|
||||||
requestor.acceptFunction(function.getName(),
|
ASTUtil.getType(function.getReturnType()), parameterString,
|
||||||
ASTUtil.getType(function.getReturnType()), parameterString,
|
completionStart, completionLength, relevance);
|
||||||
completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTClassSpecifier){
|
else if(node instanceof IASTClassSpecifier){
|
||||||
IASTClassSpecifier classSpecifier = (IASTClassSpecifier)node;
|
IASTClassSpecifier classSpecifier = (IASTClassSpecifier)node;
|
||||||
ASTClassKind classkind = classSpecifier.getClassKind();
|
ASTClassKind classkind = classSpecifier.getClassKind();
|
||||||
if(classkind == ASTClassKind.CLASS){
|
if(classkind == ASTClassKind.CLASS){
|
||||||
int relevance = computeRelevance(ICElement.C_CLASS, prefix, classSpecifier.getName());
|
int relevance = computeRelevance(ICElement.C_CLASS, prefix, classSpecifier.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptClass(classSpecifier.getName(),
|
||||||
requestor.acceptClass(classSpecifier.getName(),
|
completionStart, completionLength, relevance);
|
||||||
completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(classkind == ASTClassKind.STRUCT){
|
if(classkind == ASTClassKind.STRUCT){
|
||||||
int relevance = computeRelevance(ICElement.C_STRUCT, prefix, classSpecifier.getName());
|
int relevance = computeRelevance(ICElement.C_STRUCT, prefix, classSpecifier.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptStruct(classSpecifier.getName(),
|
||||||
requestor.acceptStruct(classSpecifier.getName(),
|
completionStart, completionLength, relevance);
|
||||||
completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(classkind == ASTClassKind.UNION){
|
if(classkind == ASTClassKind.UNION){
|
||||||
int relevance = computeRelevance(ICElement.C_UNION, prefix, classSpecifier.getName());
|
int relevance = computeRelevance(ICElement.C_UNION, prefix, classSpecifier.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptUnion(classSpecifier.getName(),
|
||||||
requestor.acceptUnion(classSpecifier.getName(),
|
completionStart, completionLength, relevance);
|
||||||
completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTMacro){
|
else if(node instanceof IASTMacro){
|
||||||
IASTMacro macro = (IASTMacro)node;
|
IASTMacro macro = (IASTMacro)node;
|
||||||
int relevance = computeRelevance(ICElement.C_MACRO, prefix, macro.getName());
|
int relevance = computeRelevance(ICElement.C_MACRO, prefix, macro.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptMacro(macro.getName(), completionStart, completionLength, relevance);
|
||||||
requestor.acceptMacro(macro.getName(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTNamespaceDefinition){
|
else if(node instanceof IASTNamespaceDefinition){
|
||||||
IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)node;
|
IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)node;
|
||||||
int relevance = computeRelevance(ICElement.C_NAMESPACE, prefix, namespace.getName());
|
int relevance = computeRelevance(ICElement.C_NAMESPACE, prefix, namespace.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptNamespace(namespace.getName(), completionStart, completionLength, relevance);
|
||||||
requestor.acceptNamespace(namespace.getName(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTEnumerationSpecifier){
|
else if(node instanceof IASTEnumerationSpecifier){
|
||||||
IASTEnumerationSpecifier enumeration = (IASTEnumerationSpecifier)node;
|
IASTEnumerationSpecifier enumeration = (IASTEnumerationSpecifier)node;
|
||||||
int relevance = computeRelevance(ICElement.C_ENUMERATION, prefix, enumeration.getName());
|
int relevance = computeRelevance(ICElement.C_ENUMERATION, prefix, enumeration.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptEnumeration(enumeration.getName(), completionStart, completionLength, relevance);
|
||||||
requestor.acceptEnumeration(enumeration.getName(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if(node instanceof IASTEnumerator){
|
else if(node instanceof IASTEnumerator){
|
||||||
IASTEnumerator enumerator = (IASTEnumerator)node;
|
IASTEnumerator enumerator = (IASTEnumerator)node;
|
||||||
int relevance = computeRelevance(ICElement.C_ENUMERATOR, prefix, enumerator.getName());
|
int relevance = computeRelevance(ICElement.C_ENUMERATOR, prefix, enumerator.getName());
|
||||||
if(relevance >= 0){
|
requestor.acceptEnumerator(enumerator.getName(), completionStart, completionLength, relevance);
|
||||||
requestor.acceptEnumerator(enumerator.getName(), completionStart, completionLength, relevance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addKeywordToCompletions (String keyword){
|
private void addKeywordToCompletions (String keyword){
|
||||||
int relevance = KEYWORD_TYPE_RELEVANCE;
|
int relevance = KEYWORD_TYPE_RELEVANCE;
|
||||||
requestor.acceptKeyword(keyword, completionStart, completionLength, relevance);
|
requestor.acceptKeyword(keyword, completionStart, completionLength, relevance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addKeywordsToCompletions(Iterator keywords){
|
private void addKeywordsToCompletions(Iterator keywords){
|
||||||
while (keywords.hasNext()){
|
while (keywords.hasNext()){
|
||||||
String keyword = (String) keywords.next();
|
String keyword = (String) keywords.next();
|
||||||
|
@ -318,10 +293,10 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private void completionOnMember(IASTCompletionNode completionNode){
|
private void completionOnMemberReference(IASTCompletionNode completionNode){
|
||||||
// Completing after a dot
|
// Completing after a dot
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// 2. lookup fields & add to completion proposals
|
// 2. lookup fields & add to completion proposals
|
||||||
LookupResult result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.FIELDS);
|
LookupResult result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.FIELDS);
|
||||||
addToCompletions (result);
|
addToCompletions (result);
|
||||||
|
@ -332,10 +307,10 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
result = searchNode.lookup (completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
||||||
addToCompletions (result);
|
addToCompletions (result);
|
||||||
}
|
}
|
||||||
private void completionOnType(IASTCompletionNode completionNode){
|
private void completionOnTypeReference(IASTCompletionNode completionNode){
|
||||||
// completing on a type
|
// completing on a type
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// if the prefix is not empty
|
// if the prefix is not empty
|
||||||
if(completionNode.getCompletionPrefix().length() > 0 ) {
|
if(completionNode.getCompletionPrefix().length() > 0 ) {
|
||||||
// 2. Lookup all types that could be used here
|
// 2. Lookup all types that could be used here
|
||||||
|
@ -353,9 +328,9 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
|
|
||||||
private void completionOnFieldType(IASTCompletionNode completionNode){
|
private void completionOnFieldType(IASTCompletionNode completionNode){
|
||||||
// 1. basic completion on all types
|
// 1. basic completion on all types
|
||||||
completionOnType(completionNode);
|
completionOnTypeReference(completionNode);
|
||||||
// 2. Get the search scope node
|
// 2. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// 3. lookup methods
|
// 3. lookup methods
|
||||||
// we are at a field declaration place, the user could be trying to override a function.
|
// we are at a field declaration place, the user could be trying to override a function.
|
||||||
// We have to lookup functions that could be overridden here.
|
// We have to lookup functions that could be overridden here.
|
||||||
|
@ -364,20 +339,12 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
}
|
}
|
||||||
private void completionOnVariableType(IASTCompletionNode completionNode){
|
private void completionOnVariableType(IASTCompletionNode completionNode){
|
||||||
// 1. basic completion on all types
|
// 1. basic completion on all types
|
||||||
completionOnType(completionNode);
|
completionOnTypeReference(completionNode);
|
||||||
}
|
|
||||||
private void completionOnMethodReturnType(IASTCompletionNode completionNode){
|
|
||||||
// 1. basic completion on all types
|
|
||||||
completionOnType(completionNode);
|
|
||||||
}
|
|
||||||
private void completionOnFunctionReturnType(IASTCompletionNode completionNode){
|
|
||||||
// 1. basic completion on all types
|
|
||||||
completionOnType(completionNode);
|
|
||||||
}
|
}
|
||||||
private void completionOnSingleNameReference(IASTCompletionNode completionNode){
|
private void completionOnSingleNameReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
// the search node is the code scope inwhich completion is requested
|
// the search node is the code scope inwhich completion is requested
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// if prefix is not empty
|
// if prefix is not empty
|
||||||
if (completionNode.getCompletionPrefix().length() > 0){
|
if (completionNode.getCompletionPrefix().length() > 0){
|
||||||
// here we have to look for anything that could be referenced within this scope
|
// here we have to look for anything that could be referenced within this scope
|
||||||
|
@ -393,32 +360,33 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
// TODO : complete the lookup call
|
// TODO : complete the lookup call
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void completionOnQualifiedNameReference(IASTCompletionNode completionNode){
|
private void completionOnScopedReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
// the search node is the name before the qualification
|
// the search node is the name before the qualification
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// here we have to look for anything that could be referenced within this scope
|
// here we have to look for anything that could be referenced within this scope
|
||||||
// 1. lookup local variables, global variables, functions, methods, structures, enums, macros, and namespaces
|
// 1. lookup local variables, global variables, functions, methods, structures, enums, macros, and namespaces
|
||||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.ALL);
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
}
|
}
|
||||||
private void completionOnStructureReference(IASTCompletionNode completionNode){
|
|
||||||
// 1. Get the search scope node
|
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
|
||||||
// only look for structures : classes, structs, and unions
|
|
||||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.STRUCTURES);
|
|
||||||
addToCompletions(result);
|
|
||||||
}
|
|
||||||
private void completionOnClassReference(IASTCompletionNode completionNode){
|
private void completionOnClassReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// only look for classes
|
// only look for classes
|
||||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CLASSES);
|
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CLASSES);
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
}
|
}
|
||||||
|
private void completionOnNamespaceReference(IASTCompletionNode completionNode){
|
||||||
|
// 1. Get the search scope node
|
||||||
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
|
// only look for classes
|
||||||
|
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.NAMESPACES);
|
||||||
|
addToCompletions(result);
|
||||||
|
}
|
||||||
private void completionOnExceptionReference(IASTCompletionNode completionNode){
|
private void completionOnExceptionReference(IASTCompletionNode completionNode){
|
||||||
// here we have to look for all types
|
// here we have to look for all types
|
||||||
completionOnType(completionNode);
|
completionOnTypeReference(completionNode);
|
||||||
// plus if the prefix is empty, add "..." to the proposals
|
// plus if the prefix is empty, add "..." to the proposals
|
||||||
if(completionNode.getCompletionPrefix().length() == 0){
|
if(completionNode.getCompletionPrefix().length() == 0){
|
||||||
addKeywordToCompletions(exceptionKeyword);
|
addKeywordToCompletions(exceptionKeyword);
|
||||||
|
@ -426,17 +394,17 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
}
|
}
|
||||||
private void completionOnMacroReference(IASTCompletionNode completionNode){
|
private void completionOnMacroReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// only look for macros
|
// only look for macros
|
||||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.MACROS);
|
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.MACROS);
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
}
|
}
|
||||||
private void completionOnMessageSend(IASTCompletionNode completionNode){
|
private void completionOnFunctionReference(IASTCompletionNode completionNode){
|
||||||
// TODO: complete the lookups
|
// TODO: complete the lookups
|
||||||
}
|
}
|
||||||
private void completionOnQualifiedAllocationExpression(IASTCompletionNode completionNode){
|
private void completionOnConstructorReference(IASTCompletionNode completionNode){
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
IASTNode searchNode = completionNode.getCompletionContext();
|
IASTNode searchNode = completionNode.getCompletionScope();
|
||||||
// only lookup constructors
|
// only lookup constructors
|
||||||
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CONSTRUCTORS);
|
LookupResult result = searchNode.lookup(completionNode.getCompletionPrefix(), IASTNode.LookupKind.CONSTRUCTORS);
|
||||||
}
|
}
|
||||||
|
@ -447,30 +415,26 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
addKeywordsToCompletions(result.iterator());
|
addKeywordsToCompletions(result.iterator());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void complete(IWorkingCopy sourceUnit, int completionOffset, List completionList) {
|
public IASTCompletionNode complete(IWorkingCopy sourceUnit, int completionOffset, List completionList) {
|
||||||
|
|
||||||
// 1- Parse the translation unit
|
// 1- Parse the translation unit
|
||||||
IASTCompletionNode completionNode = parse(sourceUnit, completionOffset);
|
IASTCompletionNode completionNode = parse(sourceUnit, completionOffset);
|
||||||
|
|
||||||
if (completionNode == null)
|
if (completionNode == null)
|
||||||
return;
|
return null;
|
||||||
|
|
||||||
// set the completionStart and the completionLength
|
// set the completionStart and the completionLength
|
||||||
completionStart = completionOffset;
|
completionStart = completionOffset;
|
||||||
completionLength = completionNode.getCompletionPrefix().length();
|
completionLength = completionNode.getCompletionPrefix().length();
|
||||||
|
|
||||||
// 2- Check the return value
|
// 2- Check the return value
|
||||||
if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.DOT_MEMBER){
|
if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.MEMBER_REFERENCE){
|
||||||
// CompletionOnDotMember
|
// completionOnMemberReference
|
||||||
completionOnMember(completionNode);
|
completionOnMemberReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.ARROW_MEMBER){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.SCOPED_REFERENCE){
|
||||||
//CompletionOnArrowMember
|
// completionOnMemberReference
|
||||||
completionOnMember(completionNode);
|
completionOnMemberReference(completionNode);
|
||||||
}
|
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.QUALIFIEDNAME_MEMBER){
|
|
||||||
//CompletionOnQualifiedNameMember
|
|
||||||
completionOnMember(completionNode);
|
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.FIELD_TYPE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.FIELD_TYPE){
|
||||||
// CompletionOnFieldType
|
// CompletionOnFieldType
|
||||||
|
@ -478,36 +442,28 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.VARIABLE_TYPE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.VARIABLE_TYPE){
|
||||||
// CompletionOnVariableType
|
// CompletionOnVariableType
|
||||||
completionOnType(completionNode);
|
completionOnTypeReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.ARGUMENT_TYPE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.ARGUMENT_TYPE){
|
||||||
// CompletionOnArgumentType
|
// CompletionOnArgumentType
|
||||||
completionOnVariableType(completionNode);
|
completionOnVariableType(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.METHOD_RETURN_TYPE){
|
|
||||||
// CompletionOnMethodReturnType
|
|
||||||
completionOnMethodReturnType(completionNode);
|
|
||||||
}
|
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.FUNCTIOND_RETURN_TYPE){
|
|
||||||
// CompletionOnFunctionReturnType
|
|
||||||
completionOnFunctionReturnType(completionNode);
|
|
||||||
}
|
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.SINGLE_NAME_REFERENCE){
|
||||||
// CompletionOnSingleNameReference
|
// CompletionOnSingleNameReference
|
||||||
completionOnSingleNameReference(completionNode);
|
completionOnSingleNameReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.QUALIFIED_NAME_REFERENCE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.TYPE_REFERENCE){
|
||||||
// CompletionOnQualifiedNameReference
|
|
||||||
completionOnQualifiedNameReference(completionNode);
|
|
||||||
}
|
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.STRUCTURE_REFERENCE){
|
|
||||||
// CompletionOnStructureReference
|
// CompletionOnStructureReference
|
||||||
completionOnStructureReference(completionNode);
|
completionOnTypeReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.CLASS_REFERENCE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.CLASS_REFERENCE){
|
||||||
// CompletionOnClassReference
|
// CompletionOnClassReference
|
||||||
completionOnClassReference(completionNode);
|
completionOnClassReference(completionNode);
|
||||||
}
|
}
|
||||||
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.NAMESPACE_REFERENCE){
|
||||||
|
// completionOnNamespaceReference
|
||||||
|
completionOnNamespaceReference(completionNode);
|
||||||
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.EXCEPTION_REFERENCE){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.EXCEPTION_REFERENCE){
|
||||||
// CompletionOnExceptionReference
|
// CompletionOnExceptionReference
|
||||||
completionOnExceptionReference(completionNode);
|
completionOnExceptionReference(completionNode);
|
||||||
|
@ -516,13 +472,13 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
// CompletionOnMacroReference
|
// CompletionOnMacroReference
|
||||||
completionOnMacroReference(completionNode);
|
completionOnMacroReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.MESSAGE_SEND){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.FUNCTION_REFERENCE){
|
||||||
// CompletionOnMessageSend
|
// completionOnFunctionReference
|
||||||
completionOnMessageSend(completionNode);
|
completionOnFunctionReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.QUALIFIED_ALLOCATION_EXPRESSION){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.CONSTRUCTOR_REFERENCE){
|
||||||
// CompletionOnQualifiedAllocationExpression
|
// completionOnConstructorReference
|
||||||
completionOnQualifiedAllocationExpression(completionNode);
|
completionOnConstructorReference(completionNode);
|
||||||
}
|
}
|
||||||
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.KEYWORD){
|
else if(completionNode.getCompletionKind() == IASTCompletionNode.CompletionKind.KEYWORD){
|
||||||
// CompletionOnKeyword
|
// CompletionOnKeyword
|
||||||
|
@ -530,7 +486,7 @@ public class CompletionEngine implements RelevanceConstants{
|
||||||
}
|
}
|
||||||
|
|
||||||
completionList.addAll(completions);
|
completionList.addAll(completions);
|
||||||
return;
|
return completionNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
public class ContentAssistPreference {
|
public class ContentAssistPreference {
|
||||||
|
|
||||||
/** Preference key for content assist auto activation */
|
/** Preference key for content assist auto activation */
|
||||||
public final static String AUTOACTIVATION= "content_assist_autoactivation";
|
//public final static String AUTOACTIVATION= "content_assist_autoactivation";
|
||||||
/** Preference key for content assist auto activation delay */
|
/** Preference key for content assist auto activation delay */
|
||||||
public final static String AUTOACTIVATION_DELAY= "content_assist_autoactivation_delay";
|
public final static String AUTOACTIVATION_DELAY= "content_assist_autoactivation_delay";
|
||||||
/** Preference key for content assist proposal color */
|
/** Preference key for content assist proposal color */
|
||||||
|
@ -37,20 +37,26 @@ public class ContentAssistPreference {
|
||||||
/** Preference key for content assist auto insert */
|
/** Preference key for content assist auto insert */
|
||||||
public final static String AUTOINSERT= "content_assist_autoinsert";
|
public final static String AUTOINSERT= "content_assist_autoinsert";
|
||||||
|
|
||||||
/** Preference key for java content assist auto activation triggers */
|
/** Preference key for C/CPP content assist auto activation triggers */
|
||||||
public final static String AUTOACTIVATION_TRIGGERS_C= "content_assist_autoactivation_triggers_java";
|
public final static String AUTOACTIVATION_TRIGGERS_DOT= "content_assist_autoactivation_trigger_dot";
|
||||||
|
public final static String AUTOACTIVATION_TRIGGERS_ARROW= "content_assist_autoactivation_trigger_arrow";
|
||||||
|
public final static String AUTOACTIVATION_TRIGGERS_DOUBLECOLON= "content_assist_autoactivation_trigger_doublecolon";
|
||||||
|
|
||||||
/** Preference key for visibility of proposals */
|
/** Preference key for visibility of proposals */
|
||||||
public final static String SHOW_DOCUMENTED_PROPOSALS= "content_assist_show_visible_proposals";
|
public final static String SHOW_DOCUMENTED_PROPOSALS= "content_assist_show_visible_proposals";
|
||||||
/** Preference key for alphabetic ordering of proposals */
|
/** Preference key for alphabetic ordering of proposals */
|
||||||
public final static String ORDER_PROPOSALS= "content_assist_order_proposals";
|
public final static String ORDER_PROPOSALS= "content_assist_order_proposals";
|
||||||
/** Preference key for case sensitivity of propsals */
|
/** Preference key for case sensitivity of propsals */
|
||||||
public final static String CASE_SENSITIVITY= "content_assist_case_sensitivity";
|
//public final static String CASE_SENSITIVITY= "content_assist_case_sensitivity";
|
||||||
/** Preference key for adding imports on code assist */
|
/** Preference key for adding imports on code assist */
|
||||||
public final static String ADD_INCLUDE= "content_assist_add_import";
|
public final static String ADD_INCLUDE= "content_assist_add_import";
|
||||||
/** Preference key for completion search scope */
|
/** Preference key for completion search scope */
|
||||||
public final static String PROJECT_SCOPE_SEARCH= "content_assist_project_scope_search";
|
public final static String CURRENT_FILE_SEARCH_SCOPE= "content_assist_current_file_search_scope";
|
||||||
|
/** Preference key for completion search scope */
|
||||||
|
public final static String PROJECT_SEARCH_SCOPE= "content_assist_project_search_scope";
|
||||||
|
/** Preference key for completion search scope */
|
||||||
|
public final static String PROJECT_AND_DEPENDENCY_SEARCH_SCOPE= "content_assist_project_and_dependency_search_scope";
|
||||||
|
|
||||||
private static Color getColor(IPreferenceStore store, String key, IColorManager manager) {
|
private static Color getColor(IPreferenceStore store, String key, IColorManager manager) {
|
||||||
RGB rgb= PreferenceConverter.getColor(store, key);
|
RGB rgb= PreferenceConverter.getColor(store, key);
|
||||||
return manager.getColor(rgb);
|
return manager.getColor(rgb);
|
||||||
|
@ -72,16 +78,24 @@ public class ContentAssistPreference {
|
||||||
CCompletionProcessor jcp= getCProcessor(assistant);
|
CCompletionProcessor jcp= getCProcessor(assistant);
|
||||||
if (jcp == null)
|
if (jcp == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String triggers= store.getString(AUTOACTIVATION_TRIGGERS_C);
|
String triggers = "";
|
||||||
if (triggers != null)
|
boolean useDotAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
|
||||||
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
if(useDotAsTrigger)
|
||||||
|
triggers = ".";
|
||||||
|
boolean useArrowAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
|
||||||
|
if(useArrowAsTrigger)
|
||||||
|
triggers += ">";
|
||||||
|
boolean useDoubleColonAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
|
||||||
|
if(useDoubleColonAsTrigger)
|
||||||
|
triggers += ":";
|
||||||
|
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
||||||
|
|
||||||
boolean enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS);
|
boolean enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS);
|
||||||
//jcp.restrictProposalsToVisibility(enabled);
|
//jcp.restrictProposalsToVisibility(enabled);
|
||||||
|
|
||||||
enabled= store.getBoolean(CASE_SENSITIVITY);
|
//enabled= store.getBoolean(CASE_SENSITIVITY);
|
||||||
jcp.restrictProposalsToMatchingCases(enabled);
|
//jcp.restrictProposalsToMatchingCases(enabled);
|
||||||
|
|
||||||
enabled= store.getBoolean(ORDER_PROPOSALS);
|
enabled= store.getBoolean(ORDER_PROPOSALS);
|
||||||
jcp.orderProposalsAlphabetically(enabled);
|
jcp.orderProposalsAlphabetically(enabled);
|
||||||
|
@ -99,8 +113,11 @@ public class ContentAssistPreference {
|
||||||
CTextTools textTools= CUIPlugin.getDefault().getTextTools();
|
CTextTools textTools= CUIPlugin.getDefault().getTextTools();
|
||||||
IColorManager manager= textTools.getColorManager();
|
IColorManager manager= textTools.getColorManager();
|
||||||
|
|
||||||
boolean enabled= store.getBoolean(AUTOACTIVATION);
|
boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
|
||||||
assistant.enableAutoActivation(enabled);
|
boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
|
||||||
|
boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
|
||||||
|
boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon ));
|
||||||
|
assistant.enableAutoActivation(enabled);
|
||||||
|
|
||||||
int delay= store.getInt(AUTOACTIVATION_DELAY);
|
int delay= store.getInt(AUTOACTIVATION_DELAY);
|
||||||
assistant.setAutoActivationDelay(delay);
|
assistant.setAutoActivationDelay(delay);
|
||||||
|
@ -121,8 +138,6 @@ public class ContentAssistPreference {
|
||||||
|
|
||||||
enabled= store.getBoolean(AUTOINSERT);
|
enabled= store.getBoolean(AUTOINSERT);
|
||||||
assistant.enableAutoInsert(enabled);
|
assistant.enableAutoInsert(enabled);
|
||||||
|
|
||||||
enabled= store.getBoolean(PROJECT_SCOPE_SEARCH);
|
|
||||||
|
|
||||||
configureCProcessor(assistant, store);
|
configureCProcessor(assistant, store);
|
||||||
}
|
}
|
||||||
|
@ -133,17 +148,33 @@ public class ContentAssistPreference {
|
||||||
if (jcp == null)
|
if (jcp == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AUTOACTIVATION_TRIGGERS_C.equals(key)) {
|
if (AUTOACTIVATION_TRIGGERS_DOT.equals(key)) {
|
||||||
String triggers= store.getString(AUTOACTIVATION_TRIGGERS_C);
|
boolean useDotAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
|
||||||
if (triggers != null)
|
if (useDotAsTrigger){
|
||||||
|
String triggers= ".";
|
||||||
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
||||||
|
}
|
||||||
|
} else if (AUTOACTIVATION_TRIGGERS_ARROW.equals(key)) {
|
||||||
|
boolean useArrowAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
|
||||||
|
if (useArrowAsTrigger){
|
||||||
|
String triggers= ">";
|
||||||
|
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
||||||
|
}
|
||||||
|
} else if (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(key)) {
|
||||||
|
boolean useDoubleColonAsTrigger = store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
|
||||||
|
if (useDoubleColonAsTrigger){
|
||||||
|
String triggers= ":";
|
||||||
|
jcp.setCompletionProposalAutoActivationCharacters(triggers.toCharArray());
|
||||||
|
}
|
||||||
} else if (SHOW_DOCUMENTED_PROPOSALS.equals(key)) {
|
} else if (SHOW_DOCUMENTED_PROPOSALS.equals(key)) {
|
||||||
//boolean enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS);
|
//boolean enabled= store.getBoolean(SHOW_DOCUMENTED_PROPOSALS);
|
||||||
//jcp.restrictProposalsToVisibility(enabled);
|
//jcp.restrictProposalsToVisibility(enabled);
|
||||||
} else if (CASE_SENSITIVITY.equals(key)) {
|
}
|
||||||
boolean enabled= store.getBoolean(CASE_SENSITIVITY);
|
//else if (CASE_SENSITIVITY.equals(key)) {
|
||||||
jcp.restrictProposalsToMatchingCases(enabled);
|
// boolean enabled= store.getBoolean(CASE_SENSITIVITY);
|
||||||
} else if (ORDER_PROPOSALS.equals(key)) {
|
// jcp.restrictProposalsToMatchingCases(enabled);
|
||||||
|
// }
|
||||||
|
else if (ORDER_PROPOSALS.equals(key)) {
|
||||||
boolean enable= store.getBoolean(ORDER_PROPOSALS);
|
boolean enable= store.getBoolean(ORDER_PROPOSALS);
|
||||||
jcp.orderProposalsAlphabetically(enable);
|
jcp.orderProposalsAlphabetically(enable);
|
||||||
} else if (ADD_INCLUDE.equals(key)) {
|
} else if (ADD_INCLUDE.equals(key)) {
|
||||||
|
@ -160,9 +191,14 @@ public class ContentAssistPreference {
|
||||||
|
|
||||||
String p= event.getProperty();
|
String p= event.getProperty();
|
||||||
|
|
||||||
if (AUTOACTIVATION.equals(p)) {
|
if ((AUTOACTIVATION_TRIGGERS_DOT.equals(p))
|
||||||
boolean enabled= store.getBoolean(AUTOACTIVATION);
|
|| (AUTOACTIVATION_TRIGGERS_ARROW.equals(p))
|
||||||
assistant.enableAutoActivation(enabled);
|
|| (AUTOACTIVATION_TRIGGERS_DOUBLECOLON.equals(p))){
|
||||||
|
boolean enabledDot= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOT);
|
||||||
|
boolean enabledArrow= store.getBoolean(AUTOACTIVATION_TRIGGERS_ARROW);
|
||||||
|
boolean enabledDoubleColon= store.getBoolean(AUTOACTIVATION_TRIGGERS_DOUBLECOLON);
|
||||||
|
boolean enabled = ((enabledDot) || ( enabledArrow ) || (enabledDoubleColon ));
|
||||||
|
assistant.enableAutoActivation(enabled);
|
||||||
} else if (AUTOACTIVATION_DELAY.equals(p)) {
|
} else if (AUTOACTIVATION_DELAY.equals(p)) {
|
||||||
int delay= store.getInt(AUTOACTIVATION_DELAY);
|
int delay= store.getInt(AUTOACTIVATION_DELAY);
|
||||||
assistant.setAutoActivationDelay(delay);
|
assistant.setAutoActivationDelay(delay);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui;
|
package org.eclipse.cdt.ui;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public interface IWorkingCopyManager {
|
||||||
* input does not encode an editor input, or if there is no remembered working
|
* input does not encode an editor input, or if there is no remembered working
|
||||||
* copy for this translation unit
|
* copy for this translation unit
|
||||||
*/
|
*/
|
||||||
ITranslationUnit getWorkingCopy(IEditorInput input);
|
IWorkingCopy getWorkingCopy(IEditorInput input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts down this working copy manager. All working copies still remembered
|
* Shuts down this working copy manager. All working copies still remembered
|
||||||
|
|
|
@ -11,10 +11,9 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.ui;
|
package org.eclipse.cdt.ui;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension interface for <code>IWorkingCopyManager</code>.
|
* Extension interface for <code>IWorkingCopyManager</code>.
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
|
@ -30,7 +29,7 @@ public interface IWorkingCopyManagerExtension {
|
||||||
* @param input the editor input
|
* @param input the editor input
|
||||||
* @param workingCopy the working copy
|
* @param workingCopy the working copy
|
||||||
*/
|
*/
|
||||||
void setWorkingCopy(IEditorInput input, ITranslationUnit workingCopy);
|
void setWorkingCopy(IEditorInput input, IWorkingCopy workingCopy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the working copy set for the given editor input. If there is no
|
* Removes the working copy set for the given editor input. If there is no
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.internal.ui.actions.WorkbenchRunnableAdapter;
|
import org.eclipse.cdt.internal.ui.actions.WorkbenchRunnableAdapter;
|
||||||
|
@ -123,5 +124,8 @@ public class NewClassWizard extends BasicNewResourceWizard implements INewWizard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICElement getCreatedClassElement(){
|
||||||
|
return fPage.getCreatedClassElement();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue