org.eclipse.jface.viewers.ListViewer Java Examples
The following examples show how to use
org.eclipse.jface.viewers.ListViewer.
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: N4JSTestedProjectWizardPage.java From n4js with Eclipse Public License 1.0 | 6 votes |
@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(ViewerProperties.multipleSelection().observe(projectListViewer), PojoProperties.list(N4JSProjectInfo.class, N4JSProjectInfo.TESTED_PROJECT_PROP_NAME) .observe(projectInfo)); setControl(listComposite); }
Example #2
Source File: SimpleWidgetProvider.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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; }
Example #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
Source File: JavaBrowsingContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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); } } }); }
Example #10
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 #11
Source File: KeywordTab.java From cdt-proc with Eclipse Public License 1.0 | 5 votes |
private void setupList(ListViewer list, String value) { list.getList().removeAll(); StringTokenizer st = new StringTokenizer(value, PreferenceConstants.PREF_STORE_DELIMITER); while (st.hasMoreTokens()) { String key = st.nextToken(); if (!key.isEmpty()) { list.add(key); } } }
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: 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 #14
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 #15
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 #16
Source File: ColumnCategoriesDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override public void populateDialogArea(Composite parent) { GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); parent.setLayout(new GridLayout(4, false)); // Labels createLabels(parent, "Available columns", "Selected columns"); GridData gridData = GridDataFactory.fillDefaults().grab(true, true).create(); // Left tree - column categories treeViewer = new TreeViewer(parent); populateAvailableTree(); treeViewer.getControl().setLayoutData(gridData); // Add/remove buttons Composite buttonComposite = new Composite(parent, SWT.NONE); buttonComposite.setLayout(new GridLayout(1, true)); createAddButton(buttonComposite); createRemoveButton(buttonComposite); addListenersToTreeViewer(); // Right list - selected columns listViewer = new ListViewer(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); populateSelectedList(); addListenersToListViewer(); // Up/down buttons Composite upDownbuttonComposite = new Composite(parent, SWT.NONE); upDownbuttonComposite.setLayout(new GridLayout(1, true)); createUpButton(upDownbuttonComposite); createDownButton(upDownbuttonComposite); }
Example #17
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 #18
Source File: ColumnCategoriesDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void populateDialogArea(Composite parent) { GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); parent.setLayout(new GridLayout(4, false)); // Labels createLabels(parent, "Available columns", "Selected columns"); GridData gridData = GridDataFactory.fillDefaults().grab(true, true).create(); // Left tree - column categories treeViewer = new TreeViewer(parent); populateAvailableTree(); treeViewer.getControl().setLayoutData(gridData); // Add/remove buttons Composite buttonComposite = new Composite(parent, SWT.NONE); buttonComposite.setLayout(new GridLayout(1, true)); createAddButton(buttonComposite); createRemoveButton(buttonComposite); addListenersToTreeViewer(); // Right list - selected columns listViewer = new ListViewer(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); populateSelectedList(); addListenersToListViewer(); // Up/down buttons Composite upDownbuttonComposite = new Composite(parent, SWT.NONE); upDownbuttonComposite.setLayout(new GridLayout(1, true)); createUpButton(upDownbuttonComposite); createDownButton(upDownbuttonComposite); }
Example #19
Source File: JavaBrowsingContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void postAdd(final Object parent, final Object[] elements) { if (elements == null || elements.length <= 0) return; postRunnable(new Runnable() { public void run() { Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { Object[] newElements= getNewElements(elements); if (fViewer instanceof AbstractTreeViewer) { if (fViewer.testFindItem(parent) == null) { Object root= ((AbstractTreeViewer)fViewer).getInput(); if (root != null) ((AbstractTreeViewer)fViewer).add(root, newElements); } else ((AbstractTreeViewer)fViewer).add(parent, newElements); } else if (fViewer instanceof ListViewer) ((ListViewer)fViewer).add(newElements); else if (fViewer instanceof TableViewer) ((TableViewer)fViewer).add(newElements); if (fViewer.testFindItem(elements[0]) != null) fBrowsingPart.adjustInputAndSetSelection(elements[0]); } } }); }
Example #20
Source File: PrivilegeTab.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void createTab ( final TabFolder tabFolder ) { this.display = tabFolder.getDisplay (); this.item = new TabItem ( tabFolder, SWT.NONE ); this.item.setText ( "Privileges" ); this.viewer = new ListViewer ( tabFolder ); this.viewer.setContentProvider ( new ObservableSetContentProvider () ); this.item.setControl ( this.viewer.getControl () ); }
Example #21
Source File: InterfacesTab.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public void createTab ( final TabFolder tabFolder ) { this.item = new TabItem ( tabFolder, SWT.NONE ); this.item.setText ( Messages.InterfacesTab_TabItem_Label ); this.viewer = new ListViewer ( tabFolder ); this.item.setControl ( this.viewer.getControl () ); this.viewer.setContentProvider ( new ArrayContentProvider () ); }
Example #22
Source File: ConfigurationFormToolkit.java From neoscada with Eclipse Public License 1.0 | 5 votes |
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 () ); }
Example #23
Source File: JointDataSetPage.java From birt with Eclipse Public License 1.0 | 4 votes |
public void selectionChanged( SelectionChangedEvent event ) { selectionChanged = true; if ( event.getSource( ) instanceof ComboViewer ) { this.setPageMessage( Messages.getString( "JointDataSetPage.page.detail" ), //$NON-NLS-1$ IMessageProvider.NONE ); if ( ( (ComboViewer) event.getSource( ) ).equals( rightDataSetChooser ) ) leftSelected = false; else leftSelected = true; if ( ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ) instanceof DataSetHandle ) { DataSetHandle handle = (DataSetHandle) ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ); if ( leftSelected ) { leftDataSetName = handle.getQualifiedName( ); leftHandle = handle; } else { rightDataSetName = handle.getQualifiedName( ); rightHandle = handle; } DataSetViewData[] columsItems = null; try { DataSessionContext context = new DataSessionContext( DataSessionContext.MODE_DIRECT_PRESENTATION, handle.getModuleHandle( ) ); DataRequestSession session = DataRequestSession.newSession( context ); columsItems = DataSetProvider.getCurrentInstance( ) .populateAllCachedMetaData( handle, session ); populateColumns( columsItems ); session.shutdown( ); } catch ( BirtException e ) { ExceptionHandler.handle( e ); } } } else if ( event.getSource( ) instanceof ListViewer ) { if ( ( (ListViewer) event.getSource( ) ).equals( rightColumnList ) ) leftSelected = false; else leftSelected = true; if ( ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ) instanceof DataSetViewData ) { DataSetViewData itemModel = (DataSetViewData) ( (IStructuredSelection) event.getSelection( ) ).getFirstElement( ); if ( leftSelected ) leftColumnSelection = itemModel.getName( ); else rightColumnSelection = itemModel.getName( ); } } if ( !this.nameEditor.isDisposed( ) ) setPageComplete( canPageComplete( ) ); }
Example #24
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 #25
Source File: N4JSNewProjectWizardCreationPage.java From n4js with Eclipse Public License 1.0 | 4 votes |
private void initApiViewerBinding(DataBindingContext dbc, ListViewer apiViewer) { dbc.bindList( ViewerProperties.multipleSelection().observe(apiViewer), PojoProperties.list(N4JSProjectInfo.class, IMPLEMENTED_PROJECTS_PROP_NAME).observe(projectInfo)); }
Example #26
Source File: N4JSNewProjectWizardCreationPage.java From n4js with Eclipse Public License 1.0 | 4 votes |
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(getAvailableApiProjectNames()); 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; }
Example #27
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; }