本文整理匯總了Java中org.eclipse.jface.viewers.ITreeContentProvider.hasChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java ITreeContentProvider.hasChildren方法的具體用法?Java ITreeContentProvider.hasChildren怎麽用?Java ITreeContentProvider.hasChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ITreeContentProvider
的用法示例。
在下文中一共展示了ITreeContentProvider.hasChildren方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doubleClick
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
public void doubleClick(DoubleClickEvent event) {
final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection == null || selection.isEmpty())
return;
final Object sel = selection.getFirstElement();
final ITreeContentProvider provider = (ITreeContentProvider) viewer.getContentProvider();
if (!provider.hasChildren(sel))
return;
if (viewer.getExpandedState(sel))
viewer.collapseToLevel(sel, AbstractTreeViewer.ALL_LEVELS);
else
viewer.expandToLevel(sel, 1);
}
示例2: hasChildren
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
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;
}
示例3: doTraverse
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* 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));
}
}
}
示例4: doTraverse
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* 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));
}
}
}
示例5: addFilteredChildren
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* If the element is a leaf node, it is added to the result collection. If the element has
* children, this method will recursively look at the children and add any visible leaf nodes
* to the collection.
*
* @param element element to check
* @param contentProvider tree content provider to check for children
* @param result collection to collect leaf nodes in
*/
private void addFilteredChildren(Object element, ITreeContentProvider contentProvider, Collection<Object> result) {
if (!contentProvider.hasChildren(element)) {
result.add(element);
} else {
Object[] visibleChildren = getFilteredChildren(element);
for (int i = 0; i < visibleChildren.length; i++) {
addFilteredChildren(visibleChildren[i], contentProvider, result);
}
}
}
示例6: doTraverse
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* 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 ) );
}
}
}
示例7: hasChildren
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
protected boolean hasChildren(Object element) {
ITreeContentProvider contentProvider= (ITreeContentProvider) fPage.getViewer().getContentProvider();
return contentProvider.hasChildren(element);
}
示例8: canView
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private boolean canView(final ITreeContentProvider contentProvider, final Object element) {
return !UMLPackage.Literals.PACKAGE.isInstance(element) || contentProvider.hasChildren(element);
}