mycompletionprocessor.java

来自「这是用SWT写的一个自定义编辑器的一个小离子」· Java 代码 · 共 67 行

JAVA
67
字号
package edit4.Myedit;import org.eclipse.jface.text.ITextViewer;import org.eclipse.jface.text.contentassist.CompletionProposal;import org.eclipse.jface.text.contentassist.ICompletionProposal;import org.eclipse.jface.text.contentassist.IContentAssistProcessor;import org.eclipse.jface.text.contentassist.IContextInformation;import org.eclipse.jface.text.contentassist.IContextInformationValidator;public class MyCompletionProcessor implements IContentAssistProcessor {	protected final static String[] myProposals = { "Line1", "Line2","Line3" ,"Line4"};	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public ICompletionProposal[] computeCompletionProposals(		ITextViewer viewer,		int documentOffset) {		ICompletionProposal[] result =			new ICompletionProposal[myProposals.length];		for (int i = 0; i < myProposals.length; i++) {			result[i] = new CompletionProposal(myProposals[i], 							documentOffset, 0, myProposals[i].length());		}		return result;	}	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public char[] getCompletionProposalAutoActivationCharacters() {		return new char[] { '<' };	}	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public char[] getContextInformationAutoActivationCharacters() {		return null;	}	// For Context information 	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public IContextInformationValidator getContextInformationValidator() {		return null;	}	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public IContextInformation[] computeContextInformation(		ITextViewer viewer,		int documentOffset) {		return null;	}	/* (non-Javadoc)	 * Method declared on IContentAssistProcessor	 */	public String getErrorMessage() {		return null;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?