private void clearHistory(BuildJob[] buildJobs, BuildJob[] selectedJobs) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); ListSelectionDialog dialog = new ListSelectionDialog(shell, buildJobs, ArrayContentProvider.getInstance(), new BuildJobLabelProvider(), "Select Doxyfiles you want to remove from history"); dialog.setTitle("Clear History"); if ((selectedJobs != null) && (selectedJobs.length > 0)) { dialog.setInitialSelections(selectedJobs); } if (dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if (result.length > 0) { BuildJob[] clearJobs = new BuildJob[result.length]; System.arraycopy(result, 0, clearJobs, 0, result.length); Plugin.getDefault().getBuildManager().removeAll(clearJobs); } } }
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; }
public FilesChangedListDialog(Shell shell, Set<ChangedFile> differences, Git git, IJavaProject selection) { super(shell); this.items = differences; listSelectionDialog = new ListSelectionDialog(shell, differences, new ArrayContentProvider(), new LabelProvider(), Messages.FilesChangedListDialog_Changes); this.git = git; this.setSelection(selection); this.setHelpAvailable(false); setAuthor(Constants.ANONYMOUS); setCommitter(Constants.ANONYMOUS); Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.P_COMMIT_SIGNATURE_ACTIVE)) { if(getShell() != null) { getShell().redraw(); getShell().layout(); refreshView(); } } } }); }
/** * Creates the dialog for working set assignment. * * @param workingSets * All the working set the user should be able to select from * @param numberOfSelectedProjects * The number of selected projects */ private ListSelectionDialog createDialog(Collection<WorkingSet> workingSets, int numberOfSelectedProjects) { // Filter 'Other Projects' working set List<WorkingSet> selectableWorkingSets = workingSets.stream() .filter(set -> !set.getId().equals(WorkingSet.OTHERS_WORKING_SET_ID)).collect(Collectors.toList()); String message = String.format(DIALOG_SUBTITLE, numberOfSelectedProjects); ListSelectionDialog dialog = new NonEmptyListSelectionDialog(site.getShell(), selectableWorkingSets, ArrayContentProvider.getInstance(), WorkingSetLabelProvider.INSTANCE, message); dialog.setTitle(DIALOG_TITLE); return dialog; }
@Override protected String getNewInputObject() { final String[] currentItems = this.list.getItems(); final IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); final ILabelProvider labelProvider = new LabelProvider() { @Override public String getText(final Object element) { return (String) element; } }; final SimpleListContentProvider contentsProvider = new SimpleListContentProvider(); contentsProvider.setElements(this.sortedDifference(allProjects, currentItems)); final ListSelectionDialog dialog = new ListSelectionDialog(this.getShell(), this, contentsProvider, labelProvider, PROJECT_SELECTION_LABEL); if (dialog.open() != 0) { return null; } final Object[] result = dialog.getResult(); final int currentItemsLength = currentItems.length; final int resultLength = result.length; final String[] newItems = new String[currentItemsLength + resultLength]; System.arraycopy(currentItems, 0, newItems, 0, currentItemsLength); System.arraycopy(result, 0, newItems, currentItemsLength, result.length); this.list.setItems(newItems); return null; }
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(); }
private void computeModifications() { Set<ChangedFile> modifications = DescribeVersionsDialogUtil.computeModifications(this.getShell(), git, getOlderVersionText().getText(), getNewerVersionText().getText()); listSelectionDialog = new ListSelectionDialog(this.shellTmp.getShell(), modifications, new ArrayContentProvider(), new LabelProvider(), Messages.FilesChangedListDialog_Changes); items = modifications; if(items != null) { filesViewer.setInput(items.toArray()); } }
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; }
/** * 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$ } }
public ListSelectionDialog getListSelectionDialog() { return listSelectionDialog; }
public void setListSelectionDialog(ListSelectionDialog listSelectionDialog) { this.listSelectionDialog = listSelectionDialog; }