Mercurial > projects > dwt-addons
comparison dwtx/jface/text/contentassist/ICompletionProposalExtension2.d @ 129:eb30df5ca28b
Added JFace Text sources
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 23 Aug 2008 19:10:48 +0200 |
parents | |
children | c4fb132a086c |
comparison
equal
deleted
inserted
replaced
128:8df1d4193877 | 129:eb30df5ca28b |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.jface.text.contentassist.ICompletionProposalExtension2; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 | |
17 import dwtx.jface.text.DocumentEvent; | |
18 import dwtx.jface.text.IDocument; | |
19 import dwtx.jface.text.ITextViewer; | |
20 | |
21 | |
22 /** | |
23 * Extends {@link dwtx.jface.text.contentassist.ICompletionProposal} | |
24 * with the following functions: | |
25 * <ul> | |
26 * <li>handling of trigger characters with modifiers</li> | |
27 * <li>visual indication for selection of a proposal</li> | |
28 * </ul> | |
29 * | |
30 * @since 2.1 | |
31 */ | |
32 public interface ICompletionProposalExtension2 { | |
33 | |
34 /** | |
35 * Applies the proposed completion to the given document. The insertion | |
36 * has been triggered by entering the given character with a modifier at the given offset. | |
37 * This method assumes that {@link #validate(IDocument, int, DocumentEvent)} | |
38 * returns <code>true</code> if called for <code>offset</code>. | |
39 * | |
40 * @param viewer the text viewer into which to insert the proposed completion | |
41 * @param trigger the trigger to apply the completion | |
42 * @param stateMask the state mask of the modifiers | |
43 * @param offset the offset at which the trigger has been activated | |
44 */ | |
45 void apply(ITextViewer viewer, char trigger, int stateMask, int offset); | |
46 | |
47 /** | |
48 * Called when the proposal is selected. | |
49 * | |
50 * @param viewer the text viewer. | |
51 * @param smartToggle the smart toggle key was pressed | |
52 */ | |
53 void selected(ITextViewer viewer, bool smartToggle); | |
54 | |
55 /** | |
56 * Called when the proposal is unselected. | |
57 * | |
58 * @param viewer the text viewer. | |
59 */ | |
60 void unselected(ITextViewer viewer); | |
61 | |
62 /** | |
63 * Requests the proposal to be validated with respect to the document event. | |
64 * If the proposal cannot be validated, the methods returns <code>false</code>. | |
65 * If the document event was <code>null</code>, only the caret offset was changed, but not the document. | |
66 * | |
67 * This method replaces {@link ICompletionProposalExtension#isValidFor(IDocument, int)} | |
68 * | |
69 * @param document the document | |
70 * @param offset the caret offset | |
71 * @param event the document event, may be <code>null</code> | |
72 * @return bool | |
73 */ | |
74 bool validate(IDocument document, int offset, DocumentEvent event); | |
75 | |
76 } |