1 20 package org.apache.directory.ldapstudio.aciitemeditor.sourceeditor; 21 22 23 import java.util.ArrayList ; 24 import java.util.Arrays ; 25 import java.util.List ; 26 27 import org.apache.directory.ldapstudio.aciitemeditor.ACIITemConstants; 28 import org.apache.directory.ldapstudio.aciitemeditor.Activator; 29 import org.eclipse.jface.text.IRegion; 30 import org.eclipse.jface.text.ITextViewer; 31 import org.eclipse.jface.text.contentassist.ICompletionProposal; 32 import org.eclipse.jface.text.contentassist.IContextInformation; 33 import org.eclipse.jface.text.contentassist.IContextInformationValidator; 34 import org.eclipse.jface.text.templates.Template; 35 import org.eclipse.jface.text.templates.TemplateCompletionProcessor; 36 import org.eclipse.jface.text.templates.TemplateContextType; 37 import org.eclipse.swt.graphics.Image; 38 39 40 46 public class ACIContentAssistProcessor extends TemplateCompletionProcessor 47 { 48 51 public ICompletionProposal[] computeCompletionProposals( ITextViewer viewer, int offset ) 52 { 53 List <ICompletionProposal> proposalList = new ArrayList <ICompletionProposal>(); 54 55 ICompletionProposal[] templateProposals = super.computeCompletionProposals( viewer, offset ); 57 if ( templateProposals != null ) 58 { 59 proposalList.addAll( Arrays.asList( templateProposals ) ); 60 } 61 62 return ( ICompletionProposal[] ) proposalList.toArray( new ICompletionProposal[0] ); 63 } 64 65 66 69 public IContextInformation[] computeContextInformation( ITextViewer viewer, int offset ) 70 { 71 return null; 72 } 73 74 75 78 public char[] getCompletionProposalAutoActivationCharacters() 79 { 80 81 char[] chars = new char[52]; 82 for ( int i = 0; i < 26; i++ ) 83 { 84 chars[i] = ( char ) ( 'a' + i ); 85 } 86 for ( int i = 0; i < 26; i++ ) 87 { 88 chars[i + 26] = ( char ) ( 'A' + i ); 89 } 90 91 return chars; 92 } 93 94 95 98 public char[] getContextInformationAutoActivationCharacters() 99 { 100 return null; 101 } 102 103 104 107 public IContextInformationValidator getContextInformationValidator() 108 { 109 return null; 110 } 111 112 113 116 public String getErrorMessage() 117 { 118 return null; 119 } 120 121 122 125 @Override 126 protected TemplateContextType getContextType( ITextViewer viewer, IRegion region ) 127 { 128 return Activator.getDefault().getAciTemplateContextTypeRegistry().getContextType( 129 ACIITemConstants.ACI_ITEM_TEMPLATE_ID ); 130 } 131 132 133 136 @Override 137 protected Image getImage( Template template ) 138 { 139 return null; 140 } 141 142 143 146 @Override 147 protected Template[] getTemplates( String contextTypeId ) 148 { 149 return Activator.getDefault().getAciTemplateStore().getTemplates( contextTypeId ); 150 } 151 } 152 | Popular Tags |