001/***************************************************************************** 002 * Copyright by The HDF Group. * 003 * Copyright by the Board of Trustees of the University of Illinois. * 004 * All rights reserved. * 005 * * 006 * This file is part of the HDF Java Products distribution. * 007 * The full copyright notice, including terms governing use, modification, * 008 * and redistribution, is contained in the COPYING file, which can be found * 009 * at the root of the source code distribution tree, * 010 * or in https://www.hdfgroup.org/licenses. * 011 * If you do not have access to either file, you may request a copy from * 012 * help@hdfgroup.org. * 013 ****************************************************************************/ 014 015package hdf.view.dialog; 016 017import java.awt.GraphicsEnvironment; 018import java.io.File; 019 020import hdf.view.Tools; 021import hdf.view.ViewProperties; 022 023import org.slf4j.Logger; 024import org.slf4j.LoggerFactory; 025 026import org.eclipse.swt.SWT; 027import org.eclipse.swt.events.KeyAdapter; 028import org.eclipse.swt.events.KeyEvent; 029import org.eclipse.swt.events.SelectionAdapter; 030import org.eclipse.swt.events.SelectionEvent; 031import org.eclipse.swt.graphics.Font; 032import org.eclipse.swt.layout.GridData; 033import org.eclipse.swt.layout.GridLayout; 034import org.eclipse.swt.widgets.Button; 035import org.eclipse.swt.widgets.Combo; 036import org.eclipse.swt.widgets.Composite; 037import org.eclipse.swt.widgets.Control; 038import org.eclipse.swt.widgets.DirectoryDialog; 039import org.eclipse.swt.widgets.Display; 040import org.eclipse.swt.widgets.FileDialog; 041import org.eclipse.swt.widgets.Label; 042import org.eclipse.swt.widgets.Text; 043 044/** 045 * UserOptionsHDFPage.java - Configuration page for HDF-specific application 046 * settings. 047 */ 048public class UserOptionsHDFPage extends UserOptionsDefaultPage { 049 private static final Logger log = LoggerFactory.getLogger(UserOptionsHDFPage.class); 050 051 private Text fileExtField; 052 private Combo pluginCombo; 053 private Button clearTextButton, deleteTextButton, insertTextButton; 054 private Button checkConvertEnum, checkShowRegRefValues, helpButton; 055 private Button checkNativeOrder, checkDecOrder, checkIncOrder; 056 private Button checkIndexName, checkIndexCreateOrder; 057 private Button earlyLibVersion, early18LibVersion, early110LibVersion, early112LibVersion, 058 early114LibVersion, earlyLateLibVersion; 059 private Button lateLibVersion, late18LibVersion, late110LibVersion, late112LibVersion, late114LibVersion, 060 lateLateLibVersion; 061 private Button pluginDirButton; 062 063 /** Default early libversion for files */ 064 private static String earlyLibVers; 065 066 /** Default late libversion for files */ 067 private static String lateLibVers; 068 069 /** Default index type for files */ 070 private static String indexType; 071 072 /** Default index ordering for files */ 073 private static String indexOrder; 074 075 /** Path to plugins */ 076 private String pluginDir = null; 077 private int pluginDirIndex = -1; 078 private boolean isPluginListChanged = false; 079 080 /** a list of plugin paths */ 081 private static String[] pluginPathList; 082 083 /** 084 * Configuration page for HDF-specific application settings. 085 */ 086 public UserOptionsHDFPage() 087 { 088 super("HDF Settings"); 089 isPluginListChanged = false; 090 } 091 092 /** 093 * Performs special processing when this page's Defaults button has been pressed. 094 */ 095 @Override 096 public void performDefaults() 097 { 098 super.performDefaults(); 099 getPreferenceStore(); 100 } 101 102 /** 103 * Notifies that the OK button of this page's container has been pressed. 104 * 105 * @return <code>false</code> to abort the container's OK processing and 106 * <code>true</code> to allow the OK to happen 107 */ 108 @Override 109 public boolean performOk() 110 { 111 getPreferenceStore(); 112 113 if (fileExtField != null) { 114 String ext = fileExtField.getText(); 115 if ((ext != null) && (ext.length() > 0)) { 116 ext = ext.trim(); 117 ViewProperties.setFileExtension(ext); 118 } 119 } 120 121 log.trace("performOk: save HDF options earlyLibVersion={}", earlyLibVersion); 122 if (earlyLibVersion != null) { 123 if (earlyLibVersion.getSelection()) 124 ViewProperties.setEarlyLib("Earliest"); 125 else if (early18LibVersion.getSelection()) 126 ViewProperties.setEarlyLib("v18"); 127 else if (early110LibVersion.getSelection()) 128 ViewProperties.setEarlyLib("v110"); 129 else if (early112LibVersion.getSelection()) 130 ViewProperties.setEarlyLib("v112"); 131 else if (early114LibVersion.getSelection()) 132 ViewProperties.setEarlyLib("v114"); 133 else if (earlyLateLibVersion.getSelection()) 134 ViewProperties.setEarlyLib("Latest"); 135 else 136 ViewProperties.setEarlyLib("Earliest"); 137 } 138 139 log.trace("performOk: save HDF options lateLibVersion={}", lateLibVersion); 140 if (lateLibVersion != null) { 141 if (lateLibVersion.getSelection()) 142 ViewProperties.setLateLib("Earliest"); 143 else if (late18LibVersion.getSelection()) 144 ViewProperties.setLateLib("v18"); 145 else if (late110LibVersion.getSelection()) 146 ViewProperties.setLateLib("v110"); 147 else if (late112LibVersion.getSelection()) 148 ViewProperties.setLateLib("v112"); 149 else if (late114LibVersion.getSelection()) 150 ViewProperties.setLateLib("v114"); 151 else if (lateLateLibVersion.getSelection()) 152 ViewProperties.setLateLib("Latest"); 153 else 154 ViewProperties.setLateLib("Latest"); 155 } 156 157 // set index type 158 if (checkIndexName != null) { 159 if (checkIndexName.getSelection()) 160 ViewProperties.setIndexType("H5_INDEX_NAME"); 161 else 162 ViewProperties.setIndexType("H5_INDEX_CRT_ORDER"); 163 } 164 165 // set index order 166 if (checkIncOrder != null) { 167 if (checkIncOrder.getSelection()) 168 ViewProperties.setIndexOrder("H5_ITER_INC"); 169 else if (checkNativeOrder.getSelection()) 170 ViewProperties.setIndexOrder("H5_ITER_NATIVE"); 171 else 172 ViewProperties.setIndexOrder("H5_ITER_DEC"); 173 } 174 175 if (checkConvertEnum != null) 176 ViewProperties.setConvertEnum(checkConvertEnum.getSelection()); 177 if (checkShowRegRefValues != null) 178 ViewProperties.setShowRegRefValue(checkShowRegRefValues.getSelection()); 179 180 return true; 181 } 182 183 /** 184 * Checks if the location of the PluginDir changed. 185 * 186 * @return true if the plugin directory changed. 187 */ 188 public boolean isPluginListChanged() { return isPluginListChanged; } 189 190 /** 191 * Loads all stored values in the <code>FieldEditor</code>s. 192 */ 193 protected void load() 194 { 195 getPreferenceStore(); 196 197 try { 198 curFont = new Font(Display.getCurrent(), ViewProperties.getFontType(), 199 ViewProperties.getFontSize(), SWT.NORMAL); 200 } 201 catch (Exception ex) { 202 curFont = null; 203 } 204 205 fileExtField.setText(ViewProperties.getFileExtension()); 206 207 earlyLibVers = ViewProperties.getEarlyLib(); 208 log.trace("performOk: load HDF options earlyLibVers={}", earlyLibVers); 209 earlyLibVersion.setSelection(earlyLibVers.compareTo("Earliest") == 0); 210 early18LibVersion.setSelection(earlyLibVers.compareTo("v18") == 0); 211 early110LibVersion.setSelection(earlyLibVers.compareTo("v110") == 0); 212 early112LibVersion.setSelection(earlyLibVers.compareTo("v112") == 0); 213 early114LibVersion.setSelection(earlyLibVers.compareTo("v114") == 0); 214 earlyLateLibVersion.setSelection(earlyLibVers.compareTo("Latest") == 0); 215 216 lateLibVers = ViewProperties.getLateLib(); 217 log.trace("performOk: load HDF options lateLibVers={}", lateLibVers); 218 lateLibVersion.setSelection(lateLibVers.compareTo("Earliest") == 0); 219 late18LibVersion.setSelection(lateLibVers.compareTo("v18") == 0); 220 late110LibVersion.setSelection(lateLibVers.compareTo("v110") == 0); 221 late112LibVersion.setSelection(lateLibVers.compareTo("v112") == 0); 222 late114LibVersion.setSelection(lateLibVers.compareTo("v114") == 0); 223 lateLateLibVersion.setSelection(lateLibVers.compareTo("Latest") == 0); 224 225 checkConvertEnum.setSelection(ViewProperties.isConvertEnum()); 226 checkShowRegRefValues.setSelection(ViewProperties.showRegRefValues()); 227 228 indexType = ViewProperties.getIndexType(); 229 checkIndexName.setSelection(indexType.compareTo("H5_INDEX_NAME") == 0); 230 checkIndexCreateOrder.setSelection(indexType.compareTo("H5_INDEX_CRT_ORDER") == 0); 231 232 indexOrder = ViewProperties.getIndexOrder(); 233 checkIncOrder.setSelection(indexOrder.compareTo("H5_ITER_INC") == 0); 234 checkDecOrder.setSelection(indexOrder.compareTo("H5_ITER_DEC") == 0); 235 checkNativeOrder.setSelection(indexOrder.compareTo("H5_ITER_NATIVE") == 0); 236 237 pluginPathList = ViewProperties.loadPluginPaths(); 238 pluginCombo.setItems(pluginPathList); 239 pluginCombo.setVisibleItemCount(pluginPathList.length); 240 pluginCombo.setText(""); 241 pluginCombo.deselectAll(); 242 pluginDirIndex = -1; 243 pluginDir = null; 244 } 245 246 /** 247 * Creates and returns the SWT control for the customized body of this 248 * preference page under the given parent composite. 249 * 250 * @param parent the parent composite 251 * @return the new control 252 */ 253 @Override 254 protected Control createContents(Composite parent) 255 { 256 shell = parent.getShell(); 257 Composite composite = new Composite(parent, SWT.NONE); 258 composite.setLayout(new GridLayout()); 259 260 org.eclipse.swt.widgets.Group fileExtensionGroup = 261 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 262 fileExtensionGroup.setLayout(new GridLayout(2, false)); 263 fileExtensionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 264 fileExtensionGroup.setFont(curFont); 265 fileExtensionGroup.setText("File Extensions"); 266 267 Label label = new Label(fileExtensionGroup, SWT.RIGHT); 268 label.setFont(curFont); 269 label.setText("Extensions: "); 270 271 fileExtField = new Text(fileExtensionGroup, SWT.SINGLE | SWT.BORDER); 272 fileExtField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 273 fileExtField.setFont(curFont); 274 275 org.eclipse.swt.widgets.Group defaultLibVersionGroup = 276 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 277 defaultLibVersionGroup.setLayout(new GridLayout()); 278 defaultLibVersionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 279 defaultLibVersionGroup.setFont(curFont); 280 defaultLibVersionGroup.setText("Default Lib Version"); 281 282 org.eclipse.swt.widgets.Group earlyLibVersionGroup = 283 new org.eclipse.swt.widgets.Group(defaultLibVersionGroup, SWT.NONE); 284 earlyLibVersionGroup.setLayout(new GridLayout(4, true)); 285 earlyLibVersionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 286 earlyLibVersionGroup.setFont(curFont); 287 earlyLibVersionGroup.setText("Default Early Lib Version"); 288 289 earlyLibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 290 earlyLibVersion.setFont(curFont); 291 earlyLibVersion.setText("Earliest"); 292 earlyLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 293 294 early18LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 295 early18LibVersion.setFont(curFont); 296 early18LibVersion.setText("v18"); 297 early18LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 298 299 early110LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 300 early110LibVersion.setFont(curFont); 301 early110LibVersion.setText("v110"); 302 early110LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 303 304 early112LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 305 early112LibVersion.setFont(curFont); 306 early112LibVersion.setText("v112"); 307 early112LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 308 309 early114LibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 310 early114LibVersion.setFont(curFont); 311 early114LibVersion.setText("v114"); 312 early114LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 313 314 earlyLateLibVersion = new Button(earlyLibVersionGroup, SWT.RADIO); 315 earlyLateLibVersion.setFont(curFont); 316 earlyLateLibVersion.setText("Latest"); 317 earlyLateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 318 319 org.eclipse.swt.widgets.Group lateLibVersionGroup = 320 new org.eclipse.swt.widgets.Group(defaultLibVersionGroup, SWT.NONE); 321 lateLibVersionGroup.setLayout(new GridLayout(4, true)); 322 lateLibVersionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 323 lateLibVersionGroup.setFont(curFont); 324 lateLibVersionGroup.setText("Default Late Lib Version"); 325 326 lateLibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 327 lateLibVersion.setFont(curFont); 328 lateLibVersion.setText("Earliest"); 329 lateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 330 331 late18LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 332 late18LibVersion.setFont(curFont); 333 late18LibVersion.setText("v18"); 334 late18LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 335 336 late110LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 337 late110LibVersion.setFont(curFont); 338 late110LibVersion.setText("v110"); 339 late110LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 340 341 late112LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 342 late112LibVersion.setFont(curFont); 343 late112LibVersion.setText("v112"); 344 late112LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 345 346 late114LibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 347 late114LibVersion.setFont(curFont); 348 late114LibVersion.setText("v114"); 349 late114LibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 350 351 lateLateLibVersion = new Button(lateLibVersionGroup, SWT.RADIO); 352 lateLateLibVersion.setFont(curFont); 353 lateLateLibVersion.setText("Latest"); 354 lateLateLibVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 355 356 org.eclipse.swt.widgets.Group dataGroup = new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 357 dataGroup.setLayout(new GridLayout(4, false)); 358 dataGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 359 dataGroup.setFont(curFont); 360 dataGroup.setText("Data"); 361 362 helpButton = new Button(dataGroup, SWT.PUSH); 363 helpButton.setImage(ViewProperties.getHelpIcon()); 364 helpButton.setToolTipText("Help on Convert Enum"); 365 helpButton.addSelectionListener(new SelectionAdapter() { 366 @Override 367 public void widgetSelected(SelectionEvent e) 368 { 369 final String msg = "Convert enum data to strings. \n" 370 + "For example, a dataset of an enum type of (R=0, G=, B=2) \n" 371 + 372 "has values of (0, 2, 2, 2, 1, 1). With conversion, the data values are \n" 373 + "shown as (R, B, B, B, G, G).\n\n\n"; 374 375 Tools.showInformation(getShell(), "Help", msg); 376 } 377 }); 378 379 checkConvertEnum = new Button(dataGroup, SWT.CHECK); 380 checkConvertEnum.setFont(curFont); 381 checkConvertEnum.setText("Convert Enum"); 382 checkConvertEnum.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 383 384 checkShowRegRefValues = new Button(dataGroup, SWT.CHECK); 385 checkShowRegRefValues.setFont(curFont); 386 checkShowRegRefValues.setText("Show RegRef Values"); 387 checkShowRegRefValues.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 388 389 org.eclipse.swt.widgets.Group displayIndexingGroup = 390 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 391 displayIndexingGroup.setLayout(new GridLayout()); 392 displayIndexingGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 393 displayIndexingGroup.setFont(curFont); 394 displayIndexingGroup.setText("Display Indexing Options"); 395 396 org.eclipse.swt.widgets.Group indexingTypeGroup = 397 new org.eclipse.swt.widgets.Group(displayIndexingGroup, SWT.NONE); 398 indexingTypeGroup.setLayout(new GridLayout(2, true)); 399 indexingTypeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 400 indexingTypeGroup.setFont(curFont); 401 indexingTypeGroup.setText("Indexing Type"); 402 403 checkIndexName = new Button(indexingTypeGroup, SWT.RADIO); 404 checkIndexName.setFont(curFont); 405 checkIndexName.setText("By Name"); 406 checkIndexName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 407 408 checkIndexCreateOrder = new Button(indexingTypeGroup, SWT.RADIO); 409 checkIndexCreateOrder.setFont(curFont); 410 checkIndexCreateOrder.setText("By Creation Order"); 411 checkIndexCreateOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 412 413 org.eclipse.swt.widgets.Group indexingOrderGroup = 414 new org.eclipse.swt.widgets.Group(displayIndexingGroup, SWT.NONE); 415 indexingOrderGroup.setLayout(new GridLayout(3, true)); 416 indexingOrderGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 417 indexingOrderGroup.setFont(curFont); 418 indexingOrderGroup.setText("Indexing Order"); 419 420 checkIncOrder = new Button(indexingOrderGroup, SWT.RADIO); 421 checkIncOrder.setFont(curFont); 422 checkIncOrder.setText("Increments"); 423 checkIncOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 424 425 checkDecOrder = new Button(indexingOrderGroup, SWT.RADIO); 426 checkDecOrder.setFont(curFont); 427 checkDecOrder.setText("Decrements"); 428 checkDecOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 429 430 checkNativeOrder = new Button(indexingOrderGroup, SWT.RADIO); 431 checkNativeOrder.setFont(curFont); 432 checkNativeOrder.setText("Native"); 433 checkNativeOrder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 434 435 org.eclipse.swt.widgets.Group pluginDirectoryGroup = 436 new org.eclipse.swt.widgets.Group(composite, SWT.NONE); 437 pluginDirectoryGroup.setLayout(new GridLayout(3, false)); 438 pluginDirectoryGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 439 pluginDirectoryGroup.setFont(curFont); 440 pluginDirectoryGroup.setText("Plugin Paths"); 441 442 pluginPathList = ViewProperties.loadPluginPaths(); 443 pluginCombo = new Combo(pluginDirectoryGroup, SWT.BORDER | SWT.SINGLE); 444 pluginCombo.setFont(curFont); 445 pluginCombo.setItems(pluginPathList); 446 pluginCombo.setVisibleItemCount(pluginPathList.length); 447 pluginCombo.deselectAll(); 448 pluginCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); 449 pluginCombo.addKeyListener(new KeyAdapter() { 450 @Override 451 public void keyPressed(KeyEvent e) 452 { 453 if (e.keyCode == SWT.CR) { 454 String dirname = pluginCombo.getText(); 455 if (dirname == null || dirname.length() < 1 || dirname.equals(pluginDir)) 456 return; 457 pluginCombo.setText(dirname); 458 } 459 } 460 }); 461 pluginCombo.addSelectionListener(new SelectionAdapter() { 462 @Override 463 public void widgetSelected(SelectionEvent e) 464 { 465 pluginDirIndex = pluginCombo.getSelectionIndex(); 466 pluginDir = pluginCombo.getItem(pluginDirIndex); 467 } 468 }); 469 470 pluginDirButton = new Button(pluginDirectoryGroup, SWT.PUSH); 471 pluginDirButton.setFont(curFont); 472 pluginDirButton.setText("Browse..."); 473 pluginDirButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false)); 474 pluginDirButton.addSelectionListener(new SelectionAdapter() { 475 @Override 476 public void widgetSelected(SelectionEvent e) 477 { 478 final DirectoryDialog dChooser = new DirectoryDialog(shell); 479 dChooser.setFilterPath(System.getProperty("user.dir")); 480 dChooser.setText("Select a Directory"); 481 482 String dir = dChooser.open(); 483 484 if (dir == null) 485 return; 486 487 pluginCombo.setText(dir); 488 } 489 }); 490 491 insertTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); 492 insertTextButton.setFont(curFont); 493 insertTextButton.setToolTipText("Append current selection"); 494 insertTextButton.setText("Add Path"); 495 insertTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 496 insertTextButton.addSelectionListener(new SelectionAdapter() { 497 @Override 498 public void widgetSelected(SelectionEvent e) 499 { 500 String dirname = pluginCombo.getText(); 501 if (dirname == null || dirname.length() < 1) { 502 return; 503 } 504 ViewProperties.appendPluginPath(dirname); 505 pluginPathList = ViewProperties.loadPluginPaths(); 506 pluginCombo.setItems(pluginPathList); 507 pluginCombo.setVisibleItemCount(pluginPathList.length); 508 pluginCombo.setText(""); 509 pluginCombo.deselectAll(); 510 pluginDirIndex = -1; 511 pluginDir = null; 512 } 513 }); 514 515 deleteTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); 516 deleteTextButton.setFont(curFont); 517 deleteTextButton.setToolTipText("Remove current selection"); 518 deleteTextButton.setText("Remove Path"); 519 deleteTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 520 deleteTextButton.addSelectionListener(new SelectionAdapter() { 521 @Override 522 public void widgetSelected(SelectionEvent e) 523 { 524 String dirname = pluginCombo.getText(); 525 if (dirname == null || dirname.length() < 1) { 526 return; 527 } 528 String[] items = pluginCombo.getItems(); 529 for (int idx = 0; idx < items.length; idx++) { 530 if (items[idx].equals(dirname)) { 531 pluginDirIndex = idx; 532 } 533 } 534 ViewProperties.deletePluginPath(pluginDirIndex); 535 pluginPathList = ViewProperties.loadPluginPaths(); 536 pluginCombo.setItems(pluginPathList); 537 pluginCombo.setVisibleItemCount(pluginPathList.length); 538 pluginCombo.setText(""); 539 pluginCombo.deselectAll(); 540 pluginDirIndex = -1; 541 pluginDir = null; 542 } 543 }); 544 545 clearTextButton = new Button(pluginDirectoryGroup, SWT.PUSH); 546 clearTextButton.setFont(curFont); 547 clearTextButton.setToolTipText("Clear current selection"); 548 clearTextButton.setText("Clear Path Text"); 549 clearTextButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); 550 clearTextButton.addSelectionListener(new SelectionAdapter() { 551 @Override 552 public void widgetSelected(SelectionEvent e) 553 { 554 pluginCombo.setText(""); 555 pluginCombo.deselectAll(); 556 pluginDirIndex = -1; 557 pluginDir = null; 558 } 559 }); 560 561 // shell.pack(); 562 563 log.info("UserOptionsHDFPage: plugin combobox created"); 564 565 load(); 566 return composite; 567 } 568}