當前位置: 首頁>>代碼示例>>Java>>正文


Java ITreeContentProvider.getElements方法代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.ITreeContentProvider.getElements方法的典型用法代碼示例。如果您正苦於以下問題:Java ITreeContentProvider.getElements方法的具體用法?Java ITreeContentProvider.getElements怎麽用?Java ITreeContentProvider.getElements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.viewers.ITreeContentProvider的用法示例。


在下文中一共展示了ITreeContentProvider.getElements方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getElements

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * @see org.eclipse.ui.navigator.SaveablesProvider#getElements(org.eclipse.ui.Saveable)
 */
@Override
public Object[] getElements(Saveable pSaveable) {

    if (pSaveable == null) {
        return new Object[] {};
    }

    CommonViewer viewer = ProjectRegistry.ViewerRegistry.getViewer();
    ITreeContentProvider contentProvider = (ITreeContentProvider) viewer.getContentProvider();
    Object viewerInput = viewer.getInput();

    if (contentProvider == null) {
        return null;
    }

    return contentProvider.getElements(viewerInput);

}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:22,代碼來源:ExplorerSaveablesProvider.java

示例2: selectAll

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * Selects or deselects all methods.
 * 
 * @param state
 * @throws JavaModelException
 */
private void selectAll(boolean state) {
	CheckboxTreeViewer checkboxTreeViewer = getGroup().getCheckboxTreeViewer();
	ITreeContentProvider contentProvider = (ITreeContentProvider) checkboxTreeViewer.getContentProvider();
	Object[] objects = contentProvider.getElements(checkboxTreeViewer.getInput());

	for (Object object : objects) {
		checkboxTreeViewer.setChecked(object, state);
	}

	for (IMethod method : getBaseClassMethods()) {
		if (viewerFilterMethods.select(null, method.getParent(), method)) {
			if (state) {
				checkedMethods.add(method);
			} else {
				checkedMethods.remove(method);
			}
		}
	}
}
 
開發者ID:junit-tools-team,項目名稱:junit-tools,代碼行數:26,代碼來源:GroupMethodSelectionCtrl.java

示例3: getElements

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
public Object[] getElements(Object inputElement)
{
	List<ITreeContentProvider> providers = this.getProcessors();
	List<Object> result = new ArrayList<Object>();

	for (ITreeContentProvider provider : providers)
	{
		Object[] items = provider.getElements(inputElement);

		result.addAll(Arrays.asList(items));
	}

	return result.toArray();
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:15,代碼來源:IndexViewContentProvider.java

示例4: applyExpandHeuristic

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * A heuristic for determining how much information to show in this view. If
 * nodes of the tree have an excessively large number of children then it
 * may not always be ideal to display all the children by default. This
 * method attempts to display a reasonable amount of information to the
 * user.
 * 
 * @param treeViewer
 */
protected void applyExpandHeuristic(TreeViewer treeViewer) {
	ITreeContentProvider cp = (ITreeContentProvider) treeViewer.getContentProvider();
	
	Object[] rootChildren = cp.getElements(null);
	if (rootChildren.length == 0) return;
	Object root = cp.getParent(rootChildren[0]);
	
	FindFilter filter = new FindFilter();
	
	Object children[] = filter.filter(treeViewer, root, rootChildren);
	if(children.length == 1) {
		treeViewer.expandAll();
		return;
	}
	
	int totalChildren = 0;
	for(int i=0; i<25 && i<children.length; i++) {
		totalChildren += filter.filter(treeViewer, children[i], cp.getChildren(children[i])).length;
	}
	
	if(totalChildren > 25) {
		treeViewer.collapseAll();
		treeViewer.expandToLevel(root, 1);
	} else {
		treeViewer.expandAll();
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:37,代碼來源:DefinitionTreeView.java

示例5: applyExpandHeuristic

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
protected void applyExpandHeuristic(String key, String stringToMatch) {	
	ITreeContentProvider cp = (ITreeContentProvider) treeViewer.getContentProvider();
	final Object[] rootChildren = cp.getElements(null);
	if (rootChildren != null && rootChildren.length != 0) {
		if (rootChildren.length <= 25 && !CommonUtils.isNullOrEmpty(stringToMatch)) {
			for(Object object : rootChildren) {
				treeViewer.expandToLevel(object, AbstractTreeViewer.ALL_LEVELS);
			}
		} else {
			treeViewer.collapseAll();
		}
	}
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:14,代碼來源:TreeViewerPage.java

示例6: testGetElements

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * Test if the method getElements() returns a correct result.
 */
@Test
public void testGetElements() {
    ITreeContentProvider packagesTreeContentProvider = new PackagesTreeContentProvider();

    IPackageFragment javaPackage1 = mock(IPackageFragment.class);
    IPackageFragment javaPackage2 = mock(IPackageFragment.class);

    IPackageFragment[] rootPackages = { javaPackage1, javaPackage2 };

    Object[] result = packagesTreeContentProvider.getElements(rootPackages);

    assertThat("returned root packages", (IPackageFragment[]) result, is(rootPackages));
}
 
開發者ID:kopl,項目名稱:SPLevo,代碼行數:17,代碼來源:PackagesTreeContentProviderTest.java

示例7: generateNewLabel

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * create new unique text for a "label" attribute, if present, by looking at all existing. 
 * @param displayName
 * @return
 */
protected String generateNewLabel(FacesDefinition def) {
    String label = "Label"; // $NLX-AbstractTreeNodePanel.Label-1$
    String displayName = getLinkDisplayName(def);
    if (null == displayName)
        return label;
    
    Object input = ruleViewer.getInput();
    
    ITreeContentProvider cp = (ITreeContentProvider)ruleViewer.getContentProvider();
    Object[] children = cp.getElements(input);
    
    Stack<Object> stack = new Stack<Object>(); // for non-recursive tree traversal
    stack.push(input);

    Set<String> set = new HashSet<String>(); // collects current names
    
    while (!stack.isEmpty()) {
        if (null != children) {
            for (int i = 0; i < children.length; i++) {
                if (children[i] instanceof Element) {
                    String l = XPagesDOMUtil.getAttribute((Element)children[i], EXT_LIB_ATTR_LABEL);
                    if (StringUtil.isNotEmpty(l))                
                         set.add(l);
                }
                stack.push(children[i]);
            }
        }
        children = cp.getChildren(stack.pop());
    }
    while (!stack.isEmpty());
    
    String prefix = displayName;
    String[] splits = displayName.split(" "); //$NON-NLS-1$
    if (null != splits && splits.length > 0) {
        prefix = splits[0];
        for (int i = 1; i < 100; i++) {
            String thistry = prefix + " " + String.valueOf(i); //$NON-NLS-1$
            if (!set.contains(thistry)) {
                label = thistry;
                break;
            }
        }
    }
    return label;
}
 
開發者ID:OpenNTF,項目名稱:XPagesExtensionLibrary,代碼行數:51,代碼來源:RedirectRulesPanel.java

示例8: generateNewLabel

import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
 * create new unique text for a "label" attribute, if present, by looking at all existing. 
 * @param displayName
 * @return
 */
protected String generateNewLabel(FacesDefinition def) {
    if(StringUtil.equals(def.getTagName(), IExtLibTagNames.EXT_LIB_TAG_DOMINO_VIEW_LIST)){
        return null; //for the dominoViewListTreeNode tag we do not want to set the label!
    }
    String label = "Label"; // $NLX-AbstractTreeNodePanel.Label-1$
    String displayName = getLinkDisplayName(def, false);
    if (null == displayName)
        return label;
    
    Object input = _linkViewer.getInput();
    
    ITreeContentProvider cp = (ITreeContentProvider)_linkViewer.getContentProvider();
    Object[] children = cp.getElements(input);
    
    Stack<Object> stack = new Stack<Object>(); // for non-recursive tree traversal
    stack.push(input);

    Set<String> set = new HashSet<String>(); // collects current names
    
    while (!stack.isEmpty()) {
        if (null != children) {
            for (int i = 0; i < children.length; i++) {
                if (children[i] instanceof Element) {
                    String l = XPagesDOMUtil.getAttribute((Element)children[i], EXT_LIB_ATTR_LABEL);
                    if (StringUtil.isNotEmpty(l))                
                         set.add(l);
                }
                stack.push(children[i]);
            }
        }
        children = cp.getChildren(stack.pop());
    }
    while (!stack.isEmpty());
    
    String prefix = displayName;
    String[] splits = displayName.split(" "); //$NON-NLS-1$
    if (null != splits && splits.length > 0) {
        prefix = splits[0];
        for (int i = 1; i < 100; i++) {
            String thistry = prefix + " " + String.valueOf(i); //$NON-NLS-1$
            if (!set.contains(thistry)) {
                label = thistry;
                break;
            }
        }
    }
    return label;
}
 
開發者ID:OpenNTF,項目名稱:XPagesExtensionLibrary,代碼行數:54,代碼來源:AbstractTreeNodePanel.java


注:本文中的org.eclipse.jface.viewers.ITreeContentProvider.getElements方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。