1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[203361] Deleting multiple target connections misleading

This commit is contained in:
David McKnight 2009-04-20 18:45:15 +00:00
parent 373680288a
commit cbbb092074
2 changed files with 35 additions and 8 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
@ -18,11 +18,11 @@
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
* David McKnight (IBM) - [234030] SystemCommonDeleteAction should not fire delete event if deleting is failed * David McKnight (IBM) - [234030] SystemCommonDeleteAction should not fire delete event if deleting is failed
* David McKnight (IBM) - [203361] Deleting multiple target connections misleading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.actions; package org.eclipse.rse.internal.ui.actions;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -334,11 +334,11 @@ public class SystemCommonDeleteAction
List localSet = new Vector(); List localSet = new Vector();
// divide up all objects to delete // divide up all objects to delete
IStructuredSelection ssel = (IStructuredSelection)selection; List selectedResources = ((SystemDeleteDialog)dlg).getSelectedResources();
Iterator iter = ssel.iterator();
while (iter.hasNext()) for (int i = 0; i < selectedResources.size(); i++)
{ {
Object object = iter.next(); Object object = selectedResources.get(i);
ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(object); ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(object);
if (getRemoteAdapter(object) != null) if (getRemoteAdapter(object) != null)
{ {

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others. * Copyright (c) 2002, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -14,9 +14,13 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
* David McKnight (IBM) - [203361] Deleting multiple target connections misleading
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.ui.dialogs; package org.eclipse.rse.internal.ui.dialogs;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.ColumnLayoutData; import org.eclipse.jface.viewers.ColumnLayoutData;
import org.eclipse.jface.viewers.ColumnPixelData; import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ColumnWeightData;
@ -43,6 +47,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
/** /**
* Dialog for confirming resource deletion. * Dialog for confirming resource deletion.
@ -66,6 +71,7 @@ public class SystemDeleteDialog extends SystemPromptDialog
private Table table; private Table table;
private TableViewer tableViewer; private TableViewer tableViewer;
private GridData tableData; private GridData tableData;
private List _selectedResources;
// column headers // column headers
private String columnHeaders[] = { private String columnHeaders[] = {
@ -219,12 +225,18 @@ public class SystemDeleteDialog extends SystemPromptDialog
Object input = getInputObject(); Object input = getInputObject();
tableViewer.setInput(input); tableViewer.setInput(input);
// check all off
TableItem[] items = tableViewer.getTable().getItems();
for (int i = 0; i < items.length; i++){
items[i].setChecked(true);
}
return composite; return composite;
} }
private TableViewer createTableViewer(Composite parent, int nbrColumns) private TableViewer createTableViewer(Composite parent, int nbrColumns)
{ {
table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION); table = new Table(parent, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION);
table.setLinesVisible(true); table.setLinesVisible(true);
tableViewer = new TableViewer(table); tableViewer = new TableViewer(table);
tableData = new GridData(); tableData = new GridData();
@ -273,9 +285,24 @@ public class SystemDeleteDialog extends SystemPromptDialog
*/ */
protected boolean processOK() protected boolean processOK()
{ {
_selectedResources = new ArrayList();
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i++){
if (items[i].getChecked()){
SystemDeleteTableRow row = (SystemDeleteTableRow)items[i].getData();
_selectedResources.add(row.getElement());
}
}
return true; return true;
} }
public List getSelectedResources()
{
return _selectedResources;
}
/** /**
* Returns the rows of deletable items. * Returns the rows of deletable items.
*/ */