View | Details | Raw Unified | Return to bug 49552 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java (-1 / +13 lines)
Lines 40-46 Link Here
40
40
41
public class JavaMethodCompletionProposal extends LazyJavaCompletionProposal {
41
public class JavaMethodCompletionProposal extends LazyJavaCompletionProposal {
42
	/** Triggers for method proposals without parameters. Do not modify. */
42
	/** Triggers for method proposals without parameters. Do not modify. */
43
	protected final static char[] METHOD_TRIGGERS= new char[] { ';', ',', '.', '\t', '[', ' ' };
43
	protected final static char[] METHOD_TRIGGERS= new char[] { ';', ',', '.', '\t', '[', ' ', '(', '+', '-', '/', '*', '<', '>', '&', '|', '^', '?', ':', '^', '%', ']' };
44
	/** Triggers for method proposals. Do not modify. */
44
	/** Triggers for method proposals. Do not modify. */
45
	protected final static char[] METHOD_WITH_ARGUMENTS_TRIGGERS= new char[] { '(', '-', ' ' };
45
	protected final static char[] METHOD_WITH_ARGUMENTS_TRIGGERS= new char[] { '(', '-', ' ' };
46
	
46
	
Lines 99-104 Link Here
99
	}
99
	}
100
100
101
	public void apply(IDocument document, char trigger, int offset) {
101
	public void apply(IDocument document, char trigger, int offset) {
102
		
103
		String replacement= getReplacementString();
104
		if (replacement != null && replacement.endsWith("()") && trigger == '(') { //$NON-NLS-1$
105
			setCursorPosition(replacement.length() - 1);
106
			
107
			// Strip off the closing brackets if the user doesn't want them auto-closed.
108
			IPreferenceStore preferenceStore= JavaPlugin.getDefault().getPreferenceStore();
109
			if (!preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS)) {
110
				setReplacementString(replacement.substring(0, replacement.length() - 1));
111
			}
112
		}		
113
		
102
		super.apply(document, trigger, offset);
114
		super.apply(document, trigger, offset);
103
		try {
115
		try {
104
			setUpLinkedMode(document, getReplacementString());
116
			setUpLinkedMode(document, getReplacementString());
(-)ui/org/eclipse/jdt/ui/text/java/CompletionProposalCollector.java (-5 / +9 lines)
Lines 89-101 Link Here
89
	private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jdt.ui/debug/ResultCollector"));  //$NON-NLS-1$//$NON-NLS-2$
89
	private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jdt.ui/debug/ResultCollector"));  //$NON-NLS-1$//$NON-NLS-2$
90
90
91
	/** Triggers for method proposals without parameters. Do not modify. */
91
	/** Triggers for method proposals without parameters. Do not modify. */
92
	protected final static char[] METHOD_TRIGGERS= new char[] { ';', ',', '.', '\t', '[', ' ' };
92
	protected final static char[] METHOD_TRIGGERS= new char[] { ';', ',', '.', '\t', '[', ' ', '(', '+', '-', '/', '*', '<', '>', '&', '|', '^', '?', ':', '^', '%', ']' };
93
	/** Triggers for method proposals. Do not modify. */
93
	/** Triggers for method proposals. Do not modify. */
94
	protected final static char[] METHOD_WITH_ARGUMENTS_TRIGGERS= new char[] { '(', '-', ' ' };
94
	protected final static char[] METHOD_WITH_ARGUMENTS_TRIGGERS= new char[] { '(', '-', ' ' };
95
	/** Triggers for types. Do not modify. */
95
	/** Triggers for types. Do not modify. */
96
	protected final static char[] TYPE_TRIGGERS= new char[] { '.', '\t', '[', '(', ' ' };
96
	protected final static char[] TYPE_TRIGGERS= new char[] { '.', '\t', '[', '(', ' ' };
97
	/** Triggers for variables. Do not modify. */
97
	/** Triggers for variables. Do not modify. */
98
	protected final static char[] VAR_TRIGGER= new char[] { '\t', ' ', '=', ';', '.' };
98
	protected final static char[] VAR_TRIGGERS= new char[] { '\t', ' ', '=', ';', '.', '+', '-', '/', '*', '<', '>', '&', '|', '^', '~', '?', ':', '%', ')', '}', ']', ',' };
99
	/** Triggers for keywords. */
100
	protected final static char[] KEYWORD_TRIGGERS= new char[] { '\t', ' ', '=', ';', '.', '&', '|', '?', ':', '(', ')', '{', '}', ']', ',', '^' };
99
101
100
	private final CompletionProposalLabelProvider fLabelProvider= new CompletionProposalLabelProvider();
102
	private final CompletionProposalLabelProvider fLabelProvider= new CompletionProposalLabelProvider();
101
	private final ImageDescriptorRegistry fRegistry= JavaPlugin.getImageDescriptorRegistry();
103
	private final ImageDescriptorRegistry fRegistry= JavaPlugin.getImageDescriptorRegistry();
Lines 588-594 Link Here
588
		if (fJavaProject != null)
590
		if (fJavaProject != null)
589
			javaProposal.setProposalInfo(new FieldProposalInfo(fJavaProject, proposal));
591
			javaProposal.setProposalInfo(new FieldProposalInfo(fJavaProject, proposal));
590
592
591
		javaProposal.setTriggerCharacters(VAR_TRIGGER);
593
		javaProposal.setTriggerCharacters(VAR_TRIGGERS);
592
594
593
		return javaProposal;
595
		return javaProposal;
594
	}
596
	}
Lines 599-605 Link Here
599
		int length= getLength(proposal);
601
		int length= getLength(proposal);
600
		String label= fLabelProvider.createSimpleLabel(proposal);
602
		String label= fLabelProvider.createSimpleLabel(proposal);
601
		int relevance= computeRelevance(proposal);
603
		int relevance= computeRelevance(proposal);
602
		return new JavaCompletionProposal(completion, start, length, null, label, relevance);
604
		JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, null, label, relevance);
605
		javaProposal.setTriggerCharacters(KEYWORD_TRIGGERS);
606
		return javaProposal;
603
	}
607
	}
604
608
605
	private IJavaCompletionProposal createLabelProposal(CompletionProposal proposal) {
609
	private IJavaCompletionProposal createLabelProposal(CompletionProposal proposal) {
Lines 621-627 Link Here
621
		int relevance= computeRelevance(proposal);
625
		int relevance= computeRelevance(proposal);
622
626
623
		final JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, image, label, relevance);
627
		final JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, image, label, relevance);
624
		javaProposal.setTriggerCharacters(VAR_TRIGGER);
628
		javaProposal.setTriggerCharacters(VAR_TRIGGERS);
625
		return javaProposal;
629
		return javaProposal;
626
	}
630
	}
627
631

Return to bug 49552