本文整理匯總了Java中org.eclipse.jface.viewers.ITreeContentProvider.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java ITreeContentProvider.getChildren方法的具體用法?Java ITreeContentProvider.getChildren怎麽用?Java ITreeContentProvider.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ITreeContentProvider
的用法示例。
在下文中一共展示了ITreeContentProvider.getChildren方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectfirstMatching
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private boolean selectfirstMatching(Object[] elements) {
if (elements == null) {
return false;
}
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
if (Boolean.TRUE.equals(textFilter.isMatchingOrNull(element))) {
StructuredSelection selection = new StructuredSelection(element);
treeViewer.setSelection(selection, true);
return true;
}
ITreeContentProvider contentProvider = getTreeContentProvider();
Object[] children = contentProvider.getChildren(element);
boolean selectionDone = selectfirstMatching(children);
if (selectionDone) {
return true;
}
}
return false;
}
示例2: select
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
public boolean select(Viewer viewer, Object parentElement,
Object element) {
StructuredViewer sviewer = (StructuredViewer) viewer;
ITreeContentProvider provider = (ITreeContentProvider) sviewer
.getContentProvider();
if (element instanceof Group ) {
for (Object child: provider.getChildren(element)) {
if (select(viewer, element, child))
return true;
}
}
else {
Test test = (Test)element;
if (test.getTestName().contains(searchTestName)) {
return true;
}
}
return false;
}
示例3: checkStateChanged
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
// in case of changed category, go to all problems
if (element instanceof String) {
ITreeContentProvider contentProvider = (ITreeContentProvider)getTreeViewer().getContentProvider();
Object[] problems = contentProvider.getChildren(element);
for (Object problem : problems) {
if (problem instanceof Problem) {
((Problem)problem).setEnabled(event.getChecked());
}
}
}
if (element instanceof Problem) {
((Problem) element).setEnabled(event.getChecked());
}
}
示例4: isElementVisible
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
public boolean isElementVisible(Viewer viewer, Object element) {
if (WorkbenchActivityHelper.restrictUseOf(element))
return false;
// Nodes are not differentiated based on category since
// categories are selectable nodes.
if (isLeafMatch(viewer, element)) {
return true;
}
ITreeContentProvider contentProvider =
(ITreeContentProvider) ((TreeViewer) viewer).getContentProvider();
IPropertiesViewerNode node = (IPropertiesViewerNode) element;
Object[] children = contentProvider.getChildren(node);
// Will return true if any subnode of the element matches the search
if (filter(viewer, element, children).length > 0) {
return true;
}
return false;
}
示例5: select
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof Variant || element instanceof Commentable || element instanceof SoftwareElement) {
return true;
} else if (element instanceof VariationPoint) {
return select((VariationPoint) element);
} else {
StructuredViewer sviewer = (StructuredViewer) viewer;
ITreeContentProvider provider = (ITreeContentProvider) sviewer.getContentProvider();
for (Object child : provider.getChildren(element)) {
if (select(viewer, element, child)) {
return true;
}
}
return false;
}
}
示例6: isElementVisible
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
public boolean isElementVisible( Viewer viewer, Object element )
{
if ( isLeafMatch( viewer, element ) )
{
return true;
}
if ( element instanceof DataSourceType )
{
ITreeContentProvider contentProvider = (ITreeContentProvider) ( (TreeViewer) viewer ).getContentProvider( );
DataSourceType node = (DataSourceType) element;
Object[] children = contentProvider.getChildren( node );
// Will return true if any subnode of the element matches the search
if ( filter( viewer, element, children ).length > 0 )
{
return true;
}
}
return false;
}
示例7: containElement
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private static boolean containElement( Object parent,
ITreeContentProvider provider, Object element )
{
if ( parent == null )
{
return false;
}
if ( parent == element || parent.equals( element ) )
{
return true;
}
if ( provider == null )
{
return false;
}
Object[] children = provider.getChildren( parent );
for ( int i = 0; i < children.length; i++ )
{
if ( containElement( children[i], provider, element ) )
{
return true;
}
}
return false;
}
示例8: selectfirstMatching
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private boolean selectfirstMatching(Object[] elements) {
if (treeViewer==null){
return false;
}
if (textFilter==null){
return false;
}
if (elements == null) {
return false;
}
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
if (Boolean.TRUE.equals(textFilter.isMatchingOrNull(element))) {
StructuredSelection selection = new StructuredSelection(element);
treeViewer.setSelection(selection, true);
return true;
}
ITreeContentProvider contentProvider = getTreeContentProvider();
Object[] children = contentProvider.getChildren(element);
boolean selectionDone = selectfirstMatching(children);
if (selectionDone) {
return true;
}
}
return false;
}
示例9: isElementVisible
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
public boolean isElementVisible(Viewer viewer, Object element) {
// Preference nodes are not differentiated based on category since
// categories are selectable nodes.
if (isLeafMatch(viewer, element)) {
return true;
}
ITreeContentProvider contentProvider = (ITreeContentProvider) ((TreeViewer) viewer).getContentProvider();
Object[] children = contentProvider.getChildren(element);
// Will return true if any subnode of the element matches the search
if (filter(viewer, element, children).length > 0) {
return true;
}
return false;
}
示例10: updateChecksForParents
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private void updateChecksForParents(Object object, boolean state) {
ITreeContentProvider provider = (ITreeContentProvider)getContentProvider();
Object child = object;
Object parent = provider.getParent(child);
boolean change = true;
while (parent != null && change) {
Object[] siblings = provider.getChildren(parent);
int numberChecked = 0;
boolean grayed = false;
change = false;
for (int i = 0; i < siblings.length; i++) {
if (getChecked(siblings[i])) numberChecked++;
if (getGrayed(siblings[i])) grayed = true;
}
if (numberChecked == 0) {
if (getChecked(parent) || getGrayed(parent)) change = true;
setGrayChecked(parent, false);
}
else if (numberChecked == siblings.length) {
if (!getChecked(parent) || getGrayed(parent) != grayed) change = true;
setGrayed(parent, false);
setChecked(parent, true);
}
else {
if (!getChecked(parent) || !getGrayed(parent)) change = true;
setGrayChecked(parent, true);
}
child = parent;
parent = provider.getParent(child);
}
}
示例11: getChildren
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
public Object[] getChildren(Object parentElement)
{
List<ITreeContentProvider> providers = this.getProcessors();
List<Object> result = new ArrayList<Object>();
for (ITreeContentProvider provider : providers)
{
Object[] items = provider.getChildren(parentElement);
result.addAll(Arrays.asList(items));
}
return result.toArray();
}
示例12: getMatchCount
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
private int getMatchCount(ITreeContentProvider cp, Object[] elements) {
int count= 0;
for (int j = 0; j < elements.length; j++) {
count+= getDisplayedMatchCount(elements[j]);
Object[] children = cp.getChildren(elements[j]);
count+= getMatchCount(cp, children);
}
return count;
}
示例13: select
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof VariationPoint && ((VariationPoint) element).getVariabilityMechanism() == null) {
return true;
} else if (element instanceof VariationPointGroup) {
ITreeContentProvider contentProvider = (ITreeContentProvider) ((CommonViewer) viewer).getContentProvider();
for (Object child : contentProvider.getChildren(element)) {
if (select(viewer, element, child)) {
return true;
}
}
}
return false;
}
示例14: select
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* Returns whether the given element makes it through this filter.
*
* @param viewer
* @param parentElement
* @param element
* @return true if element meets the search criteria
*/
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
// sanity check
if(findFilterMode == null || findFilterText == null) return true;
// retrieve the current case insensitive search criteria
String mode = findFilterMode.getText();
String filterText = findFilterText.getText().trim().toUpperCase();
// return true if no search criteria specified
if(filterText.length() == 0) return true;
TreeViewer treeViewer = (TreeViewer) viewer;
ITreeContentProvider provider = (ITreeContentProvider) treeViewer.getContentProvider();
if(mode.equals(getDisplayText(DEFINITION_CATEGORY))) {
// walk up the tree until reaching a category containter
while(!(element instanceof String))
element = provider.getParent(element);
// apply case insensitive search criteria to the category
return ((String) element).toUpperCase().indexOf(filterText) != -1;
}
else if(mode.equals(getDisplayText(DEFINITION_NAME))) {
// if the current element is an activity then immediately apply
// case insensitive search criteria
if (element instanceof INamedDefinition)
return ((INamedDefinition) element).getName().toUpperCase().indexOf(filterText) != -1;
// if the current element is not an activity then recurse
// through all children until either a match is found or all
// have been examined
Queue<Object> openList = new LinkedList<Object>();
openList.offer(element);
while (!openList.isEmpty()) {
Object thisElement = openList.poll();
for(Object childElement : provider.getChildren(thisElement)) {
if(childElement instanceof INamedDefinition &&
((INamedDefinition) childElement).getName().toUpperCase().indexOf(filterText) != -1)
return true;
openList.offer(childElement);
}
}
}
// if all else fails, return false
return false;
}
示例15: select
import org.eclipse.jface.viewers.ITreeContentProvider; //導入方法依賴的package包/類
/**
* Returns whether the given element makes it through this filter.
*
* @param viewer
* @param parentElement
* @param element
* @return true if element meets the search criteria
*/
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
String filterText = getNameFilterText();
// sanity check
if(filterText == null) {
return true;
}
// retrieve the current case insensitive search criteria
filterText = filterText.trim().toUpperCase();
// return true if no search criteria specified
if(filterText.length() == 0) return true;
TreeViewer treeViewer = (TreeViewer) viewer;
ITreeContentProvider provider = (ITreeContentProvider) treeViewer.getContentProvider();
// if the current element is an activity then immediately apply
// case insensitive search criteria
if (matchesProfile(treeViewer, element, filterText)) {
return true;
}
// if the current element is not an activity then recurse
// through all children until either a match is found or all
// have been examined
Queue<Object> openList = new LinkedList<Object>();
openList.offer(element);
while (!openList.isEmpty()) {
Object thisElement = openList.poll();
for(Object childElement : provider.getChildren(thisElement)) {
if (matchesProfile(treeViewer, childElement, filterText)) {
return true;
}
openList.offer(childElement);
}
}
// if all else fails, return false
return false;
}