Java Code Examples for org.eclipse.jface.viewers.TreeViewer#expandAll()
The following examples show how to use
org.eclipse.jface.viewers.TreeViewer#expandAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphEditorNodeViewProvider.java From depan with Apache License 2.0 | 5 votes |
@Override public void updateExpandState(TreeViewer viewer) { TreePath[] expandState = graphData.getExpandState(); if (expandState.length > 0) { viewer.setExpandedTreePaths(expandState); return; } if (graphData.countTreeNodes() < NodeViewerProvider.AUTO_EXPAND_LIMIT) { viewer.expandAll(); } else { viewer.expandToLevel(1); } graphData.saveExpandState(viewer.getExpandedTreePaths()); }
Example 2
Source File: ViewEditorNodeViewerProvider.java From depan with Apache License 2.0 | 5 votes |
@Override public void updateExpandState(TreeViewer viewer) { int nodeCnt = editor.getViewGraph().getNodes().size(); if (nodeCnt < NodeViewerProvider.AUTO_EXPAND_LIMIT) { viewer.expandAll(); } else { viewer.expandToLevel(1); } }
Example 3
Source File: SVNDecoratorPreferencesPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Preview(Composite composite) { SWTUtils.createLabel(composite, Policy.bind("SVNDecoratorPreferencesPage.preview")); //$NON-NLS-1$ fImageCache= new LocalResourceManager(JFaceResources.getResources()); fViewer = new TreeViewer(composite); GridData data = SWTUtils.createHVFillGridData(); data.heightHint = 225; fViewer.getControl().setLayoutData(data); fViewer.setContentProvider(this); fViewer.setLabelProvider(this); fViewer.setInput(ROOT); fViewer.expandAll(); }
Example 4
Source File: HierarchyInformationControl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected void toggleHierarchy() { TreeViewer treeViewer= getTreeViewer(); treeViewer.getTree().setRedraw(false); Object[] expandedElements= treeViewer.getExpandedElements(); TypeHierarchyContentProvider contentProvider= (TypeHierarchyContentProvider) treeViewer.getContentProvider(); treeViewer.setContentProvider(fOtherContentProvider); treeViewer.refresh(); if (fOtherExpandedElements != null) { treeViewer.setExpandedElements(fOtherExpandedElements); } else { treeViewer.expandAll(); } // reveal selection Object selectedElement= getSelectedElement(); if (selectedElement != null) getTreeViewer().reveal(selectedElement); else selectFirstMatch(); treeViewer.getTree().setRedraw(true); fOtherContentProvider= contentProvider; fOtherExpandedElements= expandedElements; updateStatusFieldText(); }
Example 5
Source File: HsPreferenceDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createTreeAreaContents(Composite parent) { // 创建左侧树 Control result = super.createTreeAreaContents(parent); TreeViewer treeViewer = getTreeViewer(); // 设置排序器 IContributionService cs = (IContributionService) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getService(IContributionService.class); treeViewer.setComparator(cs.getComparatorFor(IContributionService.TYPE_PREFERENCE)); treeViewer.expandAll(); // 展开所有 return result; }
Example 6
Source File: HsPreferenceDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override protected Control createTreeAreaContents(Composite parent) { // 创建左侧树 Control result = super.createTreeAreaContents(parent); TreeViewer treeViewer = getTreeViewer(); // 设置排序器 IContributionService cs = (IContributionService) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getService(IContributionService.class); treeViewer.setComparator(cs.getComparatorFor(IContributionService.TYPE_PREFERENCE)); treeViewer.expandAll(); // 展开所有 return result; }
Example 7
Source File: TreeSelectionDialog.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { Control composite = super.createDialogArea(parent); if (composite instanceof Composite) { updateCompositeLayout((Composite) composite); } TreeViewer treeViewer = getTreeViewer(); treeViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { return matchItemToShowInTree(element); } }); treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); treeViewer.expandAll(); if (this.initialFilter.length() > 0) { this.text.setText(this.initialFilter); this.text.setSelection(this.initialFilter.length()); this.setFilter(this.initialFilter, new NullProgressMonitor(), true); } notifyViewCreated(); onControlCreated.call(this.text); onControlCreated.call(this.getTreeViewer()); return composite; }
Example 8
Source File: TreeSelectionDialog.java From Pydev with Eclipse Public License 1.0 | 5 votes |
protected void setFilter(String text, IProgressMonitor monitor, boolean updateFilterMatcher) { synchronized (lock) { if (monitor.isCanceled()) { return; } if (updateFilterMatcher) { //just so that subclasses may already treat it. if (fFilterMatcher.lastPattern.equals(text)) { //no actual change... return; } fFilterMatcher.setFilter(text); if (monitor.isCanceled()) { return; } } TreeViewer treeViewer = getTreeViewer(); Tree tree = treeViewer.getTree(); tree.setRedraw(false); tree.getParent().setRedraw(false); try { if (monitor.isCanceled()) { return; } treeViewer.refresh(); if (monitor.isCanceled()) { return; } treeViewer.expandAll(); } finally { tree.setRedraw(true); tree.getParent().setRedraw(true); } } }
Example 9
Source File: MoveConnectorWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createProcessTreeControl(final EMFDataBindingContext dbc, final Composite parent) { final Label label = new Label(parent, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create()); label.setText(Messages.chooseTargetStepOrProcess); final TreeViewer processTreeViewer = new FilteredTree(parent, SWT.BORDER | SWT.SINGLE, new PatternFilter(), true).getViewer(); processTreeViewer.getControl().getParent().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 300).create()); processTreeViewer.setLabelProvider(new ElementLabelProvider(adapterFactory)); processTreeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); processTreeViewer.addFilter(new ConnectableElementViewerFilter(sourceProcess)); processTreeViewer.setInput(ModelHelper.getMainProcess(sourceProcess)); processTreeViewer.expandAll(); dbc.bindValue(ViewersObservables.observeSingleSelection(processTreeViewer), targetLocationObservable, updateValueStrategy().withValidator(selectionValidator()).create(), null); }
Example 10
Source File: ViewPropertiesOutput.java From arx with Apache License 2.0 | 5 votes |
/** * Creates the view. * * @param root */ private void create(final Composite root) { root.setLayout(new FillLayout()); final Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); tree.setHeaderVisible(true); treeViewer = new TreeViewer(tree); tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu()); final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); tree.setLinesVisible(true); column1.setAlignment(SWT.LEFT); column1.setText(Resources.getMessage("PropertiesView.1")); //$NON-NLS-1$ column1.setWidth(160); final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT); column2.setAlignment(SWT.LEFT); column2.setText(Resources.getMessage("PropertiesView.2")); //$NON-NLS-1$ column2.setWidth(100); treeViewer.setContentProvider(new OutputContentProvider()); treeViewer.setLabelProvider(new OutputLabelProvider()); treeViewer.setInput(roots); treeViewer.expandAll(); }
Example 11
Source File: ClaferConstraintDialog.java From CogniCrypt with Eclipse Public License 2.0 | 4 votes |
/** * Create contents of the dialog. * * @param parent */ @Override protected Control createDialogArea(final Composite parent) { final Composite container = (Composite) super.createDialogArea(parent); final GridLayout gl_container = new GridLayout(1, false); container.setLayout(gl_container); getShell().setMinimumSize(600, 400); final TreeViewer treeViewer = new TreeViewer(container); // TODO be more readable about these predicates treeViewer.setContentProvider(new ClaferModelContentProvider(feat -> !feat.getFeatureName().isEmpty(), prop -> !prop.getPropertyName().isEmpty())); treeViewer.setLabelProvider(new ClaferModelLabelProvider()); // create a temporary clafer model that contains the current model as well as the feature currently being created final ClaferModel tempModel = this.claferModel.clone(); tempModel.add(this.currentFeature); treeViewer.setInput(tempModel); treeViewer.expandAll(); treeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); treeViewer.getControl().addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(final MouseEvent e) { if (treeViewer.getSelection() instanceof TreeSelection) { final TreeSelection ts = (TreeSelection) treeViewer.getSelection(); // add feature name to text field if feature name clicked if (ts.getFirstElement() instanceof ClaferFeature) { final ClaferFeature featureClicked = (ClaferFeature) ts.getFirstElement(); appendConstraint(featureClicked.getFeatureName()); } // add to text field if property name clicked else if (ts.getFirstElement() instanceof ClaferProperty) { final ClaferProperty propertyClicked = (ClaferProperty) ts.getFirstElement(); ((ClaferModel) treeViewer.getInput()).getParentFeatureOfProperty(propertyClicked); final StringBuilder addition = new StringBuilder(); addition.append(propertyClicked.getPropertyName()); appendConstraint(addition.toString()); } } super.mouseDoubleClick(e); } }); final Group group = new Group(container, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); final RowLayout rl_group = new RowLayout(SWT.HORIZONTAL); group.setLayout(rl_group); final ArrayList<Entry<String, String>> buttonContents = new ArrayList<>(); buttonContents.add(new SimpleEntry<String, String>("NOT", "!=")); buttonContents.add(new SimpleEntry<String, String>("EQUALS", "=")); buttonContents.add(new SimpleEntry<String, String>("AND", "AND")); buttonContents.add(new SimpleEntry<String, String>("OR", "OR")); buttonContents.add(new SimpleEntry<String, String>("IMPLIES", "=>")); buttonContents.add(new SimpleEntry<String, String>("(", "(")); buttonContents.add(new SimpleEntry<String, String>(")", ")")); buttonContents.add(new SimpleEntry<String, String>(">", ">")); buttonContents.add(new SimpleEntry<String, String>("<", "<")); for (final Entry<String, String> btn : buttonContents) { final Button newButton = new Button(group, SWT.PUSH); newButton.setText(btn.getKey()); newButton.addListener(SWT.Selection, arg0 -> appendConstraint(btn.getValue())); } this.text = new Text(container, SWT.BORDER | SWT.WRAP | SWT.SINGLE); this.text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); if (this.modifiedConstraint != null) { this.text.setText(this.modifiedConstraint.getConstraint()); } return container; }
Example 12
Source File: NodeListViewProvider.java From depan with Apache License 2.0 | 4 votes |
@Override public void updateExpandState(TreeViewer viewer) { if (nodes.size() < NodeViewerProvider.AUTO_EXPAND_LIMIT) { viewer.expandAll(); } }
Example 13
Source File: PromptParameterDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
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 ); 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( ); }
Example 14
Source File: PyCodeCoverageTestWorkbench.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public void testPyCodeCoverageView() throws Exception { final PyCodeCoverageView view = PyCodeCoverageView.getView(true); //At this point it should have no folder selected and the option to run things in coverage should be //set to false. assertTrue(!PyCoveragePreferences.getAllRunsDoCoverage()); assertTrue(PyCodeCoverageView.getChosenDir() == null); assertTrue(!view.allRunsGoThroughCoverage.getSelection()); assertTrue(!PyCoveragePreferences.getInternalAllRunsDoCoverage()); view.allRunsGoThroughCoverage.setSelection(true); view.allRunsGoThroughCoverage.notifyListeners(SWT.Selection, new Event()); assertTrue(PyCoveragePreferences.getInternalAllRunsDoCoverage()); assertTrue(!PyCoveragePreferences.getAllRunsDoCoverage()); view.setSelectedContainer(sourceFolder); TreeViewer treeViewer = view.getTreeViewer(); ITreeContentProvider cp = (ITreeContentProvider) treeViewer.getContentProvider(); Object[] elements = cp.getElements(treeViewer.getInput()); assertEquals(1, elements.length); ILabelProvider labelProvider = (ILabelProvider) treeViewer.getLabelProvider(); assertEquals("pack_cov", labelProvider.getText(elements[0])); TestCaseUtils.assertContentsEqual(getInitialCoverageText(), view.getCoverageText()); Object[] expandedElements = treeViewer.getExpandedElements(); assertEquals(0, expandedElements.length); treeViewer.expandAll(); expandedElements = treeViewer.getExpandedElements(); assertEquals(1, expandedElements.length); view.executeRefreshAction(new NullProgressMonitor()); expandedElements = treeViewer.getExpandedElements(); assertEquals(1, expandedElements.length); assertTrue(PyCoveragePreferences.getAllRunsDoCoverage()); final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench(); Display display = workBench.getDisplay(); // Make sure to run the UI thread. final PyEdit modCovEditor = (PyEdit) PyOpenEditor.doOpenEditor(modCov); try { display.syncExec(new Runnable() { @Override public void run() { LaunchShortcut launchShortcut = new LaunchShortcut(); launchShortcut.launch(modCovEditor, "run"); } }); final String modCovCoverageText = StringUtils.replaceNewLines(getModCovCoverageText(), "\n"); //Should be enough time for the refresh to happen! goToManual(10000, new ICallback<Boolean, Object>() { @Override public Boolean call(Object arg) { return modCovCoverageText.equals(StringUtils.replaceNewLines(view.getCoverageText(), "\n")); } }); TestCaseUtils.assertContentsEqual(modCovCoverageText, view.getCoverageText()); //goToManual(); } finally { try { modCovEditor.close(false); } catch (Exception e) { //ignore anything here } } }
Example 15
Source File: ViewPropertiesInput.java From arx with Apache License 2.0 | 4 votes |
/** * Creates the view. * * @param root */ private void create(final Composite root) { root.setLayout(new FillLayout()); Tree tree = new Tree(root, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); tree.setHeaderVisible(true); treeViewer = new TreeViewer(tree); tree.setMenu(new ClipboardHandlerTree(treeViewer).getMenu()); final TreeColumn column1 = new TreeColumn(tree, SWT.LEFT); tree.setLinesVisible(true); column1.setAlignment(SWT.LEFT); column1.setText(Resources.getMessage("PropertiesView.3")); //$NON-NLS-1$ column1.setWidth(160); final TreeColumn column2 = new TreeColumn(tree, SWT.RIGHT); column2.setAlignment(SWT.LEFT); column2.setText(Resources.getMessage("PropertiesView.4")); //$NON-NLS-1$ column2.setWidth(100); final TreeColumn column6 = new TreeColumn(tree, SWT.RIGHT); column6.setAlignment(SWT.LEFT); column6.setText(Resources.getMessage("PropertiesView.5")); //$NON-NLS-1$ column6.setWidth(100); final TreeColumn column7 = new TreeColumn(tree, SWT.RIGHT); column7.setAlignment(SWT.LEFT); column7.setText(Resources.getMessage("PropertiesView.101")); //$NON-NLS-1$ column7.setWidth(80); final TreeColumn column3 = new TreeColumn(tree, SWT.RIGHT); column3.setAlignment(SWT.LEFT); column3.setText(Resources.getMessage("PropertiesView.6")); //$NON-NLS-1$ column3.setWidth(50); final TreeColumn column4 = new TreeColumn(tree, SWT.RIGHT); column4.setAlignment(SWT.LEFT); column4.setText(Resources.getMessage("PropertiesView.7")); //$NON-NLS-1$ column4.setWidth(50); final TreeColumn column5 = new TreeColumn(tree, SWT.RIGHT); column5.setAlignment(SWT.LEFT); column5.setText(Resources.getMessage("PropertiesView.8")); //$NON-NLS-1$ column5.setWidth(50); final TreeColumn column8 = new TreeColumn(tree, SWT.RIGHT); column8.setAlignment(SWT.LEFT); column8.setText(Resources.getMessage("PropertiesView.113")); //$NON-NLS-1$ column8.setWidth(50); final TreeColumn column9 = new TreeColumn(tree, SWT.RIGHT); column9.setAlignment(SWT.LEFT); column9.setText(Resources.getMessage("PropertiesView.126")); //$NON-NLS-1$ column9.setWidth(50); treeViewer.setContentProvider(new InputContentProvider()); treeViewer.setLabelProvider(new InputLabelProvider()); treeViewer.setInput(roots); treeViewer.expandAll(); }
Example 16
Source File: AbstractOutlineWorkbenchTest.java From xsemantics with Eclipse Public License 1.0 | 3 votes |
/** * The tree viewer is expanded and a string representation of the tree is * built where children are indented of TAB_INDENT number of tabs; this * string representation is then compared with the expected representation. * * @param treeViewer * @param expected */ protected void assertAllLabels(TreeViewer treeViewer, CharSequence expected) { treeViewer.expandAll(); IOutlineNode rootNode = getOutlineRootNode(treeViewer); assertEquals(expected.toString().trim().replaceAll("\r", ""), outlineStringRepresentation(rootNode).trim().replaceAll("\r", "")); }