Java Code Examples for org.eclipse.jface.viewers.ListViewer#addSelectionChangedListener()
The following examples show how to use
org.eclipse.jface.viewers.ListViewer#addSelectionChangedListener() .
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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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); } }