Java Code Examples for org.eclipse.ui.dialogs.ListSelectionDialog#getResult()
The following examples show how to use
org.eclipse.ui.dialogs.ListSelectionDialog#getResult() .
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: EPackageChooser.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public List<EPackageInfo> open() { final Iterable<IResource> resourcesContainingGenModels = findResourcesContainingGenModels(); ListSelectionDialog listSelectionDialog = new ListSelectionDialog(shell, resourcesContainingGenModels, new ContentProvider(), new LabelProvider(), Messages.EPackageChooser_ChooseGenModel); int result = listSelectionDialog.open(); if (result == Window.OK) { List<EPackageInfo> ePackageInfos = Lists.newArrayList(); for (Object selection : listSelectionDialog.getResult()) { if (selection instanceof IFile) { IFile file = (IFile) selection; URI genModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true); ePackageInfos.addAll(createEPackageInfosFromGenModel(genModelURI)); } } return ePackageInfos; } return Collections.emptyList(); }
Example 2
Source File: ProjectsWorkbookPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private CPListElement[] addProjectDialog() { try { Object[] selectArr= getNotYetRequiredProjects(); new JavaElementComparator().sort(null, selectArr); ListSelectionDialog dialog= new ListSelectionDialog(getShell(), Arrays.asList(selectArr), new ArrayContentProvider(), new JavaUILabelProvider(), NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message); dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { Object[] result= dialog.getResult(); CPListElement[] cpElements= new CPListElement[result.length]; for (int i= 0; i < result.length; i++) { IJavaProject curr= (IJavaProject) result[i]; cpElements[i]= new CPListElement(fCurrJProject, IClasspathEntry.CPE_PROJECT, curr.getPath(), curr.getResource()); } return cpElements; } } catch (JavaModelException e) { return null; } return null; }
Example 3
Source File: SaveUtils.java From txtUML with Eclipse Public License 1.0 | 5 votes |
private static Object[] openSaveDialog(Shell shell, Collection<IEditorPart> editors) { ListSelectionDialog lsd = new ListSelectionDialog(shell, editors, new ArrayContentProvider(), getLabelProvider(), "Select resources to save:"); lsd.setInitialSelections(editors.toArray()); lsd.setTitle("Save and Launch"); lsd.open(); return lsd.getResult(); }
Example 4
Source File: IDEClassPathBlock.java From birt with Eclipse Public License 1.0 | 5 votes |
private IDECPListElement[] addProjectDialog( ) { try { Object[] selectArr = getNotYetRequiredProjects( ); new JavaElementComparator( ).sort( null, selectArr ); ListSelectionDialog dialog = new ListSelectionDialog( getShell( ), Arrays.asList( selectArr ), new ArrayContentProvider( ), new ProjectLabelProvider( ), Messages.getString("IDEClassPathBlock.ProjectDialog_message") ); //$NON-NLS-1$ dialog.setTitle( Messages.getString("IDEClassPathBlock.ProjectDialog_title") ); //$NON-NLS-1$ dialog.setHelpAvailable( false ); if ( dialog.open( ) == Window.OK ) { Object[] result = dialog.getResult( ); IDECPListElement[] cpElements = new IDECPListElement[result.length]; for ( int i = 0; i < result.length; i++ ) { IJavaProject curr = ( (IJavaProject) result[i] ); cpElements[i] = new IDECPListElement( IClasspathEntry.CPE_PROJECT, curr.getPath( ), curr.getResource( ) ); } return cpElements; } } catch ( JavaModelException e ) { return null; } return null; }
Example 5
Source File: SVNDecoratorPreferencesPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Add another variable to the given target. The variable is inserted at current position * A ListSelectionDialog is shown and the choose the variables to add */ private void addVariables(Text target, Map bindings) { final List variables = new ArrayList(bindings.size()); ILabelProvider labelProvider = new LabelProvider() { public String getText(Object element) { return ((StringPair)element).s1 + " - " + ((StringPair)element).s2; //$NON-NLS-1$ } }; IStructuredContentProvider contentsProvider = new IStructuredContentProvider() { public Object[] getElements(Object inputElement) { return variables.toArray(new StringPair[variables.size()]); } public void dispose() {} public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} }; for (Iterator it = bindings.keySet().iterator(); it.hasNext();) { StringPair variable = new StringPair(); variable.s1 = (String) it.next(); // variable variable.s2 = (String) bindings.get(variable.s1); // description variables.add(variable); } ListSelectionDialog dialog = new ListSelectionDialog( this.getShell(), this, contentsProvider, labelProvider, Policy.bind("SVNDecoratorPreferencesPage.selectVariablesToAdd")); //$NON-NLS-1$ dialog.setTitle(Policy.bind("SVNDecoratorPreferencesPage.AddVariables")); //$NON-NLS-1$ if (dialog.open() != ListSelectionDialog.OK) return; Object[] result = dialog.getResult(); for (int i = 0; i < result.length; i++) { target.insert("{"+((StringPair)result[i]).s1 +"}"); //$NON-NLS-1$ //$NON-NLS-2$ } }