Java Code Examples for org.eclipse.jface.viewers.ListViewer#setLabelProvider()
The following examples show how to use
org.eclipse.jface.viewers.ListViewer#setLabelProvider() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SVNWizardPage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 2
Source File: UnansweredDocumentsView.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
public UnansweredDocumentsView(Composite parent, IWorkbenchPartSite site, Supplier<Questionnaire> questionnaireSupplier, Supplier<IProject> projectSupplier) { this.questionnaireSupplier = questionnaireSupplier; this.projectSupplier = projectSupplier; incompleteDocumentsLabel = new Label(parent, 0); incompleteDocumentsLabel.setText(TEMPLATE_ANSWERS_COMPLETE); incompleteDocumentsLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); incompleteDocumentsList = new ListViewer(parent, SWT.V_SCROLL); GridData gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1); gd.heightHint = (int) (((org.eclipse.swt.widgets.List) incompleteDocumentsList.getControl()).getItemHeight() * 4); gd.widthHint = 300; incompleteDocumentsList.getControl().setLayoutData(gd); incompleteDocumentsList.getControl().setVisible(false); incompleteDocumentsList.setSorter(new ViewerSorter()); incompleteDocumentsList.setContentProvider(ArrayContentProvider.getInstance()); incompleteDocumentsList.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((Document) element).getKey(); } }); site.setSelectionProvider(incompleteDocumentsList); }
Example 3
Source File: TaskOverview.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
@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(); }
Example 4
Source File: FileStoreSelectDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createListViewer(final Composite listComposite) { fileStoreListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); fileStoreListViewer.getList().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).create()); fileStoreListViewer.setContentProvider(new ArrayContentProvider()); fileStoreListViewer.setLabelProvider(new FileStoreLabelProvider()); final IRepositoryStore<?> ars = (IRepositoryStore<?>) RepositoryManager.getInstance() .getRepositoryStore(getRepositoryStoreClass()); fileStoreListViewer.setInput(ars.getChildren()); fileStoreListViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { final boolean empty = event.getSelection().isEmpty(); getButton(IDialogConstants.OK_ID).setEnabled(!empty); removeButton.setEnabled(!empty); selected = (AbstractFileStore) ((IStructuredSelection) event.getSelection()).getFirstElement(); } }); fileStoreListViewer.getList().setFocus(); }
Example 5
Source File: DocumentPropertySection.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private ListViewer createList(final Composite mainComposite) { final List list = getWidgetFactory().createList(mainComposite, SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); list.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final ListViewer documentListViewer = new ListViewer(list); documentListViewer.setLabelProvider(new ElementForIdLabelProvider()); documentListViewer.setContentProvider(new ObservableListContentProvider()); documentListViewer.addDoubleClickListener(this); documentListViewer.addSelectionChangedListener(this); documentListViewer.getList().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { e.doit = false; removeDocuments(); } } }); return documentListViewer; }
Example 6
Source File: TransitionOrderingPropertySection.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createList(final Composite mainComposite) { final List list = getWidgetFactory().createList(mainComposite, SWT.BORDER | SWT.V_SCROLL); list.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 90).create()); listViewer = new ListViewer(list); listViewer.setContentProvider(new ObservableListContentProvider<Element>()); listViewer.setLabelProvider(new LabelProvider(){ @Override public String getText(final Object element) { if(element != null && element instanceof Connection){ final String transitionName = ((Connection) element).getName(); return transitionName +" -- "+((Connection) element).getTarget().getName(); } return super.getText(element); } }); listViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateButtonsEnablement(); } }); }
Example 7
Source File: OutlineDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createObjectListViewer(final Composite viewersComposite) { objectListViewer = new ListViewer(viewersComposite); objectListViewer.getList().setLayoutData(GridDataFactory.fillDefaults().hint(100,200).create()); objectListViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); objectListViewer.setContentProvider(new ArrayContentProvider()); objectListViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { final IStructuredSelection selection = (IStructuredSelection) event.getSelection(); final EObject selectedObject = (EObject)selection.getFirstElement(); final OutlineFilter filter =(OutlineFilter) outline.getFilters()[0]; filter.setElementToDisplay(selectedObject); if (outline!=null){ outline.refresh(true); } } }); objectListViewer.setInput(elementToDisplay); }
Example 8
Source File: WorkspaceMergeDialog.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * Create the table viewer for showing warnings. * * @param parent the parent composite of the table viewer * @return the table viewer */ private static ListViewer createWarningsTableViewer(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new FillLayout()); GridDataFactory.fillDefaults().span(2, 1).grab(true, true).exclude(true).applyTo(composite); final ListViewer tableViewer = new ListViewer(composite); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); tableViewer.setLabelProvider(new LabelProvider()); return tableViewer; }
Example 9
Source File: JointDataSetPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * create left composite for page * * @param composite */ private void createLeftGroup( Composite composite ) { leftGroup = new Group( composite, SWT.NONE ); leftGroup.setLayout( new FormLayout( ) ); leftGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) ); FormData data = new FormData( ); data.top = new FormAttachment( 0, 5 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 10, -5 ); leftDataSetChooser = new ComboViewer( leftGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); leftDataSetChooser.getCombo( ).setLayoutData( data ); DataSetComboProvider provider = new DataSetComboProvider( ); leftDataSetChooser.setContentProvider( provider ); leftDataSetChooser.setLabelProvider( provider ); leftDataSetChooser.setInput( dataSetList ); leftDataSetChooser.addSelectionChangedListener( this ); data = new FormData( ); data.top = new FormAttachment( leftDataSetChooser.getCombo( ), 10 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 100, -5 ); leftColumnList = new ListViewer( leftGroup, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER ); leftColumnList.getControl( ).setLayoutData( data ); ColumnProvider colProvider = new ColumnProvider( ); leftColumnList.setContentProvider( colProvider ); leftColumnList.setLabelProvider( colProvider ); leftColumnList.addSelectionChangedListener( this ); }
Example 10
Source File: JointDataSetPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * create right composite for page * * @param composite */ private void createRightGroup( Composite composite ) { rightGroup = new Group( composite, SWT.NONE ); rightGroup.setLayout( new FormLayout( ) ); rightGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) ); FormData data = new FormData( ); data.top = new FormAttachment( 0, 5 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 10, -5 ); rightDataSetChooser = new ComboViewer( rightGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); rightDataSetChooser.getControl( ).setLayoutData( data ); DataSetComboProvider provider = new DataSetComboProvider( ); rightDataSetChooser.setContentProvider( provider ); rightDataSetChooser.setLabelProvider( provider ); rightDataSetChooser.setInput( dataSetList ); rightDataSetChooser.addSelectionChangedListener( this ); data = new FormData( ); data.top = new FormAttachment( rightDataSetChooser.getControl( ), 10 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 100, -5 ); rightColumnList = new ListViewer( rightGroup, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER ); rightColumnList.getControl( ).setLayoutData( data ); ColumnProvider colProvider = new ColumnProvider( ); rightColumnList.setContentProvider( colProvider ); rightColumnList.setLabelProvider( colProvider ); rightColumnList.addSelectionChangedListener( this ); }
Example 11
Source File: GroovyEditorDocumentationDialogTray.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createFunctionCategories(final Composite parent) { final Composite catComposite = new Composite(parent, SWT.NONE); catComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); catComposite.setLayout(new GridLayout(1, true)); groovyHelpLinkFactory.createGroovyHelpLink(catComposite); final Label catTitle = new Label(catComposite, SWT.NONE); catTitle.setText(Messages.categoriesTitle); categoriesList = new ListViewer(catComposite, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE); categoriesList.setLabelProvider(new CategoryLabelProvider()); categoriesList.setContentProvider(new FunctionCategoriesProvider()); categoriesList.setInput( FunctionsRepositoryFactory.getFunctionCatgories(RepositoryManager.getInstance().getCurrentRepository())); categoriesList.getList().setSelection(0); final int categorieMinheight = categoriesList.getList().getItemHeight() * categoriesList.getList().getItemCount(); categoriesList.getList().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, categorieMinheight).create()); categoriesList.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { final IFunctionCategory cat = (IFunctionCategory) ((IStructuredSelection) event.getSelection()).getFirstElement(); functionsList.getViewer().setInput(cat); } }); }
Example 12
Source File: CatchLinkEventSectionContribution.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void createControl(final Composite composite, final TabbedPropertySheetWidgetFactory widgetFactory, final ExtensibleGridPropertySection extensibleGridPropertySection) { list = new ListViewer(composite, SWT.BORDER | SWT.V_SCROLL); list.getControl().setLayoutData(GridDataFactory.fillDefaults().hint(200, 55).grab(true, false).create()); list.setLabelProvider(new LinkLabelProvider()); list.setContentProvider(ArrayContentProvider.getInstance()); list.setInput(catchLinkElement.getFrom()); }
Example 13
Source File: AnnotateView.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * 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); } }
Example 14
Source File: HL7LabImportRulesPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
/** * Create contents of the preference page. * * @param parent */ @Override public Control createContents(Composite parent){ Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(2, false)); Label lblLabNoPathFlagMeansNonPath = new Label(composite, SWT.WRAP); lblLabNoPathFlagMeansNonPath .setText(Messages.HL7LabImportRulesPreferencePage_lblLabImportRulesHeader_text); ToolBarManager toolbarmgr = new ToolBarManager(); toolbarmgr.add(new AddMissingPathFlagMeansNonPathLaboratoryAction()); toolbarmgr.add(new RemoveMissingPathFlagMeansNonPathLaboratoryAction()); ToolBar toolbar = toolbarmgr.createControl(composite); toolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); new Label(composite, SWT.NONE); labMPathMNonPathListViewer = new ListViewer(composite, SWT.BORDER | SWT.V_SCROLL); labMPathMNonPathListViewer.setContentProvider(ArrayContentProvider.getInstance()); labMPathMNonPathListViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element){ if (element instanceof Kontakt) { return ((Kontakt) element).getLabel(); } return super.getText(element); } }); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); gridData.heightHint = 80; labMPathMNonPathListViewer.getList() .setLayoutData(gridData); labMPathMNonPathListViewer.setInput(findAllLabsWithPathFlagMissingMeansNonPathologic()); return container; }