private void createFileListArea(Composite parent) { Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NONE); composite.setFont(font); GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); fileTree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_BOTH); gd.minimumHeight = 300; gd.minimumWidth = 350; fileTree.setLayoutData(gd); fileTree.setFont(font); fileTree.addListener( SWT.SetData, new Listener() { public void handleEvent(Event event) { TreeItem item = (TreeItem) event.item; FileInfo info = findFileInfo(item); if (info == null) { updateItems(item.getParentItem(), false); } else { fillItem(item, info); } } }); }
/* * (non-Javadoc) * * @see * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets * .Composite) */ @Override 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()); if (hasNewFolderButton) { Button button = new Button(composite, SWT.PUSH); button.setText(TernUIMessages.Button_newFolder); button.addSelectionListener( new SelectionAdapter() { @Override 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; }
/* * (non-Javadoc) * * @see * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets * .Composite) */ @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Label messageLabel = createMessageArea(composite); CheckboxTreeViewer treeViewer = createTreeViewer(composite); Control buttonComposite = createSelectionButtons(composite); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = convertWidthInCharsToPixels(fWidth); data.heightHint = convertHeightInCharsToPixels(fHeight); Tree treeWidget = treeViewer.getTree(); treeWidget.setLayoutData(data); treeWidget.setFont(parent.getFont()); if (fIsEmpty) { messageLabel.setEnabled(false); treeWidget.setEnabled(false); buttonComposite.setEnabled(false); } return composite; }
@Override protected TreeViewer createTreeViewer(Composite parent) { Tree tree = new Tree(parent, SWT.SINGLE); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = tree.getItemHeight() * 12; tree.setLayoutData(gd); final TreeViewer treeViewer = new OutlineTreeViewer(tree); lexicalSortingAction = new LexicalSortingAction(treeViewer); hideNonSharedAction = new HideNonSharedAction(treeViewer); outlineContentProvider = new ContentProvider(); labelProvider = new CeylonOutlineLabelProvider() { Font getFont() { return getTreeViewer().getControl().getFont(); } String getPrefix() { return getFilterText().getText(); } }; treeViewer.setLabelProvider(labelProvider); treeViewer.addFilter(new OutlineNamePatternFilter(getFilterText())); // fSortByDefiningTypeAction= new SortByDefiningTypeAction(treeViewer); // fShowOnlyMainTypeAction= new ShowOnlyMainTypeAction(treeViewer); treeViewer.setContentProvider(outlineContentProvider); outlineSorter = new OutlineSorter(); treeViewer.setSorter(outlineSorter); treeViewer.setAutoExpandLevel(getDefaultLevel()); tree.addKeyListener(new ChangeViewListener()); tree.setFont(CeylonPlugin.getOutlineFont()); return treeViewer; }