comparison dwtx/jface/text/source/ContentAssistantFacade.d @ 141:ea8dd2e11034

instanceof and throws
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 21:25:28 +0200
parents 51e6e63f930e
children
comparison
equal deleted inserted replaced
140:26688fec6d23 141:ea8dd2e11034
90 /** 90 /**
91 * Facade to allow minimal access to the given content assistant. 91 * Facade to allow minimal access to the given content assistant.
92 * <p> 92 * <p>
93 * The offered API access can grow over time. 93 * The offered API access can grow over time.
94 * </p> 94 * </p>
95 * 95 *
96 * @since 3.4 96 * @since 3.4
97 */ 97 */
98 public final class ContentAssistantFacade { 98 public final class ContentAssistantFacade {
99 99
100 private IContentAssistant fContentAssistant; 100 private IContentAssistant fContentAssistant;
101 101
102 /** 102 /**
103 * Creates a new facade. 103 * Creates a new facade.
104 * 104 *
105 * @param contentAssistant the content assistant which implements {@link IContentAssistantExtension2} and {@link IContentAssistantExtension4} 105 * @param contentAssistant the content assistant which implements {@link IContentAssistantExtension2} and {@link IContentAssistantExtension4}
106 */ 106 */
107 public this(IContentAssistant contentAssistant) { 107 public this(IContentAssistant contentAssistant) {
108 Assert.isLegal(contentAssistant instanceof IContentAssistantExtension4 && contentAssistant instanceof IContentAssistantExtension4); 108 Assert.isLegal(cast(IContentAssistantExtension4)contentAssistant && cast(IContentAssistantExtension4)contentAssistant );
109 fContentAssistant= contentAssistant; 109 fContentAssistant= contentAssistant;
110 } 110 }
111 111
112 /** 112 /**
113 * Returns the handler for the given command identifier. 113 * Returns the handler for the given command identifier.
114 * <p> 114 * <p>
115 * The same handler instance will be returned when called a more than once 115 * The same handler instance will be returned when called a more than once
116 * with the same command identifier. 116 * with the same command identifier.
117 * </p> 117 * </p>
118 * 118 *
119 * @param commandId the command identifier 119 * @param commandId the command identifier
120 * @return the handler for the given command identifier 120 * @return the handler for the given command identifier
121 * @throws IllegalArgumentException if the command is not supported by this 121 * @throws IllegalArgumentException if the command is not supported by this
122 * content assistant 122 * content assistant
123 * @throws IllegalStateException if called when the content assistant is 123 * @throws IllegalStateException if called when the content assistant is
130 } 130 }
131 131
132 /** 132 /**
133 * Adds a completion listener that will be informed before proposals are 133 * Adds a completion listener that will be informed before proposals are
134 * computed. 134 * computed.
135 * 135 *
136 * @param listener the listener 136 * @param listener the listener
137 * @throws IllegalStateException if called when the content assistant is 137 * @throws IllegalStateException if called when the content assistant is
138 * uninstalled 138 * uninstalled
139 */ 139 */
140 public void addCompletionListener(ICompletionListener listener) { 140 public void addCompletionListener(ICompletionListener listener) {
143 (cast(IContentAssistantExtension2)fContentAssistant).addCompletionListener(listener); 143 (cast(IContentAssistantExtension2)fContentAssistant).addCompletionListener(listener);
144 } 144 }
145 145
146 /** 146 /**
147 * Removes a completion listener. 147 * Removes a completion listener.
148 * 148 *
149 * @param listener the listener to remove 149 * @param listener the listener to remove
150 * @throws IllegalStateException if called when the content assistant is 150 * @throws IllegalStateException if called when the content assistant is
151 * uninstalled 151 * uninstalled
152 */ 152 */
153 public void removeCompletionListener(ICompletionListener listener) { 153 public void removeCompletionListener(ICompletionListener listener) {