public void addSelectedFilesToTargetList() { ISelection selection = sourceFileViewer.getSelection(); if (isValidSourceFileViewerSelection(selection)) { java.util.List list = null; if (selection instanceof IStructuredSelection) { list = ((IStructuredSelection) selection).toList(); if (list != null) { list = ((IStructuredSelection) selection).toList(); for (Iterator i = list.iterator(); i.hasNext(); ) { IResource resource = (IResource) i.next(); if (resource instanceof IFile) { // Check if its in the list. Don't add it if it is. String resourceName = resource.getFullPath().toString(); if (selectedListBox.indexOf(resourceName) == -1) selectedListBox.add(resourceName); } } setFiles(selectedListBox.getItems()); } setAddButtonEnabled(false); if (selectedListBox.getItemCount() > 0) { removeAllButton.setEnabled(true); if (isFileMandatory) setPageComplete(true); if (selectedListBox.getSelectionCount() > 0) setRemoveButtonEnabled(true); else setRemoveButtonEnabled(false); } } } }
private void delete() { String[] result = wResult.getSelection(); for (int i = 0; i < result.length; i++) { int idx = wResult.indexOf(result[i]); if (idx >= 0 && idx < mappings.size()) { mappings.remove(idx); } } refreshMappings(); }
/** * Sets the contents of the receiver's text field to the given string. * * <p>Note: The text field in a <code>Combo</code> is typically only capable of displaying a * single line of text. Thus, setting the text to a string containing line breaks or other special * characters will probably cause it to display incorrectly. * * @param string the new text * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setText(String string) { checkWidget(); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int index = list.indexOf(string); if (index == -1) { list.deselectAll(); text.setText(string); return; } text.setText(string); text.selectAll(); list.setSelection(index); list.showSelection(); }
/** * Searches the receiver's list starting at the given, zero-relative index until an item is found * that is equal to the argument, and returns the index of that item. If no item is found or the * starting index is out of range, returns -1. * * @param string the search item * @param start the zero-relative index at which to begin the search * @return the index of the item * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT - if the string is null * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public int indexOf(String string, int start) { checkWidget(); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return list.indexOf(string, start); }
public int indexOf(Node resultNode) { return listIntermediary.indexOf(getQualifiedName(resultNode)); }