Mercurial > projects > dwt-addons
annotate dwtx/jface/text/contentassist/ContextInformation.d @ 134:51e6e63f930e
Regex fix for casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 01:46:20 +0200 |
parents | 7d818bd32d63 |
children | b6bad70d540a |
rev | line source |
---|---|
129 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2006 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.ContextInformation; | |
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.ICompletionProposalExtension3; // packageimport | |
28 import dwtx.jface.text.contentassist.ContextInformationValidator; // 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 | |
51 | |
52 import dwt.graphics.Image; | |
53 import dwtx.core.runtime.Assert; | |
54 | |
55 | |
56 | |
57 /** | |
58 * A default implementation of the <code>IContextInformation</code> interface. | |
59 */ | |
60 public final class ContextInformation : IContextInformation { | |
61 | |
62 /** The name of the context. */ | |
63 private final String fContextDisplayString; | |
64 /** The information to be displayed. */ | |
65 private final String fInformationDisplayString; | |
66 /** The image to be displayed. */ | |
67 private final Image fImage; | |
68 | |
69 /** | |
70 * Creates a new context information without an image. | |
71 * | |
72 * @param contextDisplayString the string to be used when presenting the context | |
73 * @param informationDisplayString the string to be displayed when presenting the context information | |
74 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
75 public this(String contextDisplayString, String informationDisplayString) { |
129 | 76 this(null, contextDisplayString, informationDisplayString); |
77 } | |
78 | |
79 /** | |
80 * Creates a new context information with an image. | |
81 * | |
82 * @param image the image to display when presenting the context information | |
83 * @param contextDisplayString the string to be used when presenting the context | |
84 * @param informationDisplayString the string to be displayed when presenting the context information, | |
85 * may not be <code>null</code> | |
86 */ | |
133
7d818bd32d63
Fix ctors to this with gvim regexp
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
87 public this(Image image, String contextDisplayString, String informationDisplayString) { |
129 | 88 |
89 Assert.isNotNull(informationDisplayString); | |
90 | |
91 fImage= image; | |
92 fContextDisplayString= contextDisplayString; | |
93 fInformationDisplayString= informationDisplayString; | |
94 } | |
95 | |
96 /* | |
97 * @see IContextInformation#equals(Object) | |
98 */ | |
99 public bool equals(Object object) { | |
100 if (object instanceof IContextInformation) { | |
134 | 101 IContextInformation contextInformation= cast(IContextInformation) object; |
129 | 102 bool equals= fInformationDisplayString.equalsIgnoreCase(contextInformation.getInformationDisplayString()); |
103 if (fContextDisplayString !is null) | |
104 equals= equals && fContextDisplayString.equalsIgnoreCase(contextInformation.getContextDisplayString()); | |
105 return equals; | |
106 } | |
107 return false; | |
108 } | |
109 | |
110 /* | |
111 * @see java.lang.Object#hashCode() | |
112 * @since 3.1 | |
113 */ | |
114 public int hashCode() { | |
115 int low= fContextDisplayString !is null ? fContextDisplayString.hashCode() : 0; | |
116 return (fInformationDisplayString.hashCode() << 16) | low; | |
117 } | |
118 | |
119 /* | |
120 * @see IContextInformation#getInformationDisplayString() | |
121 */ | |
122 public String getInformationDisplayString() { | |
123 return fInformationDisplayString; | |
124 } | |
125 | |
126 /* | |
127 * @see IContextInformation#getImage() | |
128 */ | |
129 public Image getImage() { | |
130 return fImage; | |
131 } | |
132 | |
133 /* | |
134 * @see IContextInformation#getContextDisplayString() | |
135 */ | |
136 public String getContextDisplayString() { | |
137 if (fContextDisplayString !is null) | |
138 return fContextDisplayString; | |
139 return fInformationDisplayString; | |
140 } | |
141 } |