当前位置: 首页>>代码示例>>Java>>正文


Java ITreeContentProvider类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.ITreeContentProvider的典型用法代码示例。如果您正苦于以下问题:Java ITreeContentProvider类的具体用法?Java ITreeContentProvider怎么用?Java ITreeContentProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITreeContentProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了ITreeContentProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
@Override
public void init ( final ICommonContentExtensionSite config )
{
    final ITreeContentProvider contentProvider = config.getService ().getContentExtensionById ( this.contentExtensionId ).getContentProvider ();
    if ( contentProvider instanceof ObservableSetTreeContentProvider )
    {
        addSource ( ( (ObservableSetTreeContentProvider)contentProvider ).getKnownElements () );
    }
    else if ( contentProvider instanceof ObservableSetContentProvider )
    {
        addSource ( ( (ObservableSetContentProvider)contentProvider ).getKnownElements () );
    }
    else if ( contentProvider instanceof ObservableListContentProvider )
    {
        addSource ( ( (ObservableListContentProvider)contentProvider ).getKnownElements () );
    }
    else if ( contentProvider instanceof ObservableListTreeContentProvider )
    {
        addSource ( ( (ObservableListTreeContentProvider)contentProvider ).getKnownElements () );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:CommonListeningLabelProvider.java

示例2: 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);

}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:19,代码来源:ExpandCollapseDoubleClickListener.java

示例3: 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;
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:22,代码来源:AbstractFilterableTreeQuickDialog.java

示例4: hasUnfilteredChild

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
/**
 * @param viewer
 * @param element
 * @return if the element has children that pass the filter
 */
private boolean hasUnfilteredChild(TreeViewer viewer, Object element) {
	// No point calling hasChildren() because the operation is the same
	// cost
	// as getting the children
	// If the element has a child that passes the filter, then we want
	// to
	// keep the parent around - even if it does not pass the filter
	// itself
	Object[] children = ((ITreeContentProvider) viewer.getContentProvider()).getChildren(element);
	if (children != null) {
		for (int i = 0; i < children.length; i++) {
			if (select(viewer, element, children[i])) {
				return true;
			}
		}
	}
	// Element does not pass the filter
	return false;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:25,代码来源:AbstractInformationControl.java

示例5: 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;
}
 
开发者ID:FutureProcessing,项目名称:RFRunnerPlugin,代码行数:23,代码来源:Filter.java

示例6: 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

示例7: 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());
	}

}
 
开发者ID:kwin,项目名称:cppcheclipse,代码行数:19,代码来源:ProblemsTreeEditor.java

示例8: 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

示例9: handleManifestmainclassBrowse

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
/**
 * Uses the standard container selection dialog to
 * choose the new value for the container field.
 */

private void handleManifestmainclassBrowse() {

    String mainClass = getManifestmainclass();
    
    ILabelProvider lp= new WorkbenchLabelProvider();
    ITreeContentProvider cp= new WorkbenchContentProvider();

    IResource[] res=jproject.getResource();
    IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(res, true);
    SelectionDialog dialog = JavaUI.createMainTypeDialog(getShell(), getContainer(), searchScope, 0, false);
    dialog.setMessage("Select Main-Class for JAR file");
    dialog.setTitle("Fat Jar Config");
    
    if (dialog.open() == SelectionDialog.OK) {
        Object[] elements= dialog.getResult();
        if (elements.length == 1) {
            SourceType mainElement = (SourceType)elements[0];
            mainClass = mainElement.getFullyQualifiedName();
            manifestmainclassText.setText(mainClass);
        }
    }
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:28,代码来源:ConfigPage.java

示例10: 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;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:PropertiesPatternFilter.java

示例11: 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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:17,代码来源:IndexViewContentProvider.java

示例12: TranslatableTreeComposite

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
public TranslatableTreeComposite(Composite parent, ITreeContentProvider contentProvider, Object input, TranslatableSet languageSet, Set<TranslatableResourceBundle> updatedBundles) {
	super(parent, SWT.NONE);

	setLayout(new GridLayout(1, false));
	
	final TreeViewer viewer = new TreeViewer(this, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	treeControl = viewer.getTree(); 
	viewer.getTree().setHeaderVisible(true);
	viewer.getTree().setLinesVisible(true);
	viewer.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	viewer.setContentProvider(contentProvider);

	createTreeColumns(viewer, languageSet, updatedBundles);

	viewer.setInput(input);

	ColumnViewerToolTipSupport.enableFor(viewer);

	createButtonsSection(this, viewer, languageSet, updatedBundles).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:21,代码来源:TranslatableTreeComposite.java

示例13: CheckboxTreeAndListGroup

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
/**
 *	Creates an instance of this class.  Use this constructor if you wish to specify
 *	the width and/or height of the combined widget (to only hardcode one of the
 *	sizing dimensions, specify the other dimension's value as -1)
 * @param parent parent composite
 * @param rootObject
 * @param treeContentProvider
 * @param treeLabelProvider
 * @param listContentProvider
 * @param listLabelProvider
 * @param style
 * @param width the width
 * @param height the height
 */
public CheckboxTreeAndListGroup(
		Composite parent,
		Object rootObject,
		ITreeContentProvider treeContentProvider,
		ILabelProvider treeLabelProvider,
		IStructuredContentProvider listContentProvider,
		ILabelProvider listLabelProvider,
		int style,
		int width,
		int height) {
	fRoot= rootObject;
	fTreeContentProvider= treeContentProvider;
	fListContentProvider= listContentProvider;
	fTreeLabelProvider= treeLabelProvider;
	fListLabelProvider= listLabelProvider;
	createContents(parent, width, height, style);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:CheckboxTreeAndListGroup.java

示例14: getQualification

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
private String getQualification(Object element) {
	StringBuffer res= new StringBuffer();

	ITreeContentProvider provider= (ITreeContentProvider) fPage.getViewer().getContentProvider();
	Object visibleParent= provider.getParent(element);
	Object realParent= fContentProvider.getParent(element);
	Object lastElement= element;
	while (realParent != null && !(realParent instanceof IJavaModel) && !realParent.equals(visibleParent)) {
		if (!isSameInformation(realParent, lastElement))  {
			res.append(JavaElementLabels.CONCAT_STRING).append(internalGetText(realParent));
		}
		lastElement= realParent;
		realParent= fContentProvider.getParent(realParent);
	}
	return res.toString();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:PostfixLabelProvider.java

示例15: isElementVisible

import org.eclipse.jface.viewers.ITreeContentProvider; //导入依赖的package包/类
@Override
public boolean isElementVisible(Viewer viewer, Object element) {
	boolean hasChildren= ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider()).hasChildren(element);
	if (fIsDeepFiltering) {
		if (!super.isElementVisible(viewer, element))
			return false;

		// Also apply deep filtering to the other registered filters
		ViewerFilter[] filters= ((TreeViewer)viewer).getFilters();
		for (int i= 0; i < filters.length; i++) {
			if (filters[i] == this)
				continue;
			if (!filters[i].select(viewer, element, element))
				return false;
		}
		return true;
	}
	return hasChildren || isLeafMatch(viewer, element);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:FilteredElementTreeSelectionDialog.java


注:本文中的org.eclipse.jface.viewers.ITreeContentProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。