1 /******************************************************************************* 2 * Copyright (c) 2000, 2018 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.jface.dialogs; 15 16 /** 17 * Various dialog-related constants. 18 * <p> 19 * Within the dialog framework, all buttons are referred to by a button id. 20 * Various common buttons, like "OK", "Cancel", and "Finish", have pre-assigned 21 * button ids for convenience. If an application requires other dialog buttons, 22 * they should be assigned application-specific button ids counting up from 23 * <code>CLIENT_ID</code>. 24 * </p> 25 * <p> 26 * Button label constants are also provided for the common buttons. JFace 27 * automatically localizes these strings to the current locale; that is, 28 * <code>YES_LABEL</code> would be bound to the string <code>"Si"</code> in 29 * a Spanish locale, but to <code>"Oui"</code> in a French one. 30 * </p> 31 * <p> 32 * All margins, spacings, and sizes are given in "dialog units" (DLUs), where 33 * <ul> 34 * <li>1 horizontal DLU = 1/4 average character width</li> 35 * <li>1 vertical DLU = 1/8 average character height</li> 36 * </ul> 37 * </p> 38 */ 39 import org.eclipse.jface.resource.JFaceResources; 40 41 /** 42 * IDialogConstants is the interface for common dialog strings and ids used throughout JFace. It is 43 * recommended that you use these labels and ids wherever for consistency with the JFace dialogs. 44 */ 45 public interface IDialogConstants { 46 // button ids 47 48 // Note: if new button ids are added, see 49 // MessageDialogWithToggle.mapButtonLabelToButtonID(String, int) 50 /** 51 * Button id for an "Ok" button (value 0). 52 */ 53 int OK_ID = 0; 54 55 /** 56 * Button id for a "Cancel" button (value 1). 57 */ 58 int CANCEL_ID = 1; 59 60 /** 61 * Button id for a "Yes" button (value 2). 62 */ 63 int YES_ID = 2; 64 65 /** 66 * Button id for a "No" button (value 3). 67 */ 68 int NO_ID = 3; 69 70 /** 71 * Button id for a "Yes to All" button (value 4). 72 */ 73 int YES_TO_ALL_ID = 4; 74 75 /** 76 * Button id for a "Skip" button (value 5). 77 */ 78 int SKIP_ID = 5; 79 80 /** 81 * Button id for a "Stop" button (value 6). 82 */ 83 int STOP_ID = 6; 84 85 /** 86 * Button id for an "Abort" button (value 7). 87 */ 88 int ABORT_ID = 7; 89 90 /** 91 * Button id for a "Retry" button (value 8). 92 */ 93 int RETRY_ID = 8; 94 95 /** 96 * Button id for an "Ignore" button (value 9). 97 */ 98 int IGNORE_ID = 9; 99 100 /** 101 * Button id for a "Proceed" button (value 10). 102 */ 103 int PROCEED_ID = 10; 104 105 /** 106 * Button id for an "Open" button (value 11). 107 */ 108 int OPEN_ID = 11; 109 110 /** 111 * Button id for a "Close" button (value 12). 112 */ 113 int CLOSE_ID = 12; 114 115 /** 116 * Button id for a "Details" button (value 13). 117 */ 118 int DETAILS_ID = 13; 119 120 /** 121 * Button id for a "Back" button (value 14). 122 */ 123 int BACK_ID = 14; 124 125 /** 126 * Button id for a "Next" button (value 15). 127 */ 128 int NEXT_ID = 15; 129 130 /** 131 * Button id for a "Finish" button (value 16). 132 */ 133 int FINISH_ID = 16; 134 135 /** 136 * Button id for a "Help" button (value 17). 137 */ 138 int HELP_ID = 17; 139 140 /** 141 * Button id for a "Select All" button (value 18). 142 */ 143 int SELECT_ALL_ID = 18; 144 145 /** 146 * Button id for a "Deselect All" button (value 19). 147 */ 148 int DESELECT_ALL_ID = 19; 149 150 /** 151 * Button id for a "Select types" button (value 20). 152 */ 153 int SELECT_TYPES_ID = 20; 154 155 /** 156 * Button id for a "No to All" button (value 21). 157 */ 158 int NO_TO_ALL_ID = 21; 159 160 /** 161 * Starting button id reserved for internal use by JFace (value 256). JFace 162 * classes make ids by adding to this number. 163 */ 164 int INTERNAL_ID = 256; 165 166 /** 167 * Starting button id reserved for use by clients of JFace (value 1024). 168 * Clients of JFace should make ids by adding to this number. 169 */ 170 int CLIENT_ID = 1024; 171 172 // button labels 173 /** 174 * The label for OK buttons. 175 * Using this static label string provides optimum performance by looking 176 * up the label only once when JFace is initialized. However, clients that 177 * wish to support multiple locales in one system should instead use the pattern 178 * <code>JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY)</code> 179 * so that a locale other than the default may be consulted. 180 */ 181 String OK_LABEL = JFaceResources.getString(IDialogLabelKeys.OK_LABEL_KEY); 182 183 /** 184 * The label for cancel buttons. 185 * Using this static label string provides optimum performance by looking 186 * up the label only once when JFace is initialized. However, clients that 187 * wish to support multiple locales in one system should instead use the pattern 188 * <code>JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY)</code> 189 * so that a locale other than the default may be consulted. 190 */ 191 String CANCEL_LABEL = JFaceResources.getString(IDialogLabelKeys.CANCEL_LABEL_KEY); 192 193 /** 194 * The label for yes buttons. 195 * Using this static label string provides optimum performance by looking 196 * up the label only once when JFace is initialized. However, clients that 197 * wish to support multiple locales in one system should instead use the pattern 198 * <code>JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY)</code> 199 * so that a locale other than the default may be consulted. 200 */ 201 String YES_LABEL = JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY); 202 /** 203 * The label for no buttons. 204 * Using this static label string provides optimum performance by looking 205 * up the label only once when JFace is initialized. However, clients that 206 * wish to support multiple locales in one system should instead use the pattern 207 * <code>JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY)</code> 208 * so that a locale other than the default may be consulted. 209 */ 210 String NO_LABEL = JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY); 211 212 /** 213 * The label for not to all buttons. 214 * Using this static label string provides optimum performance by looking 215 * up the label only once when JFace is initialized. However, clients that 216 * wish to support multiple locales in one system should instead use the pattern 217 * <code>JFaceResources.getString(IDialogLabelKeys.NO_TO_ALL_LABEL_KEY)</code> 218 * so that a locale other than the default may be consulted. 219 */ 220 String NO_TO_ALL_LABEL = JFaceResources.getString(IDialogLabelKeys.NO_TO_ALL_LABEL_KEY); 221 222 /** 223 * The label for yes to all buttons. 224 * Using this static label string provides optimum performance by looking 225 * up the label only once when JFace is initialized. However, clients that 226 * wish to support multiple locales in one system should instead use the pattern 227 * <code>JFaceResources.getString(IDialogLabelKeys.YES_TO_ALL_LABEL_KEY)</code> 228 * so that a locale other than the default may be consulted. 229 */ 230 String YES_TO_ALL_LABEL = JFaceResources.getString(IDialogLabelKeys.YES_TO_ALL_LABEL_KEY); 231 232 /** 233 * The label for skip buttons. 234 * Using this static label string provides optimum performance by looking 235 * up the label only once when JFace is initialized. However, clients that 236 * wish to support multiple locales in one system should instead use the pattern 237 * <code>JFaceResources.getString(IDialogLabelKeys.SKIP_LABEL_KEY)</code> 238 * so that a locale other than the default may be consulted. 239 */ 240 String SKIP_LABEL = JFaceResources.getString(IDialogLabelKeys.SKIP_LABEL_KEY); 241 242 /** 243 * The label for stop buttons. 244 * Using this static label string provides optimum performance by looking 245 * up the label only once when JFace is initialized. However, clients that 246 * wish to support multiple locales in one system should instead use the pattern 247 * <code>JFaceResources.getString(IDialogLabelKeys.STOP_LABEL_KEY)</code> 248 * so that a locale other than the default may be consulted. 249 */ 250 String STOP_LABEL = JFaceResources.getString(IDialogLabelKeys.STOP_LABEL_KEY); 251 252 /** 253 * The label for abort buttons. 254 * Using this static label string provides optimum performance by looking 255 * up the label only once when JFace is initialized. However, clients that 256 * wish to support multiple locales in one system should instead use the pattern 257 * <code>JFaceResources.getString(IDialogLabelKeys.ABORT_LABEL_KEY)</code> 258 * so that a locale other than the default may be consulted. 259 */ 260 String ABORT_LABEL = JFaceResources.getString(IDialogLabelKeys.ABORT_LABEL_KEY); 261 262 /** 263 * The label for retry buttons. 264 * Using this static label string provides optimum performance by looking 265 * up the label only once when JFace is initialized. However, clients that 266 * wish to support multiple locales in one system should instead use the pattern 267 * <code>JFaceResources.getString(IDialogLabelKeys.RETRY_LABEL_KEY)</code> 268 * so that a locale other than the default may be consulted. 269 */ 270 String RETRY_LABEL = JFaceResources.getString(IDialogLabelKeys.RETRY_LABEL_KEY); 271 272 /** 273 * The label for ignore buttons. 274 * Using this static label string provides optimum performance by looking 275 * up the label only once when JFace is initialized. However, clients that 276 * wish to support multiple locales in one system should instead use the pattern 277 * <code>JFaceResources.getString(IDialogLabelKeys.IGNORE_LABEL_KEY)</code> 278 * so that a locale other than the default may be consulted. 279 */ 280 String IGNORE_LABEL = JFaceResources.getString(IDialogLabelKeys.IGNORE_LABEL_KEY); 281 282 /** 283 * The label for proceed buttons. 284 * Using this static label string provides optimum performance by looking 285 * up the label only once when JFace is initialized. However, clients that 286 * wish to support multiple locales in one system should instead use the pattern 287 * <code>JFaceResources.getString(IDialogLabelKeys.PROCEED_LABEL_KEY)</code> 288 * so that a locale other than the default may be consulted. 289 */ 290 String PROCEED_LABEL = JFaceResources.getString(IDialogLabelKeys.PROCEED_LABEL_KEY); 291 292 /** 293 * The label for open buttons. 294 * Using this static label string provides optimum performance by looking 295 * up the label only once when JFace is initialized. However, clients that 296 * wish to support multiple locales in one system should instead use the pattern 297 * <code>JFaceResources.getString(IDialogLabelKeys.OPEN_LABEL_KEY)</code> 298 * so that a locale other than the default may be consulted. 299 */ 300 String OPEN_LABEL = JFaceResources.getString(IDialogLabelKeys.OPEN_LABEL_KEY); 301 302 /** 303 * The label for close buttons. 304 * Using this static label string provides optimum performance by looking 305 * up the label only once when JFace is initialized. However, clients that 306 * wish to support multiple locales in one system should instead use the pattern 307 * <code>JFaceResources.getString(IDialogLabelKeys.CLOSE_LABEL_KEY)</code> 308 * so that a locale other than the default may be consulted. 309 */ 310 String CLOSE_LABEL = JFaceResources.getString(IDialogLabelKeys.CLOSE_LABEL_KEY); 311 312 /** 313 * The label for show details buttons. 314 * Using this static label string provides optimum performance by looking 315 * up the label only once when JFace is initialized. However, clients that 316 * wish to support multiple locales in one system should instead use the pattern 317 * <code>JFaceResources.getString(IDialogLabelKeys.SHOW_DETAILS_LABEL_KEY)</code> 318 * so that a locale other than the default may be consulted. 319 */ 320 String SHOW_DETAILS_LABEL = JFaceResources.getString(IDialogLabelKeys.SHOW_DETAILS_LABEL_KEY); 321 322 /** 323 * The label for hide details buttons. 324 * Using this static label string provides optimum performance by looking 325 * up the label only once when JFace is initialized. However, clients that 326 * wish to support multiple locales in one system should instead use the pattern 327 * <code>JFaceResources.getString(IDialogLabelKeys.HIDE_DETAILS_LABEL_KEY)</code> 328 * so that a locale other than the default may be consulted. 329 */ 330 String HIDE_DETAILS_LABEL = JFaceResources.getString(IDialogLabelKeys.HIDE_DETAILS_LABEL_KEY); 331 332 /** 333 * The label for back buttons. 334 * Using this static label string provides optimum performance by looking 335 * up the label only once when JFace is initialized. However, clients that 336 * wish to support multiple locales in one system should instead use the pattern 337 * <code>JFaceResources.getString(IDialogLabelKeys.BACK_LABEL_KEY)</code> 338 * so that a locale other than the default may be consulted. 339 */ 340 String BACK_LABEL = JFaceResources.getString(IDialogLabelKeys.BACK_LABEL_KEY); 341 342 /** 343 * The label for next buttons. 344 * Using this static label string provides optimum performance by looking 345 * up the label only once when JFace is initialized. However, clients that 346 * wish to support multiple locales in one system should instead use the pattern 347 * <code>JFaceResources.getString(IDialogLabelKeys.NEXT_LABEL_KEY)</code> 348 * so that a locale other than the default may be consulted. 349 */ 350 String NEXT_LABEL = JFaceResources.getString(IDialogLabelKeys.NEXT_LABEL_KEY); 351 352 /** 353 * The label for finish buttons. 354 * Using this static label string provides optimum performance by looking 355 * up the label only once when JFace is initialized. However, clients that 356 * wish to support multiple locales in one system should instead use the pattern 357 * <code>JFaceResources.getString(IDialogLabelKeys.FINISH_LABEL_KEY)</code> 358 * so that a locale other than the default may be consulted. 359 */ 360 String FINISH_LABEL = JFaceResources.getString(IDialogLabelKeys.FINISH_LABEL_KEY); 361 362 /** 363 * The label for help buttons. 364 * Using this static label string provides optimum performance by looking 365 * up the label only once when JFace is initialized. However, clients that 366 * wish to support multiple locales in one system should instead use the pattern 367 * <code>JFaceResources.getString(IDialogLabelKeys.HELP_LABEL_KEY)</code> 368 * so that a locale other than the default may be consulted. 369 */ 370 String HELP_LABEL = JFaceResources.getString(IDialogLabelKeys.HELP_LABEL_KEY); 371 372 // Margins, spacings, and sizes 373 /** 374 * Vertical margin in dialog units (value 7). 375 */ 376 int VERTICAL_MARGIN = 7; 377 378 /** 379 * Vertical spacing in dialog units (value 4). 380 */ 381 int VERTICAL_SPACING = 4; 382 383 /** 384 * Horizontal margin in dialog units (value 7). 385 */ 386 int HORIZONTAL_MARGIN = 7; 387 388 /** 389 * Horizontal spacing in dialog units (value 4). 390 */ 391 int HORIZONTAL_SPACING = 4; 392 393 /** 394 * Height of button bar in dialog units (value 25). 395 */ 396 int BUTTON_BAR_HEIGHT = 25; 397 398 /** 399 * Left margin in dialog units (value 20). 400 */ 401 int LEFT_MARGIN = 20; 402 403 /** 404 * Button margin in dialog units (value 4). 405 */ 406 int BUTTON_MARGIN = 4; 407 408 /** 409 * Button height in dialog units (value 14). 410 * 411 * @deprecated This constant is no longer in use. 412 * The button heights are now determined by the layout. 413 */ 414 @Deprecated 415 int BUTTON_HEIGHT = 14; 416 417 /** 418 * Button width in dialog units (value 61). 419 */ 420 int BUTTON_WIDTH = 61; 421 422 /** 423 * Indent in dialog units (value 21). 424 * 425 * @deprecated As of 3.9, this is deprecated as it is too big as DLU and got accidentally used 426 * when setting pixel values 427 */ 428 @Deprecated 429 int INDENT = 21; 430 431 /** 432 * Small indent in dialog units (value 7). 433 * 434 * @deprecated As of 3.9, this is deprecated as it is not clear what the meaning of a 435 * "small indent" would be 436 */ 437 @Deprecated 438 int SMALL_INDENT = 7; 439 440 /** 441 * Entry field width in dialog units (value 200). 442 */ 443 int ENTRY_FIELD_WIDTH = 200; 444 445 /** 446 * Minimum width of message area in dialog units (value 300). 447 */ 448 int MINIMUM_MESSAGE_AREA_WIDTH = 300; 449 } 450