mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 22:55:26 +02:00
[cleanup] Fix missing comments
This commit is contained in:
parent
47a81a0b88
commit
873ff8ec1e
5 changed files with 289 additions and 289 deletions
|
@ -1,17 +1,18 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.dialogs;
|
||||
|
@ -27,7 +28,6 @@ import org.eclipse.jface.viewers.TableViewer;
|
|||
import org.eclipse.rse.internal.ui.SystemResources;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||
import org.eclipse.rse.ui.dialogs.ISystemTypedObject;
|
||||
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.view.ISystemPropertyConstants;
|
||||
|
@ -44,18 +44,18 @@ import org.eclipse.swt.widgets.Table;
|
|||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
/**
|
||||
* Dialog for confirming resource deletion.
|
||||
* Dialog for confirming resource deletion.
|
||||
* <p>
|
||||
* This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction}
|
||||
* action. It asks the user to confirm the deletion of the input selection.
|
||||
* <p>If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter} or
|
||||
* {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, then they should implement the
|
||||
* <p>If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter} or
|
||||
* {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, then they should implement the
|
||||
* interface {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject} so that their type can be
|
||||
* displayed in this delete confirmation dialog.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction
|
||||
*/
|
||||
public class SystemDeleteDialog extends SystemPromptDialog
|
||||
public class SystemDeleteDialog extends SystemPromptDialog
|
||||
implements ISelectionChangedListener
|
||||
{
|
||||
private String warningMessage, warningTip;
|
||||
|
@ -63,38 +63,38 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
private SystemDeleteTableProvider sdtp;
|
||||
//private Label prompt;
|
||||
private Table table;
|
||||
private TableViewer tableViewer;
|
||||
private TableViewer tableViewer;
|
||||
private GridData tableData;
|
||||
|
||||
|
||||
// column headers
|
||||
private String columnHeaders[] = {
|
||||
"", //$NON-NLS-1$
|
||||
SystemResources.RESID_DELETE_COLHDG_OLDNAME,
|
||||
SystemResources.RESID_DELETE_COLHDG_TYPE
|
||||
};
|
||||
|
||||
|
||||
// column layout
|
||||
private ColumnLayoutData columnLayouts[] =
|
||||
private ColumnLayoutData columnLayouts[] =
|
||||
{
|
||||
new ColumnPixelData(19, false),
|
||||
new ColumnPixelData(19, false),
|
||||
new ColumnWeightData(150,150,true),
|
||||
new ColumnWeightData(120,120,true)
|
||||
};
|
||||
|
||||
|
||||
// give each column a property value to identify it
|
||||
private static String[] tableColumnProperties =
|
||||
private static String[] tableColumnProperties =
|
||||
{
|
||||
ISystemPropertyConstants.P_OK,
|
||||
ISystemPropertyConstants.P_OK,
|
||||
IBasicPropertyConstants.P_TEXT,
|
||||
ISystemPropertyConstants.P_TYPE,
|
||||
};
|
||||
|
||||
ISystemPropertyConstants.P_TYPE,
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor for SystemUpdateConnectionDialog
|
||||
*/
|
||||
public SystemDeleteDialog(Shell shell)
|
||||
public SystemDeleteDialog(Shell shell)
|
||||
{
|
||||
super(shell, SystemResources.RESID_DELETE_TITLE);
|
||||
super(shell, SystemResources.RESID_DELETE_TITLE);
|
||||
super.setOkButtonLabel(SystemResources.RESID_DELETE_BUTTON);
|
||||
setHelp(RSEUIPlugin.HELPPREFIX+"ddlt0000"); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -107,29 +107,29 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
/*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
|
||||
return fMessageLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a warning message to show at the top of the dialog
|
||||
*/
|
||||
public void setWarningMessage(String msg, String tip)
|
||||
{
|
||||
this.warningMessage = msg;
|
||||
this.warningTip = tip;
|
||||
this.warningTip = tip;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify the text to show for the label prompt. The default is
|
||||
* Specify the text to show for the label prompt. The default is
|
||||
* "Delete selected resources?"
|
||||
*/
|
||||
public void setPromptLabel(String text)
|
||||
{
|
||||
this.promptLabel = text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see SystemPromptDialog#getInitialFocusControl()
|
||||
*/
|
||||
protected Control getInitialFocusControl()
|
||||
protected Control getInitialFocusControl()
|
||||
{
|
||||
return tableViewer.getControl();
|
||||
}
|
||||
|
@ -137,19 +137,19 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
/**
|
||||
* @see SystemPromptDialog#createInner(Composite)
|
||||
*/
|
||||
protected Control createInner(Composite parent)
|
||||
protected Control createInner(Composite parent)
|
||||
{
|
||||
// Inner composite
|
||||
int nbrColumns = 2;
|
||||
Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
|
||||
Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
|
||||
// PROMPT
|
||||
if (promptLabel == null) {
|
||||
Object input = getInputObject();
|
||||
|
||||
|
||||
if (input instanceof IStructuredSelection) {
|
||||
int size = ((IStructuredSelection)input).size();
|
||||
|
||||
|
||||
if (size > 1) {
|
||||
/*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
}
|
||||
// should never get here
|
||||
else {
|
||||
/*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
|
||||
/*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -174,7 +174,7 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
// create image
|
||||
Image image = getShell().getDisplay().getSystemImage(SWT.ICON_WARNING);
|
||||
Label imageLabel = null;
|
||||
if (image != null)
|
||||
if (image != null)
|
||||
{
|
||||
imageLabel = new Label(composite, 0);
|
||||
image.setBackground(imageLabel.getBackground());
|
||||
|
@ -194,34 +194,34 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
// filler line
|
||||
SystemWidgetHelpers.createLabel(composite, "", nbrColumns); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
// TABLE
|
||||
tableViewer = createTableViewer(composite, nbrColumns);
|
||||
tableViewer = createTableViewer(composite, nbrColumns);
|
||||
createColumns();
|
||||
tableViewer.setColumnProperties(tableColumnProperties);
|
||||
|
||||
tableViewer.setColumnProperties(tableColumnProperties);
|
||||
|
||||
sdtp = new SystemDeleteTableProvider();
|
||||
|
||||
int width = tableData.widthHint;
|
||||
int nbrRows = Math.min(getRows().length,8);
|
||||
int rowHeight = table.getItemHeight() + table.getGridLineWidth();
|
||||
int sbHeight = table.getHorizontalBar().getSize().y;
|
||||
int sbHeight = table.getHorizontalBar().getSize().y;
|
||||
int height = (nbrRows * rowHeight) + sbHeight;
|
||||
|
||||
|
||||
tableData.heightHint = height;
|
||||
table.setLayoutData(tableData);
|
||||
table.setSize(width, height);
|
||||
|
||||
table.setLayoutData(tableData);
|
||||
table.setSize(width, height);
|
||||
|
||||
tableViewer.setLabelProvider(sdtp);
|
||||
tableViewer.setContentProvider(sdtp);
|
||||
|
||||
Object input = getInputObject();
|
||||
tableViewer.setInput(input);
|
||||
|
||||
Object input = getInputObject();
|
||||
tableViewer.setInput(input);
|
||||
|
||||
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.setLinesVisible(true);
|
||||
|
@ -229,33 +229,33 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
tableData = new GridData();
|
||||
tableData.horizontalAlignment = GridData.FILL;
|
||||
tableData.grabExcessHorizontalSpace = true;
|
||||
tableData.widthHint = 350;
|
||||
tableData.heightHint = 30;
|
||||
tableData.widthHint = 350;
|
||||
tableData.heightHint = 30;
|
||||
tableData.verticalAlignment = GridData.CENTER;
|
||||
tableData.grabExcessVerticalSpace = true;
|
||||
tableData.horizontalSpan = nbrColumns;
|
||||
table.setLayoutData(tableData);
|
||||
table.setLayoutData(tableData);
|
||||
return tableViewer;
|
||||
}
|
||||
|
||||
private void createColumns()
|
||||
}
|
||||
|
||||
private void createColumns()
|
||||
{
|
||||
TableLayout layout = new TableLayout();
|
||||
table.setLayout(layout);
|
||||
table.setHeaderVisible(true);
|
||||
for (int i = 0; i < columnHeaders.length; i++)
|
||||
for (int i = 0; i < columnHeaders.length; i++)
|
||||
{
|
||||
layout.addColumnData(columnLayouts[i]);
|
||||
TableColumn tc = new TableColumn(table, SWT.NONE,i);
|
||||
tc.setResizable(columnLayouts[i].resizable);
|
||||
tc.setText(columnHeaders[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void selectionChanged(SelectionChangedEvent event)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override of parent. Must pass selected object onto the form for initializing fields.
|
||||
* Called by SystemDialogAction's default run() method after dialog instantiated.
|
||||
|
@ -266,15 +266,15 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when user presses OK button.
|
||||
* Called when user presses OK button.
|
||||
* Return true to close dialog.
|
||||
* Return false to not close dialog.
|
||||
*/
|
||||
protected boolean processOK()
|
||||
protected boolean processOK()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rows of deletable items.
|
||||
*/
|
||||
|
@ -282,14 +282,14 @@ public class SystemDeleteDialog extends SystemPromptDialog
|
|||
{
|
||||
return (SystemDeleteTableRow[])sdtp.getElements(getInputObject());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the implementation of ISystemViewElement for the given
|
||||
* object. Returns null if the adapter is not defined or the
|
||||
* object is not adaptable.
|
||||
*/
|
||||
protected ISystemViewElementAdapter getViewAdapter(Object o)
|
||||
protected ISystemViewElementAdapter getViewAdapter(Object o)
|
||||
{
|
||||
return SystemAdapterHelpers.getViewAdapter(o);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.dialogs;
|
||||
|
@ -33,45 +33,45 @@ import org.eclipse.swt.graphics.Image;
|
|||
*/
|
||||
public class SystemDeleteTableProvider implements ITableLabelProvider, IStructuredContentProvider
|
||||
{
|
||||
|
||||
|
||||
static final int COLUMN_IMAGE = 0;
|
||||
static final int COLUMN_NAME = 1;
|
||||
static final int COLUMN_TYPE = 2;
|
||||
protected Map imageTable = new Hashtable(20);
|
||||
protected Object[] children = null;
|
||||
|
||||
static final int COLUMN_NAME = 1;
|
||||
static final int COLUMN_TYPE = 2;
|
||||
protected Map imageTable = new Hashtable(20);
|
||||
protected Object[] children = null;
|
||||
|
||||
/**
|
||||
* Constructor for SystemDeleteTableProvider
|
||||
*/
|
||||
public SystemDeleteTableProvider()
|
||||
public SystemDeleteTableProvider()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
private SystemDeleteTableRow getTableRow(Object element)
|
||||
{
|
||||
return (SystemDeleteTableRow)element;
|
||||
}
|
||||
|
||||
|
||||
private Image getImageFromDescriptor(ImageDescriptor descriptor)
|
||||
{
|
||||
if (descriptor == null)
|
||||
return null;
|
||||
//obtain the cached image corresponding to the descriptor
|
||||
Image image = (Image) imageTable.get(descriptor);
|
||||
if (image == null)
|
||||
if (image == null)
|
||||
{
|
||||
image = descriptor.createImage();
|
||||
imageTable.put(descriptor, image);
|
||||
}
|
||||
//System.out.println("...image = " + image);
|
||||
return image;
|
||||
//System.out.println("...image = " + image);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
||||
*/
|
||||
public Image getColumnImage(Object element, int column)
|
||||
public Image getColumnImage(Object element, int column)
|
||||
{
|
||||
if (column == COLUMN_IMAGE)
|
||||
return getImageFromDescriptor(getTableRow(element).getImageDescriptor());
|
||||
|
@ -82,28 +82,28 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||
*/
|
||||
public String getColumnText(Object element, int column)
|
||||
public String getColumnText(Object element, int column)
|
||||
{
|
||||
String text = ""; //$NON-NLS-1$
|
||||
if (column == COLUMN_NAME)
|
||||
text = getTableRow(element).getName();
|
||||
else if (column == COLUMN_TYPE)
|
||||
text = getTableRow(element).getType();
|
||||
text = getTableRow(element).getType();
|
||||
//System.out.println("INSIDE GETCOLUMNTEXT: " + column + ", " + text + ", " + getTableRow(element));
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
|
||||
*/
|
||||
public void addListener(ILabelProviderListener listener)
|
||||
public void addListener(ILabelProviderListener listener)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IBaseLabelProvider#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
public void dispose()
|
||||
{
|
||||
// The following we got from WorkbenchLabelProvider
|
||||
if (imageTable != null)
|
||||
|
@ -111,11 +111,11 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
Collection imageValues = imageTable.values();
|
||||
if (imageValues!=null)
|
||||
{
|
||||
Iterator images = imageValues.iterator();
|
||||
Iterator images = imageValues.iterator();
|
||||
if (images!=null)
|
||||
while (images.hasNext())
|
||||
((Image)images.next()).dispose();
|
||||
imageTable = null;
|
||||
imageTable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public boolean isLabelProperty(Object element, String property)
|
||||
public boolean isLabelProperty(Object element, String property)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -131,10 +131,10 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
||||
*/
|
||||
public void removeListener(ILabelProviderListener listener)
|
||||
public void removeListener(ILabelProviderListener listener)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return rows. Input must be an IStructuredSelection.
|
||||
*/
|
||||
|
@ -148,13 +148,13 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
int idx = 0;
|
||||
while (i.hasNext())
|
||||
{
|
||||
children[idx] = new SystemDeleteTableRow(i.next(), idx);
|
||||
children[idx] = new SystemDeleteTableRow(i.next(), idx);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the 0-based row number of the given element.
|
||||
*/
|
||||
|
@ -162,9 +162,9 @@ public class SystemDeleteTableProvider implements ITableLabelProvider, IStructur
|
|||
{
|
||||
return row.getRowNumber();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
|
||||
{
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.dialogs;
|
||||
|
@ -42,7 +43,6 @@ import org.eclipse.rse.ui.ISystemMessages;
|
|||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||
import org.eclipse.rse.ui.dialogs.ISystemTypedObject;
|
||||
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
|
@ -71,71 +71,71 @@ import org.eclipse.swt.widgets.Text;
|
|||
* Dialog for renaming multiple resources.
|
||||
* <p>
|
||||
* This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction}
|
||||
* action.
|
||||
* action.
|
||||
* <p>
|
||||
* To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed.
|
||||
* If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
|
||||
* If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
|
||||
* {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, the dialog will offer built-in error checking.
|
||||
* <p>
|
||||
* If the input objects do not adapt to org.eclipse.rse.ui.view.ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you
|
||||
* should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
|
||||
* should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
|
||||
* specify a validator that is called to verify the typed new name is valid. Further, to show the type value
|
||||
* of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
|
||||
* <p>
|
||||
* This dialog does not do the actual renames. Rather, it will return an array of the user-typed new names. These
|
||||
* are queriable via {@link #getNewNames()}, after testing that {@link #wasCancelled()} is false. The array entries
|
||||
* will match the input order.
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction
|
||||
*/
|
||||
public class SystemRenameDialog extends SystemPromptDialog
|
||||
implements
|
||||
ISelectionChangedListener,
|
||||
public class SystemRenameDialog extends SystemPromptDialog
|
||||
implements
|
||||
ISelectionChangedListener,
|
||||
TraverseListener,
|
||||
ICellEditorListener, Runnable, FocusListener
|
||||
{
|
||||
|
||||
|
||||
private SystemMessage errorMessage;
|
||||
private TextCellEditor cellEditor;
|
||||
private int currRow = 0;
|
||||
private GridData tableData = null;
|
||||
private boolean ignoreSelection = false;
|
||||
private Hashtable uniqueNameValidatorPerParent = new Hashtable();
|
||||
|
||||
|
||||
private String verbiage;
|
||||
|
||||
private SystemRenameTableProvider srtp;
|
||||
private Table table;
|
||||
private TableViewer tableViewer;
|
||||
private TableViewer tableViewer;
|
||||
private static final int COLUMN_NEWNAME = SystemRenameTableProvider.COLUMN_NEWNAME;
|
||||
private String columnHeaders[] = {
|
||||
"",SystemResources.RESID_RENAME_COLHDG_OLDNAME, //$NON-NLS-1$
|
||||
SystemResources.RESID_RENAME_COLHDG_NEWNAME,
|
||||
SystemResources.RESID_RENAME_COLHDG_TYPE
|
||||
SystemResources.RESID_RENAME_COLHDG_TYPE
|
||||
};
|
||||
private ColumnLayoutData columnLayouts[] =
|
||||
private ColumnLayoutData columnLayouts[] =
|
||||
{
|
||||
new ColumnPixelData(19, false),
|
||||
new ColumnPixelData(19, false),
|
||||
new ColumnWeightData(125,125,true),
|
||||
new ColumnWeightData(150,150,true),
|
||||
new ColumnWeightData(120,120,true)
|
||||
new ColumnWeightData(120,120,true)
|
||||
};
|
||||
// give each column a property value to identify it
|
||||
private static String[] tableColumnProperties =
|
||||
private static String[] tableColumnProperties =
|
||||
{
|
||||
ISystemPropertyConstants.P_ERROR,
|
||||
ISystemPropertyConstants.P_ERROR,
|
||||
IBasicPropertyConstants.P_TEXT,
|
||||
ISystemPropertyConstants.P_NEWNAME,
|
||||
ISystemPropertyConstants.P_TYPE,
|
||||
};
|
||||
// inner class to support cell editing
|
||||
private ICellModifier cellModifier = new ICellModifier()
|
||||
ISystemPropertyConstants.P_TYPE,
|
||||
};
|
||||
// inner class to support cell editing
|
||||
private ICellModifier cellModifier = new ICellModifier()
|
||||
{
|
||||
public Object getValue(Object element, String property)
|
||||
public Object getValue(Object element, String property)
|
||||
{
|
||||
SystemRenameTableRow row = (SystemRenameTableRow)element;
|
||||
String value = ""; //$NON-NLS-1$
|
||||
if (property.equals(ISystemPropertyConstants.P_TEXT))
|
||||
if (property.equals(IBasicPropertyConstants.P_TEXT))
|
||||
value = row.getName();
|
||||
else
|
||||
value = row.getNewName();
|
||||
|
@ -143,12 +143,12 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
return value;
|
||||
}
|
||||
|
||||
public boolean canModify(Object element, String property)
|
||||
public boolean canModify(Object element, String property)
|
||||
{
|
||||
boolean modifiable = property.equals(ISystemPropertyConstants.P_NEWNAME);
|
||||
if ((cellEditor != null) && (cellEditor.getControl() != null))
|
||||
{
|
||||
SystemRenameTableRow row = (SystemRenameTableRow)element;
|
||||
SystemRenameTableRow row = (SystemRenameTableRow)element;
|
||||
int limit = row.getNameLengthLimit();
|
||||
if (limit == -1)
|
||||
limit = 1000;
|
||||
|
@ -159,10 +159,10 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
/**
|
||||
* Modifies a marker as a result of a successfully completed direct editing.
|
||||
*/
|
||||
public void modify(Object element, String property, Object value)
|
||||
public void modify(Object element, String property, Object value)
|
||||
{
|
||||
SystemRenameTableRow row = (SystemRenameTableRow)(((TableItem)element).getData());
|
||||
//System.out.println("inside modify: " + row+"; "+property+", "+value);
|
||||
SystemRenameTableRow row = (SystemRenameTableRow)(((TableItem)element).getData());
|
||||
//System.out.println("inside modify: " + row+"; "+property+", "+value);
|
||||
if (property.equals(ISystemPropertyConstants.P_NEWNAME))
|
||||
{
|
||||
row.setNewName((String)value);
|
||||
|
@ -170,21 +170,21 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for SystemRenameDialog
|
||||
*/
|
||||
public SystemRenameDialog(Shell shell)
|
||||
public SystemRenameDialog(Shell shell)
|
||||
{
|
||||
this(shell, SystemResources.RESID_RENAME_TITLE);
|
||||
this(shell, SystemResources.RESID_RENAME_TITLE);
|
||||
}
|
||||
/**
|
||||
* Constructor when you have your own title
|
||||
*/
|
||||
public SystemRenameDialog(Shell shell, String title)
|
||||
public SystemRenameDialog(Shell shell, String title)
|
||||
{
|
||||
super(shell, title);
|
||||
super(shell, title);
|
||||
|
||||
//pack();
|
||||
setHelp(RSEUIPlugin.HELPPREFIX+"drnm0000"); //$NON-NLS-1$
|
||||
|
@ -195,7 +195,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
public void setVerbiage(String verbiage)
|
||||
{
|
||||
this.verbiage = verbiage;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the validator for the new name,as supplied by the adaptor for name checking.
|
||||
* Overrides the default which is to query it from the object's adapter.
|
||||
|
@ -216,7 +216,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
/**
|
||||
* @see SystemPromptDialog#getInitialFocusControl()
|
||||
*/
|
||||
protected Control getInitialFocusControl()
|
||||
protected Control getInitialFocusControl()
|
||||
{
|
||||
SystemRenameTableRow[] rows = getRows();
|
||||
tableViewer.setSelection(new StructuredSelection(rows[0]),true);
|
||||
|
@ -227,47 +227,47 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
/**
|
||||
* @see SystemPromptDialog#createInner(Composite)
|
||||
*/
|
||||
protected Control createInner(Composite parent)
|
||||
protected Control createInner(Composite parent)
|
||||
{
|
||||
// Inner composite
|
||||
int nbrColumns = 1;
|
||||
Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
|
||||
Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
|
||||
|
||||
if (verbiage != null)
|
||||
SystemWidgetHelpers.createVerbiage(composite, verbiage, nbrColumns, false, 200);
|
||||
else
|
||||
SystemWidgetHelpers.createVerbiage(composite, SystemResources.RESID_RENAME_VERBIAGE, nbrColumns, false, 200);
|
||||
|
||||
table = createTable(composite);
|
||||
table = createTable(composite);
|
||||
tableViewer = new TableViewer(table);
|
||||
createColumns();
|
||||
tableViewer.setColumnProperties(tableColumnProperties);
|
||||
tableViewer.setColumnProperties(tableColumnProperties);
|
||||
tableViewer.setCellModifier(cellModifier);
|
||||
CellEditor editors[] = new CellEditor[columnHeaders.length];
|
||||
cellEditor = new TextCellEditor(table);
|
||||
cellEditor.addListener(this);
|
||||
cellEditor.addListener(this);
|
||||
editors[COLUMN_NEWNAME] = cellEditor;
|
||||
tableViewer.setCellEditors(editors);
|
||||
tableViewer.setCellEditors(editors);
|
||||
cellEditor.getControl().addTraverseListener(this);
|
||||
//System.out.println("CELL EDITOR CONTROL: " + cellEditor.getControl());
|
||||
|
||||
|
||||
srtp = new SystemRenameTableProvider();
|
||||
int width = tableData.widthHint;
|
||||
int nbrRows = Math.min(getRows().length,8);
|
||||
int rowHeight = table.getItemHeight() + table.getGridLineWidth();
|
||||
int sbHeight = table.getHorizontalBar().getSize().y;
|
||||
int sbHeight = table.getHorizontalBar().getSize().y;
|
||||
int height = (nbrRows * rowHeight) + sbHeight;
|
||||
//System.out.println("#rows = "+nbrRows+", sbHeight = " + sbHeight+", totalHeight="+height);
|
||||
//System.out.println("#rows = "+nbrRows+", sbHeight = " + sbHeight+", totalHeight="+height);
|
||||
tableData.heightHint = height;
|
||||
table.setLayoutData(tableData);
|
||||
table.setSize(width, height);
|
||||
table.setLayoutData(tableData);
|
||||
table.setSize(width, height);
|
||||
tableViewer.setLabelProvider(srtp);
|
||||
tableViewer.setContentProvider(srtp);
|
||||
//System.out.println("Input Object: "+getInputObject());
|
||||
tableViewer.setInput(getInputObject());
|
||||
tableViewer.setInput(getInputObject());
|
||||
|
||||
tableViewer.addSelectionChangedListener(this);
|
||||
tableViewer.getTable().addFocusListener(this);
|
||||
tableViewer.getTable().addFocusListener(this);
|
||||
|
||||
// test if we need a unique name validator
|
||||
Shell shell = getShell();
|
||||
|
@ -276,52 +276,52 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
display.asyncExec(this);
|
||||
else
|
||||
run();
|
||||
|
||||
|
||||
return composite;
|
||||
}
|
||||
|
||||
|
||||
private Table createTable(Composite parent)
|
||||
|
||||
private Table createTable(Composite parent)
|
||||
{
|
||||
//table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
|
||||
table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
|
||||
table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
|
||||
table.setLinesVisible(true);
|
||||
tableData = new GridData();
|
||||
tableData.horizontalAlignment = GridData.FILL;
|
||||
tableData.grabExcessHorizontalSpace = true;
|
||||
tableData.widthHint = 450;
|
||||
tableData.widthHint = 450;
|
||||
tableData.heightHint= 30;
|
||||
tableData.verticalAlignment = GridData.CENTER;
|
||||
tableData.grabExcessVerticalSpace = true;
|
||||
table.setLayoutData(tableData);
|
||||
|
||||
table.setLayoutData(tableData);
|
||||
|
||||
//table.addTraverseListener(this);
|
||||
//getShell().addTraverseListener(this);
|
||||
|
||||
|
||||
|
||||
return table;
|
||||
}
|
||||
private void createColumns()
|
||||
}
|
||||
private void createColumns()
|
||||
{
|
||||
TableLayout layout = new TableLayout();
|
||||
table.setLayout(layout);
|
||||
table.setHeaderVisible(true);
|
||||
for (int i = 0; i < columnHeaders.length; i++)
|
||||
for (int i = 0; i < columnHeaders.length; i++)
|
||||
{
|
||||
layout.addColumnData(columnLayouts[i]);
|
||||
TableColumn tc = new TableColumn(table, SWT.NONE,i);
|
||||
tc.setResizable(columnLayouts[i].resizable);
|
||||
tc.setText(columnHeaders[i]);
|
||||
//tc.addSelectionListener(headerListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void selectionChanged(SelectionChangedEvent event)
|
||||
{
|
||||
//System.out.println("Selection changed. ignoreSelection? "+ignoreSelection);
|
||||
if (ignoreSelection)
|
||||
return;
|
||||
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
|
||||
if (selection.isEmpty())
|
||||
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
|
||||
if (selection.isEmpty())
|
||||
{
|
||||
currRow = -1;
|
||||
return;
|
||||
|
@ -330,8 +330,8 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
int rowIdx = srtp.getRowNumber(selectedRow);
|
||||
if (rowIdx == currRow)
|
||||
return;
|
||||
currRow = rowIdx;
|
||||
tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
|
||||
currRow = rowIdx;
|
||||
tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
|
||||
}
|
||||
/**
|
||||
* Override of parent. Must pass selected object onto the form for initializing fields.
|
||||
|
@ -344,12 +344,12 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when user presses OK button.
|
||||
* Called when user presses OK button.
|
||||
* This does not do the actual renames, but rather updates the new name array.
|
||||
* You need to query this via {@link #getNewNames()}, after ensuring the dialog was not
|
||||
* You need to query this via {@link #getNewNames()}, after ensuring the dialog was not
|
||||
* cancelled by calling {@link #wasCancelled()}.
|
||||
*/
|
||||
protected boolean processOK()
|
||||
protected boolean processOK()
|
||||
{
|
||||
// the following is for defect 41565 where the changed name is not used when enter pressed after typing
|
||||
if ((currRow >=0) && (currRow <= (getRows().length - 1)))
|
||||
|
@ -360,31 +360,31 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
}
|
||||
//else
|
||||
// System.out.println("currRow = "+currRow);
|
||||
|
||||
|
||||
boolean closeDialog = verify();
|
||||
if (closeDialog)
|
||||
{
|
||||
}
|
||||
return closeDialog;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Verifies all input.
|
||||
* @return true if there are no errors in the user input
|
||||
*/
|
||||
public boolean verify()
|
||||
public boolean verify()
|
||||
{
|
||||
SystemMessage errMsg = null;
|
||||
SystemMessage firstErrMsg = null;
|
||||
SystemRenameTableRow firstErrRow = null;
|
||||
clearErrorMessage();
|
||||
clearErrorMessage();
|
||||
SystemRenameTableRow[] rows = getRows();
|
||||
Vector newNames = new Vector();
|
||||
// first, clear pending errors...
|
||||
for (int idx=0; (idx<rows.length); idx++)
|
||||
rows[idx].setErrorMessage(null);
|
||||
for (int idx=0; (idx<rows.length); idx++)
|
||||
rows[idx].setErrorMessage(null);
|
||||
// check 1: all entries have a new name, and the new name is unique for this list.
|
||||
for (int idx=0; (firstErrMsg==null) && (idx<rows.length); idx++)
|
||||
//for (int idx=0; (idx<rows.length); idx++)
|
||||
//for (int idx=0; (idx<rows.length); idx++)
|
||||
{
|
||||
errMsg = null;
|
||||
String oldName = rows[idx].getName();
|
||||
|
@ -415,10 +415,10 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
if (!ok)
|
||||
errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (errMsg == null)
|
||||
{
|
||||
{
|
||||
//newNames.addElement(newName);
|
||||
newNames.addElement(canonicalNewName); // defect 42145
|
||||
}
|
||||
|
@ -432,13 +432,13 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
if (firstErrMsg != null)
|
||||
{
|
||||
setErrorMessage(firstErrMsg);
|
||||
tableViewer.update(rows,null);
|
||||
tableViewer.setSelection(new StructuredSelection(firstErrRow),true);
|
||||
tableViewer.update(rows,null);
|
||||
tableViewer.setSelection(new StructuredSelection(firstErrRow),true);
|
||||
tableViewer.editElement(firstErrRow,COLUMN_NEWNAME);
|
||||
}
|
||||
return (firstErrMsg == null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This hook method is called whenever the text changes in the input field.
|
||||
* The default implementation delegates the request to an <code>ISystemValidator</code> object.
|
||||
|
@ -446,18 +446,18 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
* in the Dialog's message line.
|
||||
* @see #setNameValidator(ISystemValidator)
|
||||
*/
|
||||
protected SystemMessage validateNameInput()
|
||||
{
|
||||
protected SystemMessage validateNameInput()
|
||||
{
|
||||
errorMessage= null;
|
||||
if (errorMessage == null)
|
||||
clearErrorMessage();
|
||||
else
|
||||
setErrorMessage(errorMessage);
|
||||
setPageComplete();
|
||||
return errorMessage;
|
||||
setPageComplete();
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method can be called by the dialog or wizard page host, to decide whether to enable
|
||||
* or disable the next, final or ok buttons. It returns true if the minimal information is
|
||||
|
@ -470,7 +470,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
pageComplete = true;
|
||||
return pageComplete;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inform caller of page-complete status of this form
|
||||
*/
|
||||
|
@ -485,23 +485,23 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
*/
|
||||
public void keyTraversed(TraverseEvent e)
|
||||
{
|
||||
int detail = e.detail;
|
||||
int detail = e.detail;
|
||||
//System.out.println("in keyTraversed: " + keycode + ", " + detail + ", " + doit);
|
||||
e.doit = false;
|
||||
e.doit = false;
|
||||
ignoreSelection = true;
|
||||
|
||||
|
||||
//System.out.println("...Key pressed. currRow = "+currRow);
|
||||
|
||||
// DEFECT 41807 STATED USERS SHOULD BE ALLOWED TO TAB TO THE BUTTONS
|
||||
|
||||
|
||||
//System.out.println("...Key pressed. currRow = "+currRow);
|
||||
|
||||
// DEFECT 41807 STATED USERS SHOULD BE ALLOWED TO TAB TO THE BUTTONS
|
||||
if (detail == SWT.TRAVERSE_TAB_NEXT)
|
||||
{
|
||||
if (currRow != getRows().length-1)
|
||||
{
|
||||
++currRow;
|
||||
//System.out.println("...D TAB pressed. currRow = "+currRow);
|
||||
//tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
|
||||
tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
|
||||
//System.out.println("...D TAB pressed. currRow = "+currRow);
|
||||
//tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
|
||||
tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -518,9 +518,9 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
--currRow;
|
||||
else
|
||||
currRow = 0;
|
||||
//System.out.println("...D BACKTAB pressed. currRow = "+currRow);
|
||||
//tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
|
||||
tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
|
||||
//System.out.println("...D BACKTAB pressed. currRow = "+currRow);
|
||||
//tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
|
||||
tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -530,18 +530,18 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
}
|
||||
}
|
||||
else
|
||||
e.doit = true;
|
||||
e.doit = true;
|
||||
ignoreSelection = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the rows of rename items.
|
||||
*/
|
||||
public SystemRenameTableRow[] getRows()
|
||||
{
|
||||
return (SystemRenameTableRow[])srtp.getElements(getInputObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the new names.
|
||||
*/
|
||||
|
@ -552,8 +552,8 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
for (int idx=0; idx<rows.length; idx++)
|
||||
names[idx] = rows[idx].getNewName();
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CELL EDITOR METHODS
|
||||
public void applyEditorValue()
|
||||
{
|
||||
|
@ -561,11 +561,11 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
}
|
||||
public void cancelEditor()
|
||||
{
|
||||
//System.out.println("CELLEDITOR: INSIDE CANCELEDITOR");
|
||||
//System.out.println("CELLEDITOR: INSIDE CANCELEDITOR");
|
||||
}
|
||||
public void editorValueChanged(boolean oldValidState,boolean newValidState)
|
||||
{
|
||||
//System.out.println("CELLEDITOR: INSIDE EDITORVALUECHANGED: "+oldValidState+","+newValidState);
|
||||
//System.out.println("CELLEDITOR: INSIDE EDITORVALUECHANGED: "+oldValidState+","+newValidState);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -581,14 +581,14 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
{
|
||||
nameValidator = rows[idx].getNameValidator();
|
||||
inputElement = rows[idx].getElement();
|
||||
uniqueNameValidator = setUniqueNameValidator(inputElement, nameValidator);
|
||||
uniqueNameValidator = setUniqueNameValidator(inputElement, nameValidator);
|
||||
rows[idx].setUniqueNameValidator(uniqueNameValidator);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an input element and externally-suppplied name validator for it, determine if we
|
||||
* need to augment that validator with one that will check for uniqueness, and if so
|
||||
* need to augment that validator with one that will check for uniqueness, and if so
|
||||
* create and register that uniqueness validator
|
||||
*/
|
||||
protected ValidatorUniqueString setUniqueNameValidator(Object inputElement, ISystemValidator nameValidator)
|
||||
|
@ -612,7 +612,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
System.out.println("No existing name list found for parent " + parentName); //$NON-NLS-1$
|
||||
}
|
||||
if ((ra != null) && (parentName != null))
|
||||
{
|
||||
{
|
||||
String[] names = null;
|
||||
boolean caseSensitive = ra.getSubSystem(inputElement).getSubSystemConfiguration().isCaseSensitive();
|
||||
boolean needUniqueNameValidator = !(nameValidator instanceof ISystemValidatorUniqueString);
|
||||
|
@ -625,7 +625,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
{
|
||||
// Set the busy cursor to all shells.
|
||||
super.setBusyCursor(true);
|
||||
try {
|
||||
try {
|
||||
names = ra.getRemoteParentNamesInUse(inputElement, null);
|
||||
} catch (Exception exc) {SystemBasePlugin.logError("Exception getting parent's child names in rename dialog",exc);} //$NON-NLS-1$
|
||||
if ((names != null) && (names.length>0))
|
||||
|
@ -644,7 +644,7 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
// Restore cursor
|
||||
super.setBusyCursor(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return uniqueNameValidator;
|
||||
}
|
||||
|
||||
|
@ -652,9 +652,9 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
* Returns the implementation of ISystemRemoteElement for the given
|
||||
* object. Returns null if this object does not adaptable to this.
|
||||
*/
|
||||
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
|
||||
protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
|
||||
{
|
||||
if (!(o instanceof IAdaptable))
|
||||
if (!(o instanceof IAdaptable))
|
||||
return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
|
||||
return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
|
||||
}
|
||||
|
@ -664,8 +664,8 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
public void focusGained(FocusEvent e)
|
||||
{
|
||||
/*
|
||||
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
|
||||
if (selection.isEmpty())
|
||||
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
|
||||
if (selection.isEmpty())
|
||||
{
|
||||
currRow = -1;
|
||||
return;
|
||||
|
@ -674,10 +674,10 @@ public class SystemRenameDialog extends SystemPromptDialog
|
|||
int rowIdx = srtp.getRowNumber(selectedRow);
|
||||
if (rowIdx == currRow)
|
||||
return;
|
||||
currRow = rowIdx;
|
||||
currRow = rowIdx;
|
||||
tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
|
||||
*/
|
||||
//System.out.println("Focus gained");
|
||||
//System.out.println("Focus gained");
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
||||
* All rights reserved. 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 available at
|
||||
|
@ -7,12 +7,12 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.dialogs;
|
||||
|
@ -38,16 +38,16 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
{
|
||||
static final int COLUMN_ERROR = 0;
|
||||
static final int COLUMN_OLDNAME = 1;
|
||||
static final int COLUMN_NEWNAME = 2;
|
||||
static final int COLUMN_TYPE = 3;
|
||||
private Map imageTable = new Hashtable(20);
|
||||
private Object[] children = null;
|
||||
static final int COLUMN_NEWNAME = 2;
|
||||
static final int COLUMN_TYPE = 3;
|
||||
private Map imageTable = new Hashtable(20);
|
||||
private Object[] children = null;
|
||||
private ISystemValidator inputValidator = null;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for SystemRenameTableProvider
|
||||
*/
|
||||
public SystemRenameTableProvider()
|
||||
public SystemRenameTableProvider()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
@ -60,38 +60,38 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
{
|
||||
inputValidator = nameValidator;
|
||||
}
|
||||
|
||||
|
||||
private SystemRenameTableRow getTableRow(Object element)
|
||||
{
|
||||
return (SystemRenameTableRow)element;
|
||||
}
|
||||
|
||||
|
||||
private Image getImageFromDescriptor(ImageDescriptor descriptor)
|
||||
{
|
||||
if (descriptor == null)
|
||||
return null;
|
||||
//obtain the cached image corresponding to the descriptor
|
||||
Image image = (Image) imageTable.get(descriptor);
|
||||
if (image == null)
|
||||
if (image == null)
|
||||
{
|
||||
image = descriptor.createImage();
|
||||
imageTable.put(descriptor, image);
|
||||
}
|
||||
//System.out.println("...image = " + image);
|
||||
return image;
|
||||
//System.out.println("...image = " + image);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
||||
*/
|
||||
public Image getColumnImage(Object element, int column)
|
||||
public Image getColumnImage(Object element, int column)
|
||||
{
|
||||
if (column == COLUMN_ERROR)
|
||||
{
|
||||
SystemRenameTableRow row = getTableRow(element);
|
||||
if (row.getError())
|
||||
{
|
||||
Image errorImage = JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
|
||||
Image errorImage = JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
|
||||
//RSEUIPlugin.getDefault().getImage(ISystemConstants.ICON_SYSTEM_ERROR_ID);
|
||||
return errorImage;
|
||||
}
|
||||
|
@ -107,30 +107,30 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||
*/
|
||||
public String getColumnText(Object element, int column)
|
||||
public String getColumnText(Object element, int column)
|
||||
{
|
||||
String text = ""; //$NON-NLS-1$
|
||||
if (column == COLUMN_OLDNAME)
|
||||
text = getTableRow(element).getName();
|
||||
else if (column == COLUMN_NEWNAME)
|
||||
text = getTableRow(element).getNewName();
|
||||
text = getTableRow(element).getNewName();
|
||||
else if (column == COLUMN_TYPE)
|
||||
text = getTableRow(element).getType();
|
||||
text = getTableRow(element).getType();
|
||||
//System.out.println("INSIDE GETCOLUMNTEXT: " + column + ", " + text + ", " + getTableRow(element));
|
||||
return text;
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
||||
*/
|
||||
public void addListener(ILabelProviderListener listener)
|
||||
public void addListener(ILabelProviderListener listener)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
|
||||
*/
|
||||
public void dispose()
|
||||
public void dispose()
|
||||
{
|
||||
// The following we got from WorkbenchLabelProvider
|
||||
if (imageTable != null)
|
||||
|
@ -138,11 +138,11 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
Collection imageValues = imageTable.values();
|
||||
if (imageValues!=null)
|
||||
{
|
||||
Iterator images = imageValues.iterator();
|
||||
Iterator images = imageValues.iterator();
|
||||
if (images!=null)
|
||||
while (images.hasNext())
|
||||
((Image)images.next()).dispose();
|
||||
imageTable = null;
|
||||
imageTable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
public boolean isLabelProperty(Object element, String property)
|
||||
public boolean isLabelProperty(Object element, String property)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -158,10 +158,10 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
/**
|
||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
||||
*/
|
||||
public void removeListener(ILabelProviderListener listener)
|
||||
public void removeListener(ILabelProviderListener listener)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return rows. Input must be an IStructuredSelection.
|
||||
*/
|
||||
|
@ -175,7 +175,7 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
int idx = 0;
|
||||
while (i.hasNext())
|
||||
{
|
||||
children[idx] = new SystemRenameTableRow(i.next(),idx);
|
||||
children[idx] = new SystemRenameTableRow(i.next(),idx);
|
||||
if (inputValidator != null)
|
||||
((SystemRenameTableRow)children[idx]).setNameValidator(inputValidator);
|
||||
idx++;
|
||||
|
@ -183,14 +183,14 @@ public class SystemRenameTableProvider implements ITableLabelProvider, IStructur
|
|||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2007 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
||||
* All rights reserved. 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 available at
|
||||
|
@ -7,12 +7,12 @@
|
|||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* component that contains this file: David McKnight, Kushal Munir,
|
||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
* David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.ui.dialogs;
|
||||
|
@ -29,12 +29,12 @@ import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
|||
public class SystemRenameTableRow extends SystemDeleteTableRow
|
||||
{
|
||||
private String newName;
|
||||
private SystemMessage errorMsg = null;
|
||||
private SystemMessage errorMsg = null;
|
||||
private ISystemValidator inputValidator = null;
|
||||
private ValidatorUniqueString inputUniqueNameValidator = null;
|
||||
private Object parent;
|
||||
private int nameLengthLimit = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param element that is being displayed in the tree, and which the
|
||||
|
@ -44,12 +44,12 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
{
|
||||
super(element,rowNbr);
|
||||
this.newName = getName();
|
||||
this.inputValidator = getViewAdapter(element).getNameValidator(element);
|
||||
this.inputValidator = getViewAdapter(element).getNameValidator(element);
|
||||
if (inputValidator != null) {
|
||||
nameLengthLimit = inputValidator.getMaximumNameLength();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the new name for this element. Called by the CellModifier
|
||||
* for the rename dialog.
|
||||
|
@ -67,7 +67,7 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
else
|
||||
newName = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Trim leading blanks
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
{
|
||||
return ("."+text).trim().substring(1); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the new name for this element, as set by setNewName
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
{
|
||||
return newName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the parent of this remote object that is being renamed
|
||||
*/
|
||||
|
@ -103,10 +103,10 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
/**
|
||||
* Get the canonical name of this row. Sometimes, the name alone is not enough to do uniqueness
|
||||
* checking on. For example, two connections or filter pools can have the same name if they are
|
||||
* in different profiles. Two iSeries QSYS objects can have the same name if their object types
|
||||
* are different.
|
||||
* in different profiles. Two iSeries QSYS objects can have the same name if their object types
|
||||
* are different.
|
||||
* <p>
|
||||
* This method returns a name that can be used for uniqueness checking because it is qualified
|
||||
* This method returns a name that can be used for uniqueness checking because it is qualified
|
||||
* sufficiently to make it unique.
|
||||
* <p>
|
||||
* Defers to the object's adapter
|
||||
|
@ -114,14 +114,14 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
public String getCanonicalNewName()
|
||||
{
|
||||
// this is all for defect 42145
|
||||
Object element = super.getElement();
|
||||
Object element = super.getElement();
|
||||
ISystemViewElementAdapter adapter = super.getViewAdapter();
|
||||
String cName = newName;
|
||||
if (adapter != null)
|
||||
cName = adapter.getCanonicalNewName(element, newName);
|
||||
else
|
||||
cName = newName;
|
||||
//System.out.println("Inside getCanonicalNewName: newName: " + newName + ", canonical: " + cName);
|
||||
//System.out.println("Inside getCanonicalNewName: newName: " + newName + ", canonical: " + cName);
|
||||
return cName;
|
||||
}
|
||||
/**
|
||||
|
@ -130,14 +130,14 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
*/
|
||||
public boolean newNameEqualsOldName()
|
||||
{
|
||||
Object element = super.getElement();
|
||||
Object element = super.getElement();
|
||||
ISystemViewElementAdapter adapter = super.getViewAdapter();
|
||||
if (adapter != null)
|
||||
return adapter.namesAreEqual(element, newName);
|
||||
else
|
||||
return getName().equals(newName);
|
||||
return getName().equals(newName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the name length limit, if available via the name validator supplied by the adapter.
|
||||
* Returns -1 if not available.
|
||||
|
@ -163,14 +163,14 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
{
|
||||
inputUniqueNameValidator = uniqueNameValidator;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the validator for the new name,as supplied by the adaptor for
|
||||
* this element type.
|
||||
* <p>
|
||||
* By default queries it from the object's adapter, unless setNameValidator has been
|
||||
* called.
|
||||
*/
|
||||
*/
|
||||
public ISystemValidator getNameValidator()
|
||||
{
|
||||
return inputValidator;
|
||||
|
@ -178,7 +178,7 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
|
||||
/**
|
||||
* Return the uniqueness validator for the new name,as supplied by the call to setUniqueNameValidator
|
||||
*/
|
||||
*/
|
||||
public ValidatorUniqueString getUniqueNameValidator()
|
||||
{
|
||||
return inputUniqueNameValidator;
|
||||
|
@ -197,7 +197,7 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
public SystemMessage getErrorMessage()
|
||||
{
|
||||
return errorMsg;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set error message for this row.
|
||||
* Pass null to clear it.
|
||||
|
@ -206,9 +206,9 @@ public class SystemRenameTableRow extends SystemDeleteTableRow
|
|||
{
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getNewName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue