List of usage examples for org.eclipse.jface.viewers TreeViewer expandAll
public void expandAll()
From source file:org.eclipse.emf.ecp.view.spi.categorization.swt.SWTCategorizationElementRenderer.java
License:Open Source License
/** * Inits the tree viewer./*w ww . ja v a2 s . co m*/ * * @param treeViewer the tree viewer * @param vCategorizationElement the {@link VCategorizationElement} */ protected void initTreeViewer(final TreeViewer treeViewer, VCategorizationElement vCategorizationElement) { treeViewer.setInput(vCategorizationElement); treeViewer.expandAll(); treeViewer.setSelection(new StructuredSelection(vCategorizationElement.getCategorizations().get(0))); }
From source file:org.eclipse.epf.authoring.ui.forms.ConfigurationPage.java
License:Open Source License
private void createViewerLabelAndButtons(FormToolkit toolkit, Composite parent, String text, final TreeViewer viewer) { Label label = toolkit.createLabel(parent, text); GridData gd = new GridData(SWT.FILL, SWT.END, true, false); label.setLayoutData(gd);/*w w w .java 2 s. c om*/ Button expandButton = toolkit.createButton(parent, null, SWT.PUSH); gd = new GridData(SWT.RIGHT, SWT.END, false, false); expandButton.setLayoutData(gd); expandButton.setImage(AuthoringUIPlugin.getDefault().getSharedImage("expandall.gif")); //$NON-NLS-1$ expandButton.setToolTipText(AuthoringUIResources.FilterDialog_ExpandAll); expandButton.getAccessible().addAccessibleListener( new AuthoringAccessibleListener(AuthoringUIResources.FilterDialog_ExpandAll)); expandButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } public void widgetSelected(SelectionEvent e) { viewer.expandAll(); } }); Button collapseButton = toolkit.createButton(parent, null, SWT.PUSH); gd = new GridData(SWT.RIGHT, SWT.END, false, false); collapseButton.setLayoutData(gd); collapseButton.setImage(AuthoringUIPlugin.getDefault().getSharedImage("collapseall.gif")); //$NON-NLS-1$ collapseButton.setToolTipText(AuthoringUIResources.FilterDialog_CollapseAll); collapseButton.getAccessible().addAccessibleListener( new AuthoringAccessibleListener(AuthoringUIResources.FilterDialog_CollapseAll)); collapseButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } public void widgetSelected(SelectionEvent e) { viewer.collapseAll(); } }); }
From source file:org.eclipse.handly.internal.examples.basic.ui.outline2.FooOutlinePopup.java
License:Open Source License
@Override protected void changeOutlineMode() { compactView = !compactView;/*from w w w. j av a2 s. com*/ TreeViewer treeViewer = getTreeViewer(); treeViewer.getControl().setRedraw(false); if (getPatternMatcher() == null) { TreePath[] treePaths = treeViewer.getExpandedTreePaths(); updateFilter(); treeViewer.setExpandedTreePaths(treePaths); } else { updateFilter(); treeViewer.expandAll(); } treeViewer.getControl().setRedraw(true); // reveal selection Object selectedElement = getSelectedElement(); if (selectedElement != null) treeViewer.reveal(selectedElement); else selectFirstMatch(); }
From source file:org.eclipse.handly.ui.quickoutline.FilteringOutlinePopup.java
License:Open Source License
/** * Notifies that the pattern matcher has been updated. * <p>// w w w. j a v a2 s. c o m * Default implementation refreshes the tree viewer, expands all nodes * of the tree, and selects the first matching element. * </p> */ protected void patternMatcherUpdated() { TreeViewer treeViewer = getTreeViewer(); treeViewer.getControl().setRedraw(false); treeViewer.refresh(); treeViewer.expandAll(); treeViewer.getControl().setRedraw(true); selectFirstMatch(); }
From source file:org.eclipse.jubula.client.ui.rcp.wizards.refactor.pages.MatchComponentNamesPage.java
License:Open Source License
/** {@inheritDoc} */ public void createControl(Composite parent) { SashForm sash = new SashForm(parent, SWT.HORIZONTAL); sash.setLayout(new FillLayout(SWT.VERTICAL | SWT.HORIZONTAL)); Composite leftSashContent = new Composite(sash, SWT.NONE); leftSashContent.setLayout(GridLayoutFactory.fillDefaults().create()); new Label(leftSashContent, SWT.NONE).setText(Messages.ReplaceTCRWizard_matchComponentNames_oldInterface); TreeViewer tv = new TreeViewer(leftSashContent); tv.setContentProvider(new MatchCompNamesPageTreeContentProvider()); tv.setLabelProvider(new MatchCompNamesPageTreeLabelProvider()); tv.setInput(m_execTCList);//from w w w .j a v a 2 s. c o m tv.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); tv.expandAll(); Composite rightSashContent = new Composite(sash, SWT.NONE); rightSashContent.setLayout(GridLayoutFactory.fillDefaults().create()); new Label(rightSashContent, SWT.NONE).setText(Messages.ReplaceTCRWizard_matchComponentNames_newInterface); m_cntc = new ComponentNamesTableComposite(rightSashContent, SWT.NONE); m_cntc.setSelectedExecNodeOwner(m_editor); if (m_editor instanceof TestSuiteEditor) { m_cntc.controlPropagation(false); } sash.setWeights(new int[] { 1, 2 }); setControl(sash); }
From source file:org.eclipse.linuxtools.internal.rpm.ui.editor.outline.SpecfileContentOutlinePage.java
License:Open Source License
public void update() { //set the input so that the outlines parse can be called //update the tree viewer state final TreeViewer viewer = getTreeViewer(); if (viewer != null) { final Control control = viewer.getControl(); if (control != null && !control.isDisposed()) { control.getDisplay().asyncExec(() -> { if (!control.isDisposed()) { control.setRedraw(false); if (input != null) { viewer.setInput(input); }/*from www .ja v a2 s. com*/ viewer.expandAll(); control.setRedraw(true); } }); } } }
From source file:org.eclipse.linuxtools.rpm.ui.editor.outline.SpecfileContentOutlinePage.java
License:Open Source License
public void update() { //set the input so that the outlines parse can be called //update the tree viewer state 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); if (input != null) viewer.setInput(input); viewer.expandAll(); control.setRedraw(true); }// w w w . j a v a 2 s. c o m } }); } } }
From source file:org.eclipse.m2e.core.ui.internal.dialogs.MavenGoalSelectionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout);/*from w w w . j a va 2 s. c om*/ composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label selectGoalLabel = new Label(composite, SWT.NONE); selectGoalLabel.setText(org.eclipse.m2e.core.ui.internal.Messages.MavenGoalSelectionDialog_lblSelect); final GoalsFilter filter = new GoalsFilter(); final Text filterText = new Text(composite, SWT.BORDER); GridData gd_filterText = new GridData(SWT.FILL, SWT.CENTER, true, false); gd_filterText.widthHint = 200; filterText.setLayoutData(gd_filterText); filterText.setFocus(); final TreeViewer treeViewer = createTreeViewer(composite); treeViewer.addFilter(filter); GridData data = new GridData(GridData.FILL_BOTH); data.widthHint = 500; data.heightHint = 400; // data.widthHint = convertWidthInCharsToPixels(fWidth); // data.heightHint = convertHeightInCharsToPixels(fHeight); final Tree tree = treeViewer.getTree(); tree.setLayoutData(data); tree.setFont(parent.getFont()); filterText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String text = filterText.getText(); filter.setFilter(text); treeViewer.refresh(); if (text.trim().length() == 0) { treeViewer.collapseAll(); } else { treeViewer.expandAll(); } } }); filterText.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_DOWN) { tree.setFocus(); tree.setSelection(tree.getTopItem().getItem(0)); Object[] elements = ((ITreeContentProvider) treeViewer.getContentProvider()).getElements(null); treeViewer.setSelection(new StructuredSelection(elements[0])); } } }); isQualifiedNameButton = new Button(composite, SWT.CHECK); isQualifiedNameButton .setText(org.eclipse.m2e.core.ui.internal.Messages.MavenGoalSelectionDialog_btnQualified); isQualifiedNameButton.setSelection(true); isQualifiedNameButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { isQualifiedName = isQualifiedNameButton.getSelection(); } }); // if (fIsEmpty) { // messageLabel.setEnabled(false); // treeWidget.setEnabled(false); // } return composite; }
From source file:org.eclipse.mylyn.internal.context.ui.FocusedViewerManager.java
License:Open Source License
private void updateExpansionState(StructuredViewer viewer, Object objectToRefresh) { if (viewer instanceof TreeViewer && filteredViewers.contains(viewer) && hasInterestFilter(viewer, true) && ContextUiPlugin.getDefault().getPreferenceStore() .getBoolean(IContextUiPreferenceContstants.AUTO_MANAGE_EXPANSION)) { TreeViewer treeViewer = (TreeViewer) viewer; // HACK to fix bug 278569: [context] errors with Markers view and active Mylyn task if ("org.eclipse.ui.internal.views.markers.MarkersTreeViewer".equals(treeViewer.getClass() //$NON-NLS-1$ .getCanonicalName())) {/* w w w . j a v a 2 s . com*/ objectToRefresh = null; } if (objectToRefresh == null) { treeViewer.expandAll(); } else { treeViewer.expandToLevel(objectToRefresh, AbstractTreeViewer.ALL_LEVELS); } } }
From source file:org.eclipse.mylyn.internal.pde.ui.PdeUiBridge.java
License:Open Source License
public void refreshOutline(Object element, boolean updateLabels, boolean setSelection) { IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor();//from w w w .ja va 2 s. c o m List<TreeViewer> treeViewers = getContentOutlineViewers(editorPart); for (TreeViewer treeViewer : treeViewers) { if (treeViewer != null) { if (element == null) { treeViewer.getControl().setRedraw(false); treeViewer.refresh(true); treeViewer.getControl().setRedraw(true); treeViewer.expandAll(); } else if (element instanceof PluginObjectNode) { treeViewer.getControl().setRedraw(false); treeViewer.refresh(element, true); treeViewer.getControl().setRedraw(true); treeViewer.expandAll(); } } } }