org.eclipse.ui.model.BaseWorkbenchContentProvider Java Examples
The following examples show how to use
org.eclipse.ui.model.BaseWorkbenchContentProvider.
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: CheckNodeTreeView.java From depan with Apache License 2.0 | 6 votes |
@Override protected CheckboxTreeViewer createTreeViewer(Composite parent) { int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL; CheckboxTreeViewer result = new CheckboxTreeViewer(parent, style); result.setLabelProvider(new WorkbenchLabelProvider()); result.setContentProvider(new BaseWorkbenchContentProvider()); result.setComparator(new NodeWrapperTreeSorter()); result.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (recursiveTreeSelect) { tree.setSubtreeChecked(event.getElement(), event.getChecked()); } } }); tree = result; return result; }
Example #2
Source File: ProjectBuildPathPropertyPage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * getContentProvider * * @return */ private IStructuredContentProvider getContentProvider() { return new BaseWorkbenchContentProvider() { /* * (non-Javadoc) * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object) */ @Override public Object[] getChildren(Object element) { if (element instanceof Set<?>) { return ((Set<?>) element).toArray(); } return super.getChildren(element); } }; }
Example #3
Source File: ResourceCloseManagement.java From birt with Eclipse Public License 1.0 | 6 votes |
private static boolean showSaveDirtyFileDialog( List<IEditorPart> dirtyEditors ) { AdaptableList input = new AdaptableList( dirtyEditors ); ListDialog dlg = new ListDialog( PlatformUI.getWorkbench( ) .getActiveWorkbenchWindow( ) .getShell( ) ); dlg.setContentProvider( new BaseWorkbenchContentProvider( ) ); dlg.setLabelProvider( new WorkbenchPartLabelProvider( ) ); dlg.setInput( input ); dlg.setMessage( Messages.getString( "renameChecker.saveResourcesMessage" ) ); //$NON-NLS-1$ dlg.setTitle( Messages.getString( "renameChecker.saveResourcesTitle" ) ); //$NON-NLS-1$ // Just return false to prevent the operation continuing return dlg.open( ) == IDialogConstants.OK_ID; }
Example #4
Source File: InputComponent.java From corrosion with Eclipse Public License 2.0 | 5 votes |
public void createProjectSelection() { createSelectionButton(); browseButton.addSelectionListener(widgetSelectedAdapter(e -> { ListSelectionDialog dialog = new ListSelectionDialog(browseButton.getShell(), ResourcesPlugin.getWorkspace().getRoot(), new BaseWorkbenchContentProvider(), new WorkbenchLabelProvider(), this.labelString); dialog.setTitle(Messages.LaunchUI_selection); int returnCode = dialog.open(); Object[] results = dialog.getResult(); if (returnCode == 0 && results.length > 0) { text.setText(((IProject) results[0]).getName()); editListener.modifyText(null); } })); }
Example #5
Source File: BuilderPropertyPage.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void addAddBtn(final Composite btnComposite) { Button add = new Button(btnComposite, SWT.FLAT); GridDataFactory.fillDefaults().grab(true, false).hint(100, SWT.DEFAULT).applyTo(add); add.setText("Add..."); add.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(btnComposite.getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider()); dialog.setValidator(new CheaderBlacklistSelectionStatusValidator()); dialog.setTitle("Add blacklist item"); dialog.setMessage("Select a blacklist item:"); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.addFilter(new CHeaderViewerFilter(getActualProject())); if (!values.isEmpty()) dialog.setInitialSelection(values.get(values.size() - 1)); dialog.setDialogBoundsSettings(BuilderActivator.getDefault().getDialogSettings(), Dialog.DIALOG_PERSISTLOCATION); dialog.open(); Object[] result = dialog.getResult(); if (result != null) { for (Object selection : result) { if (selection instanceof IResource) { values.add((IResource) selection); } } blackListViewer.refresh(); } } }); }
Example #6
Source File: GraphNodeViewer.java From depan with Apache License 2.0 | 5 votes |
/** * Can be overridden to provide a customized tree viewer. * For example, the derived type {@link CheckNodeTreeView} * uses a {@code CheckboxTreeViewer}. */ protected TreeViewer createTreeViewer(Composite parent) { int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL; TreeViewer result = new TreeViewer(parent, style); result.setLabelProvider(new WorkbenchLabelProvider()); result.setContentProvider(new BaseWorkbenchContentProvider()); result.setComparator(SORTER); setupHierarchyMenu(result); return result; }
Example #7
Source File: WizardFolderImportPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Returns a content provider for the list dialog. The content provider will include all available natures as * strings. * * @return the content provider that shows the natures (as string children) */ private IStructuredContentProvider getContentProvider() { return new BaseWorkbenchContentProvider() { @Override public Object[] getChildren(Object o) { if (!(o instanceof IWorkspace)) { return new Object[0]; } Set<String> elements = new HashSet<String>(); // collect all available natures in the workspace IProjectNatureDescriptor[] natureDescriptors = ((IWorkspace) o).getNatureDescriptors(); String natureId; for (IProjectNatureDescriptor descriptor : natureDescriptors) { natureId = descriptor.getNatureId(); if (natureId != null) { if (ResourceUtil.isAptanaNature(natureId)) { elements.add(natureId); fNatureDescriptions.put(natureId, descriptor.getLabel()); } } } return elements.toArray(); } }; }
Example #8
Source File: CrossflowElementChooserDialog.java From scava with Eclipse Public License 2.0 | 4 votes |
/** * @generated */ @Override public ITreeContentProvider getTreeContentProvider() { return new BaseWorkbenchContentProvider(); }
Example #9
Source File: ProjectNaturesPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Returns a content provider for the list dialog. The content provider will include all available natures as * strings. * * @return the content provider that shows the natures (as string children) */ private IStructuredContentProvider getContentProvider() { return new BaseWorkbenchContentProvider() { @Override public Object[] getChildren(Object o) { if (!(o instanceof IWorkspace)) { return new Object[0]; } Set<String> elements = new HashSet<String>(); // collect all available natures in the workspace IProjectNatureDescriptor[] natureDescriptors = ((IWorkspace) o).getNatureDescriptors(); String natureId; for (IProjectNatureDescriptor descriptor : natureDescriptors) { natureId = descriptor.getNatureId(); if (natureId != null) { if (ResourceUtil.isAptanaNature(natureId)) { elements.add(natureId); fNatureDescriptions.put(natureId, descriptor.getLabel()); } } } // add any natures that exist in the project but not in the // workbench // (this could happen when importing a project from a different // workspace or when the nature provider // got uninstalled) for (String nature : fCurrentProjectNatures) { if (elements.add(nature)) { // since we don't have the nature descriptor here, just // use the nature id for the value instead fNatureDescriptions.put(nature, nature); } } return elements.toArray(); } }; }