本文整理汇总了Java中org.eclipse.jface.viewers.IStructuredContentProvider类的典型用法代码示例。如果您正苦于以下问题:Java IStructuredContentProvider类的具体用法?Java IStructuredContentProvider怎么用?Java IStructuredContentProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStructuredContentProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了IStructuredContentProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setColumnsViewerContent
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* Set the content of the ColumnsViewer
*
*/
private void setColumnsViewerContent( )
{
selectedColumnsViewer.setContentProvider( new IStructuredContentProvider( ) {
public Object[] getElements( Object inputElement )
{
if ( inputElement instanceof java.util.List )
{
return ( (java.util.List<?>) inputElement ).toArray( );
}
return new Object[0];
}
public void dispose( )
{
}
public void inputChanged( Viewer viewer, Object oldInput,
Object newInput )
{
}
} );
}
示例2: getContentProvider
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* Returns a content provider for the list dialog. It will return all projects in the workspace except the given
* project, plus any projects referenced by the given project which do no exist in the workspace.
*
* @return the content provider that shows the project content
*/
private IStructuredContentProvider getContentProvider() {
return new WorkbenchContentProvider() {
@Override
public Object[] getChildren(Object o) {
if (!(o instanceof IWorkspace)) {
return new Object[0];
}
// Collect all the projects in the workspace except the given project
IProject[] projects = ((IWorkspace) o).getRoot().getProjects();
List<IProject> applicableProjects = Lists.newArrayList();
Optional<? extends IN4JSEclipseProject> projectOpt = null;
for (IProject candidate : projects) {
projectOpt = n4jsCore.create(candidate);
if (projectOpt.isPresent() && projectOpt.get().exists()) {
applicableProjects.add(candidate);
}
}
return applicableProjects.toArray(new IProject[applicableProjects.size()]);
}
};
}
示例3: getContentProvider
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
@Override
protected IStructuredContentProvider getContentProvider() {
return new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
String[] ret = new String[folders.size()];
folders.toArray(ret);
return ret;
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
};
}
示例4: setTableViewer
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
IStructuredContentProvider iStructuredContentProvider, ITableLabelProvider iTableLabelProvider) {
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setColumnProperties(prop);
tableViewerTable = tableViewer.getTable();
tableViewerTable.setVisible(true);
tableViewerTable.setLinesVisible(true);
tableViewerTable.setHeaderVisible(true);
createTableColumns(tableViewerTable, prop);
editors = createCellEditorList(tableViewerTable, prop.length);
tableViewer.setCellEditors(editors);
TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);
return tableViewer;
}
示例5: createSourceTable
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
private void createSourceTable(SashForm sashForm) {
avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table_1 = avaliableFieldTableViewer.getTable();
table_1.setLinesVisible(true);
table_1.setHeaderVisible(true);
avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
return ((List) inputElement).toArray();
}
});
avaliableFieldTableViewer.setInput(schemaFields);
TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE);
TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn();
tblclmnNewColumn_2.setWidth(196);
tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER);
tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider());
attachDragListener();
}
示例6: setTableViewer
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
public TableViewer setTableViewer(TableViewer tableViewer, Composite composite, String[] prop,
IStructuredContentProvider iStructuredContentProvider) {
tableViewer.setContentProvider(iStructuredContentProvider);
tableViewer.setColumnProperties(prop);
tableViewerTable = tableViewer.getTable();
tableViewerTable.setVisible(true);
tableViewerTable.setLinesVisible(true);
tableViewerTable.setHeaderVisible(true);
createTableColumns(tableViewerTable, prop);
editors = createCellEditorList(tableViewerTable, prop.length);
tableViewer.setCellEditors(editors);
TableViewerEditor.create(tableViewer, new ColumnViewerEditorActivationStrategy(tableViewer),
ColumnViewerEditor.KEYBOARD_ACTIVATION | ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL);
return tableViewer;
}
示例7: createFileListViewer
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* Creates a ListViewer whose input is an array of IFiles.
*
* @param parent the parent of the viewer
* @param title the text for the title label
* @param heightHint the nominal height of the list
* @return the created list viewer
*/
public ListViewer createFileListViewer(Composite parent, String title, int heightHint) {
createLabel(parent, title);
ListViewer listViewer = new ListViewer(parent, SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
listViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
listViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
return ((IFile) element).getFullPath().toString();
}
});
listViewer.setSorter(new WorkbenchViewerSorter());
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = heightHint;
listViewer.getList().setLayoutData(data);
return listViewer;
}
示例8: getLabel
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
public String getLabel() {
String label= super.getLabel();
StructuredViewer viewer= getViewer();
if (viewer instanceof TableViewer) {
TableViewer tv= (TableViewer) viewer;
AbstractTextSearchResult result= getInput();
if (result != null) {
int itemCount= ((IStructuredContentProvider) tv.getContentProvider()).getElements(getInput()).length;
if (showLineMatches()) {
int matchCount= getInput().getMatchCount();
if (itemCount < matchCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_matches, new Object[]{label, new Integer(itemCount), new Integer(matchCount)});
}
} else {
int fileCount= getInput().getElements().length;
if (itemCount < fileCount) {
return Messages.format(SearchMessages.FileSearchPage_limited_format_files, new Object[]{label, new Integer(itemCount), new Integer(fileCount)});
}
}
}
}
return label;
}
示例9: createBooleanComboBox
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* createBooleanComboBox
* void
*/
private void createBooleanComboBox() {
cellEditor = new ComboBoxViewerCellEditor(tableViewer.getTable(), SWT.READ_ONLY);
((ComboBoxViewerCellEditor) cellEditor).setContenProvider(new IStructuredContentProvider() {
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
((ComboBoxViewerCellEditor) cellEditor).setInput(UICoreConstant.UMLSECTION_CONSTANTS__DEFAULT_VALUES_BOOLEAN);
}
示例10: getContentProvider
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* getContentProvider
*
* @return IStructuredContentProvider
*/
private IStructuredContentProvider getContentProvider() {
return new IStructuredContentProvider() {
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
return (Object[]) inputElement;
}
/**
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
};
}
示例11: XtextEObjectSearchDialog
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
public XtextEObjectSearchDialog(Shell parent, IXtextEObjectSearch searchEngine, ILabelProvider labelProvider) {
super(parent);
this.searchEngine = searchEngine;
this.labelProvider = labelProvider;
setTitle(Messages.XtextEObjectSearchDialog_TableLabelDialogTitle);
setMessage(Messages.XtextEObjectSearchDialog_TableLabelSearchControlLabel);
setAddCancelButton(true);
// super class needs an IStructuredContentProvider so we register this dummy and
// register the lazy one later
setContentProvider(new IStructuredContentProvider() {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object inputElement) {
return null;
}
});
setLabelProvider(labelProvider);
}
示例12: ProjectSelectionDialog
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
public ProjectSelectionDialog(Shell parentShell, Object input,
IStructuredContentProvider contentProvider,
ILabelProvider labelProvider, String message, String unifiedDiff) {
super(parentShell);
this.unifiedDiff = unifiedDiff;
featureController.getFeatures(VariantSyncPlugin.getDefault()
.getSupportProjectList());
setTitle(WorkbenchMessages.ListSelection_title);
inputElement = input;
projectSelectionDiaglog = this;
this.projectContentProvider = contentProvider;
this.featureContentProvider = new FeatureListViewerContentProvider();
this.projectLabelProvider = labelProvider;
this.featureLabelProvider = new LabelProvider();
if (message != null) {
setMessage(message);
} else {
setMessage(WorkbenchMessages.ListSelection_message);
}
}
示例13: getContentProvider
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
/**
* getContentProvider
*
* @return
*/
private IStructuredContentProvider getContentProvider()
{
return new BaseWorkbenchContentProvider()
{
/*
* (non-Javadoc)
* @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object)
*/
@Override
public Object[] getChildren(Object element)
{
if (element instanceof Set<?>)
{
return ((Set<?>) element).toArray();
}
return super.getChildren(element);
}
};
}
示例14: createControl
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
Composite composite = new EnsembleComposite(parent, SWT.NONE);
control = composite;
IStructuredContentProvider contentProvider = new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
EPlan plan = (EPlan) inputElement;
ResourceConditionsMember member = plan.getMember(ResourceConditionsMember.class);
return member.getConditions().toArray();
}
@Override
public void dispose() { /* empty */
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { /* empty */
}
};
inconsViewer = InconsTableUtils.getTableViewer(composite, contentProvider);
inconsViewer.setInput(plan);
setup();
}
示例15: CheckboxTreeAndListGroup
import org.eclipse.jface.viewers.IStructuredContentProvider; //导入依赖的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);
}