本文整理匯總了Java中org.eclipse.jface.viewers.ListViewer.setInput方法的典型用法代碼示例。如果您正苦於以下問題:Java ListViewer.setInput方法的具體用法?Java ListViewer.setInput怎麽用?Java ListViewer.setInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ListViewer
的用法示例。
在下文中一共展示了ListViewer.setInput方法的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: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: 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 () );
}
示例6: showLogTab
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
private static void showLogTab(String name) {
CTabItem tabItemLog = new CTabItem(tabLogFolder, SWT.NONE);
tabItemLog.setText(name);
tabItemLog.setImage(new Image(display, ClassLoader
.getSystemResourceAsStream("icons/log.png")));
//add contorl
listViewerLog = new ListViewer(tabLogFolder, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL
| SWT.H_SCROLL);
tabItemLog.setControl(listViewerLog.getList());
listViewerLog.getList().setFont(new Font(display, "宋體", 10, SWT.NONE));
//set content provider
listViewerLog.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
Vector v = (Vector) inputElement;
return v.toArray();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
listViewerLog.setInput(vectorLog);
}
示例7: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = (GridLayout) container.getLayout();
gridLayout.numColumns = 1;
container.setLayout(gridLayout);
Composite message = new Composite(container, SWT.NONE);
message.setLayout(new FillLayout());
message.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
createMessageArea(message);
listViewer = new ListViewer(container);
listViewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
listViewer.setLabelProvider(labelProvider);
listViewer.setContentProvider(new ArrayContentProvider());
listViewer.setInput(content);
listViewer.setSelection(new StructuredSelection(getInitialElementSelections()));
listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
setResult(selection.toList());
}
});
return container;
}
示例8: construct
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
public Control construct(Composite parent) {
Composite container = new Composite(parent, SWT.FILL);
container.setLayout(new GridLayout());
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
listViewer = new ListViewer(container);
listViewer.setContentProvider(new ObjectsContentProvider());
listViewer.setLabelProvider(new ObjectsLabelProvider());
listViewer.setInput(new ObjectsList());
listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
/*
* Mockup to test events on SWT List control
*/@Override
public void selectionChanged(SelectionChangedEvent event) {
String outString = "Select" + "\n";
txt.append(outString);
}
});
txt = new Text(container, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
txt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
txt.setFocus();
txt.setText("");
return null;
}
示例9: construct
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
/**
* This is a callback that will allow us to create the viewer and initialize
* it.
*/
public Control construct (Composite parent) {
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout());
c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
List list = new List(c, SWT.MULTI | SWT.LEFT_TO_RIGHT | SWT.BORDER);
list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
viewer = new ListViewer(list);
viewer.setContentProvider(ArrayContentProvider.getInstance());
// Provide the input to the ContentProvider
viewer.setInput(new String[] {"One", "Two", "Three", "Three fourty", "View FORM", "Edit FORM"});
List list2 = new List(c, SWT.MULTI | SWT.LEFT_TO_RIGHT | SWT.BORDER);
list2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
list2.setItems(new String[] {"One", "Two", "Three", "Three fourty", "View FORM", "Edit FORM"});
final Label l = new Label(c, SWT.NONE);
l.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
l.setText("a");
final Text text = new Text(c, SWT.BORDER);
text.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
//Text t = (Text) e.widget;
if (text.getText().trim().equals("test")) {
l.setText("test");
return;
}
l.setText("a");
}
});
return null;
}
示例10: initLibraryOptionsUI
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
private Composite initLibraryOptionsUI(DataBindingContext dbc, Composite parent) {
// Additional library project options
final Group libraryProjectOptionsGroup = new Group(parent, NONE);
libraryProjectOptionsGroup
.setLayout(GridLayoutFactory.fillDefaults().margins(12, 5).numColumns(2).equalWidth(false).create());
emptyPlaceholder(libraryProjectOptionsGroup);
final Button createGreeterFileButton = new Button(libraryProjectOptionsGroup, CHECK);
createGreeterFileButton.setText("Create a greeter file");
createGreeterFileButton.setLayoutData(GridDataFactory.fillDefaults().create());
new Label(libraryProjectOptionsGroup, SWT.NONE).setText("Implementation ID:");
final Text implementationIdText = new Text(libraryProjectOptionsGroup, BORDER);
implementationIdText.setLayoutData(fillDefaults().align(FILL, SWT.CENTER).grab(true, false).create());
final Label implementedProjectsLabel = new Label(libraryProjectOptionsGroup, SWT.NONE);
implementedProjectsLabel.setText("Implemented projects:");
implementedProjectsLabel
.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.LEFT, SWT.TOP).create());
final ListViewer apiViewer = new ListViewer(libraryProjectOptionsGroup, BORDER | MULTI);
apiViewer.getControl().setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).span(1, 1).create());
apiViewer.setContentProvider(ArrayContentProvider.getInstance());
apiViewer.setInput(getAvailableApiProjectIds());
initApiViewerBinding(dbc, apiViewer);
initImplementationIdBinding(dbc, implementationIdText);
initDefaultCreateGreeterBindings(dbc, createGreeterFileButton);
// Invalidate on change
apiViewer.addSelectionChangedListener(e -> {
setPageComplete(validatePage());
});
// Invalidate on change
implementationIdText.addModifyListener(e -> {
setPageComplete(validatePage());
});
return libraryProjectOptionsGroup;
}
示例11: createDialogArea
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(final Composite parent) {
// Superclass recommends this pattern
final Composite composite = (Composite) super.createDialogArea(parent);
final FormToolkit toolkit = searchControl.getToolkit();
SWTUtil.gridLayout(composite, 1, true, 0, 0);
mruControl = new ListViewer(composite, SWT.NONE);
GridDataBuilder.newInstance().hGrab().hFill().applyTo(mruControl.getList());
mruControl.setLabelProvider(new MRULabelProvider());
mruControl.setContentProvider(new PrefixMatchingContentProvider(searchControl));
mruControl.setInput(searchControl.getRecentSearches());
mruControl.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(final DoubleClickEvent event) {
search();
}
});
mruControl.getList().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
switch (e.keyCode) {
case SWT.CR:
search();
break;
}
}
});
separator = toolkit.createSeparator(composite, SWT.HORIZONTAL);
GridDataBuilder.newInstance().hGrab().hFill().applyTo(separator);
final Label instructions =
toolkit.createLabel(composite, Messages.getString("TeamExplorerSearchControlPopup.AddASearchFilter")); //$NON-NLS-1$
GridDataBuilder.newInstance().hGrab().hFill().hIndent(3).applyTo(instructions);
instructions.setEnabled(false);
final Composite filterBar = toolkit.createComposite(composite);
GridDataBuilder.newInstance().hGrab().hFill().applyTo(filterBar);
filterBar.setLayout(new RowLayout(SWT.HORIZONTAL));
createFilterHyperlink(
filterBar,
toolkit,
Messages.getString("TeamExplorerSearchControlPopup.AssignedTo"), //$NON-NLS-1$
"A", //$NON-NLS-1$
WIQLOperators.getLocalizedOperator(WIQLOperators.MACRO_ME),
Messages.getString("TeamExplorerSearchControlPopup.AssignedToTooltip")); //$NON-NLS-1$
createFilterHyperlink(
filterBar,
toolkit,
Messages.getString("TeamExplorerSearchControlPopup.CreatedBy"), //$NON-NLS-1$
"C", //$NON-NLS-1$
WIQLOperators.getLocalizedOperator(WIQLOperators.MACRO_ME),
Messages.getString("TeamExplorerSearchControlPopup.CreatedByTooltip")); //$NON-NLS-1$
createFilterHyperlink(
filterBar,
toolkit,
Messages.getString("TeamExplorerSearchControlPopup.State"), //$NON-NLS-1$
"S", //$NON-NLS-1$
"", //$NON-NLS-1$
Messages.getString("TeamExplorerSearchControlPopup.StateTooltip")); //$NON-NLS-1$
createFilterHyperlink(
filterBar,
toolkit,
Messages.getString("TeamExplorerSearchControlPopup.WorkItemType"), //$NON-NLS-1$
"T", //$NON-NLS-1$
"", //$NON-NLS-1$
Messages.getString("TeamExplorerSearchControlPopup.WorkItemTypeTooltip")); //$NON-NLS-1$
return composite;
}
示例12: showAnnotations
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
/**
* Show the annotation view.
* @param svnFile
* @param svnAnnotateBlocks
* @param contents
* @param useHistoryView
* @throws PartInitException
*/
public void showAnnotations(ISVNRemoteFile svnFile, Collection svnAnnotateBlocks, InputStream contents, boolean useHistoryView) throws PartInitException {
// Disconnect from old annotation editor
disconnect();
// Remove old viewer
Control[] oldChildren = top.getChildren();
if (oldChildren != null) {
for (int i = 0; i < oldChildren.length; i++) {
oldChildren[i].dispose();
}
}
viewer = new ListViewer(top, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider());
viewer.addSelectionChangedListener(this);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), IHelpContextIds.ANNOTATIONS_VIEW);
top.layout();
this.svnFile = svnFile;
this.contents = contents;
this.svnAnnotateBlocks = svnAnnotateBlocks;
page = SVNUIPlugin.getActivePage();
viewer.setInput(svnAnnotateBlocks);
editor = (ITextEditor) openEditor();
IDocumentProvider provider = editor.getDocumentProvider();
document = provider.getDocument(editor.getEditorInput());
setPartName(Policy.bind("SVNAnnotateView.showFileAnnotation", new Object[] {svnFile.getName()})); //$NON-NLS-1$
setTitleToolTip(svnFile.getName());
if (!useHistoryView) {
return;
}
// Get hook to the HistoryView
historyView = (IHistoryView)page.showView(ISVNUIConstants.HISTORY_VIEW_ID);
if (historyView != null) {
historyView.showHistoryFor(svnFile);
}
}
示例13: 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) {
Composite contents = new Composite(parent, SWT.NONE);
contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
contents.setLayout(new GridLayout());
Label lbl1 = new Label(contents, SWT.NONE);
lbl1.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
lbl1.setText("Selected Project:");
Label lblSelectedProj = new Label(contents, SWT.BORDER);
lblSelectedProj.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
lblSelectedProj.setText(selectedProjectSpace.getProjectName());
Label lbl3 = new Label(contents, SWT.NONE);
lbl3.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
lbl3.setText("Compare to:");
listViewer = new ListViewer(contents, SWT.SINGLE);
listViewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
listViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
List<? extends ESProject> projects = ESWorkspaceProviderImpl.getInstance().getWorkspace()
.getLocalProjects();
return projects.toArray();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
listViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
// TODO Auto-generated method stub
return ((ProjectSpace) element).getProjectName();
}
});
listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ProjectSpace secondProjectSpace = (ProjectSpace) (((StructuredSelection) event.getSelection())
.getFirstElement());
if (secondProjectSpace.equals(selectedProjectSpace)) {
CompareProjectsDialog.this.setErrorMessage("Selected projects must be different");
CompareProjectsDialog.this.getButton(CompareProjectsDialog.OK).setEnabled(false);
} else {
CompareProjectsDialog.this.setErrorMessage(null);
CompareProjectsDialog.this.getButton(CompareProjectsDialog.OK).setEnabled(true);
}
}
});
listViewer.setInput(new Object());
this.setTitle("Select a project from list to compare");
return contents;
}
示例14: createControl
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent)
{
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout());
ListViewer listViewer = new ListViewer(container);
listViewer.setContentProvider(new ArrayContentProvider());
listViewer.setLabelProvider(new WorkbenchLabelProvider());
listViewer.setInput(ExplorerProjectPaths.getCloudScaleProjects());
listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if(event.getSelection() instanceof StructuredSelection){
StructuredSelection ss = (StructuredSelection)event.getSelection();
if(ss != null){
Object selection = ss.getFirstElement();
if(selection instanceof IProject){
if(handleSelection((IProject)selection)){
project = (IProject)selection;
setPageComplete(true);
return;
}
}
}
setPageComplete(false);
}
}
});
setPageComplete(false);
setControl(container);
}
示例15: createContents
import org.eclipse.jface.viewers.ListViewer; //導入方法依賴的package包/類
@Override
protected Control createContents(Composite parent){
Composite mainArea = new Composite(parent, SWT.NONE);
mainArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 2;
layout.leftMargin = 0;
layout.rightMargin = 0;
layout.topMargin = 0;
layout.bottomMargin = 0;
mainArea.setLayout(layout);
TableWrapData twd;
Label label;
Text infoText = new Text(mainArea, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
infoText.setLayoutData(SWTHelper.getFillTableWrapData(2, true, 1, false));
infoText.setText("Bitte wählen Sie die Labors aus, für welche Sie die Werte"
+ " in der Praxis selber ermitteln.");
label = new Label(mainArea, SWT.NONE);
label.setText("Praxislabors:");
ownLaborsList = new ListViewer(mainArea, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
List list = ownLaborsList.getList();
twd = SWTHelper.getFillTableWrapData(1, true, 1, false);
twd.heightHint = VISIBLE_NUMBER_OF_LABORS * list.getItemHeight();
list.setLayoutData(twd);
ownLaborsList.setContentProvider(new LaborsListContentProvider());
ownLaborsList.setLabelProvider(new LaborsListLabelProvider());
ownLaborsList.setInput(this);
Label lblNoCols = new Label(mainArea, SWT.NONE);
lblNoCols.setText("Spalten pro Seite:");
spinnerNoCol = new Spinner(mainArea, SWT.BORDER);
spinnerNoCol.setPageIncrement(1);
spinnerNoCol.setMaximum(10);
spinnerNoCol.setMinimum(1);
spinnerNoCol.setSelection(7);
loadFromConfig();
return mainArea;
}