1 package eu
.etaxonomy
.taxeditor
.designproposal2
.view
;
3 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
4 import org
.eclipse
.jface
.text
.ITextViewer
;
5 import org
.eclipse
.jface
.text
.contentassist
.CompletionProposal
;
6 import org
.eclipse
.jface
.text
.contentassist
.ContextInformation
;
7 import org
.eclipse
.jface
.text
.contentassist
.ICompletionProposal
;
8 import org
.eclipse
.jface
.text
.contentassist
.IContentAssistProcessor
;
9 import org
.eclipse
.jface
.text
.contentassist
.IContextInformation
;
10 import org
.eclipse
.jface
.text
.contentassist
.IContextInformationValidator
;
11 import org
.eclipse
.swt
.SWT
;
12 import org
.eclipse
.swt
.graphics
.Image
;
14 import com
.swtdesigner
.ResourceManager
;
16 import eu
.etaxonomy
.taxeditor
.designproposal2
.Activator
;
18 public class MyCompletionProcessor
implements IContentAssistProcessor
{
20 protected final static String
[] myProposals
= { "Unknown synonymy",
21 "Create homotypic synonym",
22 "Create heterotypic synoynm",
24 "Create replaced synonym",
26 "Create orthographic variant",
27 "Create misapplied name",
28 "Create concept relation"};
29 protected final static String
[] myIcons
= { "icons/unknown.gif",
31 "icons/heterosyn.gif",
35 "icons/orthovariant.gif",
36 "icons/misapplied.gif",
38 protected final static String
[] myContexts
= { "To create a homotypic synonym, there are many things to consider. I could go on all day.",
39 "Create homotypic synonym",
40 "Create heterotypic synoynm",
42 "Create replaced synonym",
44 "Create orthographic variant",
45 "Create misapplied name",
46 "Create concept relation"};
49 * Method declared on IContentAssistProcessor
51 public ICompletionProposal
[] computeCompletionProposals(
52 ITextViewer viewer
, int documentOffset
) {
53 String context
= "Describe formatting / parsing of this rel. type.";
54 // Image img = ResourceManager.getPluginImage(Activator.getDefault(), "icons/unknown.gif");
55 ICompletionProposal
[] result
=
56 new ICompletionProposal
[myProposals
.length
];
57 for (int i
= 0; i
< myProposals
.length
; i
++) {
58 IContextInformation contextInfo
=
59 new ContextInformation(null, myProposals
[i
]+" Style");
60 result
[i
] = new CompletionProposal(myProposals
[i
],documentOffset
, 0,
61 myProposals
[i
].length(), ResourceManager
.getPluginImage(Activator
.getDefault(), myIcons
[i
]),
62 myProposals
[i
], contextInfo
, context
);
69 * Method declared on IContentAssistProcessor
71 public char[] getCompletionProposalAutoActivationCharacters() {
72 return new char[] { '=', (char) SWT
.CR
};
76 * Method declared on IContentAssistProcessor
78 public char[] getContextInformationAutoActivationCharacters() {
82 // For Context information
84 * Method declared on IContentAssistProcessor
86 public IContextInformationValidator
getContextInformationValidator() {
91 * Method declared on IContentAssistProcessor
93 public IContextInformation
[] computeContextInformation(
100 * Method declared on IContentAssistProcessor
102 public String
getErrorMessage() {