本文整理匯總了Java中org.eclipse.jface.viewers.ListViewer類的典型用法代碼示例。如果您正苦於以下問題:Java ListViewer類的具體用法?Java ListViewer怎麽用?Java ListViewer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ListViewer類屬於org.eclipse.jface.viewers包,在下文中一共展示了ListViewer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createControl
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void createControl(Composite parent) {
Composite listComposite = new Composite(parent, NONE);
listComposite.setLayout(new FillLayout());
ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI);
projectListViewer.setContentProvider(ArrayContentProvider.getInstance());
projectListViewer.setInput(getNonTestProjects());
// Data binding
DataBindingContext databindingContext = new DataBindingContext();
parent.addDisposeListener(e -> databindingContext.dispose());
databindingContext.bindList(ViewersObservables.observeMultiSelection(projectListViewer),
PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME)
.observe(projectInfo));
setControl(listComposite);
}
示例2: createViewer
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
@Override
protected ListViewer createViewer(Composite parent) {
ListViewer viewerObjs = new ListViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 5);
gd.widthHint = PREF_PAGE.WIDTH_HINT_PX;
viewerObjs.getControl().setLayoutData(gd);
viewerObjs.setContentProvider(ArrayContentProvider.getInstance());
viewerObjs.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((DbInfo) element).getName();
}
});
return viewerObjs;
}
示例3: createFileListViewer
import org.eclipse.jface.viewers.ListViewer; //導入依賴的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;
}
示例4: createMapSection
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
private void createMapSection() {
Section mapSection = toolkit.createSection(form.getBody(),
ExpandableComposite.TWISTIE | Section.DESCRIPTION | ExpandableComposite.TITLE_BAR);
mapSection.setText("Skirmish Maps");
mapSection.setExpanded(true);
mapSection.setDescription("A list of available skirmish maps.");
Composite mapComposite = toolkit.createComposite(mapSection);
GridLayout squadGridLayout = new GridLayout();
squadGridLayout.numColumns = 3;
mapComposite.setLayout(squadGridLayout);
listViewer = new ListViewer(mapComposite, SWT.WRAP | SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
listViewer.add(SkirmishMapsLookup.getInstance().getMaps().toArray());
listViewer.addSelectionChangedListener(new LoadMapImageSelectionListener());
GridData mapSize = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 5);
mapSize.minimumHeight = 300;
mapSize.heightHint = 300;
listViewer.getList().setLayoutData(mapSize);
mapSection.setClient(mapComposite);
}
示例5: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
@Override
protected Control createDialogArea(Composite container) {
Composite parent = (Composite) super.createDialogArea(container);
listViewer = new ListViewer(parent);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = convertHeightInCharsToPixels(15);
gd.widthHint = convertWidthInCharsToPixels(55);
org.eclipse.swt.widgets.List list = listViewer.getList();
list.setLayoutData(gd);
list.setFont(container.getFont());
if (values != null){
list.setItems(values);
}
if (list.getItemCount() > 0){
list.select(list.getItemCount() - 1);
}
addButtons(parent);
return parent;
}
示例6: postRemove
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
private void postRemove(final Object[] elements) {
if (elements.length <= 0)
return;
postRunnable(new Runnable() {
public void run() {
Control ctrl= fViewer.getControl();
if (ctrl != null && !ctrl.isDisposed()) {
if (fViewer instanceof AbstractTreeViewer)
((AbstractTreeViewer)fViewer).remove(elements);
else if (fViewer instanceof ListViewer)
((ListViewer)fViewer).remove(elements);
else if (fViewer instanceof TableViewer)
((TableViewer)fViewer).remove(elements);
}
}
});
}
示例7: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
setTitle(title);
setMessage("Select a class.", IMessageProvider.INFORMATION);
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
listViewer = new ListViewer(container, SWT.BORDER | SWT.V_SCROLL);
list = listViewer.getList();
list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
initValues();
return container;
}
示例8: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
/**
*
* {@inheritDoc}
*
* @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
setMessage("In order to execute your requested operation, you have to select a server.");
setTitle("Please select a Server");
final Composite area = (Composite) super.createDialogArea(parent);
final Composite container = new Composite(area, SWT.NONE);
container.setLayout(new GridLayout(1, false));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
listViewer = new ListViewer(container, SWT.BORDER | SWT.V_SCROLL);
final List list = listViewer.getList();
list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
listViewer.setContentProvider(ArrayContentProvider.getInstance());
labelProvider = new ServerInfoLabelProvider();
listViewer.setLabelProvider(labelProvider);
listViewer.setInput(servers);
if (servers.size() == 1) {
listViewer.setSelection(new StructuredSelection(servers.get(0)));
}
return area;
}
示例9: selectAll
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
private void selectAll(){
if(listViewer instanceof CheckboxTableViewer){
CheckboxTableViewer tv = (CheckboxTableViewer)listViewer;
if(!tv.getTable().isDisposed()){
tv.setAllChecked(true);
selectedObjects.clear();
for(T o : objects){
if(handleSelection(o)){
selectedObjects.add(o);
}
}
handleSelectionList(selectedObjects);
}
}
if(listViewer instanceof ListViewer){
ListViewer lv = (ListViewer)listViewer;
if(!lv.getList().isDisposed()){
lv.getList().selectAll();
}
}
}
示例10: createChartsComposite
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
private void createChartsComposite (Composite container)
{
Group grpResources = new Group(container, SWT.NONE);
grpResources.setText("Resources");
grpResources.setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashResources = new SashForm(grpResources, SWT.HORIZONTAL | SWT.SMOOTH);
sashResources.setSashWidth(8);
listViewer = new ListViewer(sashResources, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
listResources = listViewer.getList();// new List(sashResources,
// SWT.BORDER | SWT.H_SCROLL |
// SWT.V_SCROLL);
listViewer.setContentProvider(new ArrayContentProvider());
listViewer.setLabelProvider(new LabelProvider()
{
@Override
public String getText(Object element)
{
return element.toString().replaceFirst("-org.spotter.demo.app.", "");
}
});
canvasRes = new Canvas(sashResources, SWT.NONE);
sashResources.setWeights(new int[] {3, 7});
addCanvasListeners();
}
示例11: createPartControl
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
@Override
public void createPartControl(Composite parent) {
viewer = new ListViewer(parent);
viewer.setContentProvider(ArrayContentProvider.getInstance());
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
Task p = (Task) element;
return p.getSummary();
};
});
viewer.setInput(TaskService.getInstance().getTasks());
getSite().setSelectionProvider(viewer);
hookDoubleClickCommand();
}
示例12: createComponents
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
public void createComponents(Composite parent)
{
this.triggerList = new ListViewer(parent, SWT.V_SCROLL | SWT.BORDER);
triggerList.setContentProvider(ArrayContentProvider.getInstance());
triggerList.setLabelProvider(getTriggerLabelProvider());
triggerList.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 3));
triggerList.addSelectionChangedListener(this);
triggerList.setInput(getTriggers());
this.cmdTrAdd = WidgetFactory.createButton(parent, "Hinzufügen", SWT.PUSH);
cmdTrAdd.addListener(SWT.Selection, this);
this.cmdTrDel = WidgetFactory.createButton(parent, "Entfernen", SWT.PUSH);
cmdTrDel.addListener(SWT.Selection, this);
this.triggerPanel = new Composite(parent, SWT.BORDER);
triggerPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
triggerPanel.setLayout(new GridLayout(2, false));
this.triggerCombo = WidgetFactory.createComboViewer(
triggerPanel, "Typ", EventRegistry.getTriggerDescriptors(), false);
triggerCombo.addSelectionChangedListener(this);
triggerCombo.getControl().setEnabled(false);
}
示例13: createViewer
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
public StructuredViewer createViewer(Composite parent){
switch (type) {
case TYPE_TREE:
return new TreeViewer(parent, style);
case TYPE_LIST:
return new ListViewer(parent, style);
case TYPE_TABLE:
return new TableViewer(parent, style);
case TYPE_LAZYLIST:
TableViewer ret = new TableViewer(parent, style | SWT.VIRTUAL);
// ret.getTable().setItemCount(0);
return ret;
}
return null;
}
示例14: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
protected Control createDialogArea(Composite parent){
Composite composite = (Composite) super.createDialogArea(parent);
composite.setLayout(new GridLayout(1, false));
Label label = new Label(composite, SWT.NONE);
label.setText("Gruppe: " + group.getName());
viewer =
new ListViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
viewer.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
viewer.setContentProvider(new ItemsContentProvider());
viewer.setLabelProvider(new ItemsLabelProvider());
viewer.setInput(this);
return composite;
}
示例15: createListSection
import org.eclipse.jface.viewers.ListViewer; //導入依賴的package包/類
public void createListSection ( final ScrolledForm form, final ConfigurationEditorInput input, final String attribute, final String label, final String delimiter, final String pattern )
{
final IObservableList list = StringSplitListObservable.observeString ( Observables.observeMapEntry ( input.getDataMap (), attribute, String.class ), delimiter, pattern );
// section
final Section section = this.toolkit.createSection ( form.getBody (), ExpandableComposite.TITLE_BAR );
section.setText ( label );
final Composite client = this.toolkit.createComposite ( section, SWT.NONE );
section.setClient ( client );
this.toolkit.paintBordersFor ( client );
client.setLayout ( new GridLayout ( 1, true ) );
final GridData gd = new GridData ( GridData.FILL_BOTH );
gd.horizontalSpan = 2;
section.setLayoutData ( gd );
// fields
final ListViewer viewer = new ListViewer ( client );
viewer.setContentProvider ( new ObservableListContentProvider () );
viewer.setInput ( list );
viewer.getControl ().setLayoutData ( new GridData ( GridData.FILL_BOTH ) );
viewer.setSorter ( new ViewerSorter () );
}