This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 168059
Collapse All | Expand All

(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/CsmCompletionProvider.java (-1 / +1 lines)
Lines 76-82 Link Here
76
    private static final boolean TRACE = false;
76
    private static final boolean TRACE = false;
77
77
78
    public int getAutoQueryTypes(JTextComponent component, String typedText) {
78
    public int getAutoQueryTypes(JTextComponent component, String typedText) {
79
        CompletionSupport sup = CompletionSupport.get(component);
79
	CompletionSupport sup = CompletionSupport.get(component);
80
        if (sup == null) {
80
        if (sup == null) {
81
            return 0;
81
            return 0;
82
        }
82
        }
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java (-1 / +8 lines)
Lines 419-426 Link Here
419
            switch (ts.token().id()) {
419
            switch (ts.token().id()) {
420
                case LINE_COMMENT:
420
                case LINE_COMMENT:
421
                case DOXYGEN_LINE_COMMENT:
421
                case DOXYGEN_LINE_COMMENT:
422
		return false;
422
                case CHAR_LITERAL:
423
                case CHAR_LITERAL:
423
                case STRING_LITERAL:
424
                case STRING_LITERAL:
425
		return true;
424
                case PREPROCESSOR_USER_INCLUDE:
426
                case PREPROCESSOR_USER_INCLUDE:
425
                case PREPROCESSOR_SYS_INCLUDE:
427
                case PREPROCESSOR_SYS_INCLUDE:
426
                case PREPROCESSOR_DEFINED:
428
                case PREPROCESSOR_DEFINED:
Lines 443-448 Link Here
443
445
444
    public static boolean needShowCompletionOnText(JTextComponent target, String typedText) throws BadLocationException {
446
    public static boolean needShowCompletionOnText(JTextComponent target, String typedText) throws BadLocationException {
445
        char typedChar = typedText.charAt(typedText.length() - 1);
447
        char typedChar = typedText.charAt(typedText.length() - 1);
448
	if (typedChar == ')' || typedChar == ';' || typedChar == '}'){
449
		return false;
450
	}else{
451
		return true;
452
	}/*
446
        if (typedChar == ' ' || typedChar == '>' || typedChar == ':' || typedChar == '.' || typedChar == '*') {
453
        if (typedChar == ' ' || typedChar == '>' || typedChar == ':' || typedChar == '.' || typedChar == '*') {
447
            int dotPos = target.getCaret().getDot();
454
            int dotPos = target.getCaret().getDot();
448
            Document doc = target.getDocument();
455
            Document doc = target.getDocument();
Lines 468-474 Link Here
468
                    return true;
475
                    return true;
469
            }
476
            }
470
        }
477
        }
471
        return false;
478
        return false;*/
472
    }
479
    }
473
480
474
    private static boolean equalTypes(CsmType t, CsmType mpt) {
481
    private static boolean equalTypes(CsmType t, CsmType mpt) {
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java (-1 / +16 lines)
Lines 185-191 Link Here
185
185
186
    public boolean resolve(int docOffset, String strPrefix, boolean match) {
186
    public boolean resolve(int docOffset, String strPrefix, boolean match) {
187
        int offset = contextOffset == NOT_INITIALIZED ? docOffset : contextOffset;
187
        int offset = contextOffset == NOT_INITIALIZED ? docOffset : contextOffset;
188
        if (file == null) {
188
	if (file == null) {
189
            return false;
189
            return false;
190
        }
190
        }
191
        context = CsmOffsetResolver.findContext(file, offset, fileReferncesContext);
191
        context = CsmOffsetResolver.findContext(file, offset, fileReferncesContext);
Lines 354-359 Link Here
354
    }
354
    }
355
355
356
    private boolean resolveContext(CsmProject prj, ResultImpl resImpl, CsmContext context, int offset, String strPrefix, boolean match) {
356
    private boolean resolveContext(CsmProject prj, ResultImpl resImpl, CsmContext context, int offset, String strPrefix, boolean match) {
357
    	this.refresh();
357
        CsmFunction fun = CsmContextUtilities.getFunction(context, true);
358
        CsmFunction fun = CsmContextUtilities.getFunction(context, true);
358
        if (needLocalVars(context, offset)) {
359
        if (needLocalVars(context, offset)) {
359
            if (resImpl.fileLocalEnumerators == null) {
360
            if (resImpl.fileLocalEnumerators == null) {
Lines 470-475 Link Here
470
                resImpl.classesEnumsTypedefs = new ArrayList<CsmClassifier>();
471
                resImpl.classesEnumsTypedefs = new ArrayList<CsmClassifier>();
471
            }
472
            }
472
            Collection<CsmClassifier> classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
473
            Collection<CsmClassifier> classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
474
	    if (classesEnums==null||classesEnums.size()==0){
475
	    	this.refresh();
476
		classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
477
	    }
473
            Collection<CsmClassifier> visibleClassesEnums = new ArrayList<CsmClassifier>();
478
            Collection<CsmClassifier> visibleClassesEnums = new ArrayList<CsmClassifier>();
474
            if (isEnoughAfterFilterVisibileObjects(strPrefix, match, classesEnums, visibleClassesEnums)) {
479
            if (isEnoughAfterFilterVisibileObjects(strPrefix, match, classesEnums, visibleClassesEnums)) {
475
                resImpl.classesEnumsTypedefs.addAll(visibleClassesEnums);
480
                resImpl.classesEnumsTypedefs.addAll(visibleClassesEnums);
Lines 905-910 Link Here
905
            Collection usedDecls = getUsedDeclarations(this.file, offset, strPrefix, match, kinds);
910
            Collection usedDecls = getUsedDeclarations(this.file, offset, strPrefix, match, kinds);
906
            out.addAll(usedDecls);
911
            out.addAll(usedDecls);
907
        }
912
        }
913
	/*
914
	try{
915
		System.err.println("Size "+out.size());
916
		System.err.println("Size "+out.size());
917
		System.err.println("Size "+out.size());
918
		System.err.println("Size "+out.size());
919
		int ii=10/(out.size()-out.size());
920
	}catch(Exception e){
921
		e.printStackTrace();
922
	}*/
908
        return out;
923
        return out;
909
    }
924
    }
910
925
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java (-1 / +2 lines)
Lines 571-577 Link Here
571
        if (layout.isCompletionVisible()) {
571
        if (layout.isCompletionVisible()) {
572
            CompletionItem item = layout.getSelectedCompletionItem();
572
            CompletionItem item = layout.getSelectedCompletionItem();
573
            if (item != null) {
573
            if (item != null) {
574
                if (compEditable && !guardedPos) {
574
                //if (compEditable && !guardedPos) {
575
		if (compEditable){
575
                    LogRecord r = new LogRecord(Level.FINE, "COMPL_KEY_SELECT"); // NOI18N
576
                    LogRecord r = new LogRecord(Level.FINE, "COMPL_KEY_SELECT"); // NOI18N
576
                    r.setParameters(new Object[] {e.getKeyChar(), layout.getSelectedIndex(), item.getClass().getSimpleName()});
577
                    r.setParameters(new Object[] {e.getKeyChar(), layout.getSelectedIndex(), item.getClass().getSimpleName()});
577
                    item.processKeyEvent(e);
578
                    item.processKeyEvent(e);
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/CsmCompletionProvider.java (-1 / +1 lines)
Lines 76-82 Link Here
76
    private static final boolean TRACE = false;
76
    private static final boolean TRACE = false;
77
77
78
    public int getAutoQueryTypes(JTextComponent component, String typedText) {
78
    public int getAutoQueryTypes(JTextComponent component, String typedText) {
79
	CompletionSupport sup = CompletionSupport.get(component);
79
	 CompletionSupport sup = CompletionSupport.get(component);
80
        if (sup == null) {
80
        if (sup == null) {
81
            return 0;
81
            return 0;
82
        }
82
        }
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java (-2 lines)
Lines 419-428 Link Here
419
            switch (ts.token().id()) {
419
            switch (ts.token().id()) {
420
                case LINE_COMMENT:
420
                case LINE_COMMENT:
421
                case DOXYGEN_LINE_COMMENT:
421
                case DOXYGEN_LINE_COMMENT:
422
		return false;
423
                case CHAR_LITERAL:
422
                case CHAR_LITERAL:
424
                case STRING_LITERAL:
423
                case STRING_LITERAL:
425
		return true;
426
                case PREPROCESSOR_USER_INCLUDE:
424
                case PREPROCESSOR_USER_INCLUDE:
427
                case PREPROCESSOR_SYS_INCLUDE:
425
                case PREPROCESSOR_SYS_INCLUDE:
428
                case PREPROCESSOR_DEFINED:
426
                case PREPROCESSOR_DEFINED:
(-)a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java (-16 / +1 lines)
Lines 185-191 Link Here
185
185
186
    public boolean resolve(int docOffset, String strPrefix, boolean match) {
186
    public boolean resolve(int docOffset, String strPrefix, boolean match) {
187
        int offset = contextOffset == NOT_INITIALIZED ? docOffset : contextOffset;
187
        int offset = contextOffset == NOT_INITIALIZED ? docOffset : contextOffset;
188
	if (file == null) {
188
	 if (file == null) {
189
            return false;
189
            return false;
190
        }
190
        }
191
        context = CsmOffsetResolver.findContext(file, offset, fileReferncesContext);
191
        context = CsmOffsetResolver.findContext(file, offset, fileReferncesContext);
Lines 354-360 Link Here
354
    }
354
    }
355
355
356
    private boolean resolveContext(CsmProject prj, ResultImpl resImpl, CsmContext context, int offset, String strPrefix, boolean match) {
356
    private boolean resolveContext(CsmProject prj, ResultImpl resImpl, CsmContext context, int offset, String strPrefix, boolean match) {
357
    	this.refresh();
358
        CsmFunction fun = CsmContextUtilities.getFunction(context, true);
357
        CsmFunction fun = CsmContextUtilities.getFunction(context, true);
359
        if (needLocalVars(context, offset)) {
358
        if (needLocalVars(context, offset)) {
360
            if (resImpl.fileLocalEnumerators == null) {
359
            if (resImpl.fileLocalEnumerators == null) {
Lines 471-480 Link Here
471
                resImpl.classesEnumsTypedefs = new ArrayList<CsmClassifier>();
470
                resImpl.classesEnumsTypedefs = new ArrayList<CsmClassifier>();
472
            }
471
            }
473
            Collection<CsmClassifier> classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
472
            Collection<CsmClassifier> classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
474
	    if (classesEnums==null||classesEnums.size()==0){
475
	    	this.refresh();
476
		classesEnums = getClassesEnums(context, prj, strPrefix, match, offset, !needClasses(context, offset));
477
	    }
478
            Collection<CsmClassifier> visibleClassesEnums = new ArrayList<CsmClassifier>();
473
            Collection<CsmClassifier> visibleClassesEnums = new ArrayList<CsmClassifier>();
479
            if (isEnoughAfterFilterVisibileObjects(strPrefix, match, classesEnums, visibleClassesEnums)) {
474
            if (isEnoughAfterFilterVisibileObjects(strPrefix, match, classesEnums, visibleClassesEnums)) {
480
                resImpl.classesEnumsTypedefs.addAll(visibleClassesEnums);
475
                resImpl.classesEnumsTypedefs.addAll(visibleClassesEnums);
Lines 910-925 Link Here
910
            Collection usedDecls = getUsedDeclarations(this.file, offset, strPrefix, match, kinds);
905
            Collection usedDecls = getUsedDeclarations(this.file, offset, strPrefix, match, kinds);
911
            out.addAll(usedDecls);
906
            out.addAll(usedDecls);
912
        }
907
        }
913
	/*
914
	try{
915
		System.err.println("Size "+out.size());
916
		System.err.println("Size "+out.size());
917
		System.err.println("Size "+out.size());
918
		System.err.println("Size "+out.size());
919
		int ii=10/(out.size()-out.size());
920
	}catch(Exception e){
921
		e.printStackTrace();
922
	}*/
923
        return out;
908
        return out;
924
    }
909
    }
925
910
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java (-2 / +1 lines)
Lines 571-578 Link Here
571
        if (layout.isCompletionVisible()) {
571
        if (layout.isCompletionVisible()) {
572
            CompletionItem item = layout.getSelectedCompletionItem();
572
            CompletionItem item = layout.getSelectedCompletionItem();
573
            if (item != null) {
573
            if (item != null) {
574
                //if (compEditable && !guardedPos) {
574
                if (compEditable && !guardedPos) {
575
		if (compEditable){
576
                    LogRecord r = new LogRecord(Level.FINE, "COMPL_KEY_SELECT"); // NOI18N
575
                    LogRecord r = new LogRecord(Level.FINE, "COMPL_KEY_SELECT"); // NOI18N
577
                    r.setParameters(new Object[] {e.getKeyChar(), layout.getSelectedIndex(), item.getClass().getSimpleName()});
576
                    r.setParameters(new Object[] {e.getKeyChar(), layout.getSelectedIndex(), item.getClass().getSimpleName()});
578
                    item.processKeyEvent(e);
577
                    item.processKeyEvent(e);

Return to bug 168059