1 package eu
.etaxonomy
.taxeditor
.prototype1
.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
.prototype1
.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 // Image img = ResourceManager.getPluginImage(Activator.getDefault(), "icons/unknown.gif");
54 ICompletionProposal
[] result
=
55 new ICompletionProposal
[myProposals
.length
];
56 for (int i
= 0; i
< myProposals
.length
; i
++) {
57 IContextInformation contextInfo
=
58 new ContextInformation(null, myProposals
[i
]+" Style");
59 // result[i] = new CompletionProposal(myProposals[i],documentOffset, 0,
60 // myProposals[i].length(), ResourceManager.getPluginImage(Activator.getDefault(), myIcons[i]),
61 // myProposals[i], contextInfo, myContexts[i]);
62 result
[i
] = new CompletionProposal("party",documentOffset
, 0,
63 myProposals
[i
].length(), ResourceManager
.getPluginImage(Activator
.getDefault(), myIcons
[i
]),
64 myProposals
[i
], contextInfo
, myContexts
[i
]);
71 * Method declared on IContentAssistProcessor
73 public char[] getCompletionProposalAutoActivationCharacters() {
74 return new char[] { '=', (char) SWT
.CR
};
78 * Method declared on IContentAssistProcessor
80 public char[] getContextInformationAutoActivationCharacters() {
84 // For Context information
86 * Method declared on IContentAssistProcessor
88 public IContextInformationValidator
getContextInformationValidator() {
93 * Method declared on IContentAssistProcessor
95 public IContextInformation
[] computeContextInformation(
102 * Method declared on IContentAssistProcessor
104 public String
getErrorMessage() {