protected void newFolderButtonPressed() { Object createdFolder = createFolder(fSelectedContainer); if (createdFolder != null) { CheckboxTreeViewer treeViewer = fViewer; treeViewer.refresh(fSelectedContainer); treeViewer.reveal(createdFolder); treeViewer.setChecked(createdFolder, true); treeViewer.setSelection(new StructuredSelection(createdFolder)); updateOKStatus(); } }
/* * (non-Javadoc) * * @see * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets * .Composite) */ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); createMessageArea(composite); CheckboxTreeViewer treeViewer = createTreeViewer(composite); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = convertWidthInCharsToPixels(60); data.heightHint = convertHeightInCharsToPixels(18); Tree treeWidget = treeViewer.getTree(); treeWidget.setLayoutData(data); treeWidget.setFont(composite.getFont()); Button button = new Button(composite, SWT.PUSH); button.setText(NewWizardMessages.MultipleFolderSelectionDialog_button); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { newFolderButtonPressed(); } }); button.setFont(composite.getFont()); fNewFolderButton = button; treeViewer.addSelectionChangedListener(this); if (fExisting != null) { Object[] existing = fExisting.toArray(); treeViewer.setGrayedElements(existing); setInitialSelections(existing); } if (fFocusElement != null) { treeViewer.setSelection(new StructuredSelection(fFocusElement), true); } treeViewer.addCheckStateListener( new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { forceExistingChecked(event); } }); applyDialogFont(composite); return composite; }