本文整理汇总了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 () );
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
示例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();
}
示例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