protected void onDeleteClicked() { if (selectedConfigsList.getSelectionCount() == 0) { return; } String[] selection = selectedConfigsList.getSelection(); StringBuilder b = new StringBuilder(); for (String item : selection) { if (b.length() > 0) { b.append(", "); } b.append(item); } int response = ask( "Are you shure you want to remove [" + b.toString() + "]?", "Removing launch configuration"); if (response != SWT.YES) { return; } selectedConfigsList.remove(selectedConfigsList.getSelectionIndices()); for (String item : selection) { if (allConfigNames.contains((String) item)) { availableConfigsCombo.add(item); } } updateButtonsState(); updateLaunchConfigurationDialog(); }
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 add() { if (wSource.getSelectionCount() == 1 && wTarget.getSelectionCount() == 1) { String sourceString = wSource.getSelection()[0]; String targetString = wTarget.getSelection()[0]; int srcIndex = Const.indexOfString(sourceString, sourceList); int tgtIndex = Const.indexOfString(targetString, targetList); if (srcIndex >= 0 && tgtIndex >= 0) { // New mapping: add it to the list... SourceToTargetMapping mapping = new SourceToTargetMapping(srcIndex, tgtIndex); mappings.add(mapping); refreshMappings(); } } }
private void ok() { if (wSelection.getSelectionCount() > 0) { selection = wSelection.getSelection()[0]; selectionNr = wSelection.getSelectionIndices()[0]; if (quickSearch) { for (int i = 0; i < choices.length; i++) { if (choices[i].equals(selection)) { selectionNr = i; } } } // We need to handle the indices properly. If a filter is applied, the wSelection will differ // from choices // So we have to get the current index from choices and store it in the indices String[] selections = wSelection.getSelection(); boolean found = false; indices = new int[selections.length]; for (int i = 0; i < selections.length; i++) { found = false; for (int j = 0; j < choices.length; j++) { if (selections[i].equals(choices[j])) { indices[i] = j; found = true; break; } } } if (!found) { indices = wSelection.getSelectionIndices(); } } else { selection = null; selectionNr = -1; indices = new int[0]; } dispose(); }
protected void updateButtonsState() { add.setEnabled(availableConfigsCombo.getSelectionIndex() >= 0); delete.setEnabled(selectedConfigsList.getSelectionCount() > 0); }