List of usage examples for org.eclipse.jface.viewers AbstractTreeViewer ALL_LEVELS
int ALL_LEVELS
To view the source code for org.eclipse.jface.viewers AbstractTreeViewer ALL_LEVELS.
Click Source Link
From source file:com.nokia.tracebuilder.view.WrapperBase.java
License:Open Source License
/** * Collapses the sibling wrappers of this wrapper * //from w w w . j av a2 s . c om * @param viewer * the viewer * @param child * the child */ private void collapseSiblings(TreeViewer viewer, ListWrapper child) { // The collapsed wrapper is shown in view, but it // children are hidden // If a sibling is shown, it is collapsed boolean needsCollapse = child.hasChildren() && child.getVisibleWrappers().next().isInView(); if (needsCollapse) { child.setChildrenInView(false); viewer.collapseToLevel(child, AbstractTreeViewer.ALL_LEVELS); } }
From source file:com.redhat.ceylon.eclipse.code.explorer.PackageExplorerPart.java
License:Open Source License
public void collapseAll() { try {/*from www. j a va 2 s.c o m*/ fViewer.getControl().setRedraw(false); fViewer.collapseToLevel(getViewPartInput(), AbstractTreeViewer.ALL_LEVELS); } finally { fViewer.getControl().setRedraw(true); } }
From source file:com.siteview.mde.internal.ui.editor.FormOutlinePage.java
License:Open Source License
public void createControl(Composite parent) { Tree widget = new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); fTreeViewer = new TreeViewer(widget); fTreeViewer.addSelectionChangedListener(this); fTreeViewer.setContentProvider(createContentProvider()); fTreeViewer.setLabelProvider(createLabelProvider()); fViewerComparator = createOutlineSorter(); if (fSorted)/*from w w w .ja v a 2s . co m*/ fTreeViewer.setComparator(fViewerComparator); else fTreeViewer.setComparator(null); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTreeViewer.setUseHashlookup(true); fTreeViewer.setInput(fEditor); IBaseModel model = fEditor.getAggregateModel(); if (model instanceof IModelChangeProvider) ((IModelChangeProvider) model).addModelChangedListener(this); }
From source file:com.siteview.mde.internal.ui.editor.outline.QuickOutlinePopupDialog.java
License:Open Source License
private void createUIWidgetTreeViewer(Composite parent) { // NOTE: Instructions to implement for PDE form pages: // Need to call PDEFormEditor.getFormOutline() // Specify PDE form editor as input // Need to adjust commandId="com.siteview.mde.ui.quickOutline" // scope: contextId="org.eclipse.ui.textEditorScope" // SEE org.eclipse.ui.contexts.window // TODO: MP: QO: LOW: Implement bi-directional support between form and source page for manifest int style = SWT.H_SCROLL | SWT.V_SCROLL; // Create the tree Tree widget = new Tree(parent, style); // Configure the layout GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = widget.getItemHeight() * 12; widget.setLayoutData(data);// ww w . j a va2 s. co m // Create the tree viewer fTreeViewer = new TreeViewer(widget); // Add the name pattern filter fNamePatternFilter = new QuickOutlineNamePatternFilter(); fTreeViewer.addFilter(fNamePatternFilter); // Set the content provider fTreeContentProvider = fOutlineContentCreator.createOutlineContentProvider(); fTreeViewer.setContentProvider(fTreeContentProvider); // Set the label provider fTreeLabelProvider = fOutlineContentCreator.createOutlineLabelProvider(); fTreeViewer.setLabelProvider(fTreeLabelProvider); // Create the outline sorter (to be set on the sort action) fTreeViewerComparator = fOutlineContentCreator.createOutlineComparator(); // Set the comparator to null (sort action will be disabled initially // because of this) // Create the default outline sorter (Most like this will just return // null to indicate sorting disabled fTreeViewerDefaultComparator = fOutlineContentCreator.createDefaultOutlineComparator(); fTreeViewer.setComparator(fTreeViewerDefaultComparator); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTreeViewer.setUseHashlookup(true); fTreeViewer.setInput(fOutlineContentCreator.getOutlineInput()); }
From source file:com.siteview.mde.internal.ui.launcher.FeatureBlock.java
License:Open Source License
public void initializeFrom(ILaunchConfiguration config) throws CoreException { fLaunchConfig = config;/*from w ww . j a v a2s. com*/ fTree.removeFilter(fSelectedOnlyFilter); setInput(config, fTree); // Setup other buttons String pluginResolution = config.getAttribute(IPDELauncherConstants.FEATURE_PLUGIN_RESOLUTION, IPDELauncherConstants.LOCATION_WORKSPACE); if (pluginResolution.equalsIgnoreCase(IPDELauncherConstants.LOCATION_WORKSPACE)) { fWorkspacePluginButton.setSelection(true); fExternalPluginButton.setSelection(false); } else { fWorkspacePluginButton.setSelection(false); fExternalPluginButton.setSelection(true); } String featureLocation = config.getAttribute(IPDELauncherConstants.FEATURE_DEFAULT_LOCATION, IPDELauncherConstants.LOCATION_WORKSPACE); fFeatureWorkspaceButton .setSelection(featureLocation.equalsIgnoreCase(IPDELauncherConstants.LOCATION_WORKSPACE)); fAutoValidate.setSelection(config.getAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, false)); // If the workspace plug-in state has changed (project closed, etc.) the launch config needs to be updated without making the tab dirty if (fLaunchConfig.isWorkingCopy()) { savePluginState((ILaunchConfigurationWorkingCopy) fLaunchConfig); } MDEPreferencesManager prefs = new MDEPreferencesManager(IMDEUIConstants.PLUGIN_ID); int index = prefs.getInt(IPreferenceConstants.FEATURE_SORT_COLUMN); TreeColumn column = fTree.getTree().getColumn(index == 0 ? COLUMN_FEATURE_NAME : index - 1); fListener.handleColumn(column, prefs.getInt(IPreferenceConstants.FEATURE_SORT_ORDER)); fRemovePluginButton.setEnabled(false); fFilterButton.setSelection(config.getAttribute(IPDELauncherConstants.SHOW_SELECTED_ONLY, false)); if (fFilterButton.getSelection()) { fTree.addFilter(fSelectedOnlyFilter); } fTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); fTree.expandAll(); fTree.refresh(true); fTab.updateLaunchConfigurationDialog(); }
From source file:com.siteview.mde.internal.ui.shared.target.ArgumentsFromContainerSelectionDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { IBundleContainer[] containers = fTarget.getBundleContainers(); boolean foundArguments = false; if (containers != null) { fAllArguments = new HashMap(containers.length); for (int i = 0; i < containers.length; i++) { String[] args = containers[i].getVMArguments(); if (args != null) { if (args.length > 0) { fAllArguments.put(containers[i], args); foundArguments = true; } else { fAllArguments.put(containers[i], new Object[] { new Status(IStatus.ERROR, MDEPlugin.getPluginId(), Messages.ArgumentsFromContainerSelectionDialog_1) }); }//w ww . j a v a 2s .com } } } PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.ARGS_FROM_CONTAINER_SELECTION_DIALOG); Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 10, 10); ((GridLayout) comp.getLayout()).verticalSpacing = 10; Label infoLabel = SWTFactory.createLabel(comp, Messages.ArgumentsFromContainerSelectionDialog_2, 1); Composite treeComp = SWTFactory.createComposite(comp, 2, 1, GridData.FILL_BOTH, 0, 0); fTree = new CheckboxTreeViewer(treeComp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = 300; gd.heightHint = 300; fTree.getControl().setLayoutData(gd); fTree.setLabelProvider(new StyledBundleLabelProvider(true, false)); fTree.setContentProvider(new ITreeContentProvider() { public Object[] getChildren(Object element) { if (element instanceof IBundleContainer) { Object args = fAllArguments.get(element); if (args != null) { return (Object[]) args; } } return new Object[0]; } public boolean hasChildren(Object element) { return getChildren(element).length > 0; } public Object[] getElements(Object element) { if (element instanceof Map) { return ((Map) element).keySet().toArray(); } return new Object[0]; } public Object getParent(Object element) { return null; } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public void dispose() { } }); fTree.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { updateCheckState(event.getElement()); updateOKButton(); } }); fTree.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (!event.getSelection().isEmpty()) { Object selected = ((IStructuredSelection) event.getSelection()).getFirstElement(); fTree.setChecked(selected, !fTree.getChecked(selected)); updateCheckState(selected); updateOKButton(); } } }); fTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); Composite buttonComp = SWTFactory.createComposite(treeComp, 1, 1, GridData.FILL_VERTICAL, 0, 0); fSelectAllButton = SWTFactory.createPushButton(buttonComp, Messages.ArgumentsFromContainerSelectionDialog_3, null); fSelectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(true); // TODO These buttons don't update as the check state changes // fSelectAllButton.setEnabled(true); // fDeselectAllButton.setEnabled(false); // fTree.getTree().getItemCount(); updateOKButton(); } }); fDeselectAllButton = SWTFactory.createPushButton(buttonComp, Messages.ArgumentsFromContainerSelectionDialog_4, null); fDeselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(false); updateOKButton(); } }); if (foundArguments) { fTree.setInput(fAllArguments); } else { fTree.getControl().setEnabled(false); fSelectAllButton.setEnabled(false); fDeselectAllButton.setEnabled(false); infoLabel.setText(Messages.ArgumentsFromContainerSelectionDialog_5); } return comp; }
From source file:com.siteview.mde.internal.ui.shared.target.TargetLocationsGroup.java
License:Open Source License
/** * Sets up the tree viewer using the given tree * @param tree// w w w. ja v a 2 s . c o m */ private void initializeTreeViewer(Tree tree) { fTreeViewer = new TreeViewer(tree); fTreeViewer.setContentProvider(new BundleContainerContentProvider()); fTreeViewer.setLabelProvider(new StyledBundleLabelProvider(true, false)); fTreeViewer.setComparator(new ViewerComparator() { public int compare(Viewer viewer, Object e1, Object e2) { // Status at the end of the list if (e1 instanceof IStatus && !(e2 instanceof IStatus)) { return 1; } if (e2 instanceof IStatus && !(e1 instanceof IStatus)) { return -1; } return super.compare(viewer, e1, e2); } }); fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateButtons(); } }); fTreeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (!event.getSelection().isEmpty()) { handleEdit(); } } }); fTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); }
From source file:com.technophobia.substeps.junit.ui.component.FeatureViewer.java
License:Open Source License
private void autoScrollInUI() { if (!autoScrollSupplier.currentValue().booleanValue()) { clearAutoExpand();/*from ww w .jav a 2 s.c o m*/ autoClose.clear(); return; } if (layoutMode.equals(ViewLayout.FLAT)) { if (autoScrollTarget != null) tableViewer.reveal(autoScrollTarget); return; } synchronized (this) { for (final SubstepsTestParentElement suite : autoExpand) { treeViewer.setExpandedState(suite, true); } clearAutoExpand(); } final SubstepsTestLeafElement current = autoScrollTarget; autoScrollTarget = null; SubstepsTestParentElement parent = current == null ? null : (SubstepsTestParentElement) treeContentProvider.getParent(current); if (autoClose.isEmpty() || !autoClose.getLast().equals(parent)) { // we're in a new branch, so let's close old OK branches: for (final ListIterator<SubstepsTestParentElement> iter = autoClose.listIterator(autoClose.size()); iter .hasPrevious();) { final SubstepsTestParentElement previousAutoOpened = iter.previous(); if (previousAutoOpened.equals(parent)) break; if (previousAutoOpened.getStatus().equals(Status.OK)) { // auto-opened the element, and all children are OK -> auto // close iter.remove(); treeViewer.collapseToLevel(previousAutoOpened, AbstractTreeViewer.ALL_LEVELS); } } while (parent != null && !testRunSession.getTestRoot().equals(parent) && treeViewer.getExpandedState(parent) == false) { autoClose.add(parent); // add to auto-opened elements -> close // later if STATUS_OK parent = (SubstepsTestParentElement) treeContentProvider.getParent(parent); } } if (current != null) treeViewer.reveal(current); }
From source file:com.testify.ecfeed.ui.editor.LinkingMethodsViewer.java
License:Open Source License
public LinkingMethodsViewer(ISectionContext sectionContext, IModelUpdateContext updateContext) { super(sectionContext, updateContext, STYLE); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.minimumHeight = 250;/*from w w w. j a v a 2 s . c o m*/ getSection().setLayoutData(gd); getSection().setText("Linking methods"); addDoubleClickListener(new SelectNodeDoubleClickListener(sectionContext.getMasterSection())); getTreeViewer().setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS); }
From source file:com.vectrace.MercurialEclipse.repository.RepositoriesView.java
License:Open Source License
public void collapseAll() { if (treeViewer == null) { return;/*from ww w . j a va 2 s .c o m*/ } treeViewer.getControl().setRedraw(false); treeViewer.collapseToLevel(treeViewer.getInput(), AbstractTreeViewer.ALL_LEVELS); treeViewer.getControl().setRedraw(true); }