Java Code Examples for org.eclipse.jface.viewers.ITreeContentProvider#hasChildren()
The following examples show how to use
org.eclipse.jface.viewers.ITreeContentProvider#hasChildren() .
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: IndexViewContentProvider.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public boolean hasChildren(Object element) { List<ITreeContentProvider> providers = this.getProcessors(); boolean result = false; for (ITreeContentProvider provider : providers) { if (provider.hasChildren(element)) { result = true; break; } } return result; }
Example 2
Source File: GroupsWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void updateParentPath(final org.bonitasoft.studio.actors.model.organization.Group group, final String pathToReplace, final String newPath, final ITreeContentProvider provider) { if (provider.hasChildren(group)) { for (final Object child : provider.getChildren(group)) { final org.bonitasoft.studio.actors.model.organization.Group childGroup = (org.bonitasoft.studio.actors.model.organization.Group) child; updateParentPath(childGroup, pathToReplace, newPath, provider); String path = childGroup.getParentPath().replace(pathToReplace, newPath); if (path.endsWith(GroupContentProvider.GROUP_SEPARATOR)) { path = path.substring(0, path.length() - 1); } if (path != null && path.equals(GroupContentProvider.GROUP_SEPARATOR)) { childGroup.setParentPath(null); } else { childGroup.setParentPath(path); } } } }
Example 3
Source File: GroupsWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected void removeButtonSelected() { for (final Object sel : ((IStructuredSelection) getViewer().getSelection()).toList()) { if (sel instanceof org.bonitasoft.studio.actors.model.organization.Group) { final ITreeContentProvider contentProvider = (ITreeContentProvider) getViewer().getContentProvider(); if (contentProvider.hasChildren(sel)) { if (groupList.contains(sel)) { if (MessageDialog.openQuestion(Display.getDefault().getActiveShell(), Messages.deleteGroupTitle, Messages.deleteGroupMsg)) { removeChildren(contentProvider, sel); } else { return; } } } groupList.remove(sel); } } getViewer().setInput(groupList); selectionChanged(new SelectionChangedEvent(getViewer(), new StructuredSelection())); ((TreeViewer) getViewer()).expandAll(); }
Example 4
Source File: ExportBarWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected boolean queryElementAndChildren(final String searchQuery, final Object element) { final String processName = ((AbstractProcess) element).getName(); final String processVersion = ((AbstractProcess) element).getVersion(); if (processName != null && processName.toLowerCase().contains(searchQuery.toLowerCase()) || processVersion != null && processVersion.toLowerCase().contains(searchQuery.toLowerCase())) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { viewer.expandAll(); } }); return true; } final ITreeContentProvider contentProvider = (ITreeContentProvider) viewer.getContentProvider(); if (contentProvider.hasChildren(element)) { for (final Object child : contentProvider.getChildren(element)) { if (queryElementAndChildren(searchQuery, child)) { return true; } } } return false; }
Example 5
Source File: BreadcrumbViewer.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * Set selection to the next or previous element if possible. * * @param next <code>true</code> if the next element should be selected, * otherwise the previous one will be selected */ void doTraverse(boolean next) { if (fSelectedItem == null) return; int index = fBreadcrumbItems.indexOf(fSelectedItem); if (next) { if (index == fBreadcrumbItems.size() - 1) { BreadcrumbItem current = (BreadcrumbItem) fBreadcrumbItems.get(index); ITreeContentProvider contentProvider = (ITreeContentProvider) getContentProvider(); if (!contentProvider.hasChildren(current.getData())) return; current.openDropDownMenu(); current.getDropDownShell().setFocus(); } else { BreadcrumbItem nextItem = (BreadcrumbItem) fBreadcrumbItems.get(index + 1); selectItem(nextItem); } } else { if (index == 1) { BreadcrumbItem root = (BreadcrumbItem) fBreadcrumbItems.get(0); root.openDropDownMenu(); root.getDropDownShell().setFocus(); } else { selectItem((BreadcrumbItem) fBreadcrumbItems.get(index - 1)); } } }
Example 6
Source File: BreadcrumbViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Set selection to the next or previous element if possible. * * @param next <code>true</code> if the next element should be selected, otherwise the previous * one will be selected */ void doTraverse(boolean next) { if (fSelectedItem == null) return; int index= fBreadcrumbItems.indexOf(fSelectedItem); if (next) { if (index == fBreadcrumbItems.size() - 1) { BreadcrumbItem current= fBreadcrumbItems.get(index); ITreeContentProvider contentProvider= (ITreeContentProvider) getContentProvider(); if (!contentProvider.hasChildren(current.getData())) return; current.openDropDownMenu(); current.getDropDownShell().setFocus(); } else { BreadcrumbItem nextItem= fBreadcrumbItems.get(index + 1); selectItem(nextItem); } } else { if (index == 1) { BreadcrumbItem root= fBreadcrumbItems.get(0); root.openDropDownMenu(); root.getDropDownShell().setFocus(); } else { selectItem(fBreadcrumbItems.get(index - 1)); } } }
Example 7
Source File: BreadcrumbViewer.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Set selection to the next or previous element if possible. * * @param next * <code>true</code> if the next element should be selected, * otherwise the previous one will be selected */ void doTraverse( boolean next ) { if ( fSelectedItem == null ) return; int index = fBreadcrumbItems.indexOf( fSelectedItem ); if ( next ) { if ( index == fBreadcrumbItems.size( ) - 1 ) { BreadcrumbItem current = (BreadcrumbItem) fBreadcrumbItems.get( index ); ITreeContentProvider contentProvider = (ITreeContentProvider) getContentProvider( ); if ( !contentProvider.hasChildren( current.getData( ) ) ) return; current.openDropDownMenu( ); current.getDropDownShell( ).setFocus( ); } else { BreadcrumbItem nextItem = (BreadcrumbItem) fBreadcrumbItems.get( index + 1 ); selectItem( nextItem ); } } else { if ( index == 1 ) { BreadcrumbItem root = (BreadcrumbItem) fBreadcrumbItems.get( 0 ); root.openDropDownMenu( ); root.getDropDownShell( ).setFocus( ); } else { selectItem( (BreadcrumbItem) fBreadcrumbItems.get( index - 1 ) ); } } }
Example 8
Source File: AbstractDefinitionSelectionImpementationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void getFlattenTree(final List<Object> flattenTree, final Object[] rootElement, final ITreeContentProvider contentProvider) { for (final Object element : rootElement) { flattenTree.add(element); if (contentProvider.hasChildren(element)) { getChildrenFlattenTree(flattenTree, element, contentProvider); } } }
Example 9
Source File: AbstractDefinitionSelectionImpementationWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void getChildrenFlattenTree(final List<Object> flattenTree, final Object parentElement, final ITreeContentProvider contentProvider) { for (final Object element : contentProvider.getChildren(parentElement)) { flattenTree.add(element); if (contentProvider.hasChildren(element)) { getChildrenFlattenTree(flattenTree, element, contentProvider); } } }
Example 10
Source File: GroupsWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void removeChildren(final ITreeContentProvider contentProvider, final Object sel) { if (contentProvider.hasChildren(sel)) { for (final Object child : contentProvider.getChildren(sel)) { removeChildren(contentProvider, child); groupList.remove(child); } } }
Example 11
Source File: DiagnoseSelektor.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void addDiagnoses(ITreeContentProvider tcp, Object[] roots){ for (Object object : roots) { if (tcp.hasChildren(object)) { addDiagnoses(tcp, tcp.getChildren(object)); } else { diagnoses.add((IDiagnosis) object); } } }
Example 12
Source File: PostfixLabelProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected boolean hasChildren(Object element) { ITreeContentProvider contentProvider= (ITreeContentProvider) fPage.getViewer().getContentProvider(); return contentProvider.hasChildren(element); }