diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java index 70699e71278..ae849351e77 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java @@ -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. *
* 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. - *
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 + *
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); - } + } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java index 9ae81600e93..90822e9cab3 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java @@ -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) { diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java index 7f0031dee6e..16627674e5e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java @@ -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. *
* This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction} - * action. + * action. *
* 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. *
* 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}. *
* 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
- * 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.
*
* 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.
*
* 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();
- }
+ }
}