List of usage examples for org.eclipse.jface.viewers TreeViewer expandAll
public void expandAll()
From source file:org.eclipse.babel.editor.tree.KeyTreeContributor.java
License:Open Source License
/** * /*from w ww. ja va 2 s .c om*/ */ public void contribute(final TreeViewer treeViewer) { treeViewer.setContentProvider(new KeyTreeContentProvider()); treeViewer.setLabelProvider(new KeyTreeLabelProvider(editor, treeModel)); treeViewer.setUseHashlookup(true); ViewerFilter onlyUnusedAndMissingKeysFilter = new OnlyUnsuedAndMissingKey(); ViewerFilter[] filters = { onlyUnusedAndMissingKeysFilter }; treeViewer.setFilters(filters); // IKeyBindingService service = editor.getSite().getKeyBindingService(); // service.setScopes(new String[]{"org.eclilpse.babel.editor.editor.tree"}); contributeActions(treeViewer); contributeKeySync(treeViewer); contributeModelChanges(treeViewer); contributeDoubleClick(treeViewer); contributeMarkers(treeViewer); // Set input model treeViewer.setInput(treeModel); treeViewer.expandAll(); }
From source file:org.eclipse.birt.data.oda.pojo.ui.impl.dialogs.ColumnMappingDialog.java
License:Open Source License
private void createTreeViewer(Composite paramArea) { Composite left = new Composite(paramArea, SWT.NONE); left.setLayout(new GridLayout(1, false)); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 150;//from w w w . j a va 2 s .c om left.setLayoutData(data); Label label = new Label(left, SWT.NONE); label.setText(Messages.getString("ColumnMappingDialog.Label.methodHierarchy")); //$NON-NLS-1$ final TreeViewer treeViewer = new TreeViewer(left, SWT.BORDER | SWT.SINGLE); treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); TreeProvider treeProvider = new TreeProvider(); treeViewer.setLabelProvider(treeProvider); treeViewer.setContentProvider(treeProvider); if (this.input != null) treeViewer.setInput(this.input.getMappingPath()); treeViewer.expandAll(); TreeItem[] items = treeViewer.getTree().getItems(); TreeItem item = null; while (items.length > 0) { item = items[0]; items = item.getItems(); } if (item != null) treeViewer.getTree().select(item); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { editBtn.setEnabled(false); if (treeViewer.getTree().getSelectionCount() == 1) { Object item = treeViewer.getTree().getSelection()[0].getData(); if (item instanceof MethodSource) { checkBoxViewer.setInput((MethodSource) item); // updateCheckBoxStatus( ); checkBoxViewer.refresh(); } } } }); }
From source file:org.eclipse.birt.report.designer.data.ui.dataset.PromptParameterDialog.java
License:Open Source License
private void createParameterGroup(Composite composite) { final Group group2 = new Group(composite, SWT.NONE); group2.setLayout(new GridLayout()); group2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 8));// GridData.FILL_BOTH)); group2.setText(Messages.getString("PromptParameterDialog.parameterGroup.title")); Label label1 = new Label(group2, SWT.NONE); label1.setText(Messages.getString("PromptParameterDialog.parameterGroup.label")); TreeViewer viewer2 = new TreeViewer(group2, SWT.FULL_SELECTION); Tree tableTree2 = viewer2.getTree(); GridData gd = new GridData(GridData.FILL_BOTH); tableTree2.setLayoutData(gd);// ww w.j av a2 s .c o m tableTree2.setHeaderVisible(true); tableTree2.setLinesVisible(true); TreeViewerColumn tvc21 = new TreeViewerColumn(viewer2, SWT.NONE); tvc21.getColumn().setText(Messages.getString("PromptParameterDialog.parameterGroup.nameColumn")); //$NON-NLS-1$ tvc21.getColumn().setWidth(200); tvc21.setLabelProvider(new NameLabelProvider(selectedStatusMap)); tvc21.setEditingSupport(new ParameterEditingSupport(viewer2, selectedStatusMap)); TreeViewerColumn tvc22 = new TreeViewerColumn(viewer2, SWT.NONE); tvc22.getColumn().setText(Messages.getString("PromptParameterDialog.parameterGroup.previousValue")); //$NON-NLS-1$ tvc22.getColumn().setWidth(200); tvc22.setLabelProvider(new PreviousValueLabelProvider()); TreeViewerColumn tvc23 = new TreeViewerColumn(viewer2, SWT.NONE); tvc23.getColumn().setText(Messages.getString("PromptParameterDialog.parameterGroup.revisedValue")); //$NON-NLS-1$ tvc23.getColumn().setWidth(200); tvc23.setLabelProvider(new RevisedValueLabelProvider()); viewer2.setContentProvider(new ParameterContentProvider()); viewer2.setInput(((IAmbiguousOption) input).getAmbiguousParameters()); viewer2.expandAll(); }
From source file:org.eclipse.bpel.ui.wizards.NewBpelFilePortTypePage.java
License:Open Source License
@Override public void createControl(Composite parent) { // Create the container final Composite container = new Composite(parent, SWT.NONE); container.setFont(parent.getFont()); initializeDialogUnits(parent);//w ww.j ava 2 s . c om container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); setControl(container); // WSDL location (as an URL) Label l = new Label(container, SWT.NONE); l.setText("WSDL URL:"); l.setToolTipText("The URL of the service description (WSDL)"); l.setLayoutData(new GridData(SWT.TOP, SWT.DEFAULT, false, false)); final Text wsdlUrlText = new Text(container, SWT.SINGLE | SWT.BORDER); wsdlUrlText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); wsdlUrlText.setToolTipText("Press the 'Tab' key to parse this WSDL"); if (this.wsdlUrl != null) wsdlUrlText.setText(this.wsdlUrl); wsdlUrlText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { NewBpelFilePortTypePage.this.wsdlUrl = ((Text) e.widget).getText(); updateStatus(); } }); final ControlDecoration wsdlTextDecoration = new ControlDecoration(wsdlUrlText, SWT.LEFT | SWT.BOTTOM); wsdlTextDecoration .setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK)); wsdlTextDecoration.setDescriptionText(wsdlUrlText.getToolTipText()); wsdlTextDecoration.hide(); // Helpers to browse for WSDL files new Label(container, SWT.NONE); // Bad but so convenient! Composite subContainer = new Composite(container, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.marginBottom = 13; subContainer.setLayout(layout); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(subContainer, SWT.NONE).setImage(this.fileSystemImg); Link browseFileSystemLink = new Link(subContainer, SWT.NONE); browseFileSystemLink.setText("<A>Browse the file system...</A>"); new Label(subContainer, SWT.NONE).setImage(this.workspaceImg); Link browseWorkspaceLink = new Link(subContainer, SWT.NONE); browseWorkspaceLink.setText("<A>Browse the workspace...</A>"); new Label(subContainer, SWT.NONE).setImage(this.parseImg); Link parseWsdlLink = new Link(subContainer, SWT.NONE); parseWsdlLink.setText("<A>Parse the given WSDL</A>"); // Port type to use for the generation l = new Label(container, SWT.NONE); l.setText("Service Contract:"); l.setToolTipText("The port type (service contract) to implement with BPEL"); final ComboViewer portTypeCombo = new ComboViewer(container, SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY); portTypeCombo.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); portTypeCombo.setContentProvider(new ArrayContentProvider()); portTypeCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { QName name = ((PortType) element).getQName(); return name.getLocalPart() + " - " + name.getNamespaceURI(); } }); // The button to import the WSDL new Label(container, SWT.NONE); Button importButton = new Button(container, SWT.CHECK); importButton.setText("Import the WSDL file with its dependencies"); importButton.setSelection(this.importWsdl); importButton.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } @Override public void widgetDefaultSelected(SelectionEvent e) { NewBpelFilePortTypePage.this.importWsdl = ((Button) e.widget).getSelection(); } }); // The viewer for a quick overview of the operations subContainer = new Composite(container, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; layout.marginTop = 11; subContainer.setLayout(layout); GridData layoutData = new GridData(GridData.FILL_BOTH); layoutData.horizontalSpan = 2; subContainer.setLayoutData(layoutData); l = new Label(subContainer, SWT.NONE); l.setText("Select a service contract (port type) and see its operations below."); final TreeViewer operationsViewer = new TreeViewer(subContainer, SWT.BORDER); operationsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); operationsViewer.setLabelProvider(new LabelProvider() { @Override public Image getImage(Object element) { Image result = null; if (element instanceof Operation) result = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_OPERATION_16); else if (element instanceof Input) result = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_INPUT_16); else if (element instanceof Output) result = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_OUTPUT_16); else if (element instanceof Fault) result = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_FAULT_16); return result; } @Override public String getText(Object element) { String result = ""; if (element instanceof Operation) { result = ((Operation) element).getName(); result = result == null || result.trim().length() == 0 ? "?" : result; } else if (element instanceof Input) { result = ((Input) element).getName(); result = result == null || result.trim().length() == 0 ? "Input" : result; } else if (element instanceof Output) { result = ((Output) element).getName(); result = result == null || result.trim().length() == 0 ? "Output" : result; } else if (element instanceof Fault) { result = ((Fault) element).getName(); result = result == null || result.trim().length() == 0 ? "Fault" : result; } return result; } }); operationsViewer.setContentProvider(new ITreeContentProvider() { @Override public void dispose() { // nothing } @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // nothing } @Override public Object[] getElements(Object inputElement) { return ((PortType) inputElement).getOperations().toArray(); } @SuppressWarnings("unchecked") @Override public Object[] getChildren(Object pa) { List<Object> result = new ArrayList<Object>(); if (pa instanceof Operation) { Operation op = (Operation) pa; if (op.getInput() != null) result.add(op.getInput()); if (op.getOutput() != null) result.add(op.getOutput()); if (op.getFaults() != null) result.addAll(op.getFaults().values()); } return result.toArray(); } @Override public Object getParent(Object element) { return null; } @Override public boolean hasChildren(Object element) { return element instanceof Operation; } }); // Listeners portTypeCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { NewBpelFilePortTypePage.this.portType = (PortType) ((IStructuredSelection) portTypeCombo .getSelection()).getFirstElement(); operationsViewer.setInput(NewBpelFilePortTypePage.this.portType); operationsViewer.refresh(); if (NewBpelFilePortTypePage.this.portType != null) { if (NewBpelFilePortTypePage.this.portType.getOperations().size() < 4) operationsViewer.expandAll(); else operationsViewer.expandToLevel(2); } updateStatus(); } }); // WSDL parsing final List<PortType> portTypes = new ArrayList<PortType>(); final IRunnableWithProgress wsdlParsingOperation = new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Parsing the WSDL...", 5); try { portTypes.clear(); monitor.worked(1); URI emfUri = URI.createURI(NewBpelFilePortTypePage.this.wsdlUrl); Collection<Definition> definitions = WsdlParser.loadAllWsdlDefinitions(emfUri, WsdlParser.createBasicResourceSetForWsdl()); for (Definition def : definitions) { for (Object o : def.getPortTypes().values()) portTypes.add((PortType) o); } monitor.worked(3); } finally { monitor.done(); } } }; wsdlUrlText.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (NewBpelFilePortTypePage.this.wsdlUrl == null) return; try { // Parse getContainer().run(true, false, wsdlParsingOperation); // Update the UI portTypeCombo.setInput(portTypes); portTypeCombo.refresh(); if (portTypes.size() > 0) portTypeCombo.getCombo().select(0); portTypeCombo.getCombo().notifyListeners(SWT.Selection, new Event()); } catch (InvocationTargetException e1) { BPELUIPlugin.log(e1); } catch (InterruptedException e1) { BPELUIPlugin.log(e1); } } }); wsdlUrlText.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { wsdlTextDecoration.hide(); } @Override public void focusGained(FocusEvent e) { wsdlTextDecoration.show(); } }); // "Browse" call-backs browseFileSystemLink.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } @Override public void widgetDefaultSelected(SelectionEvent e) { FileDialog dlg = new FileDialog(getShell()); dlg.setFilterExtensions(new String[] { "*.wsdl" }); dlg.setFilterNames(new String[] { "WSDL (*.wsdl)" }); dlg.setText("Select a service description (WSDL)."); String path = dlg.open(); if (path != null) { File f = new File(path); wsdlUrlText.setText(f.toURI().toString()); wsdlUrlText.notifyListeners(SWT.Traverse, new Event()); } } }); parseWsdlLink.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { wsdlUrlText.notifyListeners(SWT.Traverse, new Event()); } @Override public void widgetDefaultSelected(SelectionEvent e) { wsdlUrlText.notifyListeners(SWT.Traverse, new Event()); } }); browseWorkspaceLink.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } @Override public void widgetDefaultSelected(SelectionEvent e) { // Prepare the initial selection IFile currentWsdl = null; if (NewBpelFilePortTypePage.this.wsdlUrl != null) { try { java.net.URI uri = UriAndUrlHelper.urlToUri(NewBpelFilePortTypePage.this.wsdlUrl); File f = new File(uri); IPath path = new Path(f.getAbsolutePath()); currentWsdl = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); } catch (Exception e1) { BPELUIPlugin.log(e1, IStatus.WARNING); } } // Open a dialog that only shows the WSDL files in the workspace - and their ancestors/containers final List<IFile> workspaceWsdlFiles = getFiles("wsdl", Arrays.asList(ResourcesPlugin.getWorkspace().getRoot())); ElementTreeSelectionDialog dlg = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider() { @Override public Object[] getChildren(Object element) { Object[] result = super.getChildren(element); if (result == null) result = new Object[0]; List<Object> filteredResult = new ArrayList<Object>(); for (Object o : result) { if (o instanceof IFile && workspaceWsdlFiles.contains(o)) filteredResult.add(o); else if (o instanceof IContainer) { IPath containerPath = ((IContainer) o).getFullPath(); for (IFile wsdlFile : workspaceWsdlFiles) { if (containerPath.isPrefixOf(wsdlFile.getFullPath())) { filteredResult.add(o); break; } } } } return filteredResult.toArray(); } }); dlg.setInput(ResourcesPlugin.getWorkspace().getRoot()); dlg.setTitle("WSDL Selection"); dlg.setMessage("Select a WSDL file located in the workspace."); if (currentWsdl != null) dlg.setInitialElementSelections(Arrays.asList(currentWsdl)); // Open it and update the text widget if necessary if (dlg.open() == Window.OK) { IFile selectedFile = (IFile) dlg.getResult()[0]; wsdlUrlText.setText(selectedFile.getLocation().toFile().toURI().toString()); wsdlUrlText.notifyListeners(SWT.Traverse, new Event()); } } }); // Initialize the port type... if (this.portType != null) portTypeCombo.setSelection(new StructuredSelection(this.portType)); else if (portTypeCombo.getCombo().getItemCount() > 0) { portTypeCombo.getCombo().select(0); portTypeCombo.getCombo().notifyListeners(SWT.Selection, new Event()); } // ... and the page's state updateStatus(); if (getErrorMessage() != null) { setPageComplete(false); setErrorMessage(null); } }
From source file:org.eclipse.cdt.internal.autotools.ui.editors.automake.AutomakefileContentOutlinePage.java
License:Open Source License
/** * Updates the outline page.//from w ww. ja v a 2 s . c o m */ public void update() { final TreeViewer viewer = getTreeViewer(); if (viewer != null) { final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { public void run() { if (!control.isDisposed()) { control.setRedraw(false); viewer.setInput(fInput); viewer.expandAll(); control.setRedraw(true); } } }); } } }
From source file:org.eclipse.cdt.make.internal.ui.editor.MakefileContentOutlinePage.java
License:Open Source License
/** * Updates the outline page./*from www .ja v a 2 s . com*/ */ public void update() { final TreeViewer viewer = getTreeViewer(); if (viewer != null) { final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (!control.isDisposed()) { control.setRedraw(false); viewer.setInput(fInput); viewer.expandAll(); control.setRedraw(true); } } }); } } }
From source file:org.eclipse.datatools.connectivity.ui.dse.dialogs.ProfileSelectionComposite.java
License:Open Source License
/** * Initialize the selection//from w ww . ja v a 2 s . c o m */ protected void initListboxContent() { final TreeViewer viewer = (TreeViewer) getPage().getNavigatorViewer(); Display.getCurrent().syncExec(new Runnable() { public void run() { viewer.refresh(); if (getPage().getLimitToProfiles()) viewer.expandAll(); } }); Display.getCurrent().readAndDispatch(); if (this._profile != null) { Display.getCurrent().syncExec(new Runnable() { public void run() { IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(_profile); getPage().select(profile); } }); } }
From source file:org.eclipse.e4.demo.simpleide.jdt.internal.editor.JDTOutlinePage.java
License:Open Source License
@Inject public JDTOutlinePage(Composite parent, @Named(IServiceConstants.ACTIVE_PART) MPart part, IWorkspace workspace, Logger logger, INLSLookupFactoryService nlsFactory) { // if (PACKAGE_DECL == null) { // initImages(parent); // }//from w ww . ja v a2 s . c om parent.setLayout(new FillLayout()); JavaEditor editor = (JavaEditor) part.getObject(); // FIXME We need to cache this! JavaUIMessages messages = nlsFactory.createNLSLookup(JavaUIMessages.class); final AppearanceAwareLabelProvider lprovider = new AppearanceAwareLabelProvider( AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.F_APP_TYPE_SIGNATURE | JavaElementLabels.ALL_CATEGORY, AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS, logger, messages); TreeViewer viewer = new TreeViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL); viewer.setContentProvider(new ContentProvider()); viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(lprovider)); viewer.setInput(editor.getCompilationUnit()); viewer.expandAll(); }
From source file:org.eclipse.elk.core.ui.AlgorithmSelectionDialog.java
License:Open Source License
/** * Create the dialog area that displays the selection tree and filter text. * /* w ww. ja v a 2s . c om*/ * @param parent the parent composite * @return the control for the selection area */ private Control createSelectionTree(final Composite parent) { Composite composite = new Composite(parent, SWT.NONE); // create filter text final Text filterText = new Text(composite, SWT.BORDER); filterText.setText(Messages.getString("kiml.ui.59")); filterText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); filterText.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_GRAY)); // create tree viewer final TreeViewer treeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER); final AlgorithmContentProvider contentProvider = new AlgorithmContentProvider(); treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { if (element instanceof LayoutAlgorithmData) { LayoutAlgorithmData algoData = (LayoutAlgorithmData) element; String bundleName = algoData.getBundleName(); if (bundleName == null) { return algoData.getName(); } else { return algoData.getName() + " (" + bundleName + ")"; } } else if (element instanceof LayoutCategoryData) { LayoutCategoryData typeData = (LayoutCategoryData) element; if (typeData.getName() == null) { return "Other"; } else { return typeData.getName(); } } return super.getText(element); } }); treeViewer.setSorter(new ViewerSorter() { public int category(final Object element) { if (element instanceof LayoutCategoryData) { LayoutCategoryData typeData = (LayoutCategoryData) element; // the "Other" layout type has empty identifier and is put to the bottom return typeData.getId().length() == 0 ? 1 : 0; } return super.category(element); } }); treeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); treeViewer.setInput(LayoutMetaDataService.getInstance()); treeViewer.expandAll(); treeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(final DoubleClickEvent event) { okPressed(); } }); // set up a filter on the tree viewer using the filter text final Maybe<Boolean> filterChanged = new Maybe<Boolean>(Boolean.FALSE); final Maybe<Boolean> filterLeft = new Maybe<Boolean>(Boolean.FALSE); filterText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { if (!filterChanged.get()) { filterChanged.set(Boolean.TRUE); filterText.setForeground(null); int pos = filterText.getCaretPosition(); String newText = filterText.getText(pos - 1, pos - 1); filterText.setText(newText); filterText.setSelection(pos); } else { contentProvider.updateFilter(filterText.getText()); treeViewer.refresh(); treeViewer.expandAll(); ILayoutMetaData selected = contentProvider.getBestFilterMatch(); if (selected != null) { treeViewer.setSelection(new StructuredSelection(selected)); } } } }); filterText.addFocusListener(new FocusListener() { public void focusGained(final FocusEvent e) { if (filterLeft.get() && !filterChanged.get()) { filterChanged.set(Boolean.TRUE); filterText.setForeground(null); filterText.setText(""); } } public void focusLost(final FocusEvent e) { filterLeft.set(Boolean.TRUE); } }); treeViewer.addFilter(new ViewerFilter() { public boolean select(final Viewer viewer, final Object parentElement, final Object element) { return contentProvider.applyFilter(element); } }); // add a selection listener to the tree so that the selected element is displayed treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); Object element = selection.getFirstElement(); if (element instanceof ILayoutMetaData) { updateValue((ILayoutMetaData) element); } } }); composite.setLayout(new GridLayout()); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.minimumWidth = SELECTION_WIDTH; composite.setLayoutData(gridData); // register all selection listeners that have been stored in a list selectionProvider = treeViewer; for (ISelectionChangedListener listener : selectionListeners) { selectionProvider.addSelectionChangedListener(listener); } return composite; }
From source file:org.eclipse.emf.ecp.view.spi.categorization.swt.AbstractJFaceTreeRenderer.java
License:Open Source License
/** * Inits the tree viewer./*from ww w.j a va 2s. c o m*/ * * @param treeViewer the tree viewer */ protected void initTreeViewer(final TreeViewer treeViewer) { treeViewer.setInput(getVElement()); treeViewer.expandAll(); if (getCategorizations().size() != 0) { treeViewer.setSelection(new StructuredSelection(getCategorizations().get(0))); } }