Mercurial > projects > dwt-addons
annotate dwtx/jface/text/contentassist/ContextInformationValidator.d @ 192:c3583c6ec027
Added missing default cases for switch statements
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 03 Nov 2008 22:52:26 +0100 |
parents | 1a5b8f8129df |
children |
rev | line source |
---|---|
129 | 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.ContextInformationValidator; | |
14 | |
131 | 15 import dwtx.jface.text.contentassist.ContentAssistEvent; // packageimport |
16 import dwtx.jface.text.contentassist.Helper; // packageimport | |
17 import dwtx.jface.text.contentassist.PopupCloser; // packageimport | |
18 import dwtx.jface.text.contentassist.IContentAssistant; // packageimport | |
19 import dwtx.jface.text.contentassist.CompletionProposal; // packageimport | |
20 import dwtx.jface.text.contentassist.ICompletionProposalExtension5; // packageimport | |
21 import dwtx.jface.text.contentassist.IContextInformationValidator; // packageimport | |
22 import dwtx.jface.text.contentassist.IContentAssistListener; // packageimport | |
23 import dwtx.jface.text.contentassist.ICompletionProposalExtension6; // packageimport | |
24 import dwtx.jface.text.contentassist.ICompletionListener; // packageimport | |
25 import dwtx.jface.text.contentassist.ICompletionProposalExtension2; // packageimport | |
26 import dwtx.jface.text.contentassist.IContentAssistantExtension4; // packageimport | |
27 import dwtx.jface.text.contentassist.ContextInformation; // packageimport | |
28 import dwtx.jface.text.contentassist.ICompletionProposalExtension3; // packageimport | |
29 import dwtx.jface.text.contentassist.ICompletionProposal; // packageimport | |
30 import dwtx.jface.text.contentassist.IContentAssistProcessor; // packageimport | |
31 import dwtx.jface.text.contentassist.AdditionalInfoController; // packageimport | |
32 import dwtx.jface.text.contentassist.IContextInformationPresenter; // packageimport | |
33 import dwtx.jface.text.contentassist.ICompletionProposalExtension4; // packageimport | |
34 import dwtx.jface.text.contentassist.ICompletionListenerExtension; // packageimport | |
35 import dwtx.jface.text.contentassist.ContextInformationPopup; // packageimport | |
36 import dwtx.jface.text.contentassist.IContextInformationExtension; // packageimport | |
37 import dwtx.jface.text.contentassist.IContentAssistantExtension2; // packageimport | |
38 import dwtx.jface.text.contentassist.ContentAssistSubjectControlAdapter; // packageimport | |
39 import dwtx.jface.text.contentassist.CompletionProposalPopup; // packageimport | |
40 import dwtx.jface.text.contentassist.ICompletionProposalExtension; // packageimport | |
41 import dwtx.jface.text.contentassist.IContextInformation; // packageimport | |
42 import dwtx.jface.text.contentassist.IContentAssistantExtension3; // packageimport | |
43 import dwtx.jface.text.contentassist.ContentAssistant; // packageimport | |
44 import dwtx.jface.text.contentassist.IContentAssistantExtension; // packageimport | |
45 import dwtx.jface.text.contentassist.JFaceTextMessages; // packageimport | |
46 | |
47 | |
129 | 48 import dwt.dwthelper.utils; |
49 | |
50 import dwtx.jface.text.ITextViewer; | |
51 | |
52 | |
53 /** | |
54 * A default implementation of the <code>IContextInfomationValidator</code> interface. | |
55 * This implementation determines whether the information is valid by asking the content | |
56 * assist processor for all context information objects for the current position. If the | |
57 * currently displayed information is in the result set, the context information is | |
58 * considered valid. | |
59 */ | |
60 public final class ContextInformationValidator : IContextInformationValidator { | |
61 | |
62 /** The content assist processor. */ | |
63 private IContentAssistProcessor fProcessor; | |
64 /** The context information to be validated. */ | |
65 private IContextInformation fContextInformation; | |
66 /** The associated text viewer. */ | |
67 private ITextViewer fViewer; | |
68 | |
69 /** | |
70 * Creates a new context information validator which is ready to be installed on | |
71 * a particular context information. | |
72 * | |
73 * @param processor the processor to be used for validation | |
74 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
75 public this(IContentAssistProcessor processor) { |
129 | 76 fProcessor= processor; |
77 } | |
78 | |
79 /* | |
80 * @see IContextInformationValidator#install(IContextInformation, ITextViewer, int) | |
81 */ | |
82 public void install(IContextInformation contextInformation, ITextViewer viewer, int offset) { | |
83 fContextInformation= contextInformation; | |
84 fViewer= viewer; | |
85 } | |
86 | |
87 /* | |
88 * @see IContentAssistTipCloser#isContextInformationValid(int) | |
89 */ | |
90 public bool isContextInformationValid(int offset) { | |
91 IContextInformation[] infos= fProcessor.computeContextInformation(fViewer, offset); | |
92 if (infos !is null && infos.length > 0) { | |
93 for (int i= 0; i < infos.length; i++) | |
162 | 94 if (fContextInformation==/+eq+/infos[i]) |
129 | 95 return true; |
96 } | |
97 return false; | |
98 } | |
99 } |